Email: bknpk@hotmail.com Phone: +972-54-7649119
V

 

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.

  1. 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.
  2. At home - debian - it functions well and did not at the office.
  3. After some research, I found out, that debian includes in the .gvimrc the following precious lines:
  4. The file is located at /usr/share/vim/vimcurrent/debian.vim


  5. if has('gui_running')
      " Make shift-insert work like in Xterm
      map  <S-Insert> <MiddleMouse>
      map! <S-Insert> <MiddleMouse>
    endif

  6. 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:
  7. "force vim to specman syntax mode
    map <F4> :set syntax=specman

  8. 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.

  9. map <F8> :set lines=35 columns=150

  10. If you want to load into vim all files from a log file:
    gvim +":put=system('grep "\.e" e_list_mod.txt')"

  11. 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"

  12. Another vim tip:
    To return to last line in vim, one can use the tag operator: '' typing twice '.

  13. 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/

  14. To remove special characters, which were exported to a text file from outlook mail, search for the following pattern:
    [^a-zA-Z0-9_: ()\/\[\]*{}#,-\."+]

  15. 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\)\@!.\)*$

  16. To list all lines, which match a previous search:
    :g//

  17. To complete a word while typing: start the writing the word and press Control N

  18. To set clear case default editor to vim instead of emacs:
    setenv EDITOR /usr/bin/X11/gvim
    setenv WINEDITOR /usr/bin/X11/gvim

  19. 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,

  ...

More VIM scripts are listed in the table below. Or search the site (see at the end of page).


Home

VIM running a shell command on a block

VIM: convert vhdl std_logic to specman signal map format






Search This Site


Feedback This Site




new pages on this site