diff --git a/.vimrc b/.vimrc index 8ee23227e..3136a451d 100644 --- a/.vimrc +++ b/.vimrc @@ -1,5 +1,5 @@ " Modeline and Notes { -" vim: set sw=4 ts=4 sts=4 et tw=78 foldmarker={,} foldlevel=0 foldmethod=marker spell: +" vim: set sw=4 ts=4 sts=4 et tw=78 foldmarker={,} foldlevel=9 foldmethod=marker spell: " " __ _ _____ _ " ___ _ __ / _/ |___ / __ __(_)_ __ ___ @@ -205,7 +205,7 @@ set laststatus=2 " Broken down into easily includeable segments - set statusline=%<%f\ " Filename + set statusline=%<%F\ " Filename,%f->%F set statusline+=%w%h%m%r " Options if !exists('g:override_spf13_bundles') set statusline+=%{fugitive#statusline()} " Git Hotness @@ -229,7 +229,8 @@ set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap too set scrolljump=5 " Lines to scroll when cursor leaves screen set scrolloff=3 " Minimum lines to keep above and below cursor - set foldenable " Auto fold code + "set foldenable " Auto fold code + set nofoldenable " Not Auto fold code set list set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace @@ -370,7 +371,11 @@ if !exists('g:spf13_no_keyfixes') if has("user_commands") command! -bang -nargs=* -complete=file E e - command! -bang -nargs=* -complete=file W w + "command! -bang -nargs=* -complete=file W w + " + " Sample command W + " + command W :execute ':silent w !sudo tee % > /dev/null' | :edit! command! -bang -nargs=* -complete=file Wq wq command! -bang -nargs=* -complete=file WQ wq command! -bang Wa wa @@ -581,7 +586,9 @@ let NERDTreeShowBookmarks=1 let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$'] let NERDTreeChDirMode=0 - let NERDTreeQuitOnOpen=1 + " Notice: If let it =1, the tree will auto close after the file + " open + let NERDTreeQuitOnOpen=0 let NERDTreeMouseMode=2 let NERDTreeShowHidden=1 let NERDTreeKeepTreeInNewTab=1 diff --git a/.vimrc.bundles b/.vimrc.bundles index 997ae9623..c642550c1 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -102,6 +102,7 @@ " General { if count(g:spf13_bundle_groups, 'general') Bundle 'scrooloose/nerdtree' + Bundle 'Xuyuanp/nerdtree-git-plugin' Bundle 'altercation/vim-colors-solarized' Bundle 'spf13/vim-colors' Bundle 'tpope/vim-surround' @@ -124,7 +125,7 @@ Bundle 'powerline/fonts' Bundle 'bling/vim-bufferline' Bundle 'easymotion/vim-easymotion' - Bundle 'jistr/vim-nerdtree-tabs' + "Bundle 'jistr/vim-nerdtree-tabs' Bundle 'flazz/vim-colorschemes' Bundle 'mbbill/undotree' Bundle 'nathanaelkane/vim-indent-guides' @@ -244,7 +245,7 @@ " HTML { if count(g:spf13_bundle_groups, 'html') - Bundle 'amirh/HTML-AutoCloseTag' + Bundle 'heracek/HTML-AutoCloseTag' Bundle 'hail2u/vim-css3-syntax' Bundle 'gorodinskiy/vim-coloresque' Bundle 'tpope/vim-haml' diff --git a/.vimrc.bundles.local b/.vimrc.bundles.local new file mode 100755 index 000000000..c0c7c67e0 --- /dev/null +++ b/.vimrc.bundles.local @@ -0,0 +1,41 @@ +" Modeline and Notes { +" vim: set sw=4 ts=4 sts=4 et tw=78 foldmarker={,} foldlevel=0 foldmethod=marker spell: +" +" __ _ _____ _ +" ___ _ __ / _/ |___ / __ __(_)_ __ ___ +" / __| '_ \| |_| | |_ \ _____\ \ / /| | '_ ` _ \ +" \__ \ |_) | _| |___) |_____|\ V / | | | | | | | +" |___/ .__/|_| |_|____/ \_/ |_|_| |_| |_| +" |_| +" +" This is the personal .vimrc.bundles file of Steve Francia. +" While much of it is beneficial for general use, I would +" recommend picking out the parts you want and understand. +" +" This file imports the various plugins of spf13. If you +" wish to alter which groups are imported, see vimrc.before. +" If you wish to add or remove individual bundles, create +" ~/.vimrc.bundles.local and `Bundle` or `UnBundle` as needed +" from there. +" +" You can find me at http://spf13.com +" } + +" Bundle 'file://~/.vim/bundle/cscope_map.vim' +" Bundle 'file://~/.vim/bundle/goyo.vim' +Bundle 'junegunn/goyo.vim' +Bundle 'chazy/cscope_maps' +"Bundle 'file://~/.vim/bundle/bufexplorer' +"Repeat with the vimrc.bundles +"Bundle 'The-NERD-Commenter' + +" k/K is nice +Bundle 'lfv89/vim-interestingwords' +Bundle 'itchyny/vim-cursorword' + +" Bundle 'file://~/.vim/bundle/gutentags_plus' +Bundle 'yaoyz-yuneec/gutentags_plus' +Bundle 'ludovicchabant/vim-gutentags' +Bundle 'sainnhe/vim-color-forest-night' +Bundle 'isene/hyperlist.vim' +Bundle 'voldikss/vim-translate-me' diff --git a/.vimrc.local b/.vimrc.local new file mode 100644 index 000000000..8230c7164 --- /dev/null +++ b/.vimrc.local @@ -0,0 +1,163 @@ +" 关闭NERDTree快捷键 +" map t :NERDTreeToggle +" 显示行号 +let NERDTreeShowLineNumbers=1 +let NERDTreeAutoCenter=1 +" 是否显示隐藏文件 +let NERDTreeShowHidden=1 +" 设置宽度 +let NERDTreeWinSize=31 +" 在终端启动vim时,共享NERDTree +let g:nerdtree_tabs_open_on_console_startup=1 +" 忽略一下文件的显示 +let NERDTreeIgnore=['\.pyc','\~$','\.swp'] +" 显示书签列表 +let NERDTreeShowBookmarks=1 + +let g:NERDTreeIndicatorMapCustom = { + \ "Modified" : "?", + \ "Staged" : "?", + \ "Untracked" : "?", + \ "Renamed" : "?", + \ "Unmerged" : "═", + \ "Deleted" : "?", + \ "Dirty" : "?", + \ "Clean" : "??", + \ "Unknown" : "?" + \ } +" Show the line number +set nu +" Enable wrap +set wrap +" Auto open NERDTree when enter vim +" Use vim, not vim ./dir +autocmd vimenter * NERDTree +" NERDTree config +map :NERDTreeToggle +imap :NERDTreeToggle +"Use the pre dir tree +"nmap :NERDTreeToggle :NERDTreeMirror + autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") &&b:NERDTreeType == "primary") | q | endif + + +"安装tagbar插件 +""设置tagbar使用的ctags的插件,必须要设置对 +let g:tagbar_ctags_bin='/usr/bin/ctags' +"设置tagbar的窗口宽度 +"let g:tagbar_width=30 +""设置tagbar的窗口显示的位置,为左边 +let g:tagbar_right=1 +"打开文件自动 打开tagbar +"autocmd BufReadPost *.cpp,*.c,*.h,*.hpp,*.cc,*.cxx call tagbar#autoopen() +let Tlist_Show_One_File=1 +let Tlist_OnlyWindow=1 +let Tlist_Use_Right_Window=1 +let Tlist_Sort_Type='name' +let Tlist_Exit_OnlyWindow=1 +let Tlist_Show_Menu=1 +let Tlist_Max_Submenu_Items=10 +let Tlist_Max_Tag_length=20 +let Tlist_Use_SingleClick=0 +let Tlist_Auto_Open=0 +let Tlist_Close_On_Select=0 +let Tlist_File_Fold_Auto_Close=1 +let Tlist_GainFocus_On_ToggleOpen=1 +let Tlist_Process_File_Always=1 +let Tlist_WinHeight=10 +let Tlist_WinWidth=30 +let Tlist_Use_Horiz_Window=0 +map :TagbarToggle +imap :TagbarToggle +autocmd StdinReadPre * let s:std_in=1 +autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif +colorschem murphy +"In normal mode, ; is equal to : +nmap ; : + +" Buf explore +nnoremap f :CtrlPMRU + +" airline statusline etc. +let g:airline#extensions#tabline#enabled = 1 +let g:airline#extensions#tabline#formatter = 'unique_tail_improved' + + +" Close the current buffer +map bd :Bclose:tabclosegT + +" Close all the buffers +map ba :bufdo bd + +map l :bnext +map h :bprevious + +" Useful mappings for managing tabs +map tn :tabnew +map to :tabonly +map tc :tabclose +map tm :tabmove +map t :tabnext + +" Let 'tl' toggle between this and the last accessed tab +let g:lasttab = 1 +nmap tl :exe "tabn ".g:lasttab +au TabLeave * let g:lasttab = tabpagenr() + +"""""""""""""""""""""""""""""" +" => bufExplorer plugin +"""""""""""""""""""""""""""""" +" Disalbe the bufExplorer, Because it conflict with many other vim plugs +" When enable it often pop the warning as follow: +" Error detected while processing function 49_BEActivateBuffer: +" line 18: +" E684: list index out of range: 2 +" This will disable the bufExplorer +let g:bufexplorer_version = "disabled" +let g:bufExplorerDefaultHelp=0 +let g:bufExplorerShowRelativePath=1 +let g:bufExplorerFindActive=1 +let g:bufExplorerSortBy='name' +"map o :BufExplorer + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Vimroom +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +let g:goyo_width=100 +let g:goyo_margin_top = 2 +let g:goyo_margin_bottom = 2 +nnoremap z :Goyo + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Global copy/paste +" Use the global clipbord by install vim-gnome +" See: https://www.cnblogs.com/songlen/p/6883522.html +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +set clipboard=unnamedplus + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => cscope quickfix +"See: +" https://stackoverflow.com/questions/28185067/vim-go-to-next-search-result-across-multiple-files +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Replaced by the gutentags_plus plug@2019-08-02 +" set cscopequickfix=s-,c-,d-,i-,t-,e- + +" view the list of matches with: +" :cw[indow] Open the quickfix window +map :cw +imap :cw +" :ccl[ose] Close the quickfix window +nmap :ccl +map :ccl +imap :ccl +" :[count]cn[ext][!] +nmap :cn +" :[count]cp[revious][!] +nmap :cp + +" Use the new colorscheme plug +colorscheme forest-night +let g:airline_theme = 'forest_night' + + + diff --git a/README2.markdown b/README2.markdown new file mode 100755 index 000000000..9ef6ce3c6 --- /dev/null +++ b/README2.markdown @@ -0,0 +1,25 @@ +# Some trip + +# Vim +## Upgrade to 8.0 +The vim 8.0 has better support for the spf13 project. +The installation steps are as follows: + + sudo add-apt-repository ppa:jonathonf/vim + sudo apt update + sudo apt install vim + + + +## Uninstall Vim 8.0: +To uninstall Vim 8.0 and downgrade it to the stock version in Ubuntu repository, run the command below to purge the PPA: + + sudo apt install ppa-purge && sudo ppa-purge ppa:jonathonf/vim + + +## +lua(vim --version) + + sudo apt install vim-gtk/nox + +It may improve the autocomplete feature. + diff --git a/bak_TO_DEL/gutentags_plus.zip b/bak_TO_DEL/gutentags_plus.zip new file mode 100644 index 000000000..9a7ccf367 Binary files /dev/null and b/bak_TO_DEL/gutentags_plus.zip differ diff --git a/bootstrap.sh b/bootstrap.sh index 680e3c7fa..c39d82ae8 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -86,6 +86,7 @@ do_backup() { if [ -e "$1" ] || [ -e "$2" ] || [ -e "$3" ]; then msg "Attempting to back up your original vim configuration." today=`date +%Y%m%d_%s` + # remove the current vim config and backup for i in "$1" "$2" "$3"; do [ -e "$i" ] && [ ! -L "$i" ] && mv -v "$i" "$i.$today"; done @@ -124,6 +125,7 @@ create_symlinks() { lnif "$source_path/.vimrc" "$target_path/.vimrc" lnif "$source_path/.vimrc.bundles" "$target_path/.vimrc.bundles" lnif "$source_path/.vimrc.before" "$target_path/.vimrc.before" + lnif "$source_path/.vimrc.local" "$target_path/.vimrc.local" lnif "$source_path/.vim" "$target_path/.vim" if program_exists "nvim"; then @@ -131,7 +133,8 @@ create_symlinks() { lnif "$source_path/.vimrc" "$target_path/.config/nvim/init.vim" fi - touch "$target_path/.vimrc.local" + # Use the file in the spf13-vim-3 project, not create the file in the ~ dir + #touch "$target_path/.vimrc.local" ret="$?" success "Setting up vim symlinks."