fzfと仲良く
This commit is contained in:
parent
e50a4a3b83
commit
09f085c1c5
2 changed files with 42 additions and 25 deletions
19
.tmux.conf
19
.tmux.conf
|
@ -12,7 +12,7 @@ set-option -g default-shell /bin/zsh
|
|||
set-option -g default-command /bin/zsh
|
||||
|
||||
# キーストロークのディレイを減らす
|
||||
set -sg escape-time 0
|
||||
set -sg escape-time 1
|
||||
|
||||
# ウィンドウのインデックスを1から始める
|
||||
set -g base-index 1
|
||||
|
@ -26,6 +26,19 @@ bind-key r source-file ~/.tmux.conf \; display "Reloaded."
|
|||
# M-a*2でtmux内のプログラムにM-aを送る
|
||||
bind-key M-a send-prefix
|
||||
|
||||
# ƒZƒbƒVƒ‡ƒ“‘€<E28098>ì
|
||||
bind -n M-C new-session
|
||||
bind -n M-L switch-client -n
|
||||
bind -n M-H switch-client -p
|
||||
|
||||
## tmux-fzf
|
||||
TMUX_FZF_LAUNCH_KEY="a"
|
||||
TMUX_FZF_OPTIONS="-p 50% --multi --ansi --no-separator --no-scrollbar --reverse --border=none \
|
||||
--color=bg+:#1c1e26,bg:#1c1e26,spinner:#ee64ac,hl:#e95678 \
|
||||
--color=fg:#d5d8da,header:#e95678,info:#e95678,pointer:#ee64ac \
|
||||
--color=marker:#ee64ac,fg+:#d5d8da,prompt:#e95678,hl+:#e95678"
|
||||
TMUX_FZF_PREVIEW=0
|
||||
|
||||
# ウインドウ操作
|
||||
bind-key -n M-s split-window -v -c "#{pane_current_path}"
|
||||
bind-key -n M-v split-window -h -c "#{pane_current_path}"
|
||||
|
@ -112,4 +125,6 @@ set -g focus-events on
|
|||
set-window-option -g monitor-activity on
|
||||
set -g visual-activity on
|
||||
|
||||
## Alcrittyでtmuxを有効にする
|
||||
## TPM
|
||||
set -g @plugin 'sainnhe/tmux-fzf'
|
||||
run -b '/usr/share/tmux-plugin-manager/tpm'
|
||||
|
|
46
.zshrc
46
.zshrc
|
@ -3,6 +3,10 @@ if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
|
|||
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
|
||||
fi
|
||||
|
||||
# fzf.zshの読み込み
|
||||
[ -f /usr/share/fzf/key-bindings.zsh ] && source /usr/share/fzf/key-bindings.zsh
|
||||
[ -f /usr/share/fzf/completion.zsh ] && source /usr/share/fzf/completion.zsh
|
||||
|
||||
# 上位階層に移動するコマンド
|
||||
alias a='cd ../'
|
||||
alias aa='cd ../../'
|
||||
|
@ -43,14 +47,20 @@ alias tlsc='sudo tailscale up --exit-node-allow-lan-access --exit-node=mystech'
|
|||
alias tlscd='sudo tailscale down'
|
||||
|
||||
# fzf関連
|
||||
export FZF_TMUX_OPTS="-p 40%"
|
||||
export FZF_CTRL_R_OPTS="--reverse --preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"
|
||||
export FZF_DEFAULT_COMMAND='rg --files --hidden --follow --iglob "!.git/*"'
|
||||
export FZF_DEFAULT_OPTS='--ansi --height 40% --reverse --border=none'
|
||||
export FZF_CTRL_T_COMMAND='rg --files --hidden --follow --iglob "!.git/*"'
|
||||
export FZF_CTRL_T_OPTS="
|
||||
--preview 'bat --color=always --style=header,grid {}'
|
||||
--preview-window=right:40%"
|
||||
export FZF_TMUX="1"
|
||||
export FZF_TMUX_OPTS="-p 50%"
|
||||
export FZF_CTRL_R_OPTS="--reverse --preview 'echo {}' --preview-window=border-sharp,down:3:hidden:wrap --bind '?:toggle-preview'"
|
||||
export FZF_DEFAULT_COMMAND='rg --files --hidden --follow --iglob "!**/.git/*"'
|
||||
export FZF_DEFAULT_OPTS="--ansi --no-separator --no-scrollbar --reverse --border=none \
|
||||
--color=bg+:#1c1e26,bg:#1c1e26,spinner:#ee64ac,hl:#e95678 \
|
||||
--color=fg:#d5d8da,header:#e95678,info:#e95678,pointer:#ee64ac \
|
||||
--color=marker:#ee64ac,fg+:#d5d8da,prompt:#e95678,hl+:#e95678"
|
||||
export FZF_CTRL_T_COMMAND='rg --files --hidden --follow --iglob "!**.git/*"'
|
||||
export FZF_CTRL_T_OPTS="--preview 'bat --color=always --style=plain --line-range :100 {}' --preview-window=border-sharp,down:70%"
|
||||
export FZF_ALT_C_OPTS="--preview 'exa {} -h -T -F --no-user --no-time --no-filesize --no-permissions --long | head -200' --preview-window=border-sharp,hidden:down:70% --bind '?:toggle-preview'"
|
||||
export RUNEWIDTH_EASTASIAN=0
|
||||
bindkey '^[t' fzf-file-widget
|
||||
bindkey '^[r' fzf-history-widget
|
||||
|
||||
fadd() {
|
||||
local out q n addfiles
|
||||
|
@ -70,18 +80,13 @@ fadd() {
|
|||
done
|
||||
}
|
||||
|
||||
rga-fzf() {
|
||||
RG_PREFIX="rga --files-with-matches"
|
||||
fv() {
|
||||
local file
|
||||
file="$(
|
||||
FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \
|
||||
fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \
|
||||
--phony -q "$1" \
|
||||
--bind "change:reload:$RG_PREFIX {q}" \
|
||||
--preview-window="70%:wrap"
|
||||
)" &&
|
||||
echo "opening $file" &&
|
||||
xdg-open "$file"
|
||||
file=$(
|
||||
rg --files --hidden --follow --glob "!**/.git/*" | fzf-tmux -p 50% \
|
||||
--preview 'bat --color=always --style=plain {}' --preview-window=border-sharp,down:70%
|
||||
)
|
||||
v "$file"
|
||||
}
|
||||
|
||||
# tmux関連
|
||||
|
@ -103,6 +108,3 @@ SAVEHIST=10000 # 保存されるヒストリの件数
|
|||
setopt bang_hist # !を使ったヒストリ展開を行う(d)
|
||||
setopt extended_history # ヒストリに実行時間も保存する
|
||||
setopt hist_reduce_blanks # 余分なスペースを削除してヒストリに保存する
|
||||
|
||||
[ -f /usr/share/fzf/key-bindings.zsh ] && source /usr/share/fzf/key-bindings.zsh
|
||||
[ -f /usr/share/fzf/completion.zsh ] && source /usr/share/fzf/completion.zsh
|
||||
|
|
Loading…
Reference in a new issue