More generic sidebar?
Efreak opened this issue · 3 comments
Any way to make this plugin more generic? I'd love to have a pop-out sidebar that I can use to save notes, run other commands, etc that gets shared with other windows. Maybe something along the lines of embedding another tmux window inside each sidebar, connected to a single instance of nano -t $HOME/.tmux-sidebar-note.txt
?
I don't know a whole lot about tmux, I actually mostly use byobu with a few tmux settings for command shortcuts and adjusting the colors, so if this is just a simple tmux command/setting that doesn't require a plugin, please excuse my ignorance.
Hey,
the simplest way to achieve this is via tmux native key binding.. by putting something like this in .tmux.conf
:
bind v split-window -h 'nano ~/my_notes.txt'
That will open an editor with notes in a split pane when you press prefix + v
. Plugins not required, vanilla tmux. Possible downsides if you like to nitpick your workflow:
- new pane with notes will *always* focus (the cursor will be moved to new window)
- depending on your tmux version you might only be able to get a pane split on the right side, not left. (Left split is possible in tmux 2.0 with a flag I think)
- you can't just use the same key to *toggle* new split pane as with
tmux-sidebar
You can achieve all of the above things with tmux-sidebar
. The feature is undocumented because I didn't know what to use it for. Put the below line in .tmux.conf
and reload it:
set -g @sidebar-key-v 'nano ~/my_notes.txt,left,50,focus'
You can tweak the above setting to your liking:
@sidebar-key-v
will bind the command toprefix + v
. You can choose any other key eg forprefix + t
use@sidebar-key-t
.'nano ~/my_notes.txt,left,50,focus'
- this value contains options for the new window. It's 4 comma separated fields:nano ~/my_notes
this command will be executed in a new paneleft
orright
50
width of a new window (will be remembered per directory). if empty will default to half of the screenfocus
when sidebar is opened, the cursor will be focused to it. Leave empty forno focus
Let me know how this works and if you find this useful.
Another thing you can do is set @sidebar-tree-command
. This is more useful if you only want to have the behavior you desire, and not the original behavior.
In my case I have set -g @sidebar-tree-command "vifm -c 'only' ."
, which runs my file manager vifm
in the sidebar.
That's a good idea @rosshadden. Wanna add that to the options doc? Just open a PR.
Other than that I think this question/issue is solved. Please ask if you need more help.