Use fre+fzf to edit any file in a git repo, with frecency history
This commit is contained in:
parent
060fe3fc91
commit
0e80fa3b8f
1 changed files with 9 additions and 1 deletions
10
.zshrc
10
.zshrc
|
@ -129,7 +129,15 @@ export NVIM_LISTEN_ADDRESS=/tmp/nvimsocket
|
|||
|
||||
e ()
|
||||
{
|
||||
nvr --nostart --remote $(readlink -f "$@")
|
||||
if [ -n "$1" ]; then
|
||||
_file=$(readlink -f "$@")
|
||||
else
|
||||
_git_root=$(git rev-parse --show-toplevel)
|
||||
_store=$(printf $_git_root | sha1sum | cut -d ' ' -f 1)
|
||||
_file=$( (fre --store_name $_store --sorted && fd --type f --hidden --follow --exclude .git . $_git_root) | fzf-tmux)
|
||||
fre --store_name $_store --add $_file
|
||||
fi
|
||||
nvr --nostart --remote $_file
|
||||
tmux select-window -t1
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue