Skip to content

Instantly share code, notes, and snippets.

@heronmedeiros
Created August 14, 2012 14:19
Show Gist options
  • Save heronmedeiros/3349675 to your computer and use it in GitHub Desktop.
Save heronmedeiros/3349675 to your computer and use it in GitHub Desktop.
vimrc ubuntu
source /home/heron/.vim/vimrc
"Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
"Map \s as show git status
nmap <leader>s :Gstatus<CR>
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬,trail:-
set mouse=a
set list
set ttymouse=xterm2
set runtimepath^=~/.vim/bundle/ctrlp.vim
"show highligh on active line
set cul
" Forcing the use of hjkl keys to navigate
noremap <Up> <nop>
noremap <Down> <nop>
noremap <Left> <nop>
noremap <Right> <nop>
inoremap <Up> <nop>
inoremap <Down> <nop>
inoremap <Left> <nop>
inoremap <Right> <nop>
set guifont=Monospace\ Bold\ 12
map <C-m> <esc><C-w>_<esc><C-w>|
map <C-M> <esc><C-w>=
" Show syntax highlighting groups for word under cursor
nmap <C-S-P> :call <SID>SynStack()<CR>
function! <SID>SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
if exists('*HexHighlight()')
nmap <leader>h :call HexHighlight()<Return>
endif
"transform two lines in ruby into one
" a = 10
" b = 20
" becomes
" a, b = 10, 20
map <leader>q Jevbxbbi,<esc>peeer,
"call another tab with CtrlP active
map <leader>t :tabnew<CR><C-t>
" Execute open rspec buffer
" Thanks to Ian Smith-Heisters
function! RunSpec(args)
if exists("b:rails_root") && filereadable(b:rails_root . "/script/spec")
let spec = b:rails_root . "/script/spec"
else
let spec = "rspec"
end
let cmd = ":! " . spec . " % -cfn " . a:args
execute cmd
endfunction
" Mappings
" run one rspec example or describe block based on cursor position
map <leader>s :call RunSpec("-l " . <C-r>=line('.')<CR>)
" run full rspec file
map <leader>S :call RunSpec("")
imap <c-l> <space>=><space>
map <C-h> <C-w>h :vertical resize 100<CR>
"map <C-j> <C-w>j :vertical resize 100<CR>
"map <C-k> <C-w>k :vertical resize 100<CR>
map <C-l> <C-w>l :vertical resize 100<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment