From ca75532279fecdd213f63fe8a8d700a3ee08670f Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Wed, 25 Jun 2014 02:47:29 -0400 Subject: [PATCH] Played with keybindings to make them more consistent and logical and making room to add more complete spellcheck support via the custom bindings (starting with ?). --- README.md | 46 +++++++---- vim/config/keyboard.vim | 173 +++++++++++++++++++++++----------------- vim/config/settings.vim | 3 +- 3 files changed, 132 insertions(+), 90 deletions(-) diff --git a/README.md b/README.md index 8f3b972..260f066 100644 --- a/README.md +++ b/README.md @@ -83,33 +83,45 @@ A theme, config and collection of plugins for Vim. ### Keyboard ### -#### Toggles and Sidebars #### +#### Sidebars #### | Binding | Mode | Action | |:-----------------------|:----:|-------------------------------------------------:| -| \\ | NORM | Toggle the **goyo** distraction-free UI | -| | | | -| ?? | NORM | Toggle the **vim** reference manual | -| ~ | NORM | Toggle **vimfiler** file manager sidebar | -| \` | NORM | Toggle the gutter (line #s, folds, git diffs) | -| | | | -| \ | ALL | Toggle the **gundo** undo history sidebar | -| \ | ALL | Toggle the **tagbar** source code tag sidebar | -| \ | ALL | Toggle the **spellcheck** bottom bar of mistakes | +| \ | ALL | Toggle **vimfiler** file manager sidebar | +| \ | ALL | Toggle the **gundo** undo history sidebar | +| \ | ALL | Toggle the **tagbar** source code tag sidebar | | \ | ALL | Toggle the **extradite** git history window | + +#### Toggles #### + +| Binding | Mode | Action | +|:-----------------------|:----:|-------------------------------------------------:| +| \<(Ctrl-or-Alt)-F1\> | ALL | Toggle line wrapping | +| \<(Ctrl-or-Alt)-F2\> | ALL | Toggle highlighting of spelling mistakes | +| \<(Ctrl-or-Alt)-F3\> | ALL | Toggle source code syntax checking | +| \<(Ctrl-or-Alt)-F4\> | ALL | Toggle external-paste mode | | | | | -| \ | ALL | Toggle line wrapping | -| \ | ALL | Toggle highlighting of spelling mistakes | -| \ | ALL | Toggle source code syntax checking | -| \ | ALL | Toggle external-paste mode | +| \` | NORM | Toggle gutter (left bar with line numbers etc.) | +| \\ | NORM | Toggle the **vim** reference manual | +| \\ | NORM | Toggle the **goyo** distraction-free UI | +| ?\ | NORM | Toggle the **spellcheck** bottom bar of mistakes | + +#### Spell Check #### + +| Binding | Mode | Action | +|:-----------------------|:----:|-------------------------------------------------:| +| ? | NORM | Toggle spellcheck error list | +| ?+ | NORM | Add the selected word to the local dictionary | +| ?? | NORM | Show spelling suggestions for selected word | +| ?N | NORM | Go to the next spelling mistake | +| ?P | NORM | Go to the previous spelling mistake | ##### GVim ##### | Binding | Mode | Action | |:-----------------------|:----:|-------------------------------------------------:| -| \ | ALL | Toggle the menubar **(gvim)** | -| \ | ALL | Toggle the toolbar **(gvim)** | -| \ | ALL | Toggle the scrollbars **(gvim)** | +| \ | ALL | Toggle the menubar **(gvim)** | +| \ | ALL | Toggle the toolbar **(gvim)** | ### Complete Reference ### diff --git a/vim/config/keyboard.vim b/vim/config/keyboard.vim index 8fe0cab..a83fa13 100644 --- a/vim/config/keyboard.vim +++ b/vim/config/keyboard.vim @@ -73,8 +73,7 @@ " | (N) -> create a new tab with a double pane vimfiler " " (toggles and features) -" ?? | (N) -> toggle the vim reference manual -" ~ | (N) -> toggle vimfiler sidebar +" | (N) -> toggle the vim reference manual " ` | (A) -> toggle the gutter(line numbers, folds and signify) " " Space | (N) -> toggle selected fold @@ -82,41 +81,50 @@ " - | (N) -> unopen all folds " 0 | (N) -> reset all folds using default fold level " -" | (N) -> toggle the gundo sidebar -" | (A) -> toggle the tagbar sidebar -" | (A) -> toggle spellcheck error list +" | (A) -> toggle vimfiler sidebar +" | (A) -> toggle the gundo sidebar +" | (A) -> toggle the tagbar sidebar " | (A) -> toggle extradite git commit history " " | (A) -> toggle line wrapping " | (A) -> toggle spell check " | (A) -> toggle syntax checking " | (A) -> toggle external-paste mode +" | (A) -> toggle line wrapping +" | (A) -> toggle spell check +" | (A) -> toggle syntax checking +" | (A) -> toggle external-paste mode " " (gvim toggles) -" | (A) -> toggle the menubar -" | (A) -> toggle the toolbar -" | (A) -> toggle the scrollbar +" | (A) -> toggle the menubar +" | (A) -> toggle the toolbar +" +" (spellcheck) +" ? | (N) -> toggle spellcheck error list +" ?+ | (N) -> add the selected word to the local dictionary +" ?? | (N) -> show spelling suggestions for selected word +" ?N | (N) -> go to the next spelling mistake +" ?P | (N) -> go to the previous spelling mistake " " (completion) " , | (A) -> enter after emmet 'word' (ie: html:5) -" \\ | (N) -> show spelling suggestions popup for word -" \| | (N) -> add word to a local list of correct spellings " | (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 " +" (search) +" \ | (N) -> remove search highlighting +" " (formatting) " | (V) -> deletes currently selected text -" | (N) -> format document and return to cursor -" | (V) -> format the selection and return to cursor -" | (N) -> format document using :Autoformat -" | (N) -> format document to a width of 79 characters -" | (V) -> format selection to a width of 79 characters -" | (N) -> remove whitespace -" | (N) -> convert tabs into spaces -" \ | (N) -> remove search highlighting -" | (N) -> an alt mapping to remove search highlighting +" J | (N) -> format document text to 79 chars +" J | (V) -> format selected text to 79 chars +" f | (N) -> format document and return to cursor +" f | (V) -> format the selection and return to cursor +" F | (N) -> format document using :Autoformat +" w | (N) -> remove whitespace +" t | (N) -> convert tabs into spaces " | (V) -> indent all the lines currently selected " | (N) -> indent the current line " | (V) -> unindent all the lines currently selected @@ -224,7 +232,7 @@ " " (help) " q | (A) -> close the dialog -" ?? | (A) -> close the dialog +" | (A) -> close the dialog " ?> | (A) -> close the dialog " ?< | (A) -> close the dialog " @@ -266,8 +274,9 @@ noremap < "-unmapping help from F1 and Ctrl-F1 for use toggling the reference manual - "+the :h topic feature works, and ?? displays quickref + "+the :h topic feature works, and displays quickref map + map map "}}} @@ -362,10 +371,7 @@ "TOGGLES AND FEATURES:{ "toggle the vim reference manual - nnoremap ?? ':h index.txt' - - "trigger vimfiler - nnoremap ~ ':VimFiler -split -simple -toggle -no-quit -direction=topleft -winwidth=45' + nnoremap ':h index.txt' "toggle the display of the left gutter nnoremap ` ':if (&number)set number!if (&foldenable)set foldenable!endifif exists("b:sy")if (b:sy.active)SignifyToggleendifendifelseset number!if !(&foldenable)set foldenable!endifif exists("b:sy")if !(b:sy.active)SignifyToggleendifendifendif:echo "gutter visibility toggled"' @@ -388,20 +394,20 @@ xnoremap 0 'zXgv' inoremap 0 'zX' + "trigger vimfiler + nnoremap ':VimFiler -split -simple -toggle -no-quit -direction=topleft -winwidth=45' + xnoremap ':VimFiler -split -simple -toggle -no-quit -direction=topleft -winwidth=45' + inoremap ':VimFiler -split -simple -toggle -no-quit -direction=topleft -winwidth=45' + "bindings to trigger the gundo undo history - nnoremap ':GundoToggle:echo "undo history sidebar toggled"' - xnoremap ':GundoToggle' - inoremap ':GundoToggle' + nnoremap ':GundoToggle:echo "undo history sidebar toggled"' + xnoremap ':GundoToggle' + inoremap ':GundoToggle' "bindings to trigger the tagbar list of tags - nnoremap ':TagbarToggle:echo "tagbar toggled"' - xnoremap ':TagbarTogglegv' - inoremap ':TagbarToggle' - - "bindings to trigger spellcheck - nnoremap ':UpdateAndSpellCheck:call ToggleQuickfixList():wincmd j' - xnoremap ':UpdateAndSpellCheck:call ToggleQuickfixList():wincmd j' - inoremap ':UpdateAndSpellCheck:call ToggleQuickfixList():wincmd j' + nnoremap ':TagbarToggle:echo "tagbar toggled"' + xnoremap ':TagbarTogglegv' + inoremap ':TagbarToggle' "view commit history and diffs nnoremap ':Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' @@ -412,43 +418,64 @@ nnoremap ':set wrap!:echo "line wrapping toggled"' xnoremap ':set wrap!gv' inoremap ':set wrap!' - - "toggle syntax checking - nnoremap ':SyntasticToggleMode' - xnoremap ':SyntasticToggleModegv' - inoremap ':SyntasticToggleMode' + nnoremap ':set wrap!:echo "line wrapping toggled"' + xnoremap ':set wrap!gv' + inoremap ':set wrap!' "toggle spellcheck - nnoremap ':set spell!:echo "spell checking toggled"' - xnoremap ':set spell!gv' - inoremap ':set spell!' + nnoremap ':set spell!:echo "spell checking toggled"' + xnoremap ':set spell!gv' + inoremap ':set spell!' + nnoremap ':set spell!:echo "spell checking toggled"' + xnoremap ':set spell!gv' + inoremap ':set spell!' + + "toggle syntax checking + nnoremap ':SyntasticToggleMode' + xnoremap ':SyntasticToggleModegv' + inoremap ':SyntasticToggleMode' + nnoremap ':SyntasticToggleMode' + xnoremap ':SyntasticToggleModegv' + inoremap ':SyntasticToggleMode' "toggle external-paste mode set pastetoggle= + noremap "} "GVIM TOGGLES:{ - "map toggles for the menu, toolbar and vertical scrollbar - nnoremap ":if &go=~#'m'set go-=melseset go+=mendif:echo 'Menu bar toggled'" - vnoremap ":if &go=~#'m'set go-=melseset go+=mendifgv" - inoremap ":if &go=~#'m'set go-=melseset go+=mendif" + "toggle the menu + nnoremap ":if &go=~#'m'set go-=melseset go+=mendif:echo 'Menu bar toggled'" + vnoremap ":if &go=~#'m'set go-=melseset go+=mendifgv" + inoremap ":if &go=~#'m'set go-=melseset go+=mendif" - nnoremap ":if &go=~#'T'set go-=Telseset go+=Tendif:echo 'Toolbar toggled'" - vnoremap ":if &go=~#'T'set go-=Telseset go+=Tendifgv" - inoremap ":if &go=~#'T'set go-=Telseset go+=Tendif" + "toggle the toolbar + nnoremap ":if &go=~#'T'set go-=Telseset go+=Tendif:echo 'Toolbar toggled'" + vnoremap ":if &go=~#'T'set go-=Telseset go+=Tendifgv" + inoremap ":if &go=~#'T'set go-=Telseset go+=Tendif" + "} - nnoremap ":if &go=~#'r'set go-=rset go-=Lset go-=belseset go+=rset go+=Lset go+=bendif:echo 'Scrollbars toggled'" - vnoremap ":if &go=~#'r'set go-=rset go-=Lset go-=belseset go+=rset go+=Lset go+=bendifgv" - inoremap ":if &go=~#'r'set go-=rset go-=Lset go-=belseset go+=rset go+=Lset go+=bendif" + "SPELLCHECK:{ + "trigger spellcheck bar + nnoremap ? ':UpdateAndSpellCheck:call ToggleQuickfixList():wincmd j' + + "add the selected mispelled word to the local dictionary + nnoremap ?+ zg + + "display a list of suggestions for the selected mispelled word + nnoremap ?? hei + + "go to the next mispelled word + nnoremap ?N ]s + + "go to the previous mispelled word + nnoremap ?P [s "} "COMPLETION:{ "emmet switch triggerkey from let g:user_emmet_leader_key='' - "press backslash twice on a mispelled word for suggestions - nnoremap \\ hei - nnoremap \| zg "neocomplcache: scroll through completion list inoremap pumvisible() ? "\" : "\" @@ -460,20 +487,22 @@ inoremap "" . neocomplcache#undo_completion() "} + "FORMATTING:{ + nnoremap / ':noh:echo "Search results have been cleared"' + "} + "FORMATTING:{ "have backspace delete the selected text vnoremap "_x "formatting options to apply to the whole document - nnoremap mzgg=G`z:echo "The document has been formatted" - vnoremap mz=`z:echo "The selection has been formatted" - nnoremap :Autoformat:echo "The document has been formatted with :Autoformat" - nnoremap ':set tw=79gggqG:set tw=0:echo "Document text has been formatted to a width of 79 characters"' - vnoremap ':set tw=79gvgq:set tw=0:echo "Selected text has been formatted to a width of 79 characters"' - nnoremap ':FixWhitespace:echo "Trailing whitespace has been removed"' - nnoremap ':retab:noh:echo "Tabs have been converted to spaces"' - nnoremap / ':noh:echo "Search results have been cleared"' - nnoremap ':noh:echo "Search results have been cleared"' + nnoremap J ':set tw=79gggqG:set tw=0:echo "Document text has been formatted to a width of 79 characters"' + vnoremap J ':set tw=79gvgq:set tw=0:echo "Selected text has been formatted to a width of 79 characters"' + nnoremap f mzgg=G`z:echo "The document has been formatted" + vnoremap f mz=`z:echo "The selection has been formatted" + nnoremap F :Autoformat:echo "The document has been formatted with :Autoformat" + nnoremap w ':FixWhitespace:echo "Trailing whitespace has been removed"' + nnoremap t ':retab:noh:echo "Tabs have been converted to spaces"' "tab and untab the currently selected lines vnoremap >gv @@ -607,11 +636,11 @@ "help if !&diff autocmd FileType help map q ':q' - autocmd FileType help map ?? ':q' + autocmd FileType help map ':q' endif "markdown: launch table of contents instead of the tagbar - autocmd FileType mkd map ':Toch' + autocmd FileType mkd map ':Toch' "markdown table of contents autocmd FileType qf map 0 @@ -624,7 +653,7 @@ autocmd FileType qf map h j autocmd FileType qf map l k autocmd FileType qf map q ':hide' - autocmd FileType qf map ':hide' + autocmd FileType qf map ? ':hide' "vimdiff autocmd FilterWritePre * if &diff|nnoremap <> ':diffu'|endif @@ -646,9 +675,9 @@ "DISABLED MAPPINGS FOR FILETYPES: {{{ "remove incompatible toggles from specific file types - autocmd Filetype qf,vimfiler,extradite,help noremap - autocmd Filetype qf,ggundo,vimfiler,extradite,help noremap - autocmd Filetype ggundo,vimfiler,extradite,tagbar,help noremap + autocmd Filetype qf,vimfiler,extradite,help noremap + autocmd Filetype qf,ggundo,vimfiler,extradite,help noremap + autocmd Filetype ggundo,vimfiler,extradite,tagbar,help noremap ? autocmd Filetype qf,ggundo,vimfiler,tagbar,help noremap <12> "disable modifier keys with directions that would interfere with logic diff --git a/vim/config/settings.vim b/vim/config/settings.vim index 1d33e75..682d192 100644 --- a/vim/config/settings.vim +++ b/vim/config/settings.vim @@ -77,5 +77,6 @@ "GVIM: GUI CONFIG OPTIONS {{{ set guicursor+=a:blinkon0 "disable the blinking cursor - set guioptions=aegi + set guioptions=aegip "enable some good defaults for gvim + set guioptions+=lRb "enable scrollbars (right only when a split is present) "}}}