Last active
January 31, 2020 10:13
-
-
Save fum1h1ro/186f215e26b85e50f8c3406b177fa093 to your computer and use it in GitHub Desktop.
auto session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let g:autosession_file = getcwd().'/.vimsession' | |
function! AutoSession_Create() | |
if getftype(g:autosession_file) == '' | |
exec "mks!" g:autosession_file | |
endif | |
endfunction | |
function! AutoSession_Restore() | |
if getftype(g:autosession_file) != '' | |
exec "so" g:autosession_file | |
endif | |
endfunction | |
function! AutoSession_Save() | |
if getftype(g:autosession_file) != '' | |
exec "mks!" g:autosession_file | |
endif | |
endfunction | |
call AutoSession_Restore() | |
augroup session-autosave | |
au! | |
"autocmd VimEnter * call g:AutoSession_Restore() | |
autocmd VimLeavePre * call g:AutoSession_Save() | |
augroup END | |
command! AutoSessionCreate call g:AutoSession_Create() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
よくわからんけど、autocmdで読み込むと、シンタックスハイライトが消える