diff --git a/README.md b/README.md index 7b940e4..d3baa54 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,56 @@ -# Darkcloud Vim Theme, Config and Plugin Selection +# Darkcloud Vim Distribution: Theme, Config and Plugins # -## Requirements +## Requirements ## -1. Git: Required to clone and update the repository. -3. CTags: Available @ http://ctags.sourceforge.net, place in $PATH or the vim folder to use the tagbar or extended C omni/auto-completion. +1. Git: Required to clone and update the repository, and pull the plugins as submodules. +3. CTags: Available @ , 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 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 +## Features ## -1. Clone this repository then initialize and update the git submodules (in our case, the vim plugins) - * ]$ 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 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 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 key bindings that were added by this config as well as a few of the ones added by plugins in 'vim/config/keyboard.vim' +* A custom theme that includes an original colour scheme and an ever growing collection of explicit syntax colour overrides. +* A complete default configuration that attempts to provide a useful, easy to use and modern vim experience without becoming bloated. +* Key bindings and aliases to make useful features more accessible and provide a smoother work flow while attempting to vim's default behaviour while adding behaviour. +* A selection of plugins chosen either because they improve vim's support for common filetypes, or because they provide value-added features that aren't bloated and manage to make vim more useful as a text editor. -## Features +## Installation ## -* An original theme designed to be readable and aesthetically pleasing. -* A complete default configuration to start with and work from that aims to improve compatibility and provide sane, modern standards. -* Keyboard/mouse bindings that attempt to maintain vim's default behaviour while adding behaviour common to other text editors, improving accessibility to useful features, and making the mouse more capable (check the comments at the top of vim/config/keyboard.vim for a list of bindings and what they do). -* A core set of plugins that add some handy features and better support for some formats (you may want to remove plugins in vim/bundle/ supporting formats you won't be using). +1. Clone the darkcloud-vimconfig repo and use the __update__ script to install the plugins: -## Credits + `git clone https://github.com/prurigro/darkcloud-vimconfig.git` + + `sh darkcloud-vimconfig/update` + + * Note: The __update__ script requires bash, but you can enter the __darkcloud-vimconfig/__ folder and run: `git submodule update --init` to install the plugins manually if it's not available. +2. Open vim and run: `:version` to find the values for "user vimrc file" for a single-user install and "system vimrc file" for a system-wide install, then copy the vimrc file from `darkcloud-vimconfig/` to one of these locations. +3. Open the vimrc you just installed and edit the variables in the "USER CONFIG SETTINGS" section: + * **s:darkcloudpath**: Set to the location of the darkcloud-vimconfig folder. (default: __/etc/darkcloud-vimconfig__) + * **g:autostartchecker**: 1 = Check syntax once an appropriate file is loaded | 0 = Check syntax only after syntax checking is toggled on (default: 1) + * **g:powerlinefonts**: 1 = Render the statusline using characters available with powerline-patched fonts | 0 = Render the statusbar with less attractive but more compatible characters available in all fonts (default: 1) + * **guifont**: Set to the name of the font you would like to use with gVim followed by the size, making sure to escape spaces and that a powerline-compatible font is selected if the above option is set to 1. (default: Droid\ Sans\ Mono\ 12) +4. Install ctags (http://ctags.sourceforge.net) to your system using a package and ensure it can be accessed in __$PATH__, or install support for vim exclusively by copying the ctags binary to the __darkcloud-vimconfig/vim__ folder. + +## Configuration ## + +* **Custom Configuration**: Settings with priority over those set by darkcloud-vimconfig can be added to a file named __vimrc.user__, located in __darkcloud-vimconfig/vim/__ or any of the folders in the runtimepath. +* **Custom Plugins**: Pathogen compatible plugins can be cloned or extracted to "darkcloud-vimconfig/vim/bundle.user/", or a folder named "bundle" or "bundle.user" in any of the folders in the runtimepath. +* **Custom Snippets**: To add or override Emmet snippets, create __~/.vim/snippets.json__ and add your own definitions using json like shown in the [Emmet Documentation](http://docs.emmet.io/customization/snippets/). +* **File Associations**: To use the file manager in vim to run files with external programs, create "~/.vim/filetypes.vimcall" and on each line, write an association between a file extension and the program to launch files of that type that looks like: `call vimfiler#set_execute_file('mp4','xdg-open')`. +* **Update Script**: (requires: bash+git) Update the project and its submodules using the same "update" script in the root of darkcloud-vimconfig as the one used to download the plugins. +* **Generate System Tags**: (requires: bash+ctags) Generate a list of ctags for your system libraries in __/usr/include__ and __/usr/local/include__ as well as any folders passed as arguments by running the __gentags__ script. +* **Fix TMux Keys**: (requires: tmux): Add the following settings to tmux to ensure the colour scheme gets loaded and all the keyboard combinations work: `set -g default-terminal "screen-256color` and `set-window-option -g xterm-keys on` + +## Notes ## + +* Runtimepath: To find the runtimepath locations currently set, run the following in vim: `:verbose set runtimepath`. +* Key Bindings: You can find a list of the bindings added by darkcloud-vimconfig, as well as a few of the ones added by plugins in __vim/config/keyboard.vim__. + +## Credits ## * Written by prurigro: [GitHub Projects](https://github.com/prurigro) | [Arch Linux AUR Packages](https://aur.archlinux.org/packages/?SeB=m&K=prurigro) * Many other authors have their work contained in this repo, most of which are self contained in the vim/bundle directory. I also used the Vim jellybean theme as a basis for the Darkcloud theme, which is maintained by NanoTech -## License +## License ## All projects cloned in the vim/bundle folder are separate and have their own licenses. Everything else is released under the MIT license. diff --git a/generate-system-ctags b/generate-system-ctags deleted file mode 100755 index 57e381e..0000000 --- a/generate-system-ctags +++ /dev/null @@ -1,3 +0,0 @@ -#!/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/gentags b/gentags new file mode 100755 index 0000000..5c9e3fc --- /dev/null +++ b/gentags @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +[[ `type -P ctags` ]] && echo 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 25bf89d..f1c89fc 100755 --- a/update +++ b/update @@ -1,4 +1,17 @@ #!/usr/bin/env bash +cd "${0%/*}" + git pull origin git submodule update --init --recursive + + +[[ -f .gitmodules ]] && for each in vim/bundle/*; do + if [ -d "$each" ]; then + if [ -f "${each}/.git" ]; then + FILE=$(echo $each | grep -o -e "[^\/]*$") + [[ `cat .gitmodules | grep "path = " | grep -o -e "[^\/]*$" | grep -c "${FILE}"` = 0 ]] && (rm -rf "${each}" && echo "Deleted: ${each}" || (echo -e "\033[01;31mWARNING\033[00m: '${each}' was removed upstream but couldn't be deleted here.\n\nPlease delete ${each} manually."; exit 1)) + fi + fi +done +exit 0 diff --git a/vim/colors/darkcloud.vim b/vim/colors/darkcloud.vim index f7a0b96..9bbb009 100644 --- a/vim/colors/darkcloud.vim +++ b/vim/colors/darkcloud.vim @@ -8,13 +8,14 @@ "========================" " " Acknowledgements: +" " I found the jellybeans theme part way through creating " this one and liked how it scripted compatibility between " cterm and gui, so I stripped its colours and ported " my own in, using jellybeans as a functional template. " " As referenced in the original jellybean theme, the set -" of color approximation functions were creaed by Henry +" of color approximation functions were created by Henry " So, Jr. and David Liang " @@ -32,7 +33,7 @@ endif let colors_name = "darkcloud" -"color approximation funcionality{{{ +"color approximation functionality {{{ "approximate the grey index from a given grey level fun! s:grey_number(x) if &t_Co == 88 @@ -266,59 +267,84 @@ else let s:termBlack = "Grey" endif +"SPELL CHECKING UNDERLINE: (blue, yellow, none, none) +hi SpellBad guisp=#87d7ff gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=bold,underline cterm=bold,underline +hi SpellCap guisp=#ffd787 gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=underline cterm=underline +hi SpellRare guisp=NONE gui=NONE guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=NONE cterm=NONE +hi SpellLocal guisp=NONE gui=NONE guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=NONE cterm=NONE + "SYNTAX COLORS: + +"format: "format: ('name','fg ','bg ','style ',s:lowcolor-fg,'lowcolor-bg') "example:('Line','000000','f0f0f0','italic,bold',s:termBlack ,'White') -call s:X("Visual","","262626","standout","",s:termBlack) -call s:X("Cursor","","262626","standout,underline","",s:termBlack) -hi! link MatchParen Cursor +"core style +call s:X("Normal","eaeaea","262626","","White",s:termBlack) +hi Normal ctermfg=254 ctermbg=235 +call s:X("Cursor","","262626","standout,underline,bold",s:termBlack,"White") +call s:X("CursorColumn","","303030","","",s:termBlack) +hi CursorColumn ctermbg=236 +call s:X("CursorLine","","303030","","",s:termBlack) +hi CursorLine ctermbg=236 +call s:X("CursorLineNr","87d7ff","303030","bold","Blue",s:termBlack) +hi CursorLineNr ctermbg=236 +call s:X("LineNr","4e4e4e","","bold","White",s:termBlack) +hi LineNr ctermfg=239 + +call s:X("Visual","","262626","standout","",s:termBlack) +call s:X("MatchParen","ffffff","","bold,underline","","") + +"whitespace +call s:X("TabLine","","000000","","",s:termBlack) +call s:X("TabLineFill","","000000","","",s:termBlack) +call s:X("TabLineSel","000000","d0d0d0","",s:termBlack,"White") +call s:X("ExtraWhitespace","262626","","standout",s:termBlack,"") + +"menu call call s:X("Pmenu","87d7ff","303030","","Grey","Blue") call s:X("PmenuSel","87d7ff","4e4e4e","bold","White","Black") +"search +call s:X("Search","87d7ff","262626","standout","Blue",s:termBlack) +call s:X("IncSearch","87d7ff","262626","standout,bold","Blue",s:termBlack) + +"status line call s:X("StatusLine","000000","d75f5f","bold",s:termBlack,"Red") 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","87d7ff","626262","bold","Blue",s:termBlack) -call s:X("FoldColumn","87d7ff","262626","bold","Blue",s:termBlack) -call s:X("SignColumn","ffaf00","262626","bold","Red",s:termBlack) +"folding +call s:X("Folded","87d7ff","4e4e4e","bold","Blue",s:termBlack) +call s:X("FoldColumn","87d7ff","","bold","Blue","") +call s:X("SignColumn","ffaf00","","bold","Red","") hi! link ColorColumn SignColumn -call s:X("TabLine","","000000","","",s:termBlack) -call s:X("TabLineFill","","000000","","",s:termBlack) -call s:X("TabLineSel","000000","d0d0d0","",s:termBlack,"White") - -call s:X("Comment","626262","","italic","Grey","") -call s:X("Todo","d75f5f","","bold","Red","") - -call s:X("Normal","eaeaea","262626","","White",s:termBlack) -call s:X("CursorColumn","","303030","","",s:termBlack) -call s:X("CursorLine","","303030","","",s:termBlack) -call s:X("CursorLineNr","87d7ff","","bold","Blue",s:termBlack) -call s:X("LineNr","ffaf00","","","Yellow",s:termBlack) +"syntax style call s:X("Title","d75f5f","","underline","Red","") +call s:X("Comment","6c6c6c","","italic","Grey","") call s:X("Constant","87d7ff","","bold","Blue","") -call s:X("Special","ffaf00","","","Yellow","") +call s:X("Special","ffd787","","bold","Yellow","") call s:X("Delimiter","ffffff","","","White","") call s:X("String","ffffff","","italic","White","") call s:X("StringDelimiter","d0d0d0","","","White","") -call s:X("Identifier","87d7ff","","","Blue","") +call s:X("Identifier","87d7ff","","bold","Blue","") call s:X("Type","d75f5f","","bold","Red","") call s:X("Function","87d7ff","","","Blue","") call s:X("Label","d75f5f","","","Red","") call s:X("Statement","ffd787","","","Yellow","") call s:X("PreProc","ffd787","","","Yellow","") +call s:X("Keyword","ffd787","","bold","Yellow","") call s:X("Operator","d75f5f","","","Red","") call s:X("NonText","87d7ff","","","Blue","") call s:X("SpecialKey","626262","","",s:termBlack,"") -call s:X("Search","87d7ff","262626","standout","Blue",s:termBlack) -call s:X("IncSearch","87d7ff","262626","standout,bold","Blue",s:termBlack) call s:X("Directory","87d7ff","","","Blue","") call s:X("Question","87d7ff","","","Blue","") -call s:X("ExtraWhitespace","262626","","standout",s:termBlack,"") +call s:X("Todo","d75f5f","","bold","Red","") + +"errors call s:X("Error","d75f5f","000000","standout","Red",s:termBlack) hi! link WarningMsg Error hi! link ErrorMsg Error @@ -326,13 +352,7 @@ hi! link MoreMsg Special hi! link Structure PreProc hi! link Number Type -"spell checking -call s:X("SpellBad","d75f5f","","undercurl","","Red") -call s:X("SpellCap","87d7ff","","undercurl","","Blue") -call s:X("SpellLocal","ffd787","","undercurl","","Yellow") -call s:X("SpellRare","ffffff","","italic","White","") - -"diff +"vimdiff hi! link diffRemoved Constant hi! link diffAdded String call s:X("DiffAdd","000000","ffd787","italic",s:termBlack,"Yellow") @@ -340,11 +360,14 @@ call s:X("DiffDelete","000000","d75f5f","italic",s:termBlack,"Red") call s:X("DiffChange","000000","87d7ff","italic",s:termBlack,"Blue") call s:X("DiffText","000000","c6c6c6","italic",s:termBlack,"White") +"git +hi! link gitconfigAssignment Label + "html call s:X("htmlTitle","ffffff","","underline,bold","White","") -call s:X("htmlH1","d75f5f","262626","underline,bold","Red","") -call s:X("htmlH2","ffd787","262626","underline,bold","Yellow","") -call s:X("htmlH3","87d7ff","262626","underline,bold","Blue","") +call s:X("htmlH1","d75f5f","","underline,bold","Red","") +call s:X("htmlH2","ffd787","","underline,bold","Yellow","") +call s:X("htmlH3","87d7ff","","underline,bold","Blue","") call s:X("htmlH4","d75f5f","","underline","Red","") call s:X("htmlH5","ffd787","","underline","Yellow","") call s:X("htmlH6","87d7ff","","underline","Blue","") @@ -415,12 +438,14 @@ call s:X("rubyGlobalVariable","","","bold","","") "lua hi! link luaOperator Conditional -"vim-indent-guides +"vim config/vimscript call s:X("IndentGuidesOdd","","7c7c7c","","","Grey") call s:X("IndentGuidesEven","","1c1c1c","","",s:termBlack) if !exists("g:indent_guides_auto_colors") let g:indent_guides_auto_colors=0 endif +call s:X("vimOperParen","87d7ff","","","Blue","") + "notes call s:X("notesRule","","","bold","","") diff --git a/vim/config/keyboard.vim b/vim/config/keyboard.vim index 4383f98..b19aafd 100644 --- a/vim/config/keyboard.vim +++ b/vim/config/keyboard.vim @@ -11,13 +11,25 @@ " *The default key is: \ " " Reference: (view plugin documentation for the full list of commands each offers) -" q | (N) -> toggle display of the quickfix list -" l | (N) -> toggle display of the location list +" (tcomment _ can also be -) +" | (A) -> comment selection/create an empty comment +" b | (A) -> comment the current block(s) +" r | (A) -> comment everything on the line to the right +" p | (A) -> comment the current paragraph +" +" (surround) +" S" | (V) -> surround selection with quotes +" S | (V) -> surround selection " ds" | (N) -> delete surrounding "" +" dst | (N) -> delete surrounding tag (ie: ) " cs'" | (N) -> change surrounding '' to "" (any delimiters work) " cs" | (N) -> change surrounding "" to the tag: " cst" | (N) -> change any surrounding tag to "" " +" (vim) +" D | (N) -> delete/cut to the end of the line +" S | (N) -> delete/cut a line up to the whitespace +" " Mappings: " (mouse) " | (A) -> scroll right @@ -25,14 +37,15 @@ " | (A) -> unbind this from vim so xorg can paste " " (tabs) -" | (A) -> go to the next open tab -" | (A) -> go to the previous open tab -" | (A) -> open a new tab -" ` | (N) -> create a new tab with vimfiler +" 9 | (A) -> go to the next open tab +" 0 | (A) -> go to the previous open tab +" - | (A) -> open a new tab +" = | (A) -> create a new tab with vimfiler +" + | (A) -> create a new tab with vimfiler " " (toggles) -" `` | (N) -> toggle the vimfiler sidebar on the left -" ~~ | (N) -> toggle the vimfiler sidebar on the right +" `` | (N) -> toggle the vimfiler sidebar on the right +" ~~ | (N) -> toggle the vimfiler sidebar on the left " | (N) -> toggle folds " | (A) -> toggle line numbers " | (A) -> toggle row/column cursor highlighting @@ -40,10 +53,10 @@ " | (A) -> toggle all folds " | (A) -> toggle spell check " | (A) -> toggle syntax checking -" | (A) -> enable spellcheck + toggle list of spelling errors +" | (A) -> toggle the tagbar sidebar +" | (A) -> toggle the location list to check syntax errors " | (A) -> toggle the gundo undo history sidebar -" | (A) -> toggle the tagbar sidebar -" | (A) -> toggle the location/error list +" | (A) -> enable spellcheck & toggle list of spelling errors " " (gvim toggles) " | (A) -> toggle the menu @@ -62,7 +75,8 @@ " (formatting) " | (V) -> deletes currently selected text " | (N) -> deletes the character behind the cursor -" | (N) -> format document and return to current line +" | (V) -> format the selection and return to cursor +" | (N) -> format document and return to cursor " | (N) -> remove whitespace " | (N) -> convert tabs into spaces " \ | (N) -> remove search highlighting @@ -126,6 +140,28 @@ " dw | (N) -> delete chars under and after the cursor in the word " dd | (N) -> delete lines under and after the one below " +" Filetype Specific Mappings: +" (gundo) +" | (A) -> same as normal + justify one from the left +" | (A) -> same as the left mouse +" | (A) -> same as the left mouse +" | (A) -> same as j (down) +" l | (A) -> same as j (down) +" | (A) -> same as k (up) +" h | (A) -> same as k (up) +" +" (vimfiler) +" | (A) -> edit the selected file +" | (A) -> edit selected file +" | (A) -> map to l, which opens a directory +" | (A) -> map to h, which goes up one directory +" | (A) -> same as normal + justify on the left +" | (A) -> same as the left mouse +" | (A) -> same as the left mouse +" +" (vimfiler,gundo) +" +" " Aliases: " :wsudo -and- :sudow | (C) -> :SudoWrite (write the file as root using sudo) " :esudo -and- :sudoe | (C) -> :SudoRead (read a file as root using sudo) @@ -145,16 +181,27 @@ "} "TABS:{ - nnoremap ':tabnext' - nnoremap ':tabprev' - nnoremap ':tabnew' - nnoremap ` ':VimFiler -tab -project' + nnoremap 0 ':tabnext' + inoremap 0 ':tabnext' + xnoremap 0 ':tabnext' + nnoremap 9 ':tabprev' + inoremap 9 ':tabprev' + xnoremap 9 ':tabprev' + nnoremap - ':tabnew' + inoremap - ':tabnew' + xnoremap - ':tabnew' + nnoremap = ':VimFiler -tab -project' + inoremap = ':VimFiler -tab -project' + xnoremap = ':VimFiler -tab -project' + nnoremap + ':VimFiler -tab -project -double' + inoremap + ':VimFiler -tab -project -double' + xnoremap + ':VimFiler -tab -project -double' "} "TOGGLES:{ "bindings to trigger vimfiler - nnoremap `` ':VimFilerExplorer -direction=topleft -winwidth=45' - nnoremap ~~ ':VimFilerExplorer -direction=botright -winwidth=45' + nnoremap `` ':VimFilerExplorer -direction=botright -winwidth=45' + nnoremap ~~ ':VimFilerExplorer -direction=topleft -winwidth=45' "toggle folded code at foldpoints nnoremap za @@ -189,23 +236,23 @@ xnoremap ':SyntasticToggleModev' inoremap ':SyntasticToggleMode' - "bindings to trigger spellcheck - nnoremap ':UpdateAndSpellCheck:call ToggleQuickfixList()' - xnoremap ':UpdateAndSpellCheck:call ToggleQuickfixList()' - inoremap ':UpdateAndSpellCheck:call ToggleQuickfixList()' + "bindings to trigger the tagbar list of tags + nnoremap ':TagbarToggle:echo "Code tagbar toggled"' + xnoremap ':TagbarTogglev' + inoremap ':TagbarToggle' + + "bindings to trigger the tagbar list of errors + nmap