Skip to content

Instantly share code, notes, and snippets.

@Gee19
Created January 9, 2023 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gee19/15d8965b5d108817ab25b2ffcc9f5da8 to your computer and use it in GitHub Desktop.
Save Gee19/15d8965b5d108817ab25b2ffcc9f5da8 to your computer and use it in GitHub Desktop.
fzf session picker
" FZF Session Picker {{{
let s:session_dir = '$HOME/.vim/session/'
function! s:list_sessions() abort
return systemlist('ls ' . s:session_dir)
endfunction
function! s:source_session(line) abort
exec 'source ' . s:session_dir . substitute(a:line[0], '%', '\\%', 'g')
endfunction
" TODO: Add ctrl-x to delete, ctrl-e to edit
command! SessionPicker call fzf#run(fzf#wrap({
\ 'source': s:list_sessions(),
\ 'sink*': { line -> s:source_session(line) },
\ 'options': '--prompt="Source Session:" --reverse'
\ }))
" }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment