aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuangxiong Lin <[email protected]>2021-09-21 09:07:31 +0800
committerGuangxiong Lin <[email protected]>2021-09-21 09:07:31 +0800
commitbc1e8a4191fbdfc65e493d65a9c4f0fdaa2b1d19 (patch)
treee1479b8f01f744a5d7044d00e6ca07fa94f208e5
parent7e162147d967dd63dff24ac24bf190d868ef4d29 (diff)
downloaddotfiles-bc1e8a4191fbdfc65e493d65a9c4f0fdaa2b1d19.tar.gz
dotfiles-bc1e8a4191fbdfc65e493d65a9c4f0fdaa2b1d19.tar.bz2
dotfiles-bc1e8a4191fbdfc65e493d65a9c4f0fdaa2b1d19.zip
Add more fzf related functions
-rw-r--r--.functions20
1 files changed, 20 insertions, 0 deletions
diff --git a/.functions b/.functions
index 07f9afe..b34c848 100644
--- a/.functions
+++ b/.functions
@@ -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."
+}