-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
68 lines (61 loc) · 3.4 KB
/
.tmux.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#list of plugins
# prefix + I 安装配置文件中列出的插件(~/.tmux.conf)
# prefix + U 卸载配置文件中列出的插件(~/.tmux.conf)
# prefix + alt + u 移除并删除在配置文件没有列出的插件
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# 更改复制模式的默认行为为熟悉的vi风格
# tmux中复制模式通常使用复制模式的步骤如下:
# 1. 输入 <[> 进入复制模式
# 2. 按下 <空格键> 开始复制,移动光标选择复制区域
# 3. 按下 <回车键> 复制选中文本并退出复制模式
# 4. 按下 <]> 粘贴文本
# 开启vi风格后,支持vi的C-d、C-u、hjkl等快捷键
setw -g mode-keys vi
# 存在于tmux进程中的buffer缓存,虽然可以在会话间共享,但不能直接与系统粘贴板共享,不免有些遗憾
# 我们都知道,Mac自带pbcopy和pbpaste命令,分别用于复制和粘贴,但在tmux命令中它们却不能正常运行
# 我们可以使用一个包装程序reattach-to-user-namespace来重新连接到合适的命名空间,然后执行访问用户级命名空间的粘贴板服务
# 加载复制插件
# 1. 将命令行文本复制到剪贴板 <prefix+y>
# 2. 将当前面板的工作目录复制到剪贴板 <prefix+Y>
set -g @plugin 'tmux-plugins/tmux-yank'
set -g set-clipboard on
# tmux保存会话依赖于tmux进程,因此关机重启后会话将被清空
# 目前有resurrect和continuum两个插件可以持久保存用户会话
# 无须任何配置就能够备份tmux会话中的各种细节,包括窗口、面板的顺序、布局、工作目录,运行程序等等数据
# 1. 保存的快捷键: <prefix + Ctrl-s> tmux状态栏在保存开始
# 2. 恢复的快捷键: <prefix + Ctrl-r> tmux状态栏在恢复开始
# 保存时,tmux会话的详细信息会以文本文件的格式保存到~/.tmux/resurrect目录,恢复时则从此处读取
# 由于数据文件是明文的,因此你完全可以自由管理或者编辑这些会话状态文件,如果备份频繁记得定期清除历史备份
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# 重载vim/neovim会话
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-strategy-nvim 'session'
set -g @continuum-restore 'on'
set -g @resurrect-capture-pane-contents 'on'
# should update bash & zsh to latest version
# install: brew intall zsh bash
# update: omz update. from https://stackoverflow.com/questions/17648621/how-do-i-update-zsh-to-the-latest-version
set -g @plugin 'fabioluciano/tmux-tokyo-night'
set -g @theme_variation 'storm'
# set -g @plugin "janoamaral/tokyo-night-tmux"
# set -g @tokyo-night-tmux_window_id_style none
# 正则格式搜索: <prefix+/>
# 搜索结果高亮: 使用grep命令搜索且搜索不区分大小写
# 预定义的搜索:
# 1. 文件搜索 <prefix+ctrl-f>
# 2. URL搜索 <prefix+ctrl-u>
# 3. 数字搜索 <prefix+ctrl-d>
# 4. IP地址搜索 <prefix+alt-i>
# 当然可以使用n/N进行高亮选择进行一个个的跳转
#set -g @plugin 'tmux-plugins/tmux-copycat'
set -g escape-time 50
set -g default-terminal "screen-256color"
set-option -sa terminal-overrides ",xterm*:Tc"
set -g focus-events on
set -g mouse on
set -g default-command /opt/homebrew/bin/zsh
set -g default-shell /opt/homebrew/bin/zsh
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'