Commit 5d321ed

mo khan <mo@mokhan.ca>
2013-08-11 13:58:47
add mappings from http://learnvimscriptthehardway.stevelosh.com/chapters/16.html
1 parent 07a0d7f
Changed files (1)
vimrc
@@ -41,8 +41,8 @@ set smartcase   " ... unless they contain at least one capital letter
 "" Wild settings
 ""
 
-" TODO: Investigate the precise meaning of these settings
-" set wildmode=list:longest,list:full
+set wildmenu
+set wildmode=list:longest
 
 " Disable output and VCS files
 set wildignore+=*.o,*.out,*.obj,.git,*.rbc,*.rbo,*.class,.svn,*.gem
@@ -59,12 +59,15 @@ set wildignore+=*/tmp/cache/assets/*/sprockets/*,*/tmp/cache/assets/*/sass/*
 " Disable temp and backup files
 set wildignore+=*.swp,*~,._*
 
+" Ignore tmp folder, so files and coverage directory.
+set wildignore+=*/tmp/*,*.so,*/coverage/*
+
 ""
 "" Backup and swap files
 ""
 
 set backupdir^=~/.vim/_backup//    " where to put backup files.
-set directory^=~/.vim/_temp//      " where to put swap files.
+set directory^=~/.vim/_tmp//       " where to put swap files.
 
 ""
 "" Helpers
@@ -105,6 +108,7 @@ if has("autocmd")
   au FileType python setlocal softtabstop=4 tabstop=4 shiftwidth=4
 
   au BufRead,BufNewFile {*.handlebars,*.hbs} set ft=handlebars syntax=handlebars
+
   " Remember last location in file, but not for commit messages.
   " see :help last-position-jump
   au BufReadPost * if &filetype !~ '^git\c' && line("'\"") > 0 && line("'\"") <= line("$")
@@ -308,9 +312,6 @@ set laststatus=2
 set showcmd
 set showmode
 set hidden
-set wildmenu
-set wildmode=list:longest
-set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/coverage/*
 set cursorline
 set ttyfast
 set backspace=indent,eol,start
@@ -347,6 +348,17 @@ nnoremap <localleader>n :NERDTreeClose<cr>
 nnoremap <leader>t :!rspec %<cr>
 nnoremap <space> za
 vnoremap <space> zf
+" operator pending movement (cp -> change inside parens)
+onoremap p i(
+onoremap b /end<cr>
+" inside parens ie. cin(
+onoremap in( :<c-u>normal! f(vi(<cr>
+" inside last parens ie. cil(
+onoremap il( :<c-u>normal! F)vi(<cr>
+" inside markdown heading
+onoremap ih :<c-u>execute "normal! ?^==\\+$\r:nohlsearch\rkvg_"<cr>
+" around markdown heading
+onoremap ah :<c-u>execute "normal! ?^==\\+$\r:nohlsearch\rg_vk0"<cr>
 
 " surround with "
 nnoremap <leader>" viw<esc>a"<esc>hbi"<esc>lel