vimのインストールと構成


まずVIMをインストールします.linuxの下で、VIMは以下のコマンドでインストールできます.
sudo apt-get install vim
次にVIMを構成し、VIMプロファイルはデフォルトでホームディレクトリの下に保存されます.vimrcは、それを編集することでVIMを構成することができ、以下は私のVIM構成で、比較的詳細な感じがします.使いたいものは直接持って行ってもいいです.
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
filetype on                 "      
"      
set cursorline
hi CursorLine   cterm=NONE ctermbg=grey ctermfg=NONE guibg=NONE guifg=NONE
"     
set cursorcolumn
"hi CursorColumn cterm=NONE ctermbg=grey ctermfg=white guibg=grey guifg=white
syntax enable
syntax on		    "    
colorscheme koehler         "    
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible            "       vi     ,         bug    
set number					"    
set history=1000 			"     1000
set autoindent              "      
set smartindent				" C        
set cindent					"  C     
set tabstop=4				"Tab     
set softtabstop=4           "     4    
set showmatch				"         
set matchtime=3				"         (        )
set ruler					"    
set incsearch				"    ,        
set magic					"    
"        
set fenc=utf-8 
set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936
set showcmd        			"    
set guioptions-=T           "      
set guioptions-=m           "      
"    
set enc=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
"    
set langmenu=zh_CN.UTF-8
set helplang=cn
"    buffer         (  office           )
"set mouse=a
"set selection=exclusive
"set selectmode=mouse,key
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let Tlist_Show_One_File=1		"          tag,         
let Tlist_Exit_OnlyWindow=1		"  taglist         ,   vim
" minibufexpl       
let g:winManagerWindowLayout='FileExplorer|TagList'
nmap wm :WMToggle<cr>
let g:miniBufExplMapCTabSwitchBufs=1
let g:miniBufExplMapWindowsNavVim=1
let g:miniBufExplMapWindowNavArrows=1
"    
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"    
func CompileRun()
exec "w"
"C     
if &filetype == 'c'
exec "!gcc % -o %<"
exec "! ./%<"
"C++  
elseif &filetype == 'cpp'
exec "!g++ % -o %<"
exec "! ./%<"
"java  
elseif &filetype == 'java'
exec "!javac %"
exec "!java %<"
"python  
elseif &filetype == 'python'
exec "!python %"
"php,html,htm  
elseif &filetype == ('php'||'html'||'htm')
exec"!google-chrome http://127.0.0.1/%:t"
endif
endfunc
" Ctrl + S   
map  <c-s>:exec "w" <CR>
imap <c-s>:exec "w" <CR>
vmap <c-s>:exec "w" <CR>
" <F5>       
map <F5> :call CompileRun()<CR>
imap <F5> <ESC>:call CompileRun()<CR>
vmap <F5> <ESC>:call CompileRun()<CR>
nnoremap <silent> <F3> :Grep<CR>
nnoremap <silent> <F12> :A<CR> 
"     
if has("win32")
    set guifont=Consolas:h14:cANSI
	set fileencoding=chinese
endif
source $VIMRUNTIME/delmenu.vim  
source $VIMRUNTIME/menu.vim  
language messages zh_CN.utf-8
"<F2>        
map <silent> <F2> :if &guioptions =~# 'T' <Bar>
        \set guioptions-=T <Bar>
        \set guioptions-=m <bar>
    \else <Bar>
        \set guioptions+=T <Bar>
        \set guioptions+=m <Bar>
    \endif<CR>