vim

来源:互联网 发布:c语言||什么意思 编辑:程序博客网 时间:2024/04/28 01:34
 

配置文件:.vimrc 下面是一个适合编程使用的VIM配置文件:

   

" User definitions ==========================================================

set nocompatible

source $VIMRUNTIME/vimrc_example.vim

set nobackup

set tags+=~/.tags

set nu

set autoindent

set tabstop=4

set et

set shiftwidth=4

set showmatch

   

map <F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>

let OmniCpp_MayCompleteScope = 1

let OmniCpp_ShowPrototypeInAbbr = 1

set completeopt=menu

   

map <Esc>[7~ <Home>

map <Esc>[8~ <End>

imap <Esc>[7~ <Home>

imap <Esc>[8~ <End>

   

   

   

   

自动缩进::set cindent或者快捷键gg=G

   

替换::s/aa/bb/g

:n,$s/aa/bb/g

%s/aa/bb/g

   

G末行

gg首行

   

0行首

$行尾

   

()上下段

Syntax on 彩色 set nu显示行号

   

%括号匹配

   

*#搜单词

   

复制:yy

:1,39y

删除::1,3d

剪切:dd

粘贴 p

   

?/ 搜索

Set nohls不高亮显示搜索结果

   

:n跳行