Add complete edit history using fre

This commit is contained in:
Daniel Lundin 2024-04-01 11:04:47 +02:00
parent 6bc5bcee50
commit 182abc1ad0
5 changed files with 12 additions and 2 deletions

View file

@ -1,4 +1,5 @@
alias e='tmux-edit-helper'
alias eh='tmux-edit-history'
alias dotgit='git --work-tree $HOME --git-dir $HOME/.dot_git'
alias git='git-branchless wrap --'
alias l='bat --wrap=never --pager="less -S"'

View file

@ -64,7 +64,8 @@ bind-key / copy-mode \; send-key ?
bind-key P 'capture-pane' \; capture-pane -S - \; save-buffer /tmp/tmux \; delete-buffer
bind-key -n C-\\ copy-mode \; send -X search-backward " % "\; send -X search-again
bind -n M-g display-popup -h '90%' -w '90%' -b rounded -d '#{?pane_path,#{pane_path},#{pane_current_path}}' -E "gitui"
bind -n M-e display-popup -h '40%' -w '90%' -y 0 -b rounded -d '#{?pane_path,#{pane_path},#{pane_current_path}}' -e FZF=fzf -E "~/bin/tmux-edit-helper"
bind -n M-e display-popup -h '50%' -w '90%' -y 0 -b rounded -d '#{?pane_path,#{pane_path},#{pane_current_path}}' -e FZF=fzf -E "~/bin/tmux-edit-helper"
bind -n M-h display-popup -h '50%' -w '90%' -y 0 -b rounded -d '#{?pane_path,#{pane_path},#{pane_current_path}}' -e FZF=fzf -E "~/bin/tmux-edit-history"
bind -n M-m display-popup -h '90%' -w '90%' -b rounded -d '#{?pane_path,#{pane_path},#{pane_current_path}}' -E "~/bin/tmux-build-helper"

4
bin/tmux-edit-history Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -eo pipefail
_file=$(fre --store_name edit-history --sorted | exec fzf --no-sort)
[ -n "$_file" ] && exec tmux-edit-helper "$_file"

View file

@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -exo pipefail
set -eo pipefail
eval "$(direnv export bash 2>/dev/null)"
@ -16,6 +16,8 @@ else
fre --store_name "$_store" --add "$_file"
fi
fre --store_name "edit-history" --add "$_file"
(tmux select-window -t helix &&
tmux send-keys -t helix Escape &&
tmux send-keys -t helix ":open ${_file}" Enter) || tmux new-window -t 42 -n helix helix "${_file}"

View file

@ -16,6 +16,8 @@ else
fre --store_name "$_store" --add "$_file"
fi
fre --store_name "edit-history" --add "$_file"
_nvim_socket="$XDG_RUNTIME_DIR/nvim-persistent.sock"
(tmux select-window -t nvim 2>/dev/null && tmux select-pane -t 0) && exec nvim --server "$_nvim_socket" --remote "$_file"