This content originally appeared on DEV Community and was authored by Waylon Walker
Hold on to your hats folks, we are going to start adding some rocket fuel to your tmux. We are going to configure tmux to open applications you need on a regular basis in an instant.
Scripting tmux to open up specific applications can be intimidating your first time. It can be tricky to get it to start in the right directory. If you are trying to assign applications to a keybinding it can be easy to mess up and have weird things happen every time your ~/.tmux.conf
gets sourced.
Open htop in an above split
I used this one for a number of years to take a quick peek into my systems performance while a memory intensive task was running.
bind -n M-t split-window htop \; swap-pane -U
?️ note that the
swap-pane -U
will make the htop split active immediately
Open htop in a popup
With the new tmux popup windows I really like the flow of just peeking at htop in a popup and jumping back into what I was doing. It can have a more consistent look, and not mess with the window layouts.
bind -n M-t popup -E -h 95% -w 95% -x 100% "htop"
Open an application in the current directory
One thing that can be tricky is getting apps that need to be in a specific directory started in the directory that you want. Here are two examples I use to open vifm
or gitui
.
bind -n M-e split-window -c '#{pane_current_path}' vifm . .\; resize-pane -Z;
bind C-k split-window -c '#{pane_current_path}' 'gitui'\; resize-pane -Z;
?️ note that
split-window
takes in a -c flag before the application you
want to run to specify the startup directory.
Open a popup in a specific directory
I've been converted over to using popups for these as well. I'll admit that the workflow of creating a new full screen window may have been better, but this can be a bit less jarring, espessially if you have anyone following along with what you are doing.
bind -n M-e display-popup -d '#{pane_current_path}' -E vifm
bind C-k display-popup -d '#{pane_current_path}' -E 'gitui'
for more information on how I navigate tmux, check out this full post
Also check out the full YouTube
tmux-playlist
to see all of the videos in this series.
This content originally appeared on DEV Community and was authored by Waylon Walker
Waylon Walker | Sciencx (2021-08-07T14:03:04+00:00) ? boost your tmux productivity with ? targeted. Retrieved from https://www.scien.cx/2021/08/07/%f0%9f%9a%80-boost-your-tmux-productivity-with-%f0%9f%8e%af-targeted/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.