.vimrc

changeset 431
4cb4cd6a2570
parent 430
cac0a6e87836
child 432
11b78e03f052
equal deleted inserted replaced
430:cac0a6e87836 431:4cb4cd6a2570
356 " Jump to last known pos 356 " Jump to last known pos
357 autocmd BufReadPost * 357 autocmd BufReadPost *
358 \ if line("'\"") >= 1 && line("'\"") <= line("$") | 358 \ if line("'\"") >= 1 && line("'\"") <= line("$") |
359 \ exe "normal! g`\"" | 359 \ exe "normal! g`\"" |
360 \ endif 360 \ endif
361 augroup END
362
363 function! s:MkNonExDir(file, buf)
364 if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/'
365 let dir=fnamemodify(a:file, ':h')
366 if !isdirectory(dir)
367 call mkdir(dir, 'p')
368 endif
369 endif
370 endfunction
371
372 augroup AutoMkdir
373 autocmd!
374 autocmd BufWritePre * :call s:MkNonExDir(expand('<afile>'), +expand('<abuf>'))
361 augroup END 375 augroup END
362 376
363 " https://mjj.io/2015/01/27/encrypting-files-with-gpg-and-vim/ 377 " https://mjj.io/2015/01/27/encrypting-files-with-gpg-and-vim/
364 augroup encrypted 378 augroup encrypted
365 autocmd! 379 autocmd!

mercurial