vim

790阅读 0评论2014-07-18 himrpei
分类:系统运维

1. 显示看不清楚的时候,调整下配色方案:
    :colorscheme evening
2. 文本替换:
     Search as in sed
     ~ Affects current line by default.
     ~ Use x,y ranges or % for whole file
          :1,5s/cat/dog/
          :%s/cat/dog/gi
3. 替换一行的命令行命令:
     cc     #挺好用
4. Undoing Changes:
     ~ u undo most recent change
     ~ Ctrl-r redo last "undone" change   #与上面的配合,棒极了!
     ~ U undo all changes to the current line since the cursor landed on the line.
5. Visual Mode:
    ~ Allows selection of blocks of text.
          v starts character-oriented highlighting
          V starts line-oriented highlighting
    ~ Visual keys can be used in conjunction with movement keys.
    ~ Highlighted text can be deleted, yanked, changed, filtered, search/replaced, etc.
6. Using multiple "windows":
    ~ Multiple documents can be viewed in a single vim screen.
        - Ctrl-w, s splits the screen horizontally
        - Ctrl-w, v splits the screen vertically
        - Ctrl-w, Arrow(h,j,k,l is ok, too) moves between windows.
    ~ Ex-mode instructions always affect the current window
    ~ :help windows displays more window commands
    ~ vim -O file1 file2   #竖着用两个 windows 分别打开 file1 和 file2
       vim -o file1 file2   #横着用两个 windows 分别打开 file2 和 file2
    ~ 调整 window 的大小:
        Ctrl-w, N+     #增加高度,幅度是 N
        Ctrl-w, N      #降低高度,幅度是 N
        Ctrl-w,N>    #增加宽度,幅度是 N
        Ctrl-w, N<
    #缩小宽度,幅度是 N
7.   
上一篇:SYN Cookie原理
下一篇:svn 向 git 迁移