Skip to content

Commit

Permalink
tabularize
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeraj Singh committed Feb 26, 2011
1 parent 3b18e77 commit 4130814
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ task :base do
system("git clone git://github.com/mileszs/ack.vim.git bundle/ack")
system("git clone git://github.com/edsono/vim-matchit.git bundle/matchid")
system("git clone git://github.com/tpope/vim-markdown.git bundle/markdown")

# http://vimcasts.org/episodes/aligning-text-with-tabular-vim/
system("git clone git://github.com/godlygeek/tabular.git bundle/tabular")
end

desc "Performs git plugins installation"
Expand Down Expand Up @@ -73,4 +76,3 @@ end

desc "=> base"
task :default => [:base, :git, :rails]

1 change: 1 addition & 0 deletions doc/tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ http://stackoverflow.com/questions/4275209/how-to-insert-erb-tags-with-vim
beg*
case*
def*
defs*
if*
ife*
unless*
Expand Down
19 changes: 19 additions & 0 deletions vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
" \t - open a new tab
" \j - enable disable JavaScript validation
" ctrl left/right arrow - to move between tabs
" #t<enter> to expand to Then show me the page. Note hit enter after #t
"
" Formatting
" ruby code: Go to the top of the page then =shiftg
Expand Down Expand Up @@ -160,3 +161,21 @@ let jslint_command_options = '-conf "/Users/nsingh/dev/vim/jsl-0.3.0-mac/jsl.def
"ensure that all aliases also work in mvim command prompt
" http://stackoverflow.com/questions/4642822/vim-is-not-obeying-command-aliases
set shell=/bin/bash\ -i

" #t<enter> to expand to Then show me the page. Note hit enter after #t
:ab #t Then show me the page

" http://vimcasts.org/episodes/aligning-text-with-tabular-vim/
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (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


0 comments on commit 4130814

Please sign in to comment.