摘要:第一步下載插件管理工具第二步我的到你的里面修改之前記得備份哦設(shè)定運行在增強模式下不使用的鍵盤模式設(shè)置支持多語言解決亂碼設(shè)置內(nèi)部編碼為解決輸出亂碼幫助菜單語言光標(biāo)離上下邊界行時開始滾屏對于不同類型的文件,進行自定義設(shè)置設(shè)置每行的
第一步:下載vim插件管理工具vundle
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
第二步:copy我的vimrc到你的~/.vimrc里面(修改之前記得備份哦)
" See: http://vimdoc.sourceforge.net/htmldoc/options.html for details """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "=> General """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "設(shè)定 gvim 運行在增強模式下,不使用vi的鍵盤模式 set nocompatible "設(shè)置支持多語言,解決亂碼 "設(shè)置內(nèi)部編碼為utf-8 set encoding=utf-8 set termencoding=utf-8 set fileencodings=utf-8,gbk,default,latin1 "解決consle輸出亂碼 language messages zh_CN.utf-8 "幫助菜單語言 set helplang=cn " Sets how many lines of history VIM has to remember set history=700 " Enable filetype plugins filetype off "required 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 " likew saves the current file let mapleader = "," let g:mapleader = "," " Fast saving nmap w :w! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => VIM user interface """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "Set 7 lines to the cursor - when moving vertically using j/k "光標(biāo)離上下邊界7行時開始滾屏 set so=7 " Turn on the Wild menu set wildmenu " Ignore compiled files set wildignore=*.o,*~,*.pyc if has("win16") || has("win32") set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store else set wildignore+=.git*,.hg*,.svn* endif " Height of the command bar set cmdheight=2 " 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 " Following line clears the search highlights when pressing Lb nnoremap / :nohlsearch "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 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => 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 " 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 set tabstop=4 set shiftwidth=4 "對于不同類型的文件,進行自定義設(shè)置 au FileType html,im,javascript,css set shiftwidth=2 au FileType html,im,javascript,css set tabstop=2 au FileType java,python,php set shiftwidth=4 au FileType java,python,php set tabstop=4 "設(shè)置每行的最大字符數(shù),超過的話,將換行 set textwidth=80 " Linebreak on 500 characters set lbr set tw=500 set ai "Auto indent set si "Smart indent 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 * :call VisualSelection("f") "vnoremap # :call VisualSelection("b") """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Moving around, tabs, windows and buffers """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Treat long lines as break lines (useful when moving around in them) map j gj map k gk " Moving Between Windows nnoremap h h nnoremap l l nnoremap j j nnoremap k k """""""""""""""""""""""""""""" " => 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:\%-14.(%l,%c%V%) %P """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Editing mappings """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Remap VIM 0 to first non-blank character map 0 ^ " type S, then type what you"re looking for, a /, and what to replace it with nmap S :%s/ >//g vmap S :s/ >//g "基本編輯器設(shè)置 set number "顯示行號 set laststatus=2 "顯示狀態(tài)欄 (默認(rèn)值為 1, 無法顯示狀態(tài)欄) set cmdheight=1 "設(shè)定命令行的行數(shù)為 1 "set showtabline=2 "顯示tab標(biāo)簽 "set tabline+=%f "tab標(biāo)簽 " Enable Code Folding set foldenable set foldmethod=syntax set mouse=a "任何情況都可以使用鼠標(biāo) "工作目錄隨文件變 autocmd BufEnter * cd %:p:h "不顯示工具條 set guioptions-=T " 配置文件.vimrc更改后自動重新載入使設(shè)置生效 autocmd! bufwritepost .vimrc source ~/.vimrc "設(shè)置重新載入.vimrc快捷鍵 map ss :source ~/.vimrc " 設(shè)置快速編輯.vimrc快捷鍵 map ee :e ~/.vimrc "------ Replacing ------ "type S, then type what you"re looking for, a /, and what to replace it with nmap S :%s/ >//g vmap S :s/ >//g """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Scott McCoy/svn.vim " http://www.vim.org/scripts/script.php?script_id=743 " cd ~/.vim " tar zxvf svn- .tgz """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "更新當(dāng)前目錄的代碼 "map :!svn up "提交SVN(當(dāng)前目錄) "map :!svn ci -m "" "提交SVN(當(dāng)前文件) "map :!svn ci -m "" % """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " =>Tagbar " http://www.vim.org/scripts/script.php?script_id=3465 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" noremap y :TagbarToggle let g:tagbar_ctags_bin="/usr/bin/ctags-exuberant" let g:tagbar_width=26 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " =>Exuberant Ctags " sudo apt-get install exuberant-ctags """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " ,ct = Builds ctags in current directory map ct :! /usr/bin/ctags-exuberant -R * """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => vundle " git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set rtp+=~/.vim/bundle/vundle/ call vundle#rc() "let Vundle manage Vundle "required! Bundle "gmarik/vundle" "My Bundles here: " "original repos on github " Indent Bundle "Yggdroot/indentLine" " Plugin Bundle "The-NERD-tree" "------ NERDTree Options ------ " 當(dāng)打開vim且沒有文件時自動打開NERDTree autocmd vimenter * if !argc( ) | NERDTree | endif let NERDTreeIgnore=["CVS"] let NERDTreeChDirMode=2 "setting root dir in NT also sets VIM"s cd noremap n :NERDTreeToggle " These prevent accidentally loading files while in the NERDTree panel autocmd FileType nerdtree noremap autocmd FileType nerdtree noremap autocmd FileType nerdtree noremap autocmd FileType nerdtree noremap Bundle "jiangmiao/auto-pairs" Bundle "pangloss/vim-javascript" Bundle "mattn/emmet-vim" Plugin "mattn/jscomplete-vim" Bundle "Shougo/neocomplcache" " Disable AutoComplPop. let g:acp_enableAtStartup = 0 " Use neocomplete. let g:neocomplete#enable_at_startup = 1 " Use smartcase. let g:neocomplete#enable_smart_case = 1 " Set minimum syntax keyword length. let g:neocomplete#sources#syntax#min_keyword_length = 3 let g:neocomplete#lock_buffer_name_pattern = "*ku*" " Define dictionary. let g:neocomplete#sources#dictionary#dictionaries = { "default" : "", "vimshell" : $HOME."/.vimshell_hist", "scheme" : $HOME."/.gosh_completions" } " Define keyword. if !exists("g:neocomplete#keyword_patterns") let g:neocomplete#keyword_patterns = {} endif let g:neocomplete#keyword_patterns["default"] = "hw*" "Bundle "joonty/vdebug" " : start/run (to next breakpoint/end of script) " : step over " : step into " : step out " : stop debugging "To stop debugging, press . Press it again to close the debugger interface. " : detach script from debugger " : run to cursor " : set line breakpoint " : show context variables (e.g. after ""eval") " : evaluate variable under cursor ":Breakpoint : set a breakpoint of any type (see :help VdebugBreakpoints) ":VdebugEval : evaluate some code and display the result "
e: evaluate the expression under visual highlight and display the result "Syntax Bundle "scrooloose/Syntastic" let g:syntastic_check_on_open = 1 let g:syntastic_error_symbol = "?" let g:syntastic_warning_symbol = "?" let g:syntastic_auto_loc_list = 1 let g:syntastic_loc_list_height = 5 let g:syntastic_enable_highlighting = 0 " 如果要對javascript進行語法檢查,可以安裝JSHint插件 " sudo apt-get install nodejs " sudo npm install jshint " # 如果是 12.10,我發(fā)現(xiàn) nodejs 可執(zhí)行文件的命名不符合常規(guī),要做個鏈接 " sudo ln -s /usr/bin/nodejs /usr/bind/node " " :Brief help " :BundleList -list configured bundles " :BundleInstall(!) - install(update) bundles " :BundleSearch(!) foo - search(or refresh cache first) for foo " :BundleClean(!) - confirm(or auto-approve) removal of unused bundles " vundle主要就是上面這個四個命令,例如BundleInstall是全部重新安裝,BundleInstall!則是更新 " 一般安裝插件的流程為,先BundleSearch一個插件,然后在列表中選中,按i安裝 " 安裝完之后,在vimrc中,添加Bundle "xxx" 使得bundle能夠加載這個插件,同時如果 " 需要配置這個插件,也是在vimrc中設(shè)置即可 " 如果search到的安裝不了,就換過來先在vimrc里添加Bundle "xxx" " 在去vim里執(zhí)行BundleInstall來安裝 " 卸載的話 " 1. 注釋掉Bundle/Plugin ×××(要刪除的插件相關(guān)語句) " 2. :BundleClean " Done! " see :h vundle for more details or wiki for FAQ " ps: comments after Bundle command are not allowed.. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Helper functions """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" function! HasPaste() if &paste return "PASTE MODE " en return "" endfunction
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請注明本文地址:http://specialneedsforspecialkids.com/yun/24832.html
摘要:第一步下載插件管理工具第二步我的到你的里面修改之前記得備份哦設(shè)定運行在增強模式下不使用的鍵盤模式設(shè)置支持多語言解決亂碼設(shè)置內(nèi)部編碼為解決輸出亂碼幫助菜單語言光標(biāo)離上下邊界行時開始滾屏對于不同類型的文件,進行自定義設(shè)置設(shè)置每行的 第一步:下載vim插件管理工具vundle git clone https://github.com/gmarik/vundle.git ~/.vim/bun...
摘要:既然對感覺不錯,那為什么要把博客從遷移到上呢。可以參考此文檔進去可以選擇中文安裝所有必備的應(yīng)用程序安裝完成后,即可使用安裝。插件安裝完成后,執(zhí)行下列命令來遷移所有文章。部署代碼到清除緩存文件和已生成的靜態(tài)文件。 偶然的機會看到了Hexo,就深深被吸引了,加載速度快,支持Makedown,還支持部署到Github上。作為一位PHP程序員,之前的博客用的是PHP開發(fā)的WordPress,其...
摘要:我在配置文件的第一行添加上這樣的配置插件改變了原先只能把插件全部扔到目錄下的操作方式,使得各個插件可以以一個獨立的文件夾存在于目錄中,添加和刪除插件都變的非常清爽。 首先推薦 簡明Vim練級攻略 學(xué)習(xí)Vim的使用。 以前我的vim是這樣配置的(參見 我在博客園的博客),但是感覺安裝的插件數(shù)量太少,而且將所有的都寫在一個配置文件里面不好管理,所以現(xiàn)在想在一般的配置的基礎(chǔ)上,找一些好的插件...
閱讀 1263·2021-11-23 09:51
閱讀 2639·2021-09-03 10:47
閱讀 2234·2019-08-30 15:53
閱讀 2414·2019-08-30 15:44
閱讀 1376·2019-08-30 15:44
閱讀 1194·2019-08-30 10:57
閱讀 1925·2019-08-29 12:25
閱讀 1088·2019-08-26 11:57