VIM技巧

中文显示乱码问题

echo -e ' set fileencodings=utf-8,gbk,utf-16le,cp1252,iso-8859-15,ucs-bom \n set termencoding=utf-8 \n set encoding=utf-8 ' >> /etc/vim/vimrc

Register

vim 里面的copy/paste用的是register
:reg - show all registers
"ayy = "aY = yank current line to regsiter named "a
"byw = yank current word to register "b
{Visual}"xy = yank current selection to register "x

"xp = paste AFTER current cursor
"xP = paster BEFORE current cursor

:put z = put content of register z AFTER current line
:put! z = put content of register z BEFORE current line

"1p = paste the last reg (not the current)

删除

# 删除当前行
dd
# 删除当前行 -> last line
dG
# 删除当前行 -> first line
dgg

Visual Selection

" select last selection
gv