Skip to content

A modern file explorer (Nvim-Tree) as a Tmux sidebar, with dynamic updates and bi-directional interaction.

License

Notifications You must be signed in to change notification settings

kiyoon/treemux

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Treemux for Tmux

Nothing has been this close to an IDE!

Treemux opens a sidebar with Neovim's Nvim-Tree file explorer, with additional cool features like:

  • Automatic updates on Nvim-Tree as you change directory in shell.
  • Nvim-Tree to shell interaction possible with tmuxsend.vim.
    • You can copy absolute path from Nvim-Tree and paste into the shell.
    • Change directory, execute programs, open with vim and anything you can imagine!
  • Open files from Nvim-Tree to Neovim seamlessly, using nvim-tree-remote.nvim.
    • Just open the files (double click) and it will show up in another Neovim!

Of course you also get:

  • All features from Nvim-Tree:
    • mouse click
    • automatic refresh
    • file icons
  • All features from tmux-sidebar:
    • smart sizing
      Sidebar remembers its size, so the next time you open it, it will have the exact same width. This is a per-directory property, so you can have just the right size for multiple dirs.
    • toggling
      The same key binding opens and closes the sidebar.
    • uninterrupted workflow
      The main prefix + Tab key binding opens a sidebar but does not move cursor to it.
    • pane layout stays the same
      No matter which pane layout you prefer, sidebar tries hard not to mess your pane splits. Open, then close the sidebar and everything should look the same.

Furthermore, it will detect git directory and open that as root, while still opening current directory.

Tested and working on Linux, MacOS and Windows WSL2.

Key bindings

  • prefix + Tab - toggle sidebar with a directory tree
  • prefix + Backspace - toggle sidebar and move cursor to it (focus it)

NOTE: Instant IDE modes are deprecated. Now you can just open a file from the tree without entering this mode.

Installation with Tmux Plugin Manager

Add plugin to the list of TPM plugins in .tmux.conf:

set -g @treemux-tree-nvim-init-file '~/.tmux/plugins/treemux/configs/treemux_init.lua'
set -g @plugin 'kiyoon/treemux'
  • The first line sets a separate nvim init file for the tree to separate from the editor.
    • This contains some plugins to interact neovim in another pane.
    • You can customise the tree by copying the treemux_init.lua file somewhere outside the repo and modifying the file.

Hit prefix + I to fetch the plugin and source it.

Install python support for Neovim.

pip3 install --user pynvim

Make sure you have Neovim and lsof installed.

nvim --version
lsof -h  # most distro include this, but maybe Arch wouldn't have it.

You should now be able to use the plugin.

Updating the plugin

Not only updating the plugin itself (prefix + U),
you need to also update the neovim plugins.
Run this from the side tree:

:Lazy update

Docs

  • You can open a file from the command line to the remote editor split, using treemux-nvim command. (e.g. treemux-nvim file.py)
  • customisation options

License

MIT

About

A modern file explorer (Nvim-Tree) as a Tmux sidebar, with dynamic updates and bi-directional interaction.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages

  • Shell 75.1%
  • Python 14.9%
  • Lua 10.0%