Skip to content

Instantly share code, notes, and snippets.

@Canop
Created April 12, 2020 07:40
Show Gist options
  • Save Canop/9baee3bd8fe9fe904817572e94f99a32 to your computer and use it in GitHub Desktop.
Save Canop/9baee3bd8fe9fe904817572e94f99a32 to your computer and use it in GitHub Desktop.
broot + neovim + terminator workflow

Introduction

I document here the new workflow I'm tuning in which I combine broot, neovim and terminator for enjoyable coding. I'll use here as support the exemple of Rust but it works about the same in other environnements.

Goals

  • keep open broot and neovim side to side and use broot as tree viewer and opener for vim
  • have a flexible setup: broot, neovim and terminator are basic tools that you should keep using as you do, this new combinations isn't a different world
  • Keep neovim uncluttered, don't prevent the shortcuts you already use for navigation and opening
@alok
Copy link

alok commented Mar 20, 2021

any updates on this? would love the nvim+broot combo

@humodz
Copy link

humodz commented Jun 22, 2021

I've been using this to use broot from within neovim, it's a bit ugly but sufficient for me:

init.vim

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

~/my-config/nvim-broot.toml

[[verbs]]
invocation = "ok"
key = "enter"
leave_broot = true
execution = ":print_path"
apply_to = "file"

Feedback appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment