From d5d4189e78720a6adddcece208f7393c71920cc1 Mon Sep 17 00:00:00 2001 From: Kevin Date: Wed, 2 Apr 2014 11:17:12 -0400 Subject: [PATCH] Undo history and syntax errors can now be toggled with F9 and ctrl-F9. Nerdtree was dropped in favour of the much better vimfiler. The status bar was reconfigured to display more information including the current number of errors. A script was added that can generate a tags file from /usr/include for more robust syntax checking in C. The update script was updated to hopefully handle the removal of nerdtree when it updates the submodules... Syntax highlighting has been improved in numerous directions including more definitions as well as tweaked colours. Keybindings were tweaked again and new ones added for the new features. The paste function was incorrectly using buffer 0 instead of the current buffer when in visual mode, but this is no longer the case. Autocompletion has been improved quite a bit and the keybindings tweaked. A bunch of general fixes and tidying up was done. --- .gitmodules | 15 +++- README.md | 19 ++-- generate-system-ctags | 3 + update | 2 +- vim/bundle/gundo.vim | 1 + vim/bundle/nerdtree | 1 - vim/bundle/syntastic | 1 + vim/bundle/unite.vim | 1 + vim/bundle/vimfiler.vim | 1 + vim/colors/darkcloud.vim | 33 ++++--- vim/config/keyboard.vim | 94 ++++++++++--------- vim/config/plugins.vim | 190 +++++++++++++++++++++++++++++++++++---- vim/config/settings.vim | 34 +++---- 13 files changed, 289 insertions(+), 106 deletions(-) create mode 100755 generate-system-ctags create mode 160000 vim/bundle/gundo.vim delete mode 160000 vim/bundle/nerdtree create mode 160000 vim/bundle/syntastic create mode 160000 vim/bundle/unite.vim create mode 160000 vim/bundle/vimfiler.vim diff --git a/.gitmodules b/.gitmodules index f891239..1b7e416 100644 --- a/.gitmodules +++ b/.gitmodules @@ -34,9 +34,6 @@ [submodule "vim/bundle/emmet-vim"] path = vim/bundle/emmet-vim url = https://github.com/mattn/emmet-vim.git -[submodule "vim/bundle/nerdtree"] - path = vim/bundle/nerdtree - url = https://github.com/scrooloose/nerdtree.git [submodule "vim/bundle/vim-markdown"] path = vim/bundle/vim-markdown url = https://github.com/plasticboy/vim-markdown.git @@ -46,3 +43,15 @@ [submodule "vim/bundle/vim-togglelist"] path = vim/bundle/vim-togglelist url = https://github.com/milkypostman/vim-togglelist.git +[submodule "vim/bundle/gundo.vim"] + path = vim/bundle/gundo.vim + url = https://github.com/sjl/gundo.vim.git +[submodule "vim/bundle/unite.vim"] + path = vim/bundle/unite.vim + url = https://github.com/Shougo/unite.vim.git +[submodule "vim/bundle/vimfiler.vim"] + path = vim/bundle/vimfiler.vim + url = https://github.com/Shougo/vimfiler.vim.git +[submodule "vim/bundle/syntastic"] + path = vim/bundle/syntastic + url = https://github.com/scrooloose/syntastic.git diff --git a/README.md b/README.md index 353f886..7b940e4 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,10 @@ ## Requirements 1. Git: Required to clone and update the repository. -3. CTags: Available @ http://ctags.sourceforge.net, this can be in $PATH or in the vim folder and is required for the tagbar plugin. +3. CTags: Available @ http://ctags.sourceforge.net, place in $PATH or the vim folder to use the tagbar or extended C omni/auto-completion. 4. Vim v7.4+: Everything has been written and tested using Vim 7.4.135, and I assume there could be issues with 7.3 and below. -2. Bash (optional): Required to use the update script, which simply runs the git repo and submodule update commands. -5. Powerline Fonts (optional): Required for the powerline lightline theme, which can be toggled in /etc/vimrc along with the gvim font +2. Bash (optional): Required to use the update and ctags generation scripts, both of which can be run with the commands listed within. +5. Powerline Fonts (optional): Required for an extended look/feel using lightline, otherwise it should be toggled off in the vimrc. ## Installation @@ -14,15 +14,16 @@ * ]$ git clone https://github.com/prurigro/darkcloud-vimconfig.git * ]$ cd darkcloud-vimconfig * ]$ git submodule update --init -2. Edit the 'vimrc' file and select whether to expect powerline fonts, choose a font for gvim, and add or change any of the loaded config files to match your personal setup. -3. There are two main ways this package can be deployed: system-wide or single-user. +2. Edit the 'vimrc' file and select whether to use powerline fonts, choose a font for gvim and add additional config after it loads the included files. +3. There are two main ways this package can be deployed: system-wide or single-user (vim must be configured to load from the respective location): * For a distro-agnostic system-wide installation in the /etc directory, copy or link: 'vimrc' to '/etc/vimrc' and the 'vim' folder to '/etc/vim'. * For a single-user installation in a user's home directory, copy or link: 'vimrc' to '~/.vimrc' -and- the 'vim' folder to '~/.vim'. -4. Make sure the 'vimrc' file and 'vim' folder are at least readable to any users that will be using the config. -5. Clone additional vim plugin repos in the 'bundle' folder to have them loaded at startup. -6. You can add or replace config files in your 'vimrc' file to customize behaviour. +4. Make sure the 'vimrc' file and 'vim' folder are readable by any users expecting to use them. +5. Clone additional vim plugin repositories in the 'bundle' folder to have them loaded at startup. +6. You can add additional config files or replace the included ones listed in the vimrc file to customize behaviour. +7. Run the 'gen-ctags-file' script to generate a tags file for the user that runs it to facilitate omnicompletion and tagbar. 7. Run the 'update' script in the base directory of the repo as an easy way to pull changes and update the plugins all at once. -8. You can find a list of keybindings that were added by this config as well as a few of the ones added by plugins in 'vim/config/keyboard.vim' +8. You can find a list of key bindings that were added by this config as well as a few of the ones added by plugins in 'vim/config/keyboard.vim' ## Features diff --git a/generate-system-ctags b/generate-system-ctags new file mode 100755 index 0000000..57e381e --- /dev/null +++ b/generate-system-ctags @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +[[ `type -P ctags` ]] && ctags -R -f ~/.vim/tags /usr/include /usr/local/include || echo "Can't find the ctags binary in $PATH" diff --git a/update b/update index 4c24db5..fe455a4 100755 --- a/update +++ b/update @@ -1,4 +1,4 @@ #!/usr/bin/env bash git pull origin -git submodule update --init +git submodule update --init --recursive --rebase diff --git a/vim/bundle/gundo.vim b/vim/bundle/gundo.vim new file mode 160000 index 0000000..3975ac8 --- /dev/null +++ b/vim/bundle/gundo.vim @@ -0,0 +1 @@ +Subproject commit 3975ac871565115e3769dc69c06bc88ddc1369af diff --git a/vim/bundle/nerdtree b/vim/bundle/nerdtree deleted file mode 160000 index b0bb781..0000000 --- a/vim/bundle/nerdtree +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b0bb781fc73ef40365e4c996a16f04368d64fc9d diff --git a/vim/bundle/syntastic b/vim/bundle/syntastic new file mode 160000 index 0000000..82bff20 --- /dev/null +++ b/vim/bundle/syntastic @@ -0,0 +1 @@ +Subproject commit 82bff20b0200c3ccb292a9261d565b5bbc609ac2 diff --git a/vim/bundle/unite.vim b/vim/bundle/unite.vim new file mode 160000 index 0000000..11c5725 --- /dev/null +++ b/vim/bundle/unite.vim @@ -0,0 +1 @@ +Subproject commit 11c572564736dfbbebe8cdbbf3e2768ad80a083c diff --git a/vim/bundle/vimfiler.vim b/vim/bundle/vimfiler.vim new file mode 160000 index 0000000..d87231f --- /dev/null +++ b/vim/bundle/vimfiler.vim @@ -0,0 +1 @@ +Subproject commit d87231f66c042d8e6d139cd0ff71af91114af49d diff --git a/vim/colors/darkcloud.vim b/vim/colors/darkcloud.vim index a15cc4f..7ad7b15 100644 --- a/vim/colors/darkcloud.vim +++ b/vim/colors/darkcloud.vim @@ -281,8 +281,8 @@ call s:X("StatusLineNC","ffffff","626262","","White","Grey") call s:X("VertSplit","626262","626262","",s:termBlack,s:termBlack) call s:X("WildMenu","808080","303030","","White",s:termBlack) -call s:X("Folded","ffaf00","626262","bold","Red",s:termBlack) -call s:X("FoldColumn","ffaf00","626262","bold","Red",s:termBlack) +call s:X("Folded","87d7ff","626262","bold","Blue",s:termBlack) +call s:X("FoldColumn","87d7ff","262626","bold","Blue",s:termBlack) call s:X("SignColumn","ffaf00","626262","bold","Red",s:termBlack) call s:X("ColorColumn","ffaf00","626262","bold","Red",s:termBlack) @@ -291,7 +291,7 @@ call s:X("TabLineFill","","000000","","",s:termBlack) call s:X("TabLineSel","000000","ffffff","",s:termBlack,"White") call s:X("Comment","626262","","italic","Grey","") -call s:X("Todo","ffaf00","808080","","Red",s:termBlack) +call s:X("Todo","d75f5f","","bold","Red","") call s:X("Normal","d0d0d0","262626","","White",s:termBlack) call s:X("MatchParen","ffffff","262626","standout,bold",s:termBlack,"White") @@ -314,10 +314,10 @@ call s:X("PreProc","ffd787","","","Yellow","") call s:X("Operator","d75f5f","","","Red","") call s:X("NonText","87d7ff","","","Blue","") call s:X("SpecialKey","000000","","",s:termBlack,"") -call s:X("Search","ffffff","d75f5f","bold","White","Red") -call s:X("IncSearch","87d7ff","626262","standout","Blue","Grey") -call s:X("Directory","ffaf00","","","Yellow","") -call s:X("Question","d75f5f","","","Red","") +call s:X("Search","000000","87d7ff","bold",s:termBlack,"Blue") +call s:X("IncSearch","","","standout","","") +call s:X("Directory","87d7ff","","","Blue","") +call s:X("Question","87d7ff","","","Blue","") call s:X("ExtraWhitespace","262626","","standout",s:termBlack,"") call s:X("Error","d75f5f","000000","standout","Red",s:termBlack) hi! link ErrorMsg Error @@ -409,9 +409,15 @@ call s:X("rubyGlobalVariable","","","bold","","") "lua hi! link luaOperator Conditional -""debugger.vim -"call s:X("DbgCurrent","","","","","") -"call s:X("DbgBreakPt","","","","","") +"syntastic error checking +call s:X("SyntasticError","d75f5f","","standout,bold","Red","") +call s:X("SyntasticWarning","ffd787","","standout,bold","Yellow","") +hi! link SyntasticErrorLine SyntasticError +hi! link SyntasticWarningLine SyntasticWarning +hi! link SyntasticErrorSign Error +hi! link SyntasticWarningSign Statement +hi! link qfSeparator Delimiter +hi! link qfLineNr SyntasticError "vim-indent-guides call s:X("IndentGuidesOdd","","7c7c7c","","","Grey") @@ -469,11 +475,4 @@ hi! link TagListFileName Directory let s:p.normal.error = [ [ s:red, s:base023 ] ] let s:p.normal.warning = [ [ s:yellow, s:base02 ] ] let g:lightline#colorscheme#darkcloud#palette = lightline#colorscheme#fill(s:p) - - "theme config (powerline fonts) - if powerlinefonts == 1 - let g:lightline = {'colorscheme': 'darkcloud', 'active': {'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'readonly', 'filename', 'modified' ] ]}, 'component': {'readonly': '%{&readonly?"":""}', 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}','fugitive': '%{exists("*fugitive#head")?fugitive#head():""}'},'component_visible_condition': {'readonly': '(&filetype!="help"&& &readonly)','modified': '(&filetype!="help"&&(&modified||!&modifiable))', 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'}, 'separator': {'left': '', 'right': ''}, 'subseparator': {'left': '', 'right': ''}} - else - let g:lightline = {'colorscheme': 'darkcloud','active': {'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'readonly', 'filename', 'modified' ] ]},'component': {'readonly': '%{&readonly?"x":""}', 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}', 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}'},'component_visible_condition': {'readonly': '(&filetype!="help"&& &readonly)','modified': '(&filetype!="help"&&(&modified||!&modifiable))', 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'},'separator': {'left': '', 'right': ''},'subseparator': {'left': '|', 'right': '|'}} - endif "}}} diff --git a/vim/config/keyboard.vim b/vim/config/keyboard.vim index 563afd7..af50826 100644 --- a/vim/config/keyboard.vim +++ b/vim/config/keyboard.vim @@ -25,28 +25,30 @@ " | (A) -> go to the previous open tab " " (toggles) +" | (N) -> toggle folds " | (A) -> toggle line numbers " | (A) -> toggle row/column highlighting -" | (A) -> toggle spell check -" | (A) -> toggle line wrapping -" | (A) -> toggle the nerdtree sidebar +" | (A) -> toggle line wrapping +" | (A) -> toggle spell check +" | (A) -> toggle all folds +" | (A) -> toggle the gundo undo history sidebar " | (A) -> toggle the tagbar sidebar -" | (A) -> toggle collapsed/folded rows -" | (A) -> toggle all folds -" | (A) -> toggle all folds +" | (A) -> toggle the error list +" `` | (N) -> toggle the filer explorer sidebar " " (gvim toggles) " | (A) -> toggle the menu " | (A) -> toggle the toolbar " | (A) -> toggle the scrollbar " -" (spelling-and-completion) -" , | (A) -> enter this following an emme 'word' (ie: html:5) +" (completion) +" ,, | (A) -> enter after emme 'word' (ie: html:5) " \\ | (N) -> show spelling suggestions popup for word " \| | (N) -> add word to a local list of correct spellings -" | (N) -> undo the most recent match selection -" | (I) -> write the part common to all suggestions -" | (I) -> cancel the match dialog (during suggestion) +" | (I) -> (neocomp) autocomplete using common string +" | (I) -> (neocomp) autocomplete the common string +" | (I) -> (neocomp) close the suggestion popup +" | (I) -> (neocomp) undo the most recent completion " " (formatting) " | (V) -> deletes currently selected text @@ -82,7 +84,7 @@ " | (N) -> select all non-whitespace to the left " " (vimdiff) -" | (N) -> update differences +" > | (N) -> update differences " >> | (N) -> next difference " << | (N) -> previous difference " >< | (N) -> replace diff in current pane with other pane @@ -129,6 +131,9 @@ "} "TOGGLES:{ + "toggle folded code at foldpoints + nnoremap za + "unmap F1 from help then map it to toggle the display of line numbers nnoremap ':set number!' vnoremap ':set number!v' @@ -139,33 +144,36 @@ vnoremap ':set cursorline! cursorcolumn!v' inoremap ':set cursorline! cursorcolumn!' - "toggle spellcheck - nnoremap ':set spell!' - vnoremap ':set spell!v' - inoremap ':set spell!' - "toggle line wrapping (and bottom bar if using the gui) - nnoremap ':set wrap! go'.'-+'[&wrap]."=b\r" - vnoremap ':set wrap! go'.'-+'[&wrap]."=b\rv" - inoremap ':set wrap! go'.'-+'[&wrap]."=b\r" + nnoremap ':set wrap! go'.'-+'[&wrap]."=b\r" + vnoremap ':set wrap! go'.'-+'[&wrap]."=b\rv" + inoremap ':set wrap! go'.'-+'[&wrap]."=b\r" - "bindings to trigger the nerdtree and tagbar sidebars - nnoremap ':NERDTreeToggle' - vnoremap ':NERDTreeToggle' - inoremap ':NERDTreeToggle' + "toggle spellcheck + nnoremap ':set spell!' + vnoremap ':set spell!v' + inoremap ':set spell!' + + "toggle all folds + nnoremap zi + vnoremap ziv + inoremap zi + + "bindings to trigger the gundo undo history + nnoremap ':GundoToggle' + vnoremap ':GundoTogglev' + inoremap ':GundoToggle' + + "bindings to trigger the tagbar list of tags nnoremap ':TagbarToggle' vnoremap ':TagbarTogglev' inoremap ':TagbarToggle' - "toggle folded code at foldpoints - nnoremap za - vnoremap zav - inoremap za + "bindings to trigger the tagbar list of errors + nmap