Simple tip how to use VIM NMAP command.
-
This example shows a simple NMAP. The NMAP statement is written in the ~/.gvimrc
file.
-
In this case I find ;, go back one word, put the word under cursor in the
search string, switch to file in buffer two, find the string and open the file,
using gf command.
-
The code is shown below:
"1) debug file 2)e_list.txt 3)specman top import files
nmap gimp /;h*:b2ngf
-
To quickly find pattern. I declared the following shortcuts:
nmap <silent> f1 /Error .*exp<Esc>
nmap <silent> f2 /debug inspect required<Esc>
-
An nmap statement can execute multiple VIM commands
as in the following
example. In this example, I created a new VIM command, called ind. It
invokes a PERL script, that does
indentation.
without the "head" and "tail" commands, the cursor would end up, after script
inovkation, at the botton of the file. So I first create a mark A and later
jump back to it.
This is shown below:
nmap ind ma<CR>:%!perl ~/bin/vim_ind.pl<CR>'a<CR>
Contact me now at: |