Return of the tmux
This commit is contained in:
parent
6dfd7d5f8e
commit
1a1acba0e7
8 changed files with 47 additions and 104 deletions
26
bin/tmux-edit-helper
Executable file
26
bin/tmux-edit-helper
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
set -fe -o pipefail
|
||||
|
||||
eval "$(direnv export bash)"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
_file=$(readlink -f "$@")
|
||||
else
|
||||
FZF=${FZF:-"fzf-tmux -p 90%,50% -y 0"}
|
||||
_root=$(git rev-parse --show-toplevel 2>/dev/null || sl root 2>/dev/null || pwd)
|
||||
_store=$(echo "$_root" | sha1sum | cut -d ' ' -f 1)
|
||||
_file=$( ( (fre --store_name "$_store" --sorted | xargs -n 100 ls -d 2>/dev/null || true) && fd --type f --hidden --follow --exclude .git --exclude .sl --ignore-file "${_root}/.gitignore" . "$_root") | cat -n | sort -k2 -k1n | uniq -f1 | sort -nk1,1 | cut -f2- | sed -e "s#^${_root}/##" | $FZF --no-sort)
|
||||
_file="${_root}/${_file}"
|
||||
fre --store_name "$_store" --add "$_file"
|
||||
fi
|
||||
|
||||
_nvim_socket="$XDG_RUNTIME_DIR/nvim-persistent.sock"
|
||||
|
||||
tmux select-window -t nvim 2>/dev/null ||
|
||||
tmux new-window -S -n nvim \
|
||||
-e "BUILD_COMMAND=$BUILD_COMMAND" \
|
||||
-e "GOPACKAGESDRIVER=$GOPACKAGESDRIVER" \
|
||||
-e "GOFLAGS=$GOFLAGS" \
|
||||
nvim --listen "$_nvim_socket"
|
||||
|
||||
nvim --server "$_nvim_socket" --remote "$_file"
|
Loading…
Add table
Add a link
Reference in a new issue