diff options
author | Sebastian Reichel <sre@ring0.de> | 2015-12-06 10:35:45 +0100 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2015-12-06 10:35:45 +0100 |
commit | e244b7034dac97d8546faeb0e889ab5868801614 (patch) | |
tree | 0c7735ece333314fe43c22a6f91244c7a16e4645 /vimrc | |
parent | 2aca9fb82e36ea2555323337f5d1f21751b65430 (diff) | |
download | vim-config-e244b7034dac97d8546faeb0e889ab5868801614.tar.bz2 |
improved ascii tablesc
Diffstat (limited to 'vimrc')
-rw-r--r-- | vimrc | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -152,3 +152,18 @@ autocmd FileType debcontrol set expandtab autocmd BufNewFile,BufRead /home/sre/src/linux/* set tabstop=8 shiftwidth=8 softtabstop=8 autocmd BufNewFile,BufRead /home/sre/src/linux-*/* set tabstop=8 shiftwidth=8 softtabstop=8 + +execute pathogen#infect() + +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 |