From 9f6420aca648c61211d38e2da1e2ddb2d0c3fdcc Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 11 Sep 2022 21:25:48 +0800 Subject: [PATCH] fix(flygrep): check if filewritable --- autoload/SpaceVim/plugins/flygrep.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/plugins/flygrep.vim b/autoload/SpaceVim/plugins/flygrep.vim index f93a7214f..04b4c1910 100644 --- a/autoload/SpaceVim/plugins/flygrep.vim +++ b/autoload/SpaceVim/plugins/flygrep.vim @@ -78,7 +78,9 @@ function! s:update_history() abort if !isdirectory(expand(g:spacevim_data_dir.'SpaceVim')) silent call mkdir(expand(g:spacevim_data_dir.'SpaceVim')) endif - silent call writefile([s:JSON.json_encode(s:grep_history)], expand(g:spacevim_data_dir.'SpaceVim/flygrep_history')) + if filewritable(expand(g:spacevim_data_dir.'SpaceVim/flygrep_history')) + call writefile([s:JSON.json_encode(s:grep_history)], expand(g:spacevim_data_dir.'SpaceVim/flygrep_history')) + endif endfunction let s:grep_history = s:read_histroy() let s:complete_input_history_num = [0,0]