好好爱自己!

tmux新版本配置有点不一样

原文:https://blog.csdn.net/danssion/article/details/86658189

解决一个问题:

 

 .tmux.conf:174: usage: bind-key [-cnr] [-T key-table] key command [arguments]

原来是 .tmux.conf的配置写错了,2.6版本和2.3版本还是有区别

 

问题2:

.tmux.conf:174: usage: bind-key [-cnr] [-T key-table] key command [arguments]

这个是针对tmux的复制模式使用vi模式以及一些好用的映射 的设置

解决方式看这里:

https://sanctum.geek.nz/arabesque/vi-mode-in-tmux/

好吧,~~修改格式:

 

    1. bind-key -T copy-mode-vi 'v' send -X begin-selection
    2.  
      bind-key -T copy-mode-vi '/' send -X search-backward
    3.  
      bind-key -T copy-mode-vi '?' send -X search-forward
    4.  
      bind-key -T copy-mode-vi ' ' send -X page-up
    5.  
      bind-key -T copy-mode-vi 'm' send -X page-down
       

       

       

       

       

       

       

_______________________________

Vi mode in tmux

Updated May 2017 to show the new syntax for the copy-mode keys.

tmux offers a set of vi-like bindings for navigating a buffer in a window. These allow you to not only navigate through the buffer beyond what your screen is currently showing, but also to search all the output generated thus far, and to select and copy text that can be pasted in any other window in the tmux session.

You can enable this as a default setting in .tmux.conf with the following:

set-window-option -g mode-keys vi

You can confirm this is working by pressing Ctrl+B and then : in a tmux session to bring up the command line, and typing:

list-keys -T copy-mode-vi

In version 2.3 and below, the syntax is different:

list-keys -t vi-copy

This will bring up a complete list of the vi-like functionality available to you in this mode.

With this done, within a tmux instance, pressing Ctrl+B and then [ will enter copy mode, allowing you to copy text or view the history of the buffer, including searching with / and ?. Most of the basic vi movements work, including screenwise vertical movement commands like Ctrl+F and Ctrl+B. You can leave this mode just by pressing Enter, or you can start a selection by pressing Space on a character, moving to another, and then pressing Enter. If you have text copied like this you can paste it into any tmux window in that session by pressing Ctrl+B and then ].

If you don’t mind artifically introducing a few Vim-only features to the vi mode, you can set things up so that vstarts a selection and y finishes it in the same way that Space and Enter do, more like Vim:

bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel

In version 2.3 and below, the syntax is very different:

bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection

Even if you’re using a terminal emulator in a GUI environment, if you get good at using this you’ll find it’s much faster and more precise than clicking and dragging to select text to copy and paste it. It keeps you from having to move to the mouse, and additionally eliminates the problem of copying whole lines split into more than one panes.

Note that all of the above assumes that your prefix is the default of Ctrl+B, which many tmux users, myself included, seem to prefer to change to the old GNU Screen prefix key of Ctrl+A.

posted @   立志做一个好的程序员  阅读(469)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 25岁的心里话
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
历史上的今天:
2016-12-01 git 查看当前与上一次version的差异

不断学习创作,与自己快乐相处

点击右上角即可分享
微信分享提示