Logotipo Dicas-L, por Ricardo Burile

Busca

Visite também: UnderLinux ·  VivaOLinux ·  LinuxSecurity ·  NoticiasLinux ·  BR-Linux ·  SoftwareLivre.org ·  [mais]   
 

 

Aprenda inglês em casa

Baixe gratuitamente as duas primeiras aulas

English for Reading and Listening

Receba por email, diariamente, mensagens contendo materiais para leitura e audição, incluindo arquivos no formato MP3 gravados por falantes nativos.

Saiba mais e faça sua inscrição

Você está aqui: Home  → Arquivo Dicas-L

 

Formação de Analistas de Negócios

Assine a Lista Dicas-L

Receba diariamente por email as dicas
de informática publicadas neste site
Para se descadastrar, clique aqui.

Publicar em del.icio.us

Criação de tags HTML dentro do vi

Colaboração: Rubens Queiroz de Almeida

Data de Publicação: 29 de Junho de 1997

O editor de textos vi possui uma característica bastante interessante que permite que se criem abreviações para comandos ou caracteres a serem automaticamente digitados.

Estas definições são criadas dentro do arquivo $HOME/.exrc.

Uma definição do tipo

  ab pl #!/usr/local/bin/perl 

fará com que sempre que se digite a string "pl" esta seja expandida para "#!/usr/local/bin/perl". A string "ab" significa "abbreviation".

Importante, quando criar as suas abreviações, não escolha uma sequência de caracteres que seja comum na língua portuguesa. Se você criar uma abreviação como:

  ab	sa	#!/bin/sh

você se verá na incômoda situação de ver todos os "sa" que digitar transformados em "#!/bin/sh". Para desabreviar, existe o comando "unab", que deve ser executado em modo de comando:

  unab sa

Uma aplicação interessante deste conceito é a criação de macros que permitam a criação automática de diretivas html, ou seja, tornar o vi html-enabled (boa essa, não?).

Abaixo incluo um exemplo de um arquivo .exrc com diretivas para criação das macros html com algumas explicações.

Dá para ver que com esta facilidade o vi pode desempenhar tarefas extremamente complexas, reduzindo o stress causando pela digitação constante. Basta deixar a imaginação fluir :-)


Exemplo de arquivo .exrc

  "
  "                          Editor HTML
  "
  "   ab .... abreviações (utilizar em modo de inserção)
  "
  "        xy  gera <XY>,
  "       nxy  gera </XY>
  "
  ab pg <HTML><HEAD><TITLE>#</TITLE>
</HEAD><BODY>
</BODY></HTML>
  ab hr <HR>
  ab pp <P>
  ab ht <HTML>
  ab nht </HTML>
  ab hd <HEAD>
  ab nhd </HEAD>
  ab ti <TITLE>
  ab nti </TITLE>
  ab bd <BODY>
  ab nbd </BODY>
  ab str <STRONG>
  ab nstr </STRONG>
  ab bo <B>
  ab nbo </B>
  ab it <I>
  ab nit </I>
  ab pre <PRE>
  ab npre </PRE>
  ab ul <UL>
  ab nul </UL>
  ab ol <OL>
  ab nol </OL>
  ab li <LI>
  ab dl <DL>
  ab ndl </DL>
  ab dt <DT>
  ab dd <DD>
  ab adr <ADDRESS>
  ab nadr </ADDRESS>
  ab h1 <H1>
  ab nh1 </H1>
  ab h2 <H2>
  ab nh2 </H2>
  ab h3 <H3>
  ab nh3 </H3>
  ab h4 <H4>
  ab nh4 </H4>
  ab h5 <H5>
  ab nh5 </H5>
  ab h6 <H6>
  ab nh6 </H6>
  ab ig <IMG SRC="#">
  ab fr <FORM ACTION="#" METHOD="#">
  ab nfr </FORM>
  "
  "   map .... Macros.   (usadas em modo de comando)
  "
  "  ctrl-x ctrl-l : a linha sob o cursor se torna o texto para um link
  "                  o cursor fica localizado após o HREF para que possa ser
  "                  feita a inserção da URL
  "
  map  o</A>kO">I<A HREF="
  "
  "  ctrl-x ctrl-w : a palavra sob o cursor se torna o texto para um hiperlink,
  "                  o cursor fica posicionado no HREF para que se possa inserir
  "                  a URL. (isto somente funciona se o cursor estiver 
  "                  posicionado no fim da palavra)
  "
  map  a</A>bbbi<A HREF="#">F#s
  "
  "  ctrl-x number : a linha sob o cursor se torna um cabecalho
  "                  ctrl-x 1  --->   H1  
  "                  ctrl-x 2  --->   H2  
  "
  map 1 I<H1>A</H1>j
  map 2 I<H2>A</H2>j
  map 3 I<H3>A</H3>j
  map 4 I<H4>A</H4>j
  map 5 I<H5>A</H5>j
  map 6 I<H6>A</H6>j

Dica Humorística :-)

Fit the Second: (Birth) Striped Irregular Bucket #5

Bastard Operator From Updated: Tuesday 14 November 1995 BOFH © 1990-1995 by Simon Travaglia and Datamation. All rights reserved.

I'm still bored.

But at least now the radio's off, it was on it's 12 repeat of "Wildfire" THIS WEEK, and it's only Tuesday; shit I hate that.

So anyway, I quicklime the engineer to remove any fingerprints and then FedEx him back to headquarters and set about waiting for the new engineer.

Now the second engineer only has to come out after another 4 hours, there's no death of engineer penalty clause, (but I'm thinking about asking for one) so I've got to fill in some time. This guy's going to be a technical engineer, the sort that comes in with a raggedy tie where he got it caught in the drum printer at 3000 rpm a couple of years ago, and he'll have the grazes on the face that indicate that he didn't get the gate open in time...

I know those sorts...

So I fill in a couple of hours by killing users off and deleting their files, then waiting for them to call...

"Um, I can't find my files" the wimpering simp on the phone says

"Files? What files?"

"The files in my account. My thesis, my research - all gone!"

"Gone ay? What's your username?"

"TURGEN"

"TROJAN?! LIKE THE CONDOM?"

"No TURGEN. T-U-R"

"OH Turgen, like TURD, but with a GEN instead of a D... Ok lets see" I make vague clicking noises my dragging the quicklimed man's fingers back and forth across the keypad. "Uh-huh" >drag dragdragedy poke "I KNOW!"

"Well, what are you calling ME for? We don't make the files you know, we just look after them. And chopitty-chop too, your thesis looks like it's due in a couple of days.."

I hang up - he'll call back. Meantime I open up a copy of "VMS BASTARD OPERATORS MANUAL FROM HELL" I'm reading the article I sent in about getting rid of those trouble users...

"... Modify the user's password minimum from 6 to 32 letters, give the password a 1 day lifetime, set it so that they HAVE to use the password generate utility when they change their password (so their password will always be something that looks like vaguely pronouncable line-noise), add a secondary password with the same as the above, then redefine their CLI tables so that the only command that works is DELETE, and all other commands point to it."

Beautiful.... Shit I'm good!

He calls back.

"MY FILES ARE GONE!" he screams, panicking.

"Did you have a backup?" I ask, as sweet as pie

"But that's what you people are supposed to do!" he sobs

"Yeah, well we did - but then we switched to those 8mm tapes, and they're the same size as the ones in my video camera, so I've been using them to tape the neighbour's sex romps..."

I hear the revolver go off, but what the hell, it's 5pm, and not my problem...

Veja a relação completa dos artigos de Rubens Queiroz de Almeida

Referências Adicionais

Referências adicionais sobre os assuntos abordados neste site podem ser encontradas em nossa Bibliografia.

Avalie esta dica

  • Currently 3.00/5
  • 1
  • 2
  • 3
  • 4
  • 5

Avaliação: 3.0 /5 (621 votos)

Recomende este site
Recomendar este artigo


Versão para impressão


Opinião dos Leitores

*Nome:
Email:
Me notifique sobre novos comentários nessa pagina
Oculte meu email
*Texto:
 
  Para publicar seu comentário, digite o código contido na imagem acima
 


Powered by Scriptsmill Comments Script
Treina Linux -  Cursos de Linux e Video aulas

Cursos

PROXY - Mão na Massa
Implemente um servidor Proxy em qualquer distribuição
Dia 27 de Setembro - São Paulo
Saiba mais

Biblioteca

Redes - Guia Prático
Por Carlos. E. Morimoto

Hardware - o Guia Definitivo
Por Carlos. E. Morimoto

Kurumin 7 - Guia Prático
Por Carlos. E. Morimoto

Linux: Ferramentas Técnicas, 2ed
Por Carlos. E. Morimoto

Use a Cabeça!: JSP & Servlets
Por Brian Bashan, Kathy Sierra, Bert Bates

Google Hacking
Por JOHNNY LONG

1808
Por Laurentino Gomes

Sistemas de Banco de Dados
Por Ramez E. Elmasri e Shamkant Navathe

Linux: Guia do Administrador do Sistema
Por Rubem E. Ferreira

A Menina que Roubava Livros
Por Markus Zusak

Sistemas Operacionais Modernos
Por Andrew S. Tanembaum

Hardware: Curso Completo
Por Gabriel Torres

PHP para Quem Conhece PHP
Por Juliano Niederauer

Redes de Computadores: Curso Completo
Por Gabriel Torres

Java: Como Programar
Por Harvey M. Deitel e Paul J. Deitel

O Caçador de Pipas
Por Khaled Hosseini

O Médico Doente
Por Dráuzio Varella

Enterprise Javabeans 3.0
Por Bill Burke, Richard Monson

MySQL - Guia do Programador
Por André Milani

Certificação Linux
Por Uira Ribeiro

Manual Completo do Linux: Guia do Administrador
Por Evi Nemeth, Trent R. Hein, Garth Snyder

OpenGL: uma Abordagem Prática e Objetiva
Por Marcelo Cohen, Isabel Harb Manssour

Expressões Regulares: Uma Abordagem Divertida
Por Aurélio Marinho Jargas

Extreme Programming
Por Vinicius Manhaes Teles