`
wangxe
  • 浏览: 9988 次
  • 来自: ...
社区版块
存档分类
最新评论

Vim Tips

阅读更多

* .vimrc example

    " Use Vim settings, rather then Vi settings (much better!).
    " This must be first, because it changes other options as a side effect.
    set nocompatible

    " set indent for c and cpp
    set cindent 
    set shiftwidth=4
   
    " set the space number of a tab
    set tabstop=4
   
    " make tab convert to space.
    set expandtab
   
    " enable syntax highlight
    syntax on
   
    " set the color scheme to 'sand'
    colo sand
   
    " increament search
    set incsearch
   
    " highlight search by manual
    set hls 
    set hlsearch
    nohls

    " allow backspacing over everything in insert mode
    set backspace=indent,eol,start
   
    " showing matches when type ')', ']', '}'
    set showmatch
    set matchtime=1

    " key maping
    " keys in insert/command mode
    "map! ^[[H <Home>
   
    "To the first non-blank character of the line.
    map! ^[[H ^[^i
    map ^[[H ^
    "map! ^[OH <Home>
   
    map! <Esc>[F <End>
    map <Esc>[F <End>
    "map! <Esc>OF <End>
   
    map! <Esc>[3~ <Delete>
    "map! <Esc>OE <Space>
   
    " set <Delete> to delete a char under the cursor.
    imap ^? <Del>
   
* 更换color scheme
    在/usr/local/share/vim/vim62/colors下,vim预设很多schemes。

    创建~/.vim/colors目录,
    放入mycolor.vim,
    在.vimrc中加入 colo mycolor

* 更换syntax file
    在/usr/local/share/vim/vim62/syntax下,vim预设很多schemes。

    创建~/.vim/syntax目录,
    放入mysyntax.vim,
    在.vimrc中加入 set syntax=mysyntax
   


常用命令:

auto complete
    <C-p> <C-n>


ma:      Make a bookmark named a at the current cursor position.
        A bookmark can be named any lowercase letter.
        You can't see the bookmark, but it's there!
   
`a:     Go to bookmark a. Important: that's a backtick, not a single quote.
        The backtick is located to the left of the 1 on most keyboards.
       
`.:     Go to the line that you last edited. This is very useful!
        If you need to scroll through the file to look something up,
        you can go back to where you were without bookmarking it by using the `. command.
       
*      Read the string under the cursor and go to the next place it appears.
    (For instance, if your cursor was somewhere on the word "bob," the cursor
    would move to the next occurance of "bob" in your file.)
   
#     Same as above, except it moves the cursor to the previous occurance.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics