Merge commit '068d708cf2824672044e67949a2b9116ba2be81c' as 'vim'
This commit is contained in:
29
vim/ftplugin/tex.vim
Normal file
29
vim/ftplugin/tex.vim
Normal file
@@ -0,0 +1,29 @@
|
||||
set formatoptions+=1rnmBa
|
||||
|
||||
" Reformat lines (getting the spacing correct) {{{
|
||||
fun! TeX_fmt()
|
||||
if (getline(".") != "")
|
||||
let save_cursor = getpos(".")
|
||||
let op_wrapscan = &wrapscan
|
||||
set nowrapscan
|
||||
let par_begin = '^\(%D\)\=\s*\($\|\\begin\|\\end\|\\\[\|\\\]\|\\\(sub\)*section\>\|\\item\>\|\\NC\>\|\\blank\>\|\\noindent\>\)'
|
||||
let par_end = '^\(%D\)\=\s*\($\|\\start\|\\stop\|\\Start\|\\place\|\\\(sub\)*section\>\|\\item\>\|\\NC\>\|\\blank\>\)'
|
||||
try
|
||||
exe '?'.par_begin.'?+'
|
||||
catch /E384/
|
||||
1
|
||||
endtry
|
||||
norm V
|
||||
try
|
||||
exe '/'.par_end.'/-'
|
||||
catch /E385/
|
||||
$
|
||||
endtry
|
||||
norm gq
|
||||
let &wrapscan = op_wrapscan
|
||||
call setpos('.', save_cursor)
|
||||
endif
|
||||
endfun
|
||||
|
||||
nmap Q :call TeX_fmt()<CR>
|
||||
" }}}
|
||||
Reference in New Issue
Block a user