Skip to content

Instantly share code, notes, and snippets.

@humodz
Last active August 18, 2022 20:06
Show Gist options
  • Save humodz/71e3840c7161ba49d96f49d2aa627ca7 to your computer and use it in GitHub Desktop.
Save humodz/71e3840c7161ba49d96f49d2aa627ca7 to your computer and use it in GitHub Desktop.
Use broot as a file browser for neovim
Use broot as a file browser for neovim
" Search using broot
noremap <C-B> :call RunBroot()<CR>i
fun! RunBroot()
let l:command = 'broot --conf ~/my-config/nvim-broot.toml'
enew
call termopen(l:command, {'on_exit': 'BrootOnExit'})
endfun
fun! BrootOnExit(job_id, code, event) dict
let l:filename = getline(1)
enew | bd! #
if (l:filename != '')
execute 'edit ' . l:filename
else
bp
endif
endfun
[[verbs]]
invocation = "ok"
key = "enter"
leave_broot = true
execution = ":print_path"
apply_to = "file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment