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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值