From 73226d9191b3dcb4f877ee2eaf9367955556920c Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 29 Jul 2012 22:45:03 +0200 Subject: [PATCH] leader shortcut to append modeline after last line in buffer --- .vimrc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.vimrc b/.vimrc index b776603..051bbd7 100644 --- a/.vimrc +++ b/.vimrc @@ -156,6 +156,18 @@ endfunction inoremap =Smart_TabComplete() +" Append modeline after last line in buffer. +" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX +" files. +function! AppendModeline() + let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d :", + \ &tabstop, &shiftwidth, &textwidth) + let l:modeline = substitute(&commentstring, "%s", l:modeline, "") + call append(line("$"), l:modeline) +endfunction +nnoremap ml :call AppendModeline() + + "switch spellcheck languages let g:myLang = 0 let g:myLangList = [ "nospell", "fr_fr", "en_gb" ]