diff options
author | Guangxiong Lin <[email protected]> | 2021-09-21 09:07:31 +0800 |
---|---|---|
committer | Guangxiong Lin <[email protected]> | 2021-09-21 09:07:31 +0800 |
commit | bc1e8a4191fbdfc65e493d65a9c4f0fdaa2b1d19 (patch) | |
tree | e1479b8f01f744a5d7044d00e6ca07fa94f208e5 /.functions | |
parent | 7e162147d967dd63dff24ac24bf190d868ef4d29 (diff) | |
download | dotfiles-bc1e8a4191fbdfc65e493d65a9c4f0fdaa2b1d19.tar.gz dotfiles-bc1e8a4191fbdfc65e493d65a9c4f0fdaa2b1d19.tar.bz2 dotfiles-bc1e8a4191fbdfc65e493d65a9c4f0fdaa2b1d19.zip |
Add more fzf related functions
Diffstat (limited to '.functions')
-rw-r--r-- | .functions | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -14,3 +14,23 @@ fco () { ) || return git checkout $(awk '{print $2}' <<<$target) } + +fjrnl () { + title=$(jrnl --short | fzf --tac --no-sort) \ + && jrnl -on $(echo $title | cut -c 1-16) $1 +} + +fs () { + local session + session=$(tmux list-sessions -F "#{session_name}" \ + | fzf --query=$1 --select-1 --exit-0) \ + && tmux switch-client -t $session +} + +tm() { + [[ -n "$TMUX" ]] && change="switch-client" || change="attach-session" + if [ $1 ]; then + tmux $change -t "$1" 2>/dev/null || (tmux new-session -d -s $1 && tmux $change -t "$1"); return + fi + session=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | fzf --exit-0) && tmux $change -t "$session" || echo "No sessions found." +} |