Improve some keymaps, instead of overriding standard keys.

Added many convenience mappings for LustyJuggler such as
,lm for rails models, ,lc for controllers, etc
This commit is contained in:
yan 2011-12-12 20:42:54 -08:00 committed by Yan Pritzker
parent 41c6546332
commit 2d8f106d43
10 changed files with 86 additions and 35 deletions

View File

@ -130,7 +130,7 @@ TODO: these customizations will be extracted into a separate keybinding plugin s
* F - instantly Find definition of class (must have exuberant ctags installed) * F - instantly Find definition of class (must have exuberant ctags installed)
* B - show buffers (LustyJuggler buffer search), just type to fuzzy match a buffer name * B - show buffers (LustyJuggler buffer search), just type to fuzzy match a buffer name
* S - Show buffers in LustyJuggler (use asdfjkl home row keys to then select buffer) * S - Show buffers in LustyJuggler (use asdfjkl home row keys to then select buffer)
* \t - Tag list (list of methods in a class) * ,T - Tag list (list of methods in a class)
* 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
@ -168,7 +168,7 @@ Included vim plugins
* ShowMarks - creates a visual gutter to the left of the number column showing you your marks (saved locations). use \mt to toggle it, \mm to place the next available mark, \mh to delete, \ma to clear all. Use standard vim mark navigation ('X) for mark named X. * ShowMarks - creates a visual gutter to the left of the number column showing you your marks (saved locations). use \mt to toggle it, \mm to place the next available mark, \mh to delete, \ma to clear all. Use standard vim mark navigation ('X) for mark named X.
* EasyMotion - hit ,, (forward) or z,, (back) and watch the magic happen. just type the letters and jump directly to your target - in the provided vimrc the keys are optimized for home and upper row, no pinkies * EasyMotion - hit ,, (forward) or z,, (back) and watch the magic happen. just type the letters and jump directly to your target - in the provided vimrc the keys are optimized for home and upper row, no pinkies
* LustyJuggler/Explorer - hit B, type buf name to match a buffer, or type S and use the home row keys to select a buffer * LustyJuggler/Explorer - hit B, type buf name to match a buffer, or type S and use the home row keys to select a buffer
* TagList - hit T to see a list of methods in a class (uses ctags) * TagList - hit ,T to see a list of methods in a class (uses ctags)
* CommandT - although I personally use PeepOpen, this is available as it's pretty standard * CommandT - although I personally use PeepOpen, this is available as it's pretty standard
Git Git

View File

@ -0,0 +1,5 @@
" Auto open nerd tree on startup
let g:nerdtree_tabs_open_on_gui_startup = 1
" Focus in the main content window
let g:nerdtree_tabs_focus_on_files = 1

View File

@ -2,4 +2,3 @@
let NERDTreeMinimalUI = 1 let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1 let NERDTreeDirArrows = 1
let g:NERDTreeWinSize = 30 let g:NERDTreeWinSize = 30

View File

@ -12,3 +12,11 @@ call EasyMotion#InitOptions({
\ , 'hl_group_target' : 'Question' \ , 'hl_group_target' : 'Question'
\ , 'hl_group_shade' : 'EasyMotionShade' \ , 'hl_group_shade' : 'EasyMotionShade'
\ }) \ })
" Use EasyMotion by double tapping comma
nmap <silent> ,, \\w
" Use EasyMotion backwards by z,,
nmap <silent> z,, \\b
" Make EasyMotion more yellow, less red
hi clear EasyMotionTarget
hi! EasyMotionTarget guifg=yellow

View File

@ -2,8 +2,32 @@
" ======================================== " ========================================
" better triggers for buffer switching " better triggers for buffer switching
" B to use the a/s/d/f juggler, S to search the buffers " B to use the a/s/d/f juggler, S to search the buffers
nmap <silent> B \lj nmap <silent> ,b \lj
nmap <silent> S \lb nmap <silent> ,s \lb
" Remap using comma for the leader
" lusty file explorer
nmap <silent> ,lf \lf
" lusty file explorer from current location
nmap <silent> ,lr \lr
" lusty buffer juggler (alternative mapping)
nmap <silent> ,lb \lb
" lusty buffer juggler (alternative mapping)
nmap <silent> ,lj \lj
"idea from : http://www.charlietanksley.net/blog/blog/2011/10/18/vim-navigation-with-lustyexplorer-and-lustyjuggler/
" open lusty file explorer from specific rails-friendly places
map ,lm :LustyFilesystemExplorer app/models<CR>
map ,lc :LustyFilesystemExplorer app/controllers<CR>
map ,lv :LustyFilesystemExplorer app/views<CR>
map ,lh :LustyFilesystemExplorer app/helpers<CR>
map ,ll :LustyFilesystemExplorer lib<CR>
map ,lp :LustyFilesystemExplorer public<CR>
map ,ls :LustyFilesystemExplorer specs<CR>
map ,lt :LustyFilesystemExplorer test<CR>
let g:LustyJugglerSuppressRubyWarning = 1 let g:LustyJugglerSuppressRubyWarning = 1
let g:LustyJugglerAltTabMode = 1 let g:LustyJugglerAltTabMode = 1

View File

@ -3,7 +3,16 @@
let g:neocomplcache_enable_at_startup = 1 let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_enable_camel_case_completion = 1 let g:neocomplcache_enable_camel_case_completion = 1
let g:neocomplcache_enable_underbar_completion = 1 let g:neocomplcache_enable_underbar_completion = 1
let g:neocomplcache_min_syntax_length = 5 let g:neocomplcache_enable_smart_case = 1
" default # of completions is 100, that's crazy
let g:neocomplcache_max_list = 5
" words less than 3 letters long aren't worth completing
let g:neocomplcache_auto_completion_start_length = 3
" tab completion (from neocomplcache docs)
imap <expr><TAB> neocomplcache#sources#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : pumvisible() ? "\<C-n>" : "\<TAB>"
" Choose completions using Apple-Space " Choose completions using Apple-Space
inoremap <expr><D-Space> pumvisible() ? "\<C-n>" : "\<TAB>" inoremap <expr><D-Space> pumvisible() ? "\<C-n>" : "\<TAB>"

View File

@ -5,6 +5,8 @@
" alias yw to yank the entire word even if the " alias yw to yank the entire word even if the
" cursor is inside the word " cursor is inside the word
nnoremap yw yaw nnoremap yw yaw
"make Y consistent with C and D
nnoremap Y y$
" ======================================== " ========================================
" RSI Prevention - keyboard remaps " RSI Prevention - keyboard remaps
@ -44,12 +46,12 @@ imap <D-/> <Esc>:TComment<CR>i
nnoremap ,gg :GitGrep " nnoremap ,gg :GitGrep "
nnoremap ,gcp :GitGrepCurrentPartial<CR> nnoremap ,gcp :GitGrepCurrentPartial<CR>
" hit F to find the definition of the current class " hit ,f to find the definition of the current class
" this uses ctags. the standard way to get this is Ctrl-] " this uses ctags. the standard way to get this is Ctrl-]
nnoremap <silent> F <C-]> nnoremap <silent> ,f <C-]>
"toggle between last two buffers with Z (normally ctrl-shift-6) "toggle between last two buffers with Z (normally ctrl-shift-6)
nnoremap <silent> Z <C-^> nnoremap <silent> ,z <C-^>
"git grep the current word using K (mnemonic Kurrent) "git grep the current word using K (mnemonic Kurrent)
nnoremap <silent> K :GitGrep <cword><CR> nnoremap <silent> K :GitGrep <cword><CR>
@ -74,8 +76,8 @@ nnoremap <silent> Q <C-w>c
" Use \Q to kill the buffer entirely " Use \Q to kill the buffer entirely
nnoremap <silent> <Leader>Q :bw<CR> nnoremap <silent> <Leader>Q :bw<CR>
"open the taglist (method browser) using \t "open the taglist (method browser) using ,t
nnoremap <silent> <Leader>t :TlistToggle<CR> nnoremap <silent> ,T :TlistToggle<CR>
" create <%= foo %> erb tags using Ctrl-k in edit mode " create <%= foo %> erb tags using Ctrl-k in edit mode
imap <silent> <C-K> <%= %><Esc>3hi imap <silent> <C-K> <%= %><Esc>3hi

View File

@ -8,3 +8,5 @@ hi! link rubyDefine rubyControl
" the currently selected buffer. " the currently selected buffer.
hi clear Question hi clear Question
hi! Question guifg=yellow hi! Question guifg=yellow
hi! link TagListFileName Question

View File

@ -0,0 +1,10 @@
" https://github.com/carlhuda/janus/blob/master/vimrc
" Unimpaired configuration
" Bubble single lines
nmap <C-Up> [e
nmap <C-Down> ]e
" Bubble multiple lines
vmap <C-Up> [egv
vmap <C-Down> ]egv

40
vimrc
View File

@ -1,17 +1,13 @@
"Use Vim settings, rather then Vi settings (much better!).
"This must be first, because it changes other options as a side effect.
set nocompatible
" Use tpope's pathogen plugin to manage all other plugins " Use tpope's pathogen plugin to manage all other plugins
runtime bundle/tpope-vim-pathogen/autoload/pathogen.vim runtime bundle/tpope-vim-pathogen/autoload/pathogen.vim
call pathogen#infect() call pathogen#infect()
call pathogen#helptags() call pathogen#helptags()
"Use Vim settings, rather then Vi settings (much better!). set number " Line numbers are good
"This must be first, because it changes other options as a side effect.
set nocompatible
" Line numbers are good
set number
" I don't like code folding
set nofoldenable
"allow backspacing over everything in insert mode "allow backspacing over everything in insert mode
set backspace=indent,eol,start set backspace=indent,eol,start
@ -92,8 +88,6 @@ syntax on
set mouse=a set mouse=a
set ttymouse=xterm2 set ttymouse=xterm2
" Dont worry about the name. What this does is allow Vim to manage multiple buffers effectively.
"
" The current buffer can be put to the background without writing to disk; " The current buffer can be put to the background without writing to disk;
" When a background buffer becomes current again, marks and undo-history are remembered. " When a background buffer becomes current again, marks and undo-history are remembered.
" Turn this on. " Turn this on.
@ -102,25 +96,23 @@ set hidden
" Make it beautiful - colors and fonts " Make it beautiful - colors and fonts
if has("gui_running") if has("gui_running")
"tell the term has 256 colors "tell the term has 256 colors
set t_Co=256 set t_Co=256
" http://ethanschoonover.com/solarized/vim-colors-solarized " http://ethanschoonover.com/solarized/vim-colors-solarized
colorscheme solarized colorscheme solarized
set background=dark set background=dark
set guitablabel=%M%t set guitablabel=%M%t
set lines=60 set lines=60
set columns=190 set columns=190
set guifont=Inconsolata:h20,Monaco:h17 set guifont=Inconsolata:h20,Monaco:h17
else else
"dont load csapprox if we no gui support - silences an annoying warning "dont load csapprox if we no gui support - silences an annoying warning
let g:CSApprox_loaded = 1 let g:CSApprox_loaded = 1
endif endif
"make Y consistent with C and D
nnoremap Y y$
" automaticaly reload files changed outside of vim " automaticaly reload files changed outside of vim
set autoread set autoread