junegunn / fzf.vim

fzf :heart: vim
MIT License
9.59k stars 582 forks source link

Cannot open temporary file / folder when opening fzf on new MacBook after sleep #1392

Closed ayroblu closed 2 years ago

ayroblu commented 2 years ago

On my new MacBook, after sleeping, and waking, then trying to open fzf, I get this kind of error

NeoVim:

image image

Vim:

image image

I know it's a new MacBook or related issue / feature because I also use https://github.com/xolox/vim-session and that throws an error when trying to save a session after sleeping too, and that worked fine for ages, and hasn't been updated in 7 years.

Anyways, seems like the tmp folder goes missing after sleeping, so would be great to make a new one or something?

ayroblu commented 2 years ago

I did some investigation on this, and it's kind of a vim thing with tempname()?

Some resources and temporary workaround:

" Recreate tmpdir if deleted while sleeping
" https://github.com/neovim/neovim/pull/11284
" https://groups.google.com/g/vim_use/c/qgRob9SWDv8/m/FAOFVVcDTv0J
command! Mktmpdir call mkdir(fnamemodify(tempname(),":p:h"),"",0700)
nnoremap <leader>mk :Mktmpdir<cr>

Feel free to close this issue if it's a won't fix

junegunn commented 2 years ago

Thanks for the report and the investigation. This is clearly an issue of Vim itself, so it's not clear fzf should try to work around the problem because when it happens, many other plugins will also not work (any plugin that runs an external command using system() will fail).