fancy get-me-an-editor shortcut
This commit is contained in:
parent
73ed0a2047
commit
f8df3834d9
3 changed files with 15 additions and 14 deletions
|
@ -56,6 +56,7 @@ bind-key / copy-mode \; send-key ?
|
||||||
bind-key P 'capture-pane' \; capture-pane -S - \; save-buffer /tmp/tmux \; delete-buffer
|
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-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_current_path}' -E "gitui"
|
bind -n M-g display-popup -h '90%' -w '90%' -b rounded -d '#{pane_current_path}' -E "gitui"
|
||||||
|
bind -n M-e display-popup -h '60%' -w '80%' -b rounded -d '#{pane_current_path}' -E "~/bin/nvim-edit-fzf"
|
||||||
|
|
||||||
setw -g window-status-format ""
|
setw -g window-status-format ""
|
||||||
setw -g window-status-current-format ""
|
setw -g window-status-current-format ""
|
||||||
|
|
15
.zshrc
15
.zshrc
|
@ -104,6 +104,7 @@ export LESS="--mouse --wheel-lines=1 -nRXF"
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
alias c='cut -c-${COLUMNS}'
|
alias c='cut -c-${COLUMNS}'
|
||||||
|
alias e=nvim-edit-fzf
|
||||||
alias dotgit='git --work-tree $HOME --git-dir $HOME/.dot_git'
|
alias dotgit='git --work-tree $HOME --git-dir $HOME/.dot_git'
|
||||||
alias l=bat
|
alias l=bat
|
||||||
alias ls=exa
|
alias ls=exa
|
||||||
|
@ -139,20 +140,6 @@ set_win_title
|
||||||
## vim
|
## vim
|
||||||
export EDITOR=nvim
|
export EDITOR=nvim
|
||||||
|
|
||||||
e ()
|
|
||||||
{
|
|
||||||
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
|
|
||||||
nvim --server $XDG_RUNTIME_DIR/nvim.sock --remote $_file
|
|
||||||
tmux select-window -t1
|
|
||||||
}
|
|
||||||
|
|
||||||
## fzf
|
## fzf
|
||||||
export FZF_TMUX=1
|
export FZF_TMUX=1
|
||||||
export FZF_COMPLETION_TRIGGER=";"
|
export FZF_COMPLETION_TRIGGER=";"
|
||||||
|
|
13
bin/nvim-edit-fzf
Executable file
13
bin/nvim-edit-fzf
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -fe -o pipefail
|
||||||
|
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
_file=$(readlink -f "$@")
|
||||||
|
else
|
||||||
|
_git_root=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
|
||||||
|
_store=$(echo "$_git_root" | sha1sum | cut -d ' ' -f 1)
|
||||||
|
_file=$( (fre --store_name "$_store" --sorted && fd --type f --hidden --follow --exclude .git . "$_git_root") | fzf )
|
||||||
|
fre --store_name "$_store" --add "$_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
nvim --server "$XDG_RUNTIME_DIR/nvim.sock" --remote "$_file" && tmux select-window -t1
|
Loading…
Reference in a new issue