呼~,配置了一天的vim效果图如下:
这里我除了添加vinrc的配置信息,还添加了了Ctag,taglist,和WinManger插件
vimrc:
1 set nu "set num line"
2 set go=
3 set guifont=Courier_New:h10:cANSI
4 autocmd InsertEnter * se cul
5 set ruler
6 syntax on
7 set showcmd
8 set bg=dark
9 colorscheme murphy
10 if version >= 603
11 set helplang=cn
12 set encoding=utf-8
13 endif
14 set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
15 set termencoding=utf-8
16 set encoding=utf-8
17 set fileencodings=ucs-bom,utf-8,cp936
18 set fileencoding=utf-8
19 set autoindent
20 set tabstop=2
21 set softtabstop=2
22 set shiftwidth=2
23 set noexpandtab
24 :inoremap ( ()<ESC>i
25 :inoremap ) <c-r>=ClosePair(')')<CR>
26 :inoremap { {<CR>}<ESC>O
27 :inoremap } <c-r>=ClosePair('}')<CR>
28 :inoremap [ []<ESC>i
29 :inoremap ] <c-r>=ClosePair(']')<CR>
30 :inoremap " ""<ESC>i
31 :inoremap ' ''<ESC>i
32 function! ClosePair(char)
33 if getline('.')[col('.') - 1] == a:char
34 return "\<Right>"
35 else
36 return a:char
37 endif
38 endfunction
39 filetype plugin indent on
40 set completeopt=longest,menu
41 autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()"
42 func SetTitle()
43 if &filetype == 'sh'
44 call setline(1,"\#########################################################################")
45 call append(line("."), "\# File Name: ".expand("%"))
46 call append(line(".")+1, "\# Author: ma6174")
47 call append(line(".")+2, "\# mail: ma6174@163.com")
48 call append(line(".")+3, "\# Created Time: ".strftime("%c"))
49 call append(line(".")+4, "\#########################################################################")
50 call append(line(".")+5, "\#!/bin/bash")
51 call append(line(".")+6, "")
52 else
53
54 call setline(1, "/*************************************************************************")
55 call append(line("."), " > File Name: ".expand("%"))
56 call append(line(".")+1, " > Author: tianyueyang")
57 call append(line(".")+2, " > Mail: pawnsir@163.com ")
58 call append(line(".")+3, " > Created Time: ".strftime("%c"))
59 call append(line(".")+4, " ************************************************************************/")
60 call append(line(".")+5, "")
61 endif
62 if &filetype == 'cpp'
63 call append(line(".")+6, "#include<iostream>")
64 call append(line(".")+7, "using namespace std;")
65 call append(line(".")+8, "")
66 endif
67 if &filetype == 'c'
68 call append(line(".")+6, "#include<stdio.h>")
69 call append(line(".")+7, "")
70 endif
71 autocmd BufNewFile * normal G
72 endfunc
73 map <C-A> ggVGY
74 map! <C-A> <Esc>ggVGY
75 map <F12> gg=G
76 map <F3> :tabnew .<CR>
77 map <C-F3> \be
78 set completeopt=preview,menu
79 set encoding=utf-8
80 set helplang=cn
81 let Tlist_Show_One_File=1
82 let Tlist_Exit_OnlyWindow=1
83 let g:winManagerWindowLayout='FileExplorer|TagList'
84 nmap wm :WMToggle<cr>''
85 filetype plugin indent on
86 set completeopt=longest,menu
之外,对于添加的几个插件我会对其进行说明:
ctags:
用法:
安装方法:
1.下载tags压缩包,解压
2.在解压目录下运行configure文件
3.执行make操作
4.在管理员权限下执行 make install
taglist:
设置:
在装了tag的基础上在.vimrc文件中进行添加:
let Tlist_Auto_Open = 1
这样当在命令模式下输入Tlist时就会在原有窗口上增加tag窗口。
WinManager:
是一个文件路径查看插件,在Linux下一般用来查看工程文件
设置方法:
1.将压缩文件解压到.vim路径下
2.为了方便使用,在.vimrc文件中添加如下命令:
let g:winManagerWindowLayout='FileExplorer|TagList'
nmap wm :WMToggle<cr>