Lingceng's Blog

Vim Tips

HERE IS MY vimrc

Wonderful block insert

in Visual block mode:
|v_b_I|    I insert the same text in front of all the selected lines
|v_b_A|    A append the same text after all the selected lines

Search word under cursor

* to search current word, n to next, N to previous

Srround tag

:help v_a
at  # arround tag
it  # inner tag

Use mark

ma # mark a
`a # go to a
`A # go to A between buffers

Autocomplete with filesystem

ctrl-x ctrl-f

Jump between windows

:help window

# make the only window
CTRL-W o

# split
CTRL-W s
# split vertically
CTRL-W v

# navigate with h j k l
# go to left
CTRL-W h

# resize with < > + -
# add 10 width
CTRL-W 10>

Show whitespace characters

:set list

# close list
:set nolist

Buffer change

CTRL-I
CTRL-O

Scroll page

N  CTRL-D   window N lines Downwards (default: 1/2 window)
N  CTRL-U   window N lines Upwards (default: 1/2 window)

Set highlight when search

set hlsearch
set nohlsearch

Comments