Vim学习及配置(综合整理)

来源:互联网 发布:json.parsearray 用法 编辑:程序博客网 时间:2024/06/01 07:54

   Vim真的很强大,配置好了,在编程的时候真是得心应手啊。这里先创建这篇文章,今天太累了就不写了。

-2012年09月15日

   这里我就不多写了。贴一个鸟哥关于Vim的地址。鸟哥写的这么强大。我就没必要写出来了。然后再贴出自己的.vimrc配置就可以了。

   鸟哥Vim网址:http://vbird.dic.ksu.edu.tw/linux_basic/0310vi.php

   我的vim配置(暂时)如下:

"change color

colo slate

"Tab indentation
set ts=4
set sw=4
set autoindent
set smartindent

"show line num
set nu

"set font
set guifont=文泉驿等宽正黑\ 12

"set window size
set lines=35 columns=123

"语法高亮“
syntax enable
syntax on

"实现c语言的缩进
set cin

"检测文件的类型
filetype on

"第一行设置tab键为3个空格,第二行设置当行之间交错时使用4个空格"
"设置匹配模式,类似当输入一个左括号时会匹配相应的那个右括号"
set tabstop=3
set shiftwidth=3
set softtabstop=3
set showmatch
if &term=="xterm"
set t_Co=8
set t_Sb=^[[4%dm
set t_Sf=^[[3%dm
endif 

"括号之类呢自动补全"
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
":inoremap < <><ESC>i"
":inoremap > <c-r>=ClosePair('>')<CR>"
:inoremap " ""<ESC>i
:inoremap \" <c-r>=ClosePair('"')<CR>
:inoremap ' ''<ESC>i
:inoremap \' <c-r>=ClosePair(''')<CR>

function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf

"在编辑过程中,在右下角显示光标位置的状态行"
set ruler

"打开文件类型检测, 加了这句才可以用智能补全"
filetype plugin indent on

"使用winmanager"
let g:winManagerWindowLayout='FileExplorer'
nmap wm :WMToggle<cr>


   以前配置的还用了ctags之类的。现在木有用。只用了winmanager。现在主要用来编python。配置好Vim就非常得心应手了。到这里吧。

-2012年9月20日

原创粉丝点击