From e9481f6bc817575586499fe837900ce56b9a52a8 Mon Sep 17 00:00:00 2001 From: Kevin Date: Sat, 5 Apr 2014 03:20:53 -0400 Subject: [PATCH] Fixed some keybindings, added help dialog sidebar toggles (help dialogs now always pop up veritcally, which made sense to me considering their column width and the average size of screens these day), touched up the readme and some missing keyboard toggles, added a few more formats relevant to emmet, and gave variables default values in the configs so they don't need to be declared (default values are stated in the README) --- .gitmodules | 3 ++ README.md | 35 +++++++++--------- vim/config/keyboard.vim | 79 ++++++++++++++++++++++++++--------------- vim/config/plugins.vim | 12 +++++-- vim/config/settings.vim | 1 + 5 files changed, 83 insertions(+), 47 deletions(-) diff --git a/.gitmodules b/.gitmodules index 87bafd9..5051059 100644 --- a/.gitmodules +++ b/.gitmodules @@ -67,3 +67,6 @@ [submodule "vim/bundle/vim-polyglot"] path = vim/bundle/vim-polyglot url = https://github.com/sheerun/vim-polyglot.git +[submodule "vim/bundle/vim-fugitive"] + path = vim/bundle/vim-fugitive + url = https://github.com/tpope/vim-fugitive.git diff --git a/README.md b/README.md index d3baa54..bfeb89a 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ ## Requirements ## -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. +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. ## Features ## @@ -19,17 +19,19 @@ 1. Clone the darkcloud-vimconfig repo and use the __update__ script to install the plugins: - `git clone https://github.com/prurigro/darkcloud-vimconfig.git` - - `sh darkcloud-vimconfig/update` - + * `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) + +3. Open the vimrc you just installed and either edit the variables in the "__USER CONFIG SETTINGS__" section, or (preferably) copy them to __vim/vimrc.user__ and edit them there: + + * **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__: 0) + * **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 ## @@ -44,8 +46,9 @@ ## 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__. +* **Runtimepath**: To find the runtimepath locations currently set, run the following in vim: `:verbose set runtimepath`. +* **Reference**: Type `??`, `?>` and '?<' to toggle sidebars with different reference topics. +* **Unique 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 ## diff --git a/vim/config/keyboard.vim b/vim/config/keyboard.vim index b19aafd..ac8ce00 100644 --- a/vim/config/keyboard.vim +++ b/vim/config/keyboard.vim @@ -38,12 +38,15 @@ " " (tabs) " 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 +" 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 quick reference sidebar +" ?> | (N) -> toggle command reference sidebar +" ?< | (N) -> toggle normal mode key bindings reference sidebar " `` | (N) -> toggle the vimfiler sidebar on the right " ~~ | (N) -> toggle the vimfiler sidebar on the left " | (N) -> toggle folds @@ -150,17 +153,26 @@ " | (A) -> same as k (up) " h | (A) -> same as k (up) " +" (help) +" q | (N) -> close the dialog +" " (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) +" | (N) -> edit selected file +" | (N) -> same as normal + justify on the left +" | (N) -> same as the left mouse +" | (N) -> same as the left mouse +" | (N) -> map to l, which opens a directory +" | (N) -> map to h, which goes up one directory +" ' | (N) -> edit the selected file " +" (gundo) +" | (N) -> same as normal + justify on the left +" | (N) -> same as the left mouse +" | (N) -> same as the left mouse +" | (N) -> same as down +" l | (N) -> same as j +" | (N) -> same as Up +" h | (N) -> same as k " " Aliases: " :wsudo -and- :sudow | (C) -> :SudoWrite (write the file as root using sudo) @@ -203,6 +215,10 @@ nnoremap `` ':VimFilerExplorer -direction=botright -winwidth=45' nnoremap ~~ ':VimFilerExplorer -direction=topleft -winwidth=45' + nnoremap ?? ':h quickref' + nnoremap ?> ':exusage' + nnoremap ?< ':viusage' + "toggle folded code at foldpoints nnoremap za @@ -381,23 +397,29 @@ "}}} "FILETYPE SPECIFIC MAPPINGS: {{{ - "gundo - autocmd FileType gundo noremap 0l - autocmd FileType gundo noremap - autocmd FileType gundo noremap - autocmd FileType gundo noremap j - autocmd FileType gundo noremap l j - autocmd FileType gundo noremap k - autocmd FileType gundo noremap h k + "help + autocmd FileType help nnoremap q ':q' + autocmd FileType help nnoremap ?? ':q' + autocmd FileType help nnoremap ?> ':q' + autocmd FileType help nnoremap ?< ':q' "vimfiler - autocmd FileType vimfiler noremap l - autocmd FileType vimfiler noremap h - autocmd FileType vimfiler noremap <2-LeftMouse> (vimfiler_edit_file) - autocmd FileType vimfiler noremap 0 - autocmd FileType vimfiler noremap - autocmd FileType vimfiler noremap - autocmd FileType vimfiler noremap e + autocmd FileType vimfiler nmap <2-LeftMouse> (vimfiler_edit_file) + autocmd FileType vimfiler nmap 0 + autocmd FileType vimfiler nmap + autocmd FileType vimfiler nmap + autocmd FileType vimfiler nmap l + autocmd FileType vimfiler nmap h + autocmd FileType vimfiler nmap ' e + + "gundo + autocmd FileType gundo nmap 0l + autocmd FileType gundo nmap + autocmd FileType gundo nmap + autocmd FileType gundo nmap + autocmd FileType gundo nmap l j + autocmd FileType gundo nmap + autocmd FileType gundo nmap h k "}}} "DISABLED MAPPINGS: {{{ @@ -421,7 +443,6 @@ autocmd Filetype gundo,vimfiler noremap autocmd Filetype gundo,vimfiler noremap autocmd Filetype gundo,vimfiler noremap - "}}} "ALIASES: COMMAND SHORTCUTS {{{ diff --git a/vim/config/plugins.vim b/vim/config/plugins.vim index 0cf249c..d1bc856 100644 --- a/vim/config/plugins.vim +++ b/vim/config/plugins.vim @@ -16,7 +16,7 @@ let g:use_emmet_complete_tag=1 let g:user_emmet_mode='a' - autocmd FileType html,css,php,aspx EmmetInstall + autocmd FileType css,json,htm,html,php,aspx EmmetInstall if filereadable("~/.vim/snippets.json") let g:user_emmet_settings = webapi#json#decode(join(readfile(expand('~/.vim/snippets.json')), "\n")) @@ -105,7 +105,11 @@ call lightline#update() endfunction - "status bar config with and without powerline fonts + "status bar config with and without powerline fonts (defaults to off) + if !exists("g:powerlinefonts") + let g:powerlinefonts=0 + endif + if (g:powerlinefonts == 1) let g:lightline = { \ 'colorscheme': 'darkcloud', @@ -163,6 +167,10 @@ "}}} "SYNTASTIC: CONFIGURE SYNTAX CHECKING {{{ + if !exists("g:autostartchecker") + let g:autostartchecker=1 + endif + if (g:autostartchecker == 1) let g:syntastic_mode_map = {'mode':'active','active_filetypes':[],'passive_filetypes':[]} let g:syntastic_check_on_open=1 diff --git a/vim/config/settings.vim b/vim/config/settings.vim index 09220c6..147bb6e 100644 --- a/vim/config/settings.vim +++ b/vim/config/settings.vim @@ -73,6 +73,7 @@ autocmd FileType gitcommit,notes,mail,notmuch,text setlocal spell autocmd FileType notes,mail,notmuch,mkd,text setlocal nonumber autocmd FileType mail,notmuch,text setlocal wrap + autocmd FileType help,* wincmd L "help windows always open vertically "disable folding by default in vimdiff if &diff