问题描述:

In my ~/.tmux.conf I have this which works great:

bind-key -t vi-copy n cursor-down

It allows me to move my cursor in history / copy mode.

I want to jump more rapidly (like I do in vim).

I want to jump 5 lines, but this doesn't work:

bind-key -t vi-copy E 5 cursor-up

How can I add a keybinding that will jump several lines?

网友答案:

Originally, tmux has only a restricted support for commands in copy-mode. You can't assign multiple commands, you can't repeat them. The only option is only assign a single command to a keystroke.

However, there's a mod for tmux that allows the full-fledged support for scripting in tmux: http://ershov.github.io/tmux/ (I'm the author)

Using this mod, you can do it this way:

bind-key -t vi-copy K tcl {
  for {set i 0} {$i < 5} {incr i} {
    cursor-up
  }
}

Also, you'd be able to use variables, loops, define your own procedures and also have more control on tmux internals.

相关阅读:
Top