ASIC/FPGA Design and Verification Out Source Services
VIM shift insert to paste data
Having same behavior for shift insert as paste behaves in non graphical VIM and xterm.
- shift insert in xterm and non graphical VIM acts as paste - middle mouse button. This option is very convenient, even if your kids did not break the middle mouse button, like mine.
- At home - debian - it functions well and did not at the office.
- After some research, I found out, that debian includes in the .gvimrc the following precious lines:
- The file is located at /usr/share/vim/vimcurrent/debian.vim
if has('gui_running')
" Make shift-insert work like in Xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
endif
-
The following two vim tips were given to me from a friend
Hagai Naveh
A useful vim alias, which is handy, is manual syntax enable. vim supposed to be file name suffix sensitive and automatically enable the syntax. With specman files, on rare occasions, automatic syntax detect and enable fails:
"force vim to specman syntax mode
map <F4> :set syntax=specman
-
Sometimes it is required to enlarge the gvim window from
the default size. The following is a nice way to do it
with a F8 shortcut.
map <F8> :set lines=35 columns=150
-
If you want to load into vim all files from a log file:
gvim +":put=system('grep "\.e" e_list_mod.txt')"
-
Note + from the command line is used to invoke a vim command. Some examples, shown below, are to search a specific pattern or start and go to a given line number:
vi uart.txt +/"uart rev A"
vi uart.txt +":12"
- Another vim tip:To return to last line in vim, one can use the tag operator: '' typing twice '.
-
Today I needed to convert a 64 bit binary string to nibbles:
Input:0111100001111000111100011110001111000111100011110001111000111100
Output:0111_1000_0111_1000_1111_0001_1110_0011_1100_0111_1000_1111_0001_1110_0011_1100
vim command:g/\([01][01][01][01]\)\([01][01]*\)/s//\1_\2/
-
To remove special characters, which were exported to a text file from outlook mail, search for the following pattern:
[^a-zA-Z0-9_: ()\/\[\]*{}#,-\."+]
-
Sometimes it may be useful to search a line, that
does not contain a specific pattern.
The following
command, with the regular expression in it, will
match all lines, which does not contain it.
/^\(\(The_Regular_Expression\)\@!.\)*$
-
To list all lines, which match a previous search:
:g//
-
To complete a word while typing:
start the writing the word and press
Control N
-
To set clear case default editor to vim instead of
emacs:
setenv EDITOR /usr/bin/X11/gvim
setenv WINEDITOR /usr/bin/X11/gvim
-
To sort a file with reverse characters, for
instance: to sort a file, which contains directory
file list, according to file suffix, use the following
commands, from within vim:
:%!rev | sort | rev
: - vim command,
% - work on the entire vim text,
rev - reverse string,
sort,
|