Vim

From Augix' Wiki

Jump to: navigation, search

Contents

Learning Vim

  • indent in multiple lines
    • way1: enter visual mode, use ">" or "<" to increase or decrease indent
    • way2: use "==" to give indent to the current line, use "n==", n is a number: to give indent to the following lines until line number n.
  • #

the # key create a motion jumping from the current word to the same word in the current buffer

Tips

  • To change to the directory of the current file:
:cd %:h
  • To show the key mappings
:map
  • Moving around, scroll up and down the screen

CTRL-F CTRL-B CTRL-U CTRL-D CTRL-E CTRL-Y

  • Jumping

One can use CTRL-O or CTRL-I jumping to older cursor position or newer position. One can also use

:ju

to print the jump list.

  • Show invisible characters
:set list
  • Hide invisible characters
: set nolist
  • Disable all blinking:
:set guicursor+=a:blinkon0

Files and Tabs

  • create a new tab
:tabnew
  • switch to next tab
gt

or

:tabn


Plugins

  • How to install a Vimball plugin (with .vba extension)?

Open the vba file with vim, and type the :source % command right there. The % refers to the current file

    let g:Tlist_Ctags_Cmd='~/bin/ctags/bin/ctags'
$ ctags -R --fields=+lS . /picb/home5/augix/Programming/ /picb/compbio5/augix/cDNA/
  • the ctgas command line I used in MPI-EVA
$ ctags -R ./Programming/ ./Research/
  • gvim color scheme, in ~/.gvimrc
" by augix
" color scheme: desert
colorscheme desert
  • python debugger

runscript

  • VOoM

Show outline table on the left

  • VimWiki

personal wiki with vim.

Vim with Python

Write .vim file

  • stop loading the current .vim file
" disable it in MacVim
if has('gui_macvim')
	finish
endif

Send selected lines to a screen

  • Install

One only need to copy send.vim and send2screen.py to the right directory.

http://www.vim.org/scripts/script.php?script_id=2104

http://www.vim.org/scripts/script.php?script_id=1048

http://users.physik.fu-berlin.de/~mgoerz/blog/2008/09/integrating-vim-with-ipython/

Personal tools