常用配置文件config汇总
约 873 字
预计阅读 2 分钟
次阅读
.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
|
# 基本设置
set-option -g history-limit 100000 # 提高历史记录限制,适合查看长时间的输出
set-option -g mouse on # 启用鼠标支持
#set-option -g default-shell /usr/bin/bash # 默认使用 Bash,视情况而定
set-option -g prefix C-a # 更改前缀键为 Ctrl + a (如不习惯可改回 C-b)
unbind C-b # 取消 Ctrl + b 作为前缀键
bind C-a send-prefix # 保留 Ctrl + a 为前缀键
# 窗格管理
bind '"' split-window -v
# 快速切换窗格
bind h select-pane -L # 切换到左侧窗格
bind j select-pane -D # 切换到下方窗格
bind k select-pane -U # 切换到上方窗格
bind l select-pane -R # 切换到右侧窗格
# 更改窗格大小
bind -r H resize-pane -L 5 # 左调整窗格大小
bind -r J resize-pane -D 5 # 下调整窗格大小
bind -r K resize-pane -U 5 # 上调整窗格大小
bind -r L resize-pane -R 5 # 右调整窗格大小
# 鼠标滚轮绑定
bind -n WheelUpPane if-shell -F '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e' # 鼠标滚轮向上时进入复制模式
bind -n WheelDownPane send-keys -M # 鼠标滚轮向下时退出复制模式
# 复制模式和粘贴
unbind -T copy-mode-vi v # 取消 vi 风格的视觉模式
bind -T copy-mode-vi v send -X begin-selection # 按 v 开始选择
bind -T copy-mode-vi y send -X copy-selection # 按 y 复制内容
bind p paste-buffer # 前缀键 + p 粘贴内容
# 状态栏优化
set-option -g status-interval 2 # 每 2 秒刷新状态栏
set-option -g status-left "#[fg=green](#S) " # 显示会话名
set-option -g status-right "" # 不显示时间
# 改进外观
set-option -g status-bg black # 状态栏背景色
set-option -g status-fg green # 状态栏前景色
set-window-option -g window-status-current-style bg=blue,fg=white # 当前窗口的状态栏样式
# 快速重载配置文件
bind r source-file ~/.tmux.conf \; display-message "Tmux 配置已重载" # 前缀键 + r 重载配置
|
.vimrc
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
|
" 启用混合行号
set number relativenumber
" 启用语法高亮
syntax on
" 自动检测文件类型,加载相应插件和缩进规则
filetype plugin indent on
" 设置缩进相关配置
set tabstop=4 " 一个 tab 键对应 4 个空格
set shiftwidth=4 " 自动缩进使用 4 个空格
set expandtab " 将 tab 转换为空格
set autoindent " 自动缩进
set smartindent " 根据语法自动调整缩进
" 搜索时忽略大小写,除非有大写字母
set ignorecase
set smartcase
" 实时高亮搜索结果
set hlsearch
" 但一旦你移动光标,高亮将被自动取消
autocmd CursorMoved * :nohlsearch
" 输入搜索模式时增量显示匹配结果
set incsearch
" 显示光标当前位置的状态行
set ruler
" 启用状态栏
set laststatus=2
" 启用命令行补全
set wildmenu
" 启用光标下方 8 行预留显示
set scrolloff=6
" 高亮当前行
set cursorline
" 显示匹配的括号
set showmatch
" 启用多级撤销
set undofile
set undodir=~/.vim/undodir " 保存撤销历史的目录
" 减少更新屏幕的时间间隔(更快的响应速度)
set updatetime=300
" 减少交换文件写入的频率
set lazyredraw
|