nvim-config

Log | Files | Refs | README

vim.vim (616B)


      1 " Last Change: 2021 Jan 27
      2 function! s:UpdateLastMod()
      3 	" Save window and cursor location:
      4 	if expand('%:t:r') != 'change_date'
      5 		let l:last_line = line('$') > 3 ? 3 : line('$')
      6 		let l:winview = winsaveview()
      7 		" Use rst's preferred format for the time:
      8 		execute '1,' . l:last_line . 's/\mLast Change:\(\s*\).*/Last Change:\1' . strftime('%Y %b %d') . '/'
      9 		" Restore window and cursor location:
     10 		call winrestview(l:winview)
     11 	endif
     12 endfunction
     13 
     14 setlocal foldenable
     15 setlocal foldmethod=marker
     16 setlocal tabstop=2
     17 setlocal shiftwidth=2
     18 setlocal softtabstop=2
     19 autocmd BufWritePre *.vim silent! call s:UpdateLastMod()