Skip to content

Instantly share code, notes, and snippets.

@christian-marie
Created October 25, 2013 03:05
Show Gist options
  • Save christian-marie/7148875 to your computer and use it in GitHub Desktop.
Save christian-marie/7148875 to your computer and use it in GitHub Desktop.
set textwidth=79
set formatoptions=cqro
set autoindent
if has('gui_running')
set guifont=Terminus
endif
filetype indent plugin on
syntax on
call pathogen#infect()
color torte
let g:syntastic_ruby_exec="/usr/bin/ruby"
let python_higlight_all=1
au! FileType haml set sw=8 noet
set guioptions-=m
set guioptions-=T
set guioptions-=r
au BufEnter * execute ":lcd " . expand("%:p:h")
inoremap <silent> = =<Esc>:call <SID>ealign()<CR>a
function! s:ealign()
let p = '^.*=\s.*$'
if exists(':Tabularize') && getline('.') =~# '^.*=' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*'))
Tabularize/=/l1
normal! 0
call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
nnoremap t, :Tabularize /,\zs<CR>
vnoremap t, :Tabularize /,\zs<CR>
nnoremap t:: :Tabularize /\s:<CR>
vnoremap t:: :Tabularize /\s:<CR>
nnoremap t= :Tabularize /=>\@!<CR>
vnoremap t= :Tabularize /=>\@!<CR>
nnoremap t=> :Tabularize /=><CR>
vnoremap t=> :Tabularize /=><CR>
nnoremap t-> :Tabularize /-><CR>
vnoremap t-> :Tabularize /-><CR>
nnoremap t{ :Tabularize /{<CR>
vnoremap t{ :Tabularize /{<CR>
nnoremap t} :Tabularize /}<CR>
vnoremap t} :Tabularize /}<CR>
nnoremap t: :Tabularize /^[^:]*:.\zs/l0l1l0<CR>
vnoremap t: :Tabularize /^[^:]*:.\zs/l0l1l0<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment