vimrc: add AppendModeline func
This commit is contained in:
parent
c63faf67fc
commit
aa31766bae
12
.vim/vimrc
12
.vim/vimrc
@ -1243,6 +1243,18 @@ set exrc
|
|||||||
set secure
|
set secure
|
||||||
|
|
||||||
|
|
||||||
|
" Append modeline before first 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 ft=%s fenc=%s ff=%s :',
|
||||||
|
\ &tabstop, &filetype, &fileencoding, &fileformat)
|
||||||
|
let l:modeline = substitute(&commentstring, '%s', l:modeline, '')
|
||||||
|
call append (line('^'), l:modeline)
|
||||||
|
endfunction
|
||||||
|
nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
|
||||||
|
|
||||||
|
|
||||||
function! AskQuit (msg, proposed_action)
|
function! AskQuit (msg, proposed_action)
|
||||||
if confirm(a:msg, "&Quit?\n" . a:proposed_action) == 1
|
if confirm(a:msg, "&Quit?\n" . a:proposed_action) == 1
|
||||||
exit
|
exit
|
||||||
|
Loading…
Reference in New Issue
Block a user