天天看点

vim tipsOther

vim diff 

1.   已经打开的vim  中,diff 新的文件

:diffsplit  file

        简写(diffs)  

       默认为  hor 模式

       : vert  diffs   file   --》 垂直模式

  2. dp 和 do 后,重新diff一下

diffupdate    

        (diffu)

 3.   下一个/上一个 diff 

[c

]c  

4. 设置 diffopt

set diffopt=filler,vertical

设置后,diffs 出来的内容,默认使用垂直模式

5. ctrl-w,r   交换窗口位置

设置文件的格式

:set fileformats=unix,dos    设置vim 可以支持的格式,优先unix,后dos

:set fileformat?  查询当前文件格式

:set fileformat=unix 转换当前文件格式为unix

设置文件的编码格式

:set fileencoding=utf-8

:set fileencoding 查询文件格式

Other

附带几个命令

e   -- end of the word

{   }   start or end of block 

H  M  L       jump to  high  middle low pos of the screen

a    insert after the current cursor

J    merge the next line with current line

#  --> *  

.   repeat  command