add(nvim): improved keymaps

This commit is contained in:
Léana 江 2023-04-02 13:49:19 +02:00
parent 9e9b03a7a1
commit a1aff2d68e
9 changed files with 75 additions and 90 deletions

View file

@ -0,0 +1,21 @@
function tmux_attach
if test -z $argv
set -f cmd "fish"
else
set -f cmd "$argv"
end
set -f choice (string join ';' "new" (tmux list-sessions -F "#{session_name}") | tr ';' '\n' | fzf)
switch $choice
case ""
case "new"
read -l -P "How would you like to name this session? " prefix
if not test -z $prefix
set prefix $prefix"@"
end
tmux new-session -s "$prefix""$PWD" "$cmd"
case "*"
tmux attach-session -t "$choice"
end
end

View file

@ -2,7 +2,7 @@
# Name each session with the name of the directory where tmux is invoked
# If there's already a session present for that directory, fuzzy search your way through
function tmux_sessionizer --description 'manages tmux sessions'
function tmux_sessionizer --description 'manage tmux sessions'
tmux start-server
if test -z $argv
@ -16,16 +16,7 @@ function tmux_sessionizer --description 'manages tmux sessions'
tmux new-session -s "$PWD" "$cmd"
else
# attach to existing session(s)
set -f choice (string join ';' "new" (tmux list-sessions -F "#{session_name}") | tr ';' '\n' | fzf)
if test -z $choice
echo "[exited fzf]"
else if test $choice = "new"
read -l -P "How would you like to name this session? " custom_name
tmux new-session -s "$custom_name"@"$PWD" "$cmd"
else
tmux attach-session -t "$choice"
end
tmux_attach $argv
end
commandline --function repaint