vim配置

 

1. 安裝必要的軟件php

sudo apt-get install ctags cscope python-dev build-essential 

2. 升級vim到7.4html

方法一:手動編譯java

(1) 卸載原有的Vimpython

sudo apt-get remove vim vim-tiny vim-common vim-runtime gvim vim-gui-common

(2)編譯安裝vim74c++

hg clone https://vim.googlecode.com/hg/ vim

cd vim
./configure --with-features=huge \
            --enable-rubyinterp=yes \
            --enable-pythoninterp=yes \
            --enable-python3interp=yes \
            --enable-perlinterp=yes \
            --enable-luainterp=yes \
            --enable-gui=gtk2 --enable-cscope --prefix=/usr
make VIMRUNTIMEDIR=/usr/share/vim/vim74
make install

方法二: 手動添加PPA(Personal Package Archives)git

sudo add-apt-repository ppa:nmi/vim-snapshots
sudo apt-get update
sudo apt-get install vim

3. 安裝vim管理插件 pathogengithub

參見 http://www.cnblogs.com/gtarcoder/p/4632325.html 數據庫

4. 安裝vim插件 nerdtree, nerdtree-tabs, powerline, conslas-powerline-vim, vim-colors-solarizedjson

cd ~/.vim/bundle

git clone http://github.com/scrooloose/nerdtree.git   #安裝nerdtree

git clone https://github.com/jistr/vim-nerdtree-tabs.git #安裝nerdtree-tabs

git clone https://github.com/eugeii/consolas-powerline-vim.git #安裝powerline

git clone git://github.com/altercation/vim-colors-solarized.git #安裝vim-colors-solarized

5. 安裝自動補全 youcompletemeubuntu

(1) 下載youcompleteme

git clone https://github.com/Valloric/YouCompleteMe.git
git submodule update --init --recursive

(2) 編譯安裝youcompleteme

cd ~/.vim/bundle/YouCompleteMe
./install --clang-completer #對c/c++語言進行支持

正常來講,YCM會去下載clang的包,若是已經有,也能夠用系統--system-libclang。

步驟(2)是使用腳本進行自動編譯安裝ycm對c語言的支持,也能夠下載clang的源碼,編譯,以下所示

$: cd ~  
$: mkdir ycm_build  
$: cd ycm_build  
$: cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/cpp  
$: cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=/usr/clang_3_3/ . ~/.vim/bundle/YouCompleteMe/third_party_ycmd/cpp
$: make ycm_core  
$: cp /usr/clang_3_3/lib/libclang.so ~/.vim/bundle/YouCompleteMe/python/libclang.so #這一步是爲了使用新的libcang.so  
      
$: cd ~/.vim/bundle/YouCompleteMe  
    .vim/bunble/YouCompleteMe$: ./install.sh --clang-completer  

(3)修改配置文件 ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py

# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to <http://unlicense.org/>

import os
import ycm_core

# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
#'-Werror',
#'-Wc++98-compat',
'-Wno-long-long',
'-Wno-variadic-macros',
'-fexceptions',
'-stdlib=libc++',
# THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won't know which
# language to use when compiling headers. So it will guess. Badly. So C++
# headers will be compiled as C headers. You don't want that so ALWAYS specify
# a "-std=<something>".
# For a C project, you would set this to something like 'c99' instead of
# 'c++11'.
'-std=c++11',
# ...and the same thing goes for the magic -x option which specifies the
# language that the files to be compiled are written in. This is mostly
# relevant for c++ headers.
# For a C project, you would set this to 'c' instead of 'c++'.
'-x',
'c++',
'-I',
'.',
'-isystem',
'/usr/include',
'-isystem',
'/usr/local/include',
'-isystem',
'/Library/Developer/CommandLineTools/usr/include',
'-isystem',
'/Library/Developer/CommandLineTools/usr/bin/../lib/c++/v1',
]

# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''

if os.path.exists( compilation_database_folder ):
  database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
  database = None

SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]

def DirectoryOfThisScript():
  return os.path.dirname( os.path.abspath( __file__ ) )

def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
  if not working_directory:
    return list( flags )
  new_flags = []
  make_next_absolute = False
  path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
  for flag in flags:
    new_flag = flag

    if make_next_absolute:
      make_next_absolute = False
      if not flag.startswith( '/' ):
        new_flag = os.path.join( working_directory, flag )

    for path_flag in path_flags:
      if flag == path_flag:
        make_next_absolute = True
        break

      if flag.startswith( path_flag ):
        path = flag[ len( path_flag ): ]
        new_flag = path_flag + os.path.join( working_directory, path )
        break

    if new_flag:
      new_flags.append( new_flag )
  return new_flags

def IsHeaderFile( filename ):
  extension = os.path.splitext( filename )[ 1 ]
  return extension in [ '.h', '.hxx', '.hpp', '.hh' ]

def GetCompilationInfoForFile( filename ):
  # The compilation_commands.json file generated by CMake does not have entries
  # for header files. So we do our best by asking the db for flags for a
  # corresponding source file, if any. If one exists, the flags for that file
  # should be good enough.
  if IsHeaderFile( filename ):
    basename = os.path.splitext( filename )[ 0 ]
    for extension in SOURCE_EXTENSIONS:
      replacement_file = basename + extension
      if os.path.exists( replacement_file ):
        compilation_info = database.GetCompilationInfoForFile(
          replacement_file )
        if compilation_info.compiler_flags_:
          return compilation_info
    return None
  return database.GetCompilationInfoForFile( filename )

def FlagsForFile( filename, **kwargs ):
  if database:
    # Bear in mind that compilation_info.compiler_flags_ does NOT return a
    # python list, but a "list-like" StringVec object
    compilation_info = GetCompilationInfoForFile( filename )
    if not compilation_info:
      return None

    final_flags = MakeRelativePathsInFlagsAbsolute(
      compilation_info.compiler_flags_,
      compilation_info.compiler_working_dir_ )

    # NOTE: This is just for YouCompleteMe; it's highly likely that your project
    # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR
    # ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT.
    #try:
    #  final_flags.remove( '-stdlib=libc++' )
    #except ValueError:
    #  pass
  else:
    relative_to = DirectoryOfThisScript()
    final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )

  return {
    'flags': final_flags,
    'do_cache': True
  }
View Code

5. 修改配置文件 ~/.vimrc

"---------------------------------- pathogen 設置-------------------------
"pathogen插件用於管理其餘vim插件,安裝其餘插件時候,能夠直接解壓覆蓋到 .vim 目錄下的 autoload, plugin, doc目錄;
"也能夠安裝完pathogen以後(會在autoload目錄下有一個pathogen.vim,同時在.vim 下建立 bundles目錄)進入 bundles目錄,
"執行 git clone xxxx 到bundles目錄,利用 pathogen進行安裝
execute pathogen#infect()
execute pathogen#helptags()



"定義快捷鍵的前綴,前綴相似於命令空間,避免多個相同的快捷鍵衝突
"如 c, <header> c, <header><header> c 是三個不一樣的快捷鍵
let mapleader=";"

"----------------------------------基本配置------------------------------
"關閉兼容模式
set nocompatible

"文件類型檢測,能夠針對不一樣類型的文件加載不一樣的插件
filetype on
"根據偵測的文件類型,加載相應的插件
filetype plugin on

"vim 自身命令行 模式自動補全
set wildmenu

"設置語法高亮
if has("syntax")
    syntax on
endif 


"高亮光標所在的行
set cul 

"用淺色高亮當前行
autocmd InsertEnter * se cul

"設置行間隔
set linespace=0

"設置退格鍵可用
set backspace=2

"設置匹配模式,顯示匹配的括號
set showmatch

"整詞換行
set linebreak

"設置光標能夠從行首或行末換到另外一行去
set whichwrap=b,s,<,>,[,] 

"設置使用鼠標
set mouse=a
"set mouse=

"顯示行號
set number

"標誌預覽窗口
set previewwindow

"設置歷史記錄條數
set history=50

"設置自動寫回文件
"自動把內容寫回文件: 如文件被修改過,在每一個 :next、:rewind、:last、:first、:previous、:stop、:suspend、:tag、:!、:make、CTRL-]
" 和 CTRL-^命令時進行;用 :buffer、CTRL-O、CTRL-I、'{A-Z0-9} 或 `{A-Z0-9}  命令轉到別的文件時亦然。
set autowrite

"記住上次打開文件的位置,從新打開時自動跳轉到上次編輯的位置
set viminfo='10,\"100,:20,%,n~/.viminfo
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif

"---------------------------------配色方案------------------------------
syntax enable

syntax on

"設置背景色
set background=dark

"vim 配色方案
"colorscheme solarized
colorscheme desert

set t_Co=256

"設置字體
set guifont=Consolas:h11


"---------------------------------設置寬度(tab等)----
"設置tab寬度
set tabstop=4

"設置軟tab寬度,軟tab,用空格代替tab
set softtabstop=4

"自動縮進的寬度
set shiftwidth=4

"----------------------------------設置對齊和縮進--------
"設置自動對齊,(和上一行)
"set autoindent

"智能對齊
set smartindent

"使用c/c++語言的自動縮進方式
set cindent

"設置c/c++語言的具體縮進方式
set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s 

"不要用空格代替製表符
set expandtab

"在行和段開始處使用製表符
set smarttab

"-----------------------------------文件生成----------------------
"去掉輸入錯誤的提示聲音
set noeb 

"在處理未保存或只讀文件的時候,彈出確認
set confirm

"禁止生成臨時文件
set nobackup
set noswapfile


"------------------------------------狀態行設置-----------------
"0 不顯示狀態行,1 當多於一個窗口時顯示最後一個窗口的狀態行,2 老是顯示最後一個窗口的狀態行
set laststatus=2 
"顯示標尺,用於顯示光標位置處的行號和列號。每一個窗口都有本身的標尺,若是窗口有狀態行,則顯示在狀態行,不然顯示在最後一行
set ruler 

"命令行設置
"命令行顯示輸入的命令
set showcmd
"命令行顯示當前vim的模式
set showmode

"--------------------------------------查找設置--------------------------------
"輸入字符串就顯示匹配點
set incsearch
"高亮顯示查找結果
set hlsearch

"開啓實時搜索功能
set incsearch

"搜索時大小寫不敏感
set ignorecase

"--------------------------------------多窗口設置------------------------------
"打開一個新的標籤頁,而後ctags查找並在新的標籤頁面中顯示當前光標處的變量或函數
nmap <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
autocmd filetype go nmap <C-\> :tab split<CR>:exec("GoDef ".expand("<cword>")) 
"nmap <F3> :vsp<CR>:exec("tag ".expand("<cword>"))<CR>
nmap <S-Left> :tabprevious<CR>
nmap <S-Right> :tabnext<CR>


"快捷鍵依次遍歷子窗口
nnoremap nw <C-W><C-W>

"跳轉至右方的窗口
nnoremap <Leader>l <C-W>l

"跳轉至左方的窗口
nnoremap <Leader>j <C-W>h

"跳轉至上方的窗口
nnoremap <Leader>i <C-W>k

"跳轉至下方的窗口
nnoremap <Leader>k <C-W>j


"-------------------------------------設置多終端之間的拷貝-------------------
"visual 模式下,xw 複製選中的區域, 到另外一個終端下,xr粘貼
if has("unix")
   nmap xr :r $HOME/.vimxfer<CR>
   nmap xw :'a,.w! $HOME/.vimxfer<CR>
   vmap xr c<esc>:r $HOME/.vimxfer<CR>
   vmap xw :w! $HOME/.vimxfer<CR>
else
   nmap xr :r c:/.vimxfer<CR>
   nmap xw :'a,.w! c:/.vimxfer<CR>
   vmap xr c<esc>:r c:/.vimxfer<cr>
   vmap xw :w! c:/.vimxfer<CR>
endif




"-------------------------------------ctags設置----------------------------
"按下F2從新生成tag文件,並更新taglist
map <F2> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR>:TlistUpdate<CR>
imap <F2> <ESC>:!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR>:TlistUpdate<CR>
set tags=tags
set tags+=./tags "add current directory's generated tags file
set tags+=/usr/include/c++/tags


"---------------------------------------taglist 設置 -----------------------
"由於咱們放在環境變量裏,因此能夠直接執行
let Tlist_Ctags_Cmd='ctags'

"讓窗口顯示在右邊,0的話就是顯示在左邊
let Tlist_Use_Right_Window=1

"讓taglist能夠同時展現多個文件的函數列表
let Tlist_Show_One_File=1

"非當前文件,函數列表摺疊隱藏
let Tlist_File_Fold_Auto_Close=1 

"當taglist是最後一個分割窗口時,自動退出vim
let Tlist_Exit_OnlyWindow=1 

"是否一直處理tags.1:處理;0:不處理
let Tlist_Process_File_Always=1 

"實時更新tags
let Tlist_Inc_Winwidth=0





"---------------------------------------- cscope 設置---------------------------------
"if has("cscope")
"    set csprg=/usr/bin/cscope " 指定用來執行cscope的命令
"    set csto=0 " 設置cstag命令查找次序:0先找cscope數據庫再找標籤文件;1先找標籤文件再找cscope數據庫
"    set cst " 同時搜索cscope數據庫和標籤文件
"    set cscopequickfix=s-,c-,d-,i-,t-,e- " 使用QuickFix窗口來顯示cscope查找結果
"    set nocsverb
"    if filereadable("cscope.out") " 若當前目錄下存在cscope數據庫,添加該數據庫到vim
"        cs add cscope.out
"    elseif $CSCOPE_DB != "" " 不然只要環境變量CSCOPE_DB不爲空,則添加其指定的數據庫到vim
"        cs add $CSCOPE_DB
"    endif
"    set csverb
"endif

"map <F4> :cs add ./cscope.out .<CR><CR><CR> :cs reset<CR>
"imap <F4> <ESC>:cs add ./cscope.out .<CR><CR><CR> :cs reset<CR>
" 將:cs find
" c等Cscope查找命令映射爲<C-_>c等快捷鍵(按法是先按Ctrl+Shift+-,而後很快再按下c)
"nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>:copen<CR><CR>
"nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
"nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>:copen<CR><CR>
"nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>:copen<CR><CR>
"nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>:copen<CR><CR>
"nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>:copen<CR><CR>
"nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
"nmap <C-_>i :cs find i <C-R>=expand("<cfile>")<CR><CR>:copen<CR><CR>

"--------------------------------------cscope 設置 2 --------------------------
function! InitCsTag()
    execute "!ctags -R --languages=C++ --c++-kinds=+p --fields=+iaS --extra=+q ./"
    if(executable("cscope") && has("cscope") )
        if(has('win32'))
            silent! execute "!dir /b *.c,*.cpp,*.h,*.java,*.cs >> cscope.files"
        else
            silent! execute "!find . -name '*.h' -o -name '*.c' -o -name '*.cpp' -o -name '*.inl' -o -name '*.m' -o -name '*.mm' -o -name '*.java' -o -name '*.py' -o -name '*.html' -o -name '*.php' -o -name '*.js' > cscope.files"
        endif
        silent! execute "!cscope -b"
        silent! execute "cs kill -1"
        if filereadable("cscope.out")
            execute "cs add cscope.out"
        endif
    endif
    echohl StatusLine | echo "C/C++ cscope tag updated" | echohl None
endf

function! UpdateCsTag()
    silent! execute "!cscope -b"
    silent! execute "cs reset"
endf
    
if has("cscope")
    set cscopequickfix=s-,c-,d-,i-,t-,e-
    set csto=0
    set cst
    set csverb
endif

"nnoremap <F11> :call UpdateCsTag()
nnoremap <F9> :call InitCsTag()<CR><CR><CR><CR>
nmap <F10> :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <Leader><F10> :cs find s <C-R>=expand("<cword>")<CR><CR>:copen<CR>
nmap <F11> :cp<cr>
nmap <F12> :cn<cr>



"--------------------------------------------------nerdtree 設置-------------------------------------

let NERDChristmasTree=1
let NERDTreeAutoCenter=1
let NERDTreeBookmarksFile=$VIM.'/Data/NerdBookmarks.txt'
let NERDTreeMouseMode=2
let NERDTreeShowBookmarks=1
let NERDTreeShowFiles=1
let NERDTreeShowHidden=1
let NERDTreeShowLineNumbers=1
let NERDTreeWinPos='left'
let NERDTreeWinSize=31

"autocmd VimEnter * NERDTreeTabs

"當打開vim且沒有文件時自動打開NERDTree
autocmd vimenter * if !argc() | NERDTree | endif
" 只剩 NERDTree時自動關閉
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif

"map <F3> :NERDTreeMirror<CR>
"map <F3> :NERDTreeToggle<CR>
map <F3> :NERDTreeTabsToggle<CR>

"----------------------------------------------------powerline 設置-----------------------------------
set guifont=PowerlineSymbols\ for\ Powerline
set t_Co=256
let g:Powerline_symbols = 'fancy'

"防止出現亂碼
let Powerline_symbols = 'compatible'
set encoding=utf8

"----------------------------------------------------代碼摺疊設置-------------------------------
" 用語法高亮來定義摺疊
set foldmethod=syntax 

" 啓動vim時不要自動摺疊代碼
set foldlevel=100 

" 設置摺疊欄寬度
set foldcolumn=5 


"----------------------------------------------------quickfix設置-------------------------
" 按下F8,執行make clean
map <F8> :make clean<CR><CR><CR>

" 按下F7,執行make編譯程序,並打開quickfix窗口,顯示編譯信息
 map <F7> :make<CR><CR><CR> :copen<CR><CR>

" 按下F5,光標移到上一個錯誤所在的行
 map <F5> :cp<CR>
 
" 按下F6,光標移到下一個錯誤所在的行
 map <F6> :cn<CR>

"如下的映射是使上面的快捷鍵在插入模式下也能用
imap <F8> <ESC>:make clean<CR><CR><CR>
imap <F7> <ESC>:make<CR><CR><CR> :copen<CR><CR>
imap <F5> <ESC>:cp<CR>
imap <F6> <ESC>:cn<CR>



"----------------------------------syntastic settings----------------------
let g:syntastic_check_on_open = 1  
let g:syntastic_cpp_include_dirs = ['/usr/include/']  
let g:syntastic_cpp_remove_include_errors = 1  
let g:syntastic_cpp_check_header = 1  
let g:syntastic_cpp_compiler = 'clang++'  
"set error or warning signs  
"let g:syntastic_error_symbol = 'x'  
"let g:syntastic_warning_symbol = '!'  
""whether to show balloons  
let g:syntastic_enable_balloons = 1  
  
"----------------------------------YCM settings------------------------------
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'  
let g:ycm_collect_identifiers_from_tags_files = 1  
let g:ycm_seed_identifiers_with_syntax = 1  
let g:ycm_confirm_extra_conf = 0  

let g:ycm_error_symbol = '>>'
let g:ycm_warning_symbol = '>*'
nnoremap <leader>gl :YcmCompleter GoToDeclaration<CR>
nnoremap <leader>gf :YcmCompleter GoToDefinition<CR>
nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration<CR>
"nmap <F4> :YcmDiags<CR>


"----------------------------------------------------快捷鍵設置---------------------------
"<F1>  gnome 終端手冊
"更新ctags文件
"map <F2> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR>:TlistUpdate<CR>
"更新cscope文件
"nnoremap <F12> :call InitCsTag()
"顯示或關閉nerdtree
"map <F3> :NERDTreeTabsToggle<CR>
"
"按下F5,光標移到上一個錯誤所在的行
"map <F5> :cp<CR>
 
"按下F6,光標移到下一個錯誤所在的行
"map <F6> :cn<CR>

"按下F7,執行make編譯程序,並打開quickfix窗口,顯示編譯信息
"map <F7> :make<CR><CR><CR> :copen<CR><CR>
"
"按下F8,執行make clean
"map <F8> :make clean<CR><CR><CR>

"
"生成cscope數據庫
"nnoremap <F9> :call InitCsTag()
"cscope 查找,在當前標籤頁面顯示
"nmap <F10> :cs find s 
"cscope 查找,在新標籤頁面顯示可能的結果
"nmap <Leader><F10> :cs find s <C-R>=expand("<cword>")<CR><CR>:copen<CR>
"cscope前一個查找結果
"nmap <F11> :cp<cr>
"cscope後一個查找結果
"nmap <F12> :cn<cr>
"
"前一個tab頁面
"nmap <S-L> :tabprevious<CR>
"後一個tab頁面
"nmap <S-R> :tabnext<CR>

"快捷鍵依次遍歷子窗口
"nnoremap nw <C-W><C-W>

"跳轉至右方的窗口
"nnoremap <Leader>l <C-W>l

"跳轉至左方的窗口
"nnoremap <Leader>j <C-W>h

"跳轉至上方的窗口
"nnoremap <Leader>i <C-W>k

"跳轉至下方的窗口
"nnoremap <Leader>k <C-W>j


"------------------------------------------
"在ubuntu下須要安裝vim-gnome來支持系統剪貼板
"
"將文本塊複製到系統剪貼板
vnoremap <Leader>y "+y

"系統粘貼板內容粘貼至vim
nmap <Leader>p "+p
"-----------------------------------------
View Code
相關文章
相關標籤/搜索