Improving keybindings to not interfere with standard things

This commit is contained in:
yan
2011-12-15 22:20:51 -08:00
committed by Yan Pritzker
parent 9dcae00026
commit a55c338cdf
2 changed files with 54 additions and 27 deletions

View File

@@ -134,10 +134,13 @@ files contain key mappings as well (TODO: probably will move them out to skwp-ke
Navigation Navigation
* ,f - instantly Find definition of class (must have exuberant ctags installed) * ,f - instantly Find definition of class (must have exuberant ctags installed)
* Ctrl-j and Ctrl-k to move up and down roughly by functions
* Ctrl-\ - Show NerdTree (project finder) and expose current file
* ,, or z,, - use EasyMotion - type that and then type one of the highlighted letters.
* ,z - jump back and forth between last two buffers * ,z - jump back and forth between last two buffers
* ,, or z,, - use EasyMotion - type that and then type one of the highlighted letters.
* Ctrl-j and Ctrl-k to move up and down roughly by functions
* Ctrl-\ - Show current file in nerd tree
* Ctrl-O - Old cursor position - this is a standard mapping but very useful, so included here
* Ctrl-I - opposite of Ctrl-O (again, this is standard)
LustyJuggler LustyJuggler
@@ -148,14 +151,15 @@ files contain key mappings as well (TODO: probably will move them out to skwp-ke
Rails Rails
* \ss to run specs, \ll to run a given spec on a line - using my vim-ruby-conque plugin (https://github.com/skwp/vim-ruby-conque) * ,ru - Rails Unittest - synonym for :AV from rails.vim, opens up the corresponding test/spec to the file you're looking for, in a vertical split
* ,lm ,lc ,ls - rails specific lusty juggler file finders (models, controllers, specs, etc) - just use the letter for what you want after ,l * ,lm ,lc ,ls - rails specific lusty juggler file finders (models, controllers, specs, etc) - just use the letter for what you want after ,l
* \ss to run specs, \ll to run a given spec on a line - using my vim-ruby-conque plugin (https://github.com/skwp/vim-ruby-conque)
Search Search
* Cmd-* - highlight all occurrences of current word (similar to regular * except doesn't move) * Cmd-* - highlight all occurrences of current word (similar to regular * except doesn't move)
* ,hl - toggle search highlight on and off * ,hl - toggle search highlight on and off
* K - git grep for the Kurrent word under the cursor * ,gcw - GitGrep the current word under the cursor
* ,gg - GitGrep command line with a quote pretyped (close the quote yourself) * ,gg - GitGrep command line with a quote pretyped (close the quote yourself)
* ,gcp - GitGrep Current Partial to find references to the current view partial * ,gcp - GitGrep Current Partial to find references to the current view partial
* // - clear the search * // - clear the search
@@ -168,7 +172,7 @@ files contain key mappings as well (TODO: probably will move them out to skwp-ke
RSI-reduction RSI-reduction
* Cmd-k and Cmd-d to type underscores and dashes (use ), since they are so common in code but so far away from home row * Cmd-k and Cmd-d to type underscores and dashes (use ), since they are so common in code but so far away from home row
* W - write a file (instead of :w, saving you keystrokes for the most common vim operation) * ; instead of : - avoid Shift for common tasks, just hit semicolon to get to ex mode
Buffer/Window Manipulation Buffer/Window Manipulation
@@ -176,12 +180,17 @@ files contain key mappings as well (TODO: probably will move them out to skwp-ke
* \Q - Kill a buffer completely (normally :bw) * \Q - Kill a buffer completely (normally :bw)
* vv and ss - vertical and horizontal split windows by double tapping * vv and ss - vertical and horizontal split windows by double tapping
* H,L,I,M - to move left, right, up, down between windows * H,L,I,M - to move left, right, up, down between windows
* Cmd-H and Cmd-L - left an right on tabs
* Use Cmd-1..Cmd-0 to switch to a specific tab number (like iTerm)
Convenience Utility
* cf - Copy Filename of current file into system (not vi) paste buffer * ,cf - Copy Filename of current file into system (not vi) paste buffer
* Cc - (Current command) copies the command under your cursor and executes it in vim. Great for testing single line changes to vimrc. * ,cc - (Current command) copies the command under your cursor and executes it in vim. Great for testing single line changes to vimrc.
* gcc (comment a line) via tComment, and gcp custom alias to comment a paragraph * ,yw - yank a word from anywhere within the word (so you don't have to go to the beginning of it)
* ,ow - overwrite a word with whatever is in your yank buffer - you can be anywhere on the word. saves having to visually select it
* gcc (comment a line) via tComment (standard)
* gcp (comment a paragraph) added
* ,t - Command-T fuzzy file selector (alternative to PeepOpen / LustyJuggler) * ,t - Command-T fuzzy file selector (alternative to PeepOpen / LustyJuggler)
Included vim plugins Included vim plugins

View File

@@ -2,9 +2,15 @@
" General vim sanity improvements " General vim sanity improvements
" ======================================== " ========================================
" "
" alias yw to yank the entire word even if the " alias yw to yank the entire word 'yank inner word'
" cursor is inside the word " even if the cursor is halfway inside the word
nnoremap yw yaw " FIXME: will not properly repeat when you use a dot (tie into repeat.vim)
nnoremap ,yw yiww
" ,ow = 'overwrite word', replace a word with what's in the yank buffer
" FIXME: will not properly repeat when you use a dot (tie into repeat.vim)
nnoremap ,ow viwp
"make Y consistent with C and D "make Y consistent with C and D
nnoremap Y y$ nnoremap Y y$
@@ -24,16 +30,13 @@ imap <silent> <D-d> _
imap <silent> <D-K> - imap <silent> <D-K> -
imap <silent> <D-D> - imap <silent> <D-D> -
" alias W to write the file instead of :w
nnoremap W :w<CR>
" Don't have to use Shift to get into command mode, just hit semicolon " Don't have to use Shift to get into command mode, just hit semicolon
nnoremap ; : nnoremap ; :
" ================== rails.vim " ================== rails.vim
" "
" Open corresponding unit test/spec in a vertical split " Open corresponding unittest (or spec), alias for :AV in rails.vim
nmap ,rt :AV<CR> nmap ,ru :AV<CR>
" ==== NERD tree " ==== NERD tree
nmap ,n :NERDTreeToggle<CR> nmap ,n :NERDTreeToggle<CR>
@@ -72,6 +75,22 @@ nnoremap <silent> L <C-w>l
nnoremap <silent> I <C-w>k nnoremap <silent> I <C-w>k
nnoremap <silent> M <C-w>j nnoremap <silent> M <C-w>j
" Move between tabs with Cmd-Shift-H and Cmd-Shift-L
map <silent> <D-H> :tabprevious<cr>
map <silent> <D-L> :tabnext<cr>
" Use numbers to pick the tab you want (like iTerm)
map <silent> <D-1> :tabn 1<cr>
map <silent> <D-2> :tabn 2<cr>
map <silent> <D-3> :tabn 3<cr>
map <silent> <D-4> :tabn 4<cr>
map <silent> <D-5> :tabn 5<cr>
map <silent> <D-6> :tabn 6<cr>
map <silent> <D-7> :tabn 7<cr>
map <silent> <D-8> :tabn 8<cr>
map <silent> <D-9> :tabn 9<cr>
map <silent> <D-0> :tabn 0<cr>
" Create window splits easier. The default " Create window splits easier. The default
" way is Ctrl-w,v and Ctrl-w,s. I remap " way is Ctrl-w,v and Ctrl-w,s. I remap
" this to vv and ss " this to vv and ss
@@ -99,16 +118,16 @@ imap <silent> <C-J> <% %><Esc>2hi
" copy current filename into system clipboard - mnemonic: (c)urrent(f)ilename " copy current filename into system clipboard - mnemonic: (c)urrent(f)ilename
" this is helpful to paste someone the path you're looking at " this is helpful to paste someone the path you're looking at
nnoremap <silent> cf :let @* = expand("%:p")<CR> nnoremap <silent> ,cf :let @* = expand("%:p")<CR>
"Clear current search highlight by double tapping // "Clear current search highlight by double tapping //
nmap <silent> // :nohlsearch<CR> nmap <silent> // :nohlsearch<CR>
" (C)opy (c)ommand - which allows us to execute " (c)opy (c)ommand - which allows us to execute
" the line we're looking at (it does so by yy-copy, colon " the line we're looking at (it does so by yy-copy, colon
" to get to the command mode, C-f to get to history editing " to get to the command mode, C-f to get to history editing
" p to paste it, C-c to return to command mode, and CR to execute " p to paste it, C-c to return to command mode, and CR to execute
nmap <silent> Cc yy:<C-f>p<C-c><CR> nmap <silent> ,cc yy:<C-f>p<C-c><CR>
" Type ,hl to toggle highlighting on/off, and show current value. " Type ,hl to toggle highlighting on/off, and show current value.
noremap ,hl :set hlsearch! hlsearch?<CR> noremap ,hl :set hlsearch! hlsearch?<CR>
@@ -117,10 +136,6 @@ noremap ,hl :set hlsearch! hlsearch?<CR>
" http://vim.wikia.com/wiki/Highlight_all_search_pattern_matches " http://vim.wikia.com/wiki/Highlight_all_search_pattern_matches
nnoremap <D-*> :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR> nnoremap <D-*> :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR>
" After repeating a command, return the cursor to where it started
" http://vim.wikia.com/wiki/VimTip1142
nmap . .`[
" These are very similar keys. Typing 'a will jump to the line in the current " These are very similar keys. Typing 'a will jump to the line in the current
" file marked with ma. However, `a will jump to the line and column marked " file marked with ma. However, `a will jump to the line and column marked
" with ma. Its more useful in any case I can imagine, but its located way " with ma. Its more useful in any case I can imagine, but its located way
@@ -129,5 +144,8 @@ nmap . .`[
nnoremap ' ` nnoremap ' `
nnoremap ` ' nnoremap ` '
" Abbreviations to use...snippets that are expanded with space " ============================
" Abbreviations to use...
" ============================
" snippets that are expanded with space
abbr pry! require 'pry'; binding.pry abbr pry! require 'pry'; binding.pry