linux Vim經(jīng)典配置一例
發(fā)布時間:2013-02-11 15:25:55 作者:佚名
我要評論

把如下的文件保存為Linux主文件夾的".vimrc"文件(不同的Linux版本略有不同,ubuntu下是.vimrc),即可以把vim打造成一把利器
有需要的朋友可以參考下。
" This is my _vimrc under windows platform
" and it can be used on *nix too
" all the difference of them is the font setting session
" happy Viming,
" copyLeft (#) Abruzzi John
set linebreak " line break
set nocompatible " no compatible
set history=400 " history
set ruler
set number " line number
set hlsearch " highlight search
set noincsearch " no in C search
set expandtab " expand table
set t_vb= "close bell
set foldmethod=marker
set tabstop=4 " table step
set shiftwidth=4
set nobackup " don't backup
set smarttab " smart table
set smartindent " smart indent
set autoindent " auto indent
set cindent "cindent
set cursorline " hightlight cursor line 高亮光標所在行
" set the back space
set backspace=indent,eol,start "這行比較重要,剛接觸vim的朋友會發(fā)現(xiàn)有時候backspace鍵刪不了文字
colorscheme desert " color scheme
let Tlist_Use_Right_Window=0 " for tag_list plugin only
let Tlist_File_Fold_Auto_Close=1 " for tag_list plugin only
let g:winManagerWindowLayout="FileExplorer|TagList" " for winmanager
filetype plugin indent on " filetype setting
set completeopt=longest,menu " for code complete
" the following function is used for show the status bar on the buttom
function! CurrectDir()
let curdir = substitute(getcwd(), "", "", "g")
return curdir
endfunction
set statusline=\ [File]\ %F%m%r%h\ %w\ \ [PWD]\ %r%{CurrectDir()}%h\ \ %=[Line]\ %l,%c\ %=\ %P
" this is a setting of font
if has("win32")
set guifont=Courier_New:h10:cANSI
endif
" make sure that syntax always on
if exists("syntax_on")
syntax reset
else
syntax on
endif
" java complete
if has("autocmd")
autocmd Filetype java setlocal omnifunc=javacomplete#Complete
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""
let performance_mode=1
function MySys()
if has("win32")
return "win32"
elseif has("unix")
return "unix"
else
return "mac"
endif
endfunction
if MySys() == "unix" || MySys() == "mac"
set shell=bash
else
" set win32 shell
endif
" set auto read when file is changed from outside
if exists("&autoread")
set autoread
endif
" enable the mouse
if exists("&mouse")
set mouse=a
endif
" set mapleader
let mapleader=","
let g:mapleader=","
"fast saving
nmap <leader>x :xa!<cr>
nmap <leader>w :w!<cr>
"switch to current directory
map <leader>cd :cd %:p:h<cr>
" just for fun
map <F9> ggVGg?
" folding code
if exists("&foldenable")
set fen
endif
if exists("&foldlevel")
set fdl=0
endif
" tag list --
map <F3> :Tlist<cr>
"remove the windows ^M windows系統(tǒng)中常??梢钥吹轿谋局袏A雜著^M這樣的控制字符,用此命令刪除之
noremap <leader>m :%s/
復(fù)制代碼
代碼如下:" This is my _vimrc under windows platform
" and it can be used on *nix too
" all the difference of them is the font setting session
" happy Viming,
" copyLeft (#) Abruzzi John
set linebreak " line break
set nocompatible " no compatible
set history=400 " history
set ruler
set number " line number
set hlsearch " highlight search
set noincsearch " no in C search
set expandtab " expand table
set t_vb= "close bell
set foldmethod=marker
set tabstop=4 " table step
set shiftwidth=4
set nobackup " don't backup
set smarttab " smart table
set smartindent " smart indent
set autoindent " auto indent
set cindent "cindent
set cursorline " hightlight cursor line 高亮光標所在行
" set the back space
set backspace=indent,eol,start "這行比較重要,剛接觸vim的朋友會發(fā)現(xiàn)有時候backspace鍵刪不了文字
colorscheme desert " color scheme
let Tlist_Use_Right_Window=0 " for tag_list plugin only
let Tlist_File_Fold_Auto_Close=1 " for tag_list plugin only
let g:winManagerWindowLayout="FileExplorer|TagList" " for winmanager
filetype plugin indent on " filetype setting
set completeopt=longest,menu " for code complete
" the following function is used for show the status bar on the buttom
function! CurrectDir()
let curdir = substitute(getcwd(), "", "", "g")
return curdir
endfunction
set statusline=\ [File]\ %F%m%r%h\ %w\ \ [PWD]\ %r%{CurrectDir()}%h\ \ %=[Line]\ %l,%c\ %=\ %P
" this is a setting of font
if has("win32")
set guifont=Courier_New:h10:cANSI
endif
" make sure that syntax always on
if exists("syntax_on")
syntax reset
else
syntax on
endif
" java complete
if has("autocmd")
autocmd Filetype java setlocal omnifunc=javacomplete#Complete
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""
let performance_mode=1
function MySys()
if has("win32")
return "win32"
elseif has("unix")
return "unix"
else
return "mac"
endif
endfunction
if MySys() == "unix" || MySys() == "mac"
set shell=bash
else
" set win32 shell
endif
" set auto read when file is changed from outside
if exists("&autoread")
set autoread
endif
" enable the mouse
if exists("&mouse")
set mouse=a
endif
" set mapleader
let mapleader=","
let g:mapleader=","
"fast saving
nmap <leader>x :xa!<cr>
nmap <leader>w :w!<cr>
"switch to current directory
map <leader>cd :cd %:p:h<cr>
" just for fun
map <F9> ggVGg?
" folding code
if exists("&foldenable")
set fen
endif
if exists("&foldlevel")
set fdl=0
endif
" tag list --
map <F3> :Tlist<cr>
"remove the windows ^M windows系統(tǒng)中常??梢钥吹轿谋局袏A雜著^M這樣的控制字符,用此命令刪除之
noremap <leader>m :%s/
相關(guān)文章
- 這篇文章主要介紹了CentOS系統(tǒng)中安裝高亮vim編輯工具的方法,需要的朋友可以參考下2014-05-01
- 在linux下做開發(fā),甚至是只做管理維護工作,也少不了Vim的使用。作為一個新手,我也是剛剛接觸,本節(jié)將我日常使用或收集的Vim常用命令記錄下來2014-04-21
- vi 是 unix/linux 下極為普遍的一種文本編輯器. vi 有各種變種, 在不同的機器上有不同的變種軟件. 其中 vim 比較好用也用得比較廣泛. vim 是 Vi IMproved 的縮寫, 表示更好2014-03-13
- linux vim配置文件:語法高亮、顯示狀態(tài)行、C程序提供自動縮進等設(shè)置2013-12-13
- vi/vim 中可以使用 :s 命令來替換字符串。以前只會使用一種格式來全文替換,今天發(fā)現(xiàn)該命令有很多種寫法2013-10-16
linux vim 配置文件(高亮+自動縮進+行號+折疊+優(yōu)化)
將一下代碼copy到 用戶目錄下 新建文件為 .vimrc保存即可生效2013-07-31linux vim配置文件(經(jīng)典實用,值得珍藏)
分享vim配置文件一個,可以直接使用,配置出非常實用的編程功能,有需要的朋友參考下2013-07-31- linux vi命令大全整理,可供需要的朋友參考2012-11-09
- Vim是一個類似于Vi的文本編輯器,不過在Vi的基礎(chǔ)上增加了很多新的特性,Vim普遍被推崇為類Vi編輯器中最好的一個,事實上真正的勁敵來自Emacs的不同變體2012-11-01
- vi(vim)是上Linux非常常用的編輯器,很多Linux發(fā)行版都默認安裝了vi(vim)。vi(vim)命令繁多但是如果使用靈活之后將會大大提高效率2012-10-31