From 32d28b393da89b02494c3f65f8fe2f9691ea444b Mon Sep 17 00:00:00 2001 From: Tony Duckles Date: Sun, 1 Sep 2013 14:56:00 -0500 Subject: [PATCH] .vimrc: Cleanup mappings section --- .vimrc | 152 +++++++++++++++++++++++++++------------------------------ 1 file changed, 71 insertions(+), 81 deletions(-) diff --git a/.vimrc b/.vimrc index dabda49..f4aeacb 100644 --- a/.vimrc +++ b/.vimrc @@ -169,44 +169,6 @@ endif " Mappings " ---------------------------------------------------------------------------- -let mapleader = "," - -" to turn off highlighting and clear any message already displayed. -nnoremap :nohlsearch:echo - -" to pastetoggle, to turn-off autoindent when pasting from system clipboard -nnoremap :set paste! paste? -set pastetoggle= - -" to toggle NERDTreee -let NERDTreeShowHidden=1 " show dotfiles by default -noremap :NERDTreeToggle - -" to toggle Gundo -nnoremap :GundoToggle - -" to toggle spell-check -nnoremap :setlocal spell! spelllang=en_us spell? -inoremap :setlocal spell! spelllang=en_us spell? - -" Ctrl-P -let g:ctrlp_map = '' -let g:ctrlp_show_hidden = 1 -noremap o :CtrlP -noremap O :CtrlP -noremap m :CtrlPBuffer - -" make Y consistent with C (c$) and D (d$) -nnoremap Y y$ - -" disable default vim regex handling for searching -nnoremap / /\v -vnoremap / /\v - -" reflow paragraph with Q in normal and visual mode -nnoremap Q gqap -vnoremap Q gq - " movement based on display lines not physical lines (sane movement with wrap turned on) nnoremap j gj nnoremap k gk @@ -218,72 +180,100 @@ vnoremap gj vnoremap gk inoremap gj inoremap gk - -" do not menu with left / right in command line -cnoremap -cnoremap - " buffer navigation nnoremap :bnext nnoremap :bprev - -" easier split-window movement +" easier moving cursor between split-windows nnoremap h nnoremap j nnoremap k nnoremap l +" do not menu with left / right in command line +cnoremap +cnoremap +" reflow paragraph with Q in normal and visual mode +nnoremap Q gqap +vnoremap Q gq +" make Y consistent with C (c$) and D (d$) +nnoremap Y y$ +" disable default vim regex handling for searching +nnoremap / /\v +vnoremap / /\v " reselect visual block after indent/outdent vnoremap < >gv -" quickly edit/reload vimrc -nmap ev :edit $MYVIMRC -nmap sv :source $MYVIMRC +" to turn off highlighting and clear any message already displayed. +nnoremap :nohlsearch:echo +" to pastetoggle, to turn-off autoindent when pasting from system clipboard +nnoremap :set paste! paste? +" to toggle NERDTree +nnoremap :NERDTreeToggle +" to toggle Gundo +nnoremap :GundoToggle +" to toggle spell-check +nnoremap :setlocal spell! spelllang=en_us spell? +inoremap :setlocal spell! spelllang=en_us spell? +" leader-based keyboard shortcuts +let mapleader = "," +" CtrlP +nmap b :CtrlPBuffer +nmap o :CtrlP +nmap O :CtrlPClearCache:CtrlP +" NERDTree +nmap d :NERDTreeToggle +nmap f :NERDTreeFind +" Fugitive (Git) +nmap gb :Gblame +nmap gs :Gstatus +nmap gd :Gdiff +nmap gl :Glog +nmap gc :Gcommit +nmap gp :Gpush +" cd to the directory containing the file in the buffer +nmap cd :lcd %:h +" toggle diffmode for a buffer +nmap df :call DiffToggle() +function! DiffToggle() + if &diff + diffoff + else + diffthis + endif +endfunction +" quickly edit/reload vimrc +nmap ev :edit $MYVIMRC +nmap sv :source $MYVIMRC +" find merge conflict markers +nmap fc /\v^[<=>]{7}( .*\|$) +" toggle hlsearch +nmap hs :set hlsearch! hlsearch? " upper/lower word nmap u mQviwU`Q nmap l mQviwu`Q - " upper/lower first char of word nmap U mQgewvU`Q nmap L mQgewvu`Q - -" cd to the directory containing the file in the buffer -nmap cd :lcd %:h - +" strip all trailing whitespace in file +nmap s :%s/\s\+$// +" toggle spell-check +nmap sp :setlocal spell! spelllang=en_us spell? " set text wrapping toggles -nmap tw :set wrap! wrap? - +nmap tw :set wrap! wrap? " set list-whitespace-chars toggle -nmap ws :set list! list? +nmap ws :set list! list? -" find merge conflict markers -nmap fc /\v^[<=>]{7}( .*\|$) - -" toggle hlsearch with hs -nmap hs :set hlsearch! hlsearch? - -" strip all trailing whitespace in file -nmap s :%s/\s\+$// +" ---------------------------------------------------------------------------- +" Plugin Settings +" ---------------------------------------------------------------------------- -" toggle diffmode for a buffer -function! DiffToggle() - if &diff - diffoff - else - diffthis - endif -endfunction -nnoremap df :call DiffToggle() - -" Git (Fugitive) support -nmap gb :Gblame -nmap gs :Gstatus -nmap gd :Gdiff -nmap gl :Glog -nmap gc :Gcommit -nmap gp :Gpush +" NERDTree +let NERDTreeShowHidden=1 " show dotfiles by default +" Ctrl-P +let g:ctrlp_map = '' +let g:ctrlp_show_hidden = 1 " ---------------------------------------------------------------------------- " Auto Commands -- 2.45.2