summaryrefslogtreecommitdiffstats
path: root/indent/tex.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2014-11-11 02:37:21 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2014-11-11 02:37:21 +0100
commit617b01a5b6aa3cadb25b2ff8639e330cfc6cf3c1 (patch)
tree97fc653e0c19839490bd7aac6beeb4f5754155be /indent/tex.vim
parentbd35da8e9ca0bddd95539bef0c8f4857dc4cc746 (diff)
downloadvim-polyglot-617b01a5b6aa3cadb25b2ff8639e330cfc6cf3c1.tar.gz
vim-polyglot-617b01a5b6aa3cadb25b2ff8639e330cfc6cf3c1.zip
Updatev1.10.3
Diffstat (limited to 'indent/tex.vim')
-rw-r--r--indent/tex.vim31
1 files changed, 31 insertions, 0 deletions
diff --git a/indent/tex.vim b/indent/tex.vim
index 92866d5b..93f70ece 100644
--- a/indent/tex.vim
+++ b/indent/tex.vim
@@ -90,4 +90,35 @@ function! LatexBox_TexIndent()
endfunction
" }}}
+" Restore cursor position, window position, and last search after running a
+" command.
+function! Latexbox_CallIndent()
+ " Save the current cursor position.
+ let cursor = getpos('.')
+
+ " Save the current window position.
+ normal! H
+ let window = getpos('.')
+ call setpos('.', cursor)
+
+ " Execute the command.
+ execute 'normal! =='
+
+ " Restore the previous window position.
+ call setpos('.', window)
+ normal! zt
+
+ " Restore the previous cursor position.
+ call setpos('.', cursor)
+endfunction
+
+" autocmd to call indent after completion
+" 7.3.598
+if v:version > 703 || (v:version == 703 && has('patch598'))
+ augroup LatexBox_Completion
+ autocmd!
+ autocmd CompleteDone <buffer> call Latexbox_CallIndent()
+ augroup END
+endif
+
" vim:fdm=marker:ff=unix:noet:ts=4:sw=4