Skip to content

Commit

Permalink
fix!: fzf CTRL-R shortcut hangs in tmux2.6
Browse files Browse the repository at this point in the history
Solution: add install/build_tmux_from_source.sh, upgrade to the latest
tmux
  • Loading branch information
jiangyinzuo committed Apr 28, 2024
1 parent 97baed8 commit 3b610b8
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 486 deletions.
15 changes: 15 additions & 0 deletions install/build_tmux_from_source.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

sudo apt-get install libevent-dev ncurses-dev build-essential bison pkg-config automake

build_dir=$(pwd)/build
mkdir -p $build_dir
cd $build_dir

wget https://github.com/tmux/tmux/archive/refs/heads/master.zip -O tmux-master.zip
unzip tmux-master.zip
cd tmux-master

sh autogen.sh
./configure && make
sudo make install
3 changes: 3 additions & 0 deletions root/.config/nvim/lua/plugins/vimplug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ local M = {
},
{
"jiangyinzuo/codenote",
dependencies = {
"tpope/vim-fugitive",
},
},
{ dir = "~/.vim/pack/my_plugins/start/diffbuffer.vim" },

Expand Down
9 changes: 6 additions & 3 deletions root/.tmux.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Ubuntu18.04默认安装tmux2.6
# tmux2.6中,使用fzf的CTRL-R快捷键会卡死,请手动运行 cd ~/vimrc && ./install/build_tmux_from_source.sh安装

set-window-option -g mode-keys vi # tmux2.1+
setw -g mode-keys vi # tmux1.8

Expand Down Expand Up @@ -25,7 +28,7 @@ bind-key -T copy-mode-vi 'V' send-keys -X select-line

# https://vi.stackexchange.com/questions/16148/slow-vim-escape-from-insert-mode
# 高版本下-g和-s可以合并,但出于兼容性考虑,还是分开写
# WSL2下escape-time设置为0会导致tmux出现随机字符串,故设置为10
# escape-time设置为20在kiwi服务器上会导致tmux出现随机字符串,故设置为25
# https://github.com/microsoft/WSL/issues/5931
set -g escape-time 10
set -s escape-time 10
set -g escape-time 25
set -s escape-time 25
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function diffbuffer#Diff()
" 执行 diff 命令
execute 'diffthis'
execute 'vsplit ' . temp_file
wincmd H
execute 'diffthis'
endfunction

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
command -nargs=0 DiffBufferSaveTempFile call diffbuffer#SaveTempFile()

command -nargs=0 DiffBuffer call diffbuffer#Diff()
command -nargs=0 DiffThisBufferFirst call diffbuffer#SaveTempFile()
" diff, delta, ...
command -nargs=1 -complete=custom,diffbuffer#ExternalToolsComplete DiffBufferExternal call diffbuffer#DiffExternal(<f-args>)
command -nargs=? -complete=custom,diffbuffer#ExternalToolsComplete DiffThisBufferSecond if len(<q-args>) == 0 | call diffbuffer#Diff() | else | call diffbuffer#DiffExternal(<f-args>) | endif
6 changes: 6 additions & 0 deletions root/.vim/vimrc.d/plugin_setup.vim
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ let g:fern#default_hidden = 1
if has('nvim') || v:version >= 801
set nocursorline " vim-css-color插件下,set cursorline有性能问题
" let g:AutoPairsMapBS = 1
if has('nvim')
" confict with neovim luasnip
let g:AutoPairs = {'"': '"', '[': ']', '''''': '''''', '(': ')', '''''''''''': '''''''''''', '{': '}', '"""': '"""'}
else
let g:AutoPairs = {'```': '```', '"': '"', '[': ']', '''''': '''''', '(': ')', '''''''''''': '''''''''''', '{': '}', '"""': '"""'}
endif
let g:AutoPairsMapSpace = 0
" 只在后面有空格或者是行尾时,才补全右括号
let g:AutoPairsCompleteOnlyOnSpace = 1
Expand Down
2 changes: 2 additions & 0 deletions root/.vim/vimrc.d/vimplug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ if !exists('g:vscode')
Plug 'tpope/vim-fugitive'
" A git commit browser.
Plug 'junegunn/gv.vim'
" optionally depend on vim-fugitive
Plug 'jiangyinzuo/codenote'

source ~/.vim/vimrc.d/ai.vim
Plug 'bfrg/vim-cpp-modern', {'for': ['c', 'cpp', 'cuda']}
Expand Down
Loading

0 comments on commit 3b610b8

Please sign in to comment.