" 不要使用vi的鍵盤模式,而是vim自己的
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
" 加載配置。
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
"""""""""""""""編碼""""""""""""""""""""""""""""""""""""""""""""""""""
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1
if has("win32")
set fileencoding=chinese
else
set fileencoding=utf-8
endif
"解決菜單亂碼
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"解決consle輸出亂碼
language messages zh_CN.utf-8
""""""""""""""""通用配置""""""""""""""""""""""""""""""""""""""""""""""""""""""
"無菜單、工具欄
set go=
"配色方案
colorscheme evening
" 顯示行號
set nu!
"按Ctrl+N進行代碼補全
set completeopt=longest,menu
" 設置備份文件後綴
"set backupext=.bak
" 設置備份文件夾
set backupdir=D:/workspace/VIM
" 設置tab鍵的寬度
set tabstop=4
" 整詞換行
set linebreak
" 打開語法高亮
syn on
" 命令行補全
set wildmenu
"設置快速編輯.vimrc文件 ,e 編輯.vimrc
map <silent> <leader>e :call SwitchToBuf("~/_vimrc")<cr>
"保存.vimrc文件後會自動調用新的.vimrc
autocmd! bufwritepost .vimrc source ~/_vimrc
" 自動格式化設置
filetype indent on
set autoindent
set smartindent
" 查詢時非常方便,如要查找book單詞,當輸入到/b時,會自動找到
set incsearch
" 加了這句纔可以用智能補全
filetype pluginindenton
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 語言的編譯和運行
" 支持的語言:java F5編譯(保存+編譯) F6運行
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
func! CompileCode()
exec "w"
if &filetype == "java"
exec "!javac -encoding utf-8 %"
endif
endfunc
func! RunCode()
if &filetype == "java"
exec "!java -classpath %:h; %:t:r"
endif
endfunc
" F5 保存+編譯
map <F5> :call CompileCode()<CR>
" F6 運行
map <F6> :call RunCode()<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 快速打開vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set mapleader
let mapleader = ","
"Fast reloading of the .vimrc
map <silent> <leader>ss :source ~/.vimrc<cr>
"Fast editing of .vimrc
map <silent> <leader>ee :e ~/.vimrc<cr>
"When .vimrc is edited, reload it
autocmd! bufwritepost .vimrc source ~/.vimrc
""""""""""""""""""""""SwitchToBuf()"""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
"實現它在所有標籤頁的窗口中查找指定的文件名,如果找到這樣一個窗口,
"就跳到此窗口中;否則,它新建一個標籤頁來打開vimrc文件
"上面自動編輯.vimrc文件用到的函數
function! SwitchToBuf(filename)
let bufwinnr = bufwinnr(a:filename)
if bufwinnr != -1
exec bufwinnr . "wincmd w"
return
else
" find in each tab
tabfirst
let tab = 1
while tab <= tabpagenr("$")
let bufwinnr = bufwinnr(a:filename)
if bufwinnr != -1
exec "normal " . tab . "gt"
exec bufwinnr . "wincmd w"
return
endif
tabnext
let tab = tab + 1
endwhile
" not exist, new tab
exec "tabnew " . a:filename
endif
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 保存代碼文件前自動修改最後修改時間
au BufWritePre *.sh call TimeStamp('#')
au BufWritePre .vimrc,*.vim call TimeStamp('"')
au BufWritePre *.c,*.h call TimeStamp('//')
au BufWritePre *.cpp,*.hpp call TimeStamp('//')
au BufWritePre *.cxx,*.hxx call TimeStamp('//')
au BufWritePre *.java call TimeStamp('//')
au BufWritePre *.rb call TimeStamp('#')
au BufWritePre *.py call TimeStamp('#')
au BufWritePre Makefile call TimeStamp('#')
au BufWritePre *.php
\call TimeStamp('<?php //', '?>')
au BufWritePre *.html,*htm
\call TimeStamp('<!--', '-->')
" 更改Leader爲","
let g:C_MapLeader = ','
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
"Last change用到的函數,返回時間,能夠自動調整位置
function! TimeStamp(...)
let sbegin = ''
let send = ''
if a:0 >= 1
let sbegin = a:1.'\s*'
endif
if a:0 >= 2
let send = ' '.a:2
endif
let pattern = 'Last Change: .\+'
\. send
let pattern = '^\s*' . sbegin . pattern . '\s*$'
let now = strftime('%Y-%m-%d %H:%M:%S',
\localtime())
let row = search(pattern, 'n')
if row == 0
let now = a:1 . ' Last Change: '
\. now . send
call append(2, now)
else
let curstr = getline(row)
let col = match( curstr , 'Last')
let spacestr = repeat(' ',col - 1)
let now = a:1 . spacestr . 'Last Change: '
\. now . send
call setline(row, now)
endif
endfunction
set shellslash
set grepprg=grep\ -nJ\ $*
let g:tex_flavor='latex'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 搜索和匹配 "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 高亮顯示匹配的括號
set showmatch
" 匹配括號高亮的時間(單位是十分之一秒)
set matchtime=3
" 在搜索的時候忽略大小寫
set ignorecase
" 不要高亮被搜索的句子(phrases)
" set nohlsearch
" 在搜索時,輸入的詞句的逐字符高亮(類似firefox的搜索)
set incsearch
" 輸入:set list命令是應該顯示些啥?
set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$
" Tab補全時忽略這些忽略這些
set wildignore=*.o,*.obj,*.bak,*.exe
" 光標移動到buffer的頂部和底部時保持3行距離
set scrolloff=3
"搜索出之後高亮關鍵詞
set hlsearch
nmap <silent> <leader><cr> :noh<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>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" amix/vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Awesome_version:
" Get this config, nice color schemes and lots of plugins!
"
" Install the awesome version from:
"
" https://github.com/amix/vimrc
" Sections:
" -> General
" -> VIM user interface
" -> Colors and Fonts
" -> Files and backups
" -> Text, tab and indent related
" -> Visual mode related
" -> Moving around, tabs and buffers
" -> Status line
" -> Editing mappings
" -> vimgrep searching and cope displaying
" -> Spell checking
" -> Misc
" -> Helper functions
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sets how many lines of history VIM has to remember
set history=500
" Enable filetype plugins
filetype plugin on
filetype indent on
" Set to auto read when a file is changed from the outside
set autoread
" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
let mapleader = ","
let g:mapleader = ","
" Fast saving
nmap <leader>w :w!<cr>
" :W sudo saves the file
" (useful for handling the permission-denied error)
command W w !sudo tee % > /dev/null
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => VIM user interface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set 7 lines to the cursor - when moving vertically using j/k
set so=7
" Avoid garbled characters in Chinese language windows OS
let $LANG='en'
set langmenu=en
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
" Turn on the WiLd menu
set wildmenu
" Ignore compiled files
set wildignore=*.o,*~,*.pyc
if has("win16") || has("win32")
set wildignore+=.git\*,.hg\*,.svn\*
else
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
endif
"Always show current position
set ruler
" Height of the command bar
set cmdheight=2
" A buffer becomes hidden when it is abandoned
set hid
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Don't redraw while executing macros (good performance config)
set lazyredraw
" For regular expressions turn magic on
set magic
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" Add a bit extra margin to the left
set foldcolumn=1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enable syntax highlighting
syntax enable
try
colorscheme desert
catch
endtry
set background=dark
" Set extra options when running in GUI mode
if has("gui_running")
set guioptions-=T
set guioptions-=e
set t_Co=256
set guitablabel=%M\ %t
endif
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use Unix as the standard file type
set ffs=unix,dos,mac
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Files, backups and undo
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup
set nowb
set noswapfile
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
" Linebreak on 500 characters
set lbr
set tw=500
set cindent
set cinkeys-=0#
set indentkeys-=0#
set wrap "Wrap lines
""""""""""""""""""""""""""""""
" => Visual mode related
""""""""""""""""""""""""""""""
" Visual mode pressing * or # searches for the current selection
" Super useful! From an idea by Michael Naumann
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Moving around, tabs, windows and buffers
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search)
map <space> /
map <c-space> ?
" Disable highlight when <leader><cr> is pressed
map <silent> <leader><cr> :noh<cr>
" Smart way to move between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" Close the current buffer
map <leader>bd :Bclose<cr>:tabclose<cr>gT
" Close all the buffers
map <leader>ba :bufdo bd<cr>
map <leader>l :bnext<cr>
map <leader>h :bprevious<cr>
" Useful mappings for managing tabs
map <leader>tn :tabnew<cr>
map <leader>to :tabonly<cr>
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove
map <leader>t<leader> :tabnext
" Let 'tl' toggle between this and the last accessed tab
let g:lasttab = 1
nmap <Leader>tl :exe "tabn ".g:lasttab<CR>
au TabLeave * let g:lasttab = tabpagenr()
" Opens a new tab with the current buffer's path
" Super useful when editing files in the same directory
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/
" Switch CWD to the directory of the open buffer
map <leader>cd :cd %:p:h<cr>:pwd<cr>
" Specify the behavior when switching between buffers
try
set switchbuf=useopen,usetab,newtab
set stal=2
catch
endtry
" Return to last edit position when opening files (You want this!)
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
""""""""""""""""""""""""""""""
" => Status line
""""""""""""""""""""""""""""""
" Always show the status line
set laststatus=2
" Format the status line
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Editing mappings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Remap VIM 0 to first non-blank character
map 0 ^
" Move a line of text using ALT+[jk] or Command+[jk] on mac
nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
if has("mac") || has("macunix")
nmap <D-j> <M-j>
nmap <D-k> <M-k>
vmap <D-j> <M-j>
vmap <D-k> <M-k>
endif
" Delete trailing white space on save, useful for Python and CoffeeScript ;)
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite *.py :call DeleteTrailingWS()
autocmd BufWrite *.coffee :call DeleteTrailingWS()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Ag searching and cope displaying
" requires ag.vim - it's much better than vimgrep/grep
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" When you press gv you Ag after the selected text
vnoremap <silent> gv :call VisualSelection('gv', '')<CR>
" Open Ag and put the cursor in the right position
map <leader>g :Ag
" When you press <leader>r you can search and replace the selected text
vnoremap <silent> <leader>r :call VisualSelection('replace', '')<CR>
" Do :help cope if you are unsure what cope is. It's super useful!
"
" When you search with Ag, display your results in cope by doing:
" <leader>cc
"
" To go to the next search result do:
" <leader>n
"
" To go to the previous search results do:
" <leader>p
"
map <leader>cc :botright cope<cr>
map <leader>co ggVGy:tabnew<cr>:set syntax=qf<cr>pgg
map <leader>n :cn<cr>
map <leader>p :cp<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Spell checking
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Pressing ,ss will toggle and untoggle spell checking
map <leader>ss :setlocal spell!<cr>
" Shortcuts using <leader>
map <leader>sn ]s
map <leader>sp [s
map <leader>sa zg
map <leader>s? z=
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Misc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Remove the Windows ^M - when the encodings gets messed up
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
" Quickly open a buffer for scribble
map <leader>q :e ~/buffer<cr>
" Quickly open a markdown buffer for scribble
map <leader>x :e ~/buffer.md<cr>
" Toggle paste mode on and off
map <leader>pp :setlocal paste!<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Helper functions
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! CmdLine(str)
exe "menu Foo.Bar :" . a:str
emenu Foo.Bar
unmenu Foo
endfunction
function! VisualSelection(direction, extra_filter) range
let l:saved_reg = @"
execute "normal! vgvy"
let l:pattern = escape(@", '\\/.*$^~[]')
let l:pattern = substitute(l:pattern, "\n$", "", "")
if a:direction == 'gv'
call CmdLine("Ag \"" . l:pattern . "\" " )
elseif a:direction == 'replace'
call CmdLine("%s" . '/'. l:pattern . '/')
endif
let @/ = l:pattern
let @" = l:saved_reg
endfunction
" Returns true if paste mode is enabled
function! HasPaste()
if &paste
return 'PASTE MODE '
endif
return ''
endfunction
" Don't close window, when deleting a buffer
command! Bclose call <SID>BufcloseCloseIt()
function! <SID>BufcloseCloseIt()
let l:currentBufNum = bufnr("%")
let l:alternateBufNum = bufnr("#")
if buflisted(l:alternateBufNum)
buffer #
else
bnext
endif
if bufnr("%") == l:currentBufNum
new
endif
if buflisted(l:currentBufNum)
execute("bdelete! ".l:currentBufNum)
endif
endfunction
set nocompatible "不要使用vi的鍵盤模式,而是vim自己的
source $VIMRUNTIME/mswin.vim
behave mswin "兼容windows下的快捷鍵
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" GVIM自身的設置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
language messages zh_CN.utf-8 " 解決consle輸出亂碼
colorscheme desert " 灰褐色主題
set guioptions-=T " 隱藏工具欄
set guifont=Monospace\ 30 " 字體 && 字號
set noerrorbells " 關閉錯誤提示音
set nobackup " 不要備份文件
set linespace=0 " 字符間插入的像素行數目
set shortmess=atI " 啓動的時候不顯示那個援助索馬里兒童的提示
set novisualbell " 不要閃爍
set scrolloff=3 " 光標移動到buffer的頂部和底部時保持3行距離
set mouse=a " 可以在buffer的任何地方 ->
set selection=exclusive " 使用鼠標(類似office中 ->
set selectmode=mouse,key " 在工作區雙擊鼠標定位)
set cursorline " 突出顯示當前行
set whichwrap+=<,>,h,l " 允許backspace和光標鍵跨越行邊界
set completeopt=longest,menu "按Ctrl+N進行代碼補全
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 文本格式和排版
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set list " 顯示Tab符,->
set listchars=tab:\|\ , " 使用一高亮豎線代替
set tabstop=4 " 製表符爲4
set autoindent " 自動對齊(繼承前一行的縮進方式)
set smartindent " 智能自動縮進(以c程序的方式)
set softtabstop=4
set shiftwidth=4 " 換行時行間交錯使用4個空格
set noexpandtab " 不要用空格代替製表符
set cindent " 使用C樣式的縮進
set smarttab " 在行和段開始處使用製表符
set nowrap " 不要換行顯示一行
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 狀態行(命令行)的顯示
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set cmdheight=2 " 命令行(在狀態行下)的高度,默認爲1,這裏是2
set ruler " 右下角顯示光標位置的狀態行
set laststatus=2 " 開啓狀態欄信息
set wildmenu " 增強模式中的命令行自動完成操作
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 文件相關
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set fenc=utf-8
set encoding=utf-8 " 設置vim的工作編碼爲utf-8,如果源文件不是此編碼,vim會進行轉換後顯示
set fileencoding=utf-8 " 讓vim新建文件和保存文件使用utf-8編碼
set fileencodings=utf-8,gbk,cp936,latin-1
filetype on " 偵測文件類型
filetype indent on " 針對不同的文件類型採用不同的縮進格式
filetype plugin on " 針對不同的文件類型加載對應的插件
syntax on " 語法高亮
filetype plugin indent on " 啓用自動補全
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 查找
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set hlsearch " 開啓高亮顯示結果
set nowrapscan " 搜索到文件兩端時不重新搜索
set incsearch " 開啓實時搜索功能
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 語言的編譯和運行
" 支持的語言:java F5編譯(保存+編譯) F6運行
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
func! CompileCode()
exec "w"
if &filetype == "java"
exec "!javac -encoding utf-8 %"
endif
endfunc
func! RunCode()
if &filetype == "java"
exec "!java -classpath %:h; %:t:r"
endif
endfunc
" F5 保存+編譯
map <F5> :call CompileCode()<CR>
" F6 運行
map <F6> :call RunCode()<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 ' ''<ESC>i
:inoremap ` ``<ESC>i
function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf
"--------啓用代碼摺疊,用空格鍵來開關摺疊
set foldenable " 打開代碼摺疊
set foldmethod=syntax " 選擇代碼摺疊類型
set foldlevel=100 " 禁止自動摺疊
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc':'zo')<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 插件
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" <F9>打開文件瀏覽窗口 插件爲WinManager
let g:winManagerWindowLayout='FileExplorer'
nmap <F9> :WMToggle<CR>
" MiniBufExplorer
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
" Make VIM remember position in file after reopen
" if has("autocmd")
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Vimrc配置文件
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.