Enabled spellcheck when editing email and git commit messages, configured some formatting options, and added some key combinations to navigate with <ctrl> and select with <shift>

This commit is contained in:
Kevin 2014-03-24 17:20:35 -04:00
parent 9f5905f38f
commit 17111bdbf8
2 changed files with 57 additions and 39 deletions

View file

@ -11,6 +11,7 @@
" ds" | (N) -> delete surrounding ""
"
" Mappings:
" <Shift-MiddleClick> | (A) -> unbind this from vim so xorg can paste
" <Leader><n> | (A) -> go to the next open tab
" <Leader><p> | (A) -> go to the previous open tab
" <Tab> | (V) -> indent a block in visual mode
@ -22,14 +23,21 @@
" <F5> | (N) -> toggle line wrapping
" <F6> | (A) -> toggle visible trailing whitespace
" <F12> | (A) -> toggle collapsed/folded rows
" <Shift-p> | (V) -> paste and replace the selection
" <Shift-p> | (N) -> paste and replace the current word
" <Leader><C-f> | (N) -> format document and return to current line
" <Leader><C-w> | (N) -> remove whitespace
" <Shift-p> | (N) -> paste and replace the current word
" <Shift-p> | (V) -> paste and replace the selection
" <Ctrl-Up> | (A) -> move up a chunk of text
" <Ctrl-Down> | (A) -> move down a chunk of text
" <Shift-Left> | (N) -> move to the start of the text
" <Shift-Right> | (N) -> move to the end of the line
" <Ctrl-Up> | (N) -> move to the beginning of the document
" <Ctrl-Down> | (N) -> move to the end of the document
" <Ctrl-Right> | (N) -> move to the end of the line
" <Ctrl-Left> | (N) -> move to the beginning of the non-whitespace
" <Ctrl-\> | (N) -> move to the beginning of the line
" <Ctrl-a> | (N) -> select all
" <Shift-Up> | (N) -> select all text above the cursor
" <Shift-Down> | (N) -> select all text below the cursor
" <Shift-Right> | (N) -> select all text to the right of the cursor
" <Shift-Left> | (N) -> select to the beginning of the non-whitespace
" <Shift-\> | (N) -> select to the beginning of the line
"
" (neocomplcache)
" <Tab> | (I) -> write the part common to all suggestions
@ -50,29 +58,33 @@
"
"MAPPINGS: GENERAL KEYBINDINGS AND REBINDINGS {{{
"map shift to enable middle-click paste while being held
noremap <S-Insert> <MiddleMouse>
noremap! <S-Insert> <MiddleMouse>
"tab and untabbing selected blocks
vmap <Tab> >gv
vmap <S-Tab> <gv
vnoremap <Tab> >gv
vnoremap <S-Tab> <gv
"move to the next and previous tabs
nnoremap <silent><expr> <Leader>n ':tabn<CR>'
nnoremap <silent><expr> <Leader>p ':tabp<CR>'
nnoremap <Silent><Expr> <Leader>n ':tabn<CR>'
nnoremap <Silent><Expr> <Leader>p ':tabp<CR>'
"toggle the cursor line and column
nnoremap <silent><expr> <F3> ':set cursorline! cursorcolumn!<CR>'
nnoremap <Silent><Expr> <F3> ':set cursorline! cursorcolumn!<CR>'
"toggle the display of line numbers
nnoremap <silent><expr> <F4> ':set number!<CR>'
nnoremap <Silent><Expr> <F4> ':set number!<CR>'
"toggle line wrapping (and bottom bar if using the gui)
if !has("gui_running")
nnoremap <silent><expr> <F5> ':set wrap!<CR>'
nnoremap <Silent><Expr> <F5> ':set wrap!<CR>'
else
nnoremap <silent><expr> <F5> ':set wrap! go'.'-+'[&wrap]."=b\r"
nnoremap <Silent><Expr> <F5> ':set wrap! go'.'-+'[&wrap]."=b\r"
endif
"toggle the display of whitespace
nnoremap <silent><expr> <F6> ':set list!<CR>'
nnoremap <Silent><Expr> <F6> ':set list!<CR>'
"toggle folded code at foldpoints
inoremap <F12> <C-O>za
@ -80,40 +92,43 @@
onoremap <F12> <C-C>za
vnoremap <F12> zf
"map shift-p to paste and replace the current word or selection
vnoremap <S-p> "_d"0P
nnoremap <S-p> "_diwP
"format document then return to current line
nnoremap <Leader><C-f> mzgg=G`z<CR>
"remove trailing white space
nnoremap <silent><expr> <Leader><C-w> ':FixWhitespace<CR>'
nnoremap <Silent><Expr> <Leader><C-w> ':FixWhitespace<CR>'
"map shift to enable middle-click paste while being held
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
"remap keys to scroll through text
nnoremap <C-Up> gg0
nnoremap <C-Down> G$
nnoremap <C-Right> $
nnoremap <C-Left> ^
nnoremap <C-\> 0
"map shift-p to paste and replace the current word or selection
nnoremap <S-p> "_diwP
vnoremap <S-p> "_d"0P
"map ctrl-up/down to moving up/down by a block of text
map <C-Up> <C-U>
map <C-Down> <C-D>
"map shift-left/right to move to the start/end of the line's text
nmap <S-Left> ^
nmap <S-Right> $
"map remap keys to select text
nnoremap <C-a> ggvG
nnoremap <S-Up> vgg0
nnoremap <S-Down> vG$
nnoremap <S-Right> v$
nnoremap <S-Left> v^
nnoremap <S-\> v0
"}}}
"PLUGIN KEYBINDINGS {{{
"toggle the nerd tree sidebar
nnoremap <silent><expr> <F1> ':NERDTree<CR>'
nnoremap <Silent><Expr> <F1> ':NERDTree<CR>'
"toggle the tagbar sidebar
nnoremap <silent><expr> <F2> ':TagbarToggle<CR>'
nnoremap <Silent><Expr> <F2> ':TagbarToggle<CR>'
"neocomplcache suggestions: cancel, autocomplete, scroll up and scroll down
inoremap <expr><Tab> pumvisible() ? neocomplcache#complete_common_string() : "\<Tab>"
inoremap <expr><Backspace> pumvisible() ? neocomplcache#close_popup() : "\<Backspace>"
inoremap <expr><Leader><Backspace> neocomplcache#undo_completion()
inoremap <Expr><Tab> pumvisible() ? neocomplcache#complete_common_string() : "\<Tab>"
inoremap <Expr><Backspace> pumvisible() ? neocomplcache#close_popup() : "\<Backspace>"
inoremap <Expr><Leader><Backspace> neocomplcache#undo_completion()
"emmet switch triggerkey from <Ctrl-Y> to <Ctrl-Z>
let g:user_emmet_leader_key='<C-Z>'
@ -130,9 +145,9 @@
"GVIM: MAPPINGS FOR GUI ELEMENTS {{{
"map toggles for the menu, toolbar and scrollbar
noremap <silent><expr> <C-F1> ":if &go=~#'m'<Bar>set go-=m<Bar>else<Bar>set go+=m<Bar>endif<CR>"
noremap <silent><expr> <C-F2> ":if &go=~#'T'<Bar>set go-=T<Bar>else<Bar>set go+=T<Bar>endif<CR>"
noremap <silent><expr> <C-F3> ":if &go=~#'r'<Bar>set go-=r<Bar>else<Bar>set go+=r<Bar>endif<CR>"
noremap <Silent><Expr> <C-F1> ":if &go=~#'m'<Bar>set go-=m<Bar>else<Bar>set go+=m<Bar>endif<CR>"
noremap <Silent><Expr> <C-F2> ":if &go=~#'T'<Bar>set go-=T<Bar>else<Bar>set go+=T<Bar>endif<CR>"
noremap <Silent><Expr> <C-F3> ":if &go=~#'r'<Bar>set go-=r<Bar>else<Bar>set go+=r<Bar>endif<CR>"
"}}}
"ALIASES: COMMAND SHORTCUTS {{{

View file

@ -19,10 +19,13 @@
filetype plugin indent on
syntax on "turn syntax highlighting on
set foldmethod=syntax foldcolumn=1 foldlevel=8 "configure how folding code works
set formatoptions=roqnl12 "configure format options
"}}}
"FILETYPES: SETTINGS SPECIFIC TO A FILETYPE {{{
au BufNewFile,BufRead *.txt set spell "enable spellcheck for text files (*.txt)
au FileType mail setl spell "enable spellcheck for e-mail (mutt)
au FileType gitcommit setl spell "enable spellcheck in git commits
au BufNewFile,BufRead *.txt setl spell "enable spellcheck for text files (*.txt)
au BufNewFile,BufRead *tmux.conf setf sh "set syntax for *tmux.conf to sh (bash)
au BufNewFile,BufRead pacman.conf setf sh "set syntax for *tmux.conf to sh (bash)
au BufNewFile,BufRead yaourtrc setf sh "set syntax for *tmux.conf to sh (bash)