Is there a way to alias tmux commands?
tmux has a command mode that can be accessed via Cb :
and I'm wondering if there is a way to alias commands in my .tmux.conf
file like split-window
to something I use more often like vsp
in vim.
I know I can bind keyboard shortcuts with bind
but can I alias commands as well?
This doesn't appear to be possible as of tmux 2.0.
One thing you can do, however, is send commands to the enclosing tmux session from the shell. This means that you can, for example, create a bash alias that can split windows:
alias vsp="tmux split-window -h"
You can then run vsp
from your bash prompt to split the tmux window vertically. Depending on your specific use case, this might help.
It's also worth noting that, if minimising typing is the goal, tmux commands can be shortened to their shortest unambiguous prefix: sp
does the same thing as split-window
.
Yep. Using bind-key
in you tmux.conf. For example to split tmux windows use:
bind-key v split-window -v #C-b v to split vertically
bind-key h split-window -h #C-b h horizontal
If you don't want to use prefix (Cb) just add -n param:
bind-key -n C-right next # C - → to move to next window.
There's a mod allowing not only alias but also create new commands in tmux: http://ershov.github.io/tmux/
For example:
proc vsp {args} { split-window -h {*}$args }
No external shell involved, no new processes spawned.
链接地址: http://www.djcxy.com/p/15110.html上一篇: 带有箭头/矢量的ggplot2风时间系列
下一篇: 有没有一种方法来别名tmux命令?