Skip to content

Instantly share code, notes, and snippets.

@skyriverbend
Created March 13, 2012 00:24
Show Gist options
  • Save skyriverbend/2025633 to your computer and use it in GitHub Desktop.
Save skyriverbend/2025633 to your computer and use it in GitHub Desktop.
vim janus "~/.vimrc.after" file. nice customizations
color jellybeans
let mapleader = ","
nnoremap j gj
nnoremap k gk
" Indent using tabs (while in visual mode)
vnoremap <tab> >gv
vnoremap <s-tab> <gv
vnoremap < <gv
vnoremap > >gv
" Search only in the selected block (visual mode)
vnoremap / <esc>/\%V
" Easy buffer navigation with Mac option keys
" opt-j, opt-h, opt-k, opt-l , respectively
map <C-t> :CtrlP<cr>
map <leader>v <C-w>v<C-w>l:CtrlP<cr>
map <leader>h <C-w>s<C-w>j:CtrlP<cr>
map <leader>s <C-w>s<C-w>j:CtrlP<cr>
map <leader>++ 100<C-w>+<Cr>
map <leader>== <C-w>=<Cr>
" Toggle line-numbering
" nn <leader>n <esc>:set number! number?<cr>
" Nerd Tree
nmap <leader>d :NERDTreeToggle<cr>
nmap <leader>O :NERDTreeFind<cr>
" nmap <leader>y :CommandTFlush<cr>
"split window movements
map <C-j> <C-w>j
map <C-h> <C-w>h
map <C-k> <C-w>k
map <C-l> <C-w>l
map <leader>r :!bundle exec rspec --no-color %<CR>
"map <leader>s :!spec %<CR>
"map <leader>c :!cucumber --require features --no-color %<CR>
"map <leader>g <C-w>f
" Inser New Line **************************************************************
map <S-Enter> O<ESC> " awesome, inserts new line without going into insert mode
map <Enter> o<ESC>
inoremap ;; <ESC>
" Strip trailing whitespace (after save?)
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment