Tons of mapping issues fixed, re-add mkd table fmt, tweak keys+settings

This commit is contained in:
Kevin MacMartin 2014-10-22 03:41:50 -04:00
parent 6aef9eb513
commit 7bb3c32e3b
4 changed files with 148 additions and 87 deletions

115
README.md
View file

@ -76,71 +76,85 @@ As usual, to have your system use `vimpager` in place of `less`, you'll need to
### Mouse ### ### Mouse ###
| Binding | Mode | Action | | Binding | Mode | Action |
|:-----------------------|:----:|-------------------------------------------------:| |--------------------------|------|----------------------------------------------|
| Ctrl-ScrollUp | ALL | Scroll right a few characters at a time | | \<Ctrl-ScrollUp\> | ALL | Scroll right a few characters at a time |
| Ctrl-ScrollDown | ALL | Scroll left a few characters at a time | | \<Ctrl-ScrollDown\> | ALL | Scroll left a few characters at a time |
| Alt-ScrollUp | ALL | Scroll right one character at a time | | \<Alt-ScrollUp\> | ALL | Scroll right one character at a time |
| Alt-ScrollDown | ALL | Scroll left one character at a time | | \<Alt-ScrollDown\> | ALL | Scroll left one character at a time |
| | | | | | | |
| MiddleClick | ALL | Select between the cursor and the mouse | | MiddleClick | ALL | Select between the cursor and the mouse |
| Ctrl-LeftClick | ALL | Select between the cursor and the mouse | | \<Ctrl-LeftClick\> | ALL | Select between the cursor and the mouse |
| Alt-LeftClick | ALL | Select the line at the mouse | | \<Alt-LeftClick\> | ALL | Select the line at the mouse |
| Ctrl-Alt-LeftClick | ALL | Select the paragraph at the mouse | | \<Ctrl-Alt-LeftClick\> | ALL | Select the paragraph at the mouse |
| | | | | | | |
| Ctrl-RightClick | ALL | Copy selection or character under the cursor | | \<Ctrl-RightClick\> | ALL | Copy selection or character under the cursor |
| Ctrl-MiddleClick | ALL | Copy selection or character under the cursor | | \<Ctrl-MiddleClick\> | ALL | Copy selection or character under the cursor |
| Alt-RightClick | ALL | Cut selection or character under the cursor | | \<Alt-RightClick\> | ALL | Cut selection or character under the cursor |
| Alt-MiddleClick | ALL | Cut selection or character under the cursor | | \<Alt-MiddleClick\> | ALL | Cut selection or character under the cursor |
| Ctrl-Alt-RightClick | ALL | Paste at the cursor | | \<Ctrl-Alt-RightClick\> | ALL | Paste at the cursor |
| Ctrl-Alt-MiddleClick | ALL | Paste at the cursor | | \<Ctrl-Alt-MiddleClick\> | ALL | Paste at the cursor |
| Shift-MiddleClick | ALL | Paste the contents of the xorg buffer | | \<Shift-MiddleClick\> | ALL | Paste the contents of the xorg buffer |
### Keyboard ### ### Keyboard ###
#### Sidebars #### #### Sidebars ####
| Binding | Mode | Action | | Binding | Mode | Action |
|:-----------------------|:----:|-------------------------------------------------:| |-----------------------|------|-----------------------------------------------|
| \<(Ctrl-or-Alt)-F1\> | ALL | Toggle **vimfiler** file manager sidebar | | \<(Ctrl-or-Alt)-F1\> | ALL | Toggle **vimfiler** file manager sidebar |
| \<(Ctrl-or-Alt)-F2\> | ALL | Toggle the **gundo** undo history sidebar | | \<(Ctrl-or-Alt)-F2\> | ALL | Toggle the **gundo** undo history sidebar |
| \<(Ctrl-or-Alt)-F3\> | ALL | Toggle the **tagbar** source code tag sidebar | | \<(Ctrl-or-Alt)-F3\> | ALL | Toggle the **tagbar** source code tag sidebar |
| \<(Ctrl-or-Alt)-F4\> | ALL | Toggle the **extradite** git history window | | \<(Ctrl-or-Alt)-F4\> | ALL | Toggle the **extradite** git history window |
| \<(Ctrl-or-Alt)-F12\> | ALL | Toggle the **goyo** distraction-free mode | | \<(Ctrl-or-Alt)-F12\> | ALL | Toggle the **goyo** distraction-free mode |
#### Toggles #### #### Toggles ####
| Binding | Mode | Action | | Binding | Mode | Action |
|:-----------------------|:----:|-------------------------------------------------:| |------------------------|------|--------------------------------------------------|
| \` | NORM | Popup a command list dialog | | ~ | N | Popup a command list dialog |
| | | | | | | |
| \<F1\> | ALL | Toggle line wrapping | | \<F1\> | ALL | Toggle line wrapping |
| \<F2\> | ALL | Toggle highlighting of spelling mistakes | | \<F2\> | ALL | Toggle highlighting of spelling mistakes |
| \<F3\> | ALL | Toggle source code syntax checking | | \<F3\> | ALL | Toggle source code syntax checking |
| \<F4\> | ALL | Toggle external-paste mode | | \<F4\> | ALL | Toggle external-paste mode |
| | | | | | | |
| ~ | NORM | Toggle gutter (left bar with line numbers etc.) | | \` | N | Toggle gutter (left bar with line numbers etc.) |
| \<Backslash\>\<F1\> | NORM | Toggle the **vim** reference manual | | \<Backslash\>\<F1\> | N | Toggle the **vim** reference manual |
| \<Backslash\>\<Space\> | NORM | Toggle the **goyo** distraction-free UI | | \<Backslash\>\<Space\> | N | Toggle the **goyo** distraction-free UI |
| ?\<Space\> | NORM | Toggle the **spellcheck** bottom bar of mistakes | | ?\<Space\> | N | Toggle the **spellcheck** bottom bar of mistakes |
#### Spell Check #### #### Spell Check ####
| Binding | Mode | Action | | Binding | Mode | Action |
|:-----------------------|:----:|-------------------------------------------------:| |------------|------|-----------------------------------------------|
| ?<Space> | NORM | Toggle spellcheck error list | | ?\<Space\> | N | Toggle spellcheck error list |
| ?+ | NORM | Add the selected word to the local dictionary | | ?+ | N | Add the selected word to the local dictionary |
| ?? | NORM | Show spelling suggestions for selected word | | ?? | N | Show spelling suggestions for selected word |
| ?N | NORM | Go to the next spelling mistake | | ?N | N | Go to the next spelling mistake |
| ?P | NORM | Go to the previous spelling mistake | | ?P | N | Go to the previous spelling mistake |
##### GVim ##### #### Formatting ####
| Binding | Mode | Action | | Binding | Mode | Action |
|:-----------------------|:----:|-------------------------------------------------:| |-------------|------|---------------------------------------------------------------|
| \<Backslash\>\<F1\> | ALL | Toggle the menubar **(gvim)** | | \<Leader\>J | N+V | Format line/selected lines to a max width of the _textwidth_ |
| \<Backslash\>\<F2\> | ALL | Toggle the toolbar **(gvim)** | | \<Leader\>f | N+V | Format document/selection alignment using Vim syntax |
| \<Backslash\>\<F3\> | ALL | Toggle the scrollbars **(gvim)** | | \<Leader\>F | N | Format based on file-type using Autoformat |
| \<Leader\>F | N+V | (Markdown) Format table cursor is currently on |
| \<Leader\>t | N | Convert all tabs into spaces and continue session with spaces |
| \<Leader\>T | N | Convert all spaces into tabs and continue session with tabs |
| \<Leader\>w | N | Remove all trailing whitespace |
| \<Leader\>A | N+V | Align comments in document/selection |
| \<Leader\>a | N+V | Align comments following non-comments in document/selection |
#### GVim ####
| Binding | Mode | Action |
|---------------------|------|----------------------------------|
| \<Backslash\>\<F1\> | ALL | Toggle the menubar **(gvim)** |
| \<Backslash\>\<F2\> | ALL | Toggle the toolbar **(gvim)** |
| \<Backslash\>\<F3\> | ALL | Toggle the scrollbars **(gvim)** |
### Complete Reference ### ### Complete Reference ###
@ -187,6 +201,7 @@ For a complete list of mappings specific to **darkcloud-vimconfig**, check the l
* By Kevin MacMartin: [GitHub Projects](https://github.com/prurigro?tab=repositories) | [Arch Linux AUR Packages](https://aur.archlinux.org/packages/?SeB=m&K=prurigro) * By Kevin MacMartin: [GitHub Projects](https://github.com/prurigro?tab=repositories) | [Arch Linux AUR Packages](https://aur.archlinux.org/packages/?SeB=m&K=prurigro)
* The jellybean theme for Vim by [NanoTech](http://nanotech.nanotechcorp.net) was stripped down and used as a starting point to build the darkcloud theme included in this project. * The jellybean theme for Vim by [NanoTech](http://nanotech.nanotechcorp.net) was stripped down and used as a starting point to build the darkcloud theme included in this project.
* The [vim-markdown](https://github.com/plasticboy/vim-markdown) plugin **TableFormat** command, used to format tables in markdown files, was pulled into [plugins.vim](https://github.com/prurigro/darkcloud-vimconfig/blob/master/vim/config/plugins.vim) from [ftplugin/mkd](https://github.com/plasticboy/vim-markdown/blob/master/ftplugin/mkd.vim).
## License ## ## License ##

View file

@ -41,7 +41,8 @@ endif
autocmd BufEnter,BufRead PKGBUILD setlocal iskeyword-=. autocmd BufEnter,BufRead PKGBUILD setlocal iskeyword-=.
"filtype specific settings "filtype specific settings
autocmd Filetype text,mkd,mkdc,gitcommit,notes,mail,notmuch,rst,taskreport setlocal nonumber spell nolist wrap linebreak breakat&vim breakat-=* breakat-=. breakat-=/ breakat-=? breakat-=, breakat-=: breakat-=; breakat-=! "set some defaults for word processing autocmd Filetype text,mkd,mkdc,gitcommit,notes,mail,notmuch,rst,taskreport setlocal nonumber spell nolist linebreak breakat&vim breakat-=* breakat-=. breakat-=/ breakat-=? breakat-=, breakat-=: breakat-=; breakat-=! "set some defaults for word processing
autocmd Filetype text,gitcommit,notes,mail,notmuch,rst,taskreport setlocal wrap
autocmd FileType help* wincmd L "help windows always open vertically autocmd FileType help* wincmd L "help windows always open vertically
autocmd FileType help* vertical resize 80 "set the window size to 80 cols autocmd FileType help* vertical resize 80 "set the window size to 80 cols
autocmd FileType help* setlocal nocursorline "remove the horizontal cursor line autocmd FileType help* setlocal nocursorline "remove the horizontal cursor line

View file

@ -72,18 +72,20 @@
" <Alt-c> | (N) -> create a new tab with vimfiler " <Alt-c> | (N) -> create a new tab with vimfiler
" <Alt-d> | (N) -> create a new tab with a double pane vimfiler " <Alt-d> | (N) -> create a new tab with a double pane vimfiler
" "
" (display)
" <Esc><Esc> | (N) -> reset window and clear search
" // | (N) -> reset window and clear search
"
" (toggles and features) " (toggles and features)
" ` | (N) -> popup a command reference " ~ | (N) -> popup a command reference
" , | (N) -> display tag information in echo area " , | (N) -> display tag information in echo area
" <Leader><F1> | (N) -> toggle the vim reference manual " <Leader><F1> | (N) -> toggle the vim reference manual
" <Leader>? | (N) -> toggle the vim reference manual " <Leader>? | (N) -> toggle the vim reference manual
" ~ | (A) -> toggle the gutter(line numbers, folds and signify) " ` | (A) -> toggle the gutter(line numbers, folds and signify)
" "
" <Space> | (N) -> toggle selected fold " <Space><Space> | (N) -> toggle selected fold
" <Leader><Space> | (N) -> open all folds
" <Leader>= | (N) -> open all folds " <Leader>= | (N) -> open all folds
" <Leader>+ | (N) -> open all folds " <Leader>+ | (N) -> open all folds
" <Leader><Leader><Space> | (N) -> open all folds
" <Leader>- | (N) -> unopen all folds " <Leader>- | (N) -> unopen all folds
" <Leader>_ | (N) -> unopen all folds " <Leader>_ | (N) -> unopen all folds
" <Leader>0 | (N) -> reset all folds using default fold level " <Leader>0 | (N) -> reset all folds using default fold level
@ -118,7 +120,6 @@
" "
" (copy/paste and undo/redo) " (copy/paste and undo/redo)
" <Leader>p | (N) -> view the paste buffers and register contents " <Leader>p | (N) -> view the paste buffers and register contents
" y | (N) -> copies the character at the cursor
" P | (V) -> save selection to the buffer and paste over " P | (V) -> save selection to the buffer and paste over
" p | (V) -> preserve the buffer pasting over selected text " p | (V) -> preserve the buffer pasting over selected text
" <Ctrl-p>Direction | (N) -> paste in the direction entered " <Ctrl-p>Direction | (N) -> paste in the direction entered
@ -162,16 +163,21 @@
" <Leader>f | (N) -> format document and return to cursor " <Leader>f | (N) -> format document and return to cursor
" <Leader>f | (V) -> format the selection and return to cursor " <Leader>f | (V) -> format the selection and return to cursor
" <Leader>F | (N) -> format document using :Autoformat " <Leader>F | (N) -> format document using :Autoformat
" <Leader>w | (N) -> remove whitespace
" <Leader>t | (N) -> convert tabs into spaces " <Leader>t | (N) -> convert tabs into spaces
" <Leader>A | (N) -> aligns all comments " <Leader>T | (N) -> convert spaces into tabs
" <Leader>w | (N) -> remove whitespace
" <Leader>A | (N) -> aligns comments using the comment symbol
" <Leader>A | (V) -> aligns selected comments " <Leader>A | (V) -> aligns selected comments
" <Leader>a | (N) -> aligns all comments after text " <Leader>a | (N) -> aligns all comments after text
" <Leader>a | (V) -> aligns selected comments after text " <Leader>a | (V) -> aligns selected comments after text
" <Tab> | (V) -> indent all the lines currently selected " <Tab> | (V) -> indent all the lines currently selected
" <Tab> | (N) -> indent the current line " <Tab> | (N) -> indent the current line
" <Shift-Tab> | (V) -> unindent all the lines currently selected " <Leader>> | (V) -> indent all the lines currently selected
" <Shift-Tab> | (N) -> unindent the current line " <Leader>> | (N) -> indent the current line
" <Shift-Tab> | (V) -> un-indent all the lines currently selected
" <Shift-Tab> | (N) -> un-indent the current line
" <Leader>< | (V) -> un-indent all the lines currently selected
" <Leader>< | (N) -> un-indent the current line
" "
" (movement) " (movement)
" = | (N) -> go to the first char on the next line " = | (N) -> go to the first char on the next line
@ -217,8 +223,6 @@
" <Ctrl-Right> | (V) -> select one word right " <Ctrl-Right> | (V) -> select one word right
" <Ctrl-Left> | (V) -> select one word left " <Ctrl-Left> | (V) -> select one word left
" "
" // | (N) -> remove search highlighting
"
" (remap dangerous functions that skip undo) " (remap dangerous functions that skip undo)
" <Ctrl-u> | (I) -> undo-able equivalent " <Ctrl-u> | (I) -> undo-able equivalent
" <Ctrl-w> | (I) -> undo-able equivalent " <Ctrl-w> | (I) -> undo-able equivalent
@ -262,7 +266,9 @@
" <Leader><> | (N) -> update differences " <Leader><> | (N) -> update differences
" <Leader>>< | (N) -> update differences " <Leader>>< | (N) -> update differences
" <Leader>> | (N) -> replace diff in other pane with current pane " <Leader>> | (N) -> replace diff in other pane with current pane
" <Leader>. | (N) -> replace diff in other pane with current pane
" <Leader<< | (N) -> replace diff in current pane with other pane " <Leader<< | (N) -> replace diff in current pane with other pane
" <Leader<, | (N) -> replace diff in current pane with other pane
" "
" (vimfiler) " (vimfiler)
" <LClick> | (A) -> left click + left justify the cursor " <LClick> | (A) -> left click + left justify the cursor
@ -386,9 +392,15 @@
nnoremap <silent><expr> <A-d> ':VimFiler -tab -project -double<CR>' nnoremap <silent><expr> <A-d> ':VimFiler -tab -project -double<CR>'
"} "}
"DISPLAY:{
"clear search and reset buffer
nnoremap <silent><expr> <Esc><Esc> ':noh<CR>:redraw!<CR>'
nnoremap <silent><expr> // ':noh<CR>:redraw!<CR>'
"}
"TOGGLES AND FEATURES:{ "TOGGLES AND FEATURES:{
"toggle the command reference box "toggle the command reference box
nnoremap <silent><expr> ` ':TCommand<CR>' nnoremap <silent><expr> ~ ':TCommand<CR>'
"display tag information in the gutter "display tag information in the gutter
noremap <buffer> <silent><expr> , ':TTagechoWord<CR>' noremap <buffer> <silent><expr> , ':TTagechoWord<CR>'
@ -398,18 +410,16 @@
nnoremap <silent><expr> <Leader>? ':h index.txt<CR>' nnoremap <silent><expr> <Leader>? ':h index.txt<CR>'
"toggle the display of the left gutter "toggle the display of the left gutter
nnoremap <silent><expr> ~ ':if (&number)<Bar>set nonumber<Bar>if (&foldenable)<Bar>set nofoldenable<Bar>endif<Bar>if exists("b:sy")<Bar>if (b:sy.active)<Bar>SignifyToggle<Bar>endif<Bar>endif<Bar>else<Bar>set number<Bar>if !(&foldenable)<Bar>set foldenable<Bar>endif<Bar>if exists("b:sy")<Bar>if !(b:sy.active)<Bar>SignifyToggle<Bar>endif<Bar>endif<Bar>endif<CR>:echo "gutter visibility toggled"<CR>' nnoremap <silent><expr> ` ':if (&number)<Bar>set nonumber<Bar>if (&foldenable)<Bar>set nofoldenable<Bar>endif<Bar>if exists("b:sy")<Bar>if (b:sy.active)<Bar>SignifyToggle<Bar>endif<Bar>endif<Bar>else<Bar>set number<Bar>if !(&foldenable)<Bar>set foldenable<Bar>endif<Bar>if exists("b:sy")<Bar>if !(b:sy.active)<Bar>SignifyToggle<Bar>endif<Bar>endif<Bar>endif<CR>:echo "gutter visibility toggled"<CR>'
"toggle folded code at foldpoints "toggle folded code at foldpoints
nnoremap <Space> za nnoremap <Space><Space> za
"open all folds "open all folds
nnoremap <silent><expr> <Leader><Space> 'zn:echo "all folds have been opened"<CR>' nnoremap <silent><expr> <Space>= 'zn:echo "all folds have been opened"<CR>'
nnoremap <silent><expr> <Leader>= 'zn:echo "all folds have been opened"<CR>' nnoremap <silent><expr> <Space>+ 'zn:echo "all folds have been opened"<CR>'
nnoremap <silent><expr> <Leader>+ 'zn:echo "all folds have been opened"<CR>'
"close folds set to be closed "close folds set to be closed
nnoremap <silent><expr> <Leader><Leader><Space> 'zN:echo "all opened folds have been closed"<CR>'
nnoremap <silent><expr> <Leader>- 'zN:echo "all opened folds have been closed"<CR>' nnoremap <silent><expr> <Leader>- 'zN:echo "all opened folds have been closed"<CR>'
nnoremap <silent><expr> <Leader>_ 'zN:echo "all opened folds have been closed"<CR>' nnoremap <silent><expr> <Leader>_ 'zN:echo "all opened folds have been closed"<CR>'
@ -506,9 +516,6 @@
"display contents of paste buffers "display contents of paste buffers
nnoremap <silent><expr> <Leader>p ':reg<CR>' nnoremap <silent><expr> <Leader>p ':reg<CR>'
"allow y to copy a single character in normal mode
nnoremap y vy<Esc>
"P pastes and replaces the buffer, p pastes and keeps it "P pastes and replaces the buffer, p pastes and keeps it
vnoremap P p vnoremap P p
xmap p <Plug>ReplaceWithRegisterVisual xmap p <Plug>ReplaceWithRegisterVisual
@ -555,7 +562,7 @@
return pumvisible() ? neocomplcache#close_popup() : "\<CR>" return pumvisible() ? neocomplcache#close_popup() : "\<CR>"
endfunction endfunction
"neocomplcache tab completion "neocomplcache tab completion
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" inoremap <expr><Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
"neocomplcache : undo completion "neocomplcache : undo completion
inoremap <expr><Backspace> neocomplcache#smart_close_popup()."\<C-h>" inoremap <expr><Backspace> neocomplcache#smart_close_popup()."\<C-h>"
"neocomplcache undo completion "neocomplcache undo completion
@ -570,26 +577,35 @@
nnoremap <silent><expr> <Leader>J ':let b:tw=&textwidth<CR>:if (b:tw == 0)<Bar>set tw=80<Bar>endif<CR>gg0vG$gq:if (b:tw == 0)<Bar>set tw=0<Bar>let b:tw=80<Bar>endif<CR>:echo "Document has been formatted to a width of ".b:tw." characters"<CR>' nnoremap <silent><expr> <Leader>J ':let b:tw=&textwidth<CR>:if (b:tw == 0)<Bar>set tw=80<Bar>endif<CR>gg0vG$gq:if (b:tw == 0)<Bar>set tw=0<Bar>let b:tw=80<Bar>endif<CR>:echo "Document has been formatted to a width of ".b:tw." characters"<CR>'
vnoremap <silent><expr> <Leader>J '<Esc>:let b:tw=&textwidth<CR>:if (b:tw == 0)<Bar>set tw=80<Bar>endif<CR>gvgq:if (b:tw == 0)<Bar>set tw=0<Bar>let b:tw=80<Bar>endif<CR>:echo "Selection has been formatted to a width of ".b:tw." characters"<CR>' vnoremap <silent><expr> <Leader>J '<Esc>:let b:tw=&textwidth<CR>:if (b:tw == 0)<Bar>set tw=80<Bar>endif<CR>gvgq:if (b:tw == 0)<Bar>set tw=0<Bar>let b:tw=80<Bar>endif<CR>:echo "Selection has been formatted to a width of ".b:tw." characters"<CR>'
"format syntax "format by Vim syntax + by Autoformat tool syntax
nnoremap <Leader>f mzgg=G`z<CR>:echo "The document has been formatted"<CR> nnoremap <Leader>f mzgg=G`z<CR>:echo "The document has been formatted"<CR>
vnoremap <Leader>f mz=`z<CR>:echo "The selection has been formatted"<CR> vnoremap <Leader>f mz=`z<CR>:echo "The selection has been formatted"<CR>
nnoremap <silent><expr> <Leader>F ':Autoformat<CR>:echo "The document has been formatted with :Autoformat"<CR>' nnoremap <silent><expr> <Leader>F ':Autoformat<CR>:echo "The document has been formatted with :Autoformat"<CR>'
"convert tabs to spaces "convert tabs to spaces and spaces to tabs
nnoremap <silent><expr> <Leader>t ':set expandtab<CR>:retab!<CR>:echo "Tabs have been converted to spaces"<CR>'
nnoremap <silent><expr> <Leader>T ':set noexpandtab<CR>:%retab!<CR>:echo "Spaces have been converted to tabs"<CR>'
"remove trailing whitespace
nnoremap <silent><expr> <Leader>w ':FixWhitespace<CR>:echo "Trailing whitespace has been removed"<CR>' nnoremap <silent><expr> <Leader>w ':FixWhitespace<CR>:echo "Trailing whitespace has been removed"<CR>'
nnoremap <silent><expr> <Leader>t ':retab<CR>:noh<CR>:echo "Tabs have been converted to spaces"<CR>'
"align comments "align comments
nnoremap <Leader>A :<C-u>exe "%Tabular" '/^[^'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*'<CR> nnoremap <Leader>A :exe "%Tabular" '/^[^'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*'<CR>:redraw!<CR>
vnoremap <Leader>A :<C-u>exe "'<,'>Tabular" '/^[^'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*'<CR> vnoremap <Leader>A <C-u>:exe "'<,'>Tabular" '/^[^'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*'<CR>:redraw!<CR>
nnoremap <Leader>a :<C-u>exe "%Tabular" '/^\ *[^'.matchstr(&commentstring, '[^%]*').'\ ][^\'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*'<CR>
vnoremap <Leader>a :<C-u>exe "'<,'>Tabular" '/^\ *[^'.matchstr(&commentstring, '[^%]*').' ][^\'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*'<CR>
"tab and untab the currently selected lines "align only comments following non-comments
nnoremap <Leader>a :exe "%Tabular" '/^ *[^'.matchstr(&commentstring, '[^%]*').' ][^\'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*'<CR>:redraw!<CR>
vnoremap <Leader>a <C-u>:exe "'<,'>Tabular" '/^ *[^'.matchstr(&commentstring, '[^%]*').' ][^\'.matchstr(&commentstring, '[^%]*').']*\zs'.matchstr(&commentstring, '[^%]*').'.*'<CR>:redraw!<CR>
"tab/<Leader>> and untab/<Leader>< the currently selected lines
vnoremap <Tab> >gv vnoremap <Tab> >gv
nnoremap <Tab> v>gv<Esc> nnoremap <Tab> v>gv<Esc>
vnoremap <Leader>> >gv
nnoremap <Leader>> v>gv<Esc>
vnoremap <S-Tab> <gv vnoremap <S-Tab> <gv
nnoremap <S-Tab> v<gv<Esc> nnoremap <S-Tab> v<gv<Esc>
vnoremap <Leader>< <gv
nnoremap <Leader>< v<gv<Esc>
"} "}
"MOVEMENT:{ "MOVEMENT:{
@ -650,9 +666,6 @@
xnoremap <S-Down> G$ xnoremap <S-Down> G$
xnoremap <S-Right> $ xnoremap <S-Right> $
xnoremap <S-Left> ^ xnoremap <S-Left> ^
"clear search results
nnoremap <silent><expr> // '<Esc>:noh<CR>'
"} "}
"}}} "}}}
@ -681,7 +694,11 @@
autocmd FileType help map <buffer> <silent><expr> <Leader>? ':q<CR>' autocmd FileType help map <buffer> <silent><expr> <Leader>? ':q<CR>'
endif endif
"mappings for qf-based plugins "markdown
autocmd FileType mkd nnoremap <buffer> <silent><expr> <Leader>F ':TableFormat<CR>'
autocmd FileType mkd xnoremap <buffer> <silent><expr> <Leader>F '<Esc>:TableFormat<CR>gv'
"qf-sidebar
autocmd FileType qf map <buffer> <LeftMouse> <LeftMouse>0 autocmd FileType qf map <buffer> <LeftMouse> <LeftMouse>0
autocmd FileType qf map <buffer> <MiddleMouse> <LeftMouse> autocmd FileType qf map <buffer> <MiddleMouse> <LeftMouse>
autocmd FileType qf map <buffer> <RightMouse> <LeftMouse> autocmd FileType qf map <buffer> <RightMouse> <LeftMouse>
@ -699,7 +716,9 @@
autocmd FilterWritePre * if &diff|nnoremap <buffer> <silent><expr> <Leader><> ':diffu<CR>'|endif autocmd FilterWritePre * if &diff|nnoremap <buffer> <silent><expr> <Leader><> ':diffu<CR>'|endif
autocmd FilterWritePre * if &diff|nnoremap <buffer> <silent><expr> <Leader>>< ':diffu<CR>'|endif autocmd FilterWritePre * if &diff|nnoremap <buffer> <silent><expr> <Leader>>< ':diffu<CR>'|endif
autocmd FilterWritePre * if &diff|nnoremap <buffer> <Leader>> dp|endif autocmd FilterWritePre * if &diff|nnoremap <buffer> <Leader>> dp|endif
autocmd FilterWritePre * if &diff|nnoremap <buffer> <Leader>. dp|endif
autocmd FilterWritePre * if &diff|nnoremap <buffer> <Leader>< do|endif autocmd FilterWritePre * if &diff|nnoremap <buffer> <Leader>< do|endif
autocmd FilterWritePre * if &diff|nnoremap <buffer> <Leader>, do|endif
autocmd FilterWritePre * if &diff|cabbrev q! qall!|endif autocmd FilterWritePre * if &diff|cabbrev q! qall!|endif
"vimfiler "vimfiler
@ -713,7 +732,7 @@
autocmd FileType vimfiler map <buffer> ~ q autocmd FileType vimfiler map <buffer> ~ q
"}}} "}}}
"DISABLED MAPPINGS FOR FILETYPES: {{{ "MAPPINGS DISABLED FOR GIVEN FILETYPES: {{{
"remove incompatible toggles from specific file types "remove incompatible toggles from specific file types
autocmd Filetype qf,gundo,vimfiler,tagbar,extradite,help noremap <buffer> ~ <Nop> autocmd Filetype qf,gundo,vimfiler,tagbar,extradite,help noremap <buffer> ~ <Nop>
autocmd Filetype qf,vimfiler,extradite,help noremap <buffer> <C-F2> <Nop> autocmd Filetype qf,vimfiler,extradite,help noremap <buffer> <C-F2> <Nop>

View file

@ -8,6 +8,14 @@
" License: MIT " " License: MIT "
" " " "
"============================================================" "============================================================"
"
" Acknowledgements:
"
" The Tabular TableFormat() function is taken from the
" vim-markdown project by plasticboy, which can be found
" at https://github.com/plasticboy/vim-markdown and is
" licensed with the MIT license.
"
"INITIALIZE PLUGINS: {{{ "INITIALIZE PLUGINS: {{{
"create missing plugin config files and directories "create missing plugin config files and directories
@ -167,6 +175,24 @@
endif endif
"}}} "}}}
"TAGBAR: {{{
" TableFormat() for formatting markdown tables with Tabular
function! s:TableFormat()
let l:pos = getpos('.')
normal! {
" Search instead of `normal! j` because of the table at beginning of file edge case.
call search('|')
normal! j
" Remove everything that is not a pipe othewise well formated tables would grow
" because of addition of 2 spaces on the separator line by Tabularize /|.
s/[^|]//g
Tabularize /|
s/ /-/g
call setpos('.', l:pos)
endfunction
command! -buffer TableFormat call s:TableFormat()
"}}}
"TAGBAR: {{{ "TAGBAR: {{{
"autostart tagbar when vim opens to a compatible filetype (default: 0) "autostart tagbar when vim opens to a compatible filetype (default: 0)
if !exists("g:autostarttagbar") if !exists("g:autostarttagbar")