set completeopt=menu,longest

set wildmode=longest:full

 

set encoding=utf-8

set fileencoding=utf-8


" set the menu & the message to English

set langmenu=en_US

let $LANG = 'en_US'

source $VIMRUNTIME/delmenu.vim

source $VIMRUNTIME/menu.vim


:mksession

:source

 

:wviminfo

:rviminfo


gf ( goto file ), ctrl-o ( go back )

ctrl-o ( go back ), ctrl-i ( go forward ) 

f-? ( go to character )


Press * to search forwards for selected text, or # to search backwards.

 

Or you can simply yank the selected text with y and go to search mode /, then you can paste the last yanked text with Ctrl-R 0

 

search mode could use ? or /

use \c to force a pattern to be case insensitive, or \C to force a pattern to be case sensitive.

 

:%s/oldString/newString/g

:%s|oldString|newString|g


:%s#oldString#newString#gci

case insensitive; ask for confirmation.

:%s#oldString#newString#gcI

case sensitive  ; ask for confirmation.



 

:tabdo %s/旧/新/gi

:tabdo u

 

:vimgrep /myfunc/ **/*.c

:cw


:args **/*.php

:argdo %s/旧/新/g | update


:!php -l %<CR>

 

整文档自动缩进: gg再=:1,$


:NERDTree

C ( Change the tree root to the selected dir )

u ( Move the tree root up one directory )

r ( Recursively refresh the current directory )

t ( Open selected node/bookmark in a new tab )

T ( Same as 't' but keep the focus on the current tab )


:split ( split current window in two )

:diffthis ( like “vimdiff” )

]c ( Jump forwards to the next start of a change )

[c ( Jump backwards to the previous start of a change )

do ( Same as ":diffget" without argument or range. this doesn't work in Visual mode. )

dp ( Same as ":diffput" without argument or range. this doesn't work in Visual mode. )

:diffupdate ( keep the differences updated when you make changes to the text )


:ls ( Show all buffers )

:b1 :b2 :b3 ( Edit buffer [N] from the buffer list )


:reg ( Display the contents of all numbered and named registers )

ctrl-r [register] ( in Edit mode )


m{a-zA-Z} ( Set mark {a-zA-Z} at cursor position )

'{a-z} ( Jump to the mark {a-z} in the current buffer )