Compare commits
3 Commits
221a1c4a9a
...
a795eb8eec
| Author | SHA1 | Date | |
|---|---|---|---|
|
a795eb8eec
|
|||
|
a5febcddf6
|
|||
|
2250a56599
|
@@ -4,7 +4,7 @@ TARGET=$1
|
||||
|
||||
if [ -z "$TARGET" ]; then
|
||||
if hash fzf 2>/dev/null; then
|
||||
TARGET=$(git log -n 50 --pretty=format:'%h %s' --no-merges | fzf --border-label='Select commit' | cut -c -7 )
|
||||
TARGET=$(git log -n 50 --pretty=format:'%h %s' --no-merges | fzf --border-label=' Select commit ' | cut -c -7 )
|
||||
else
|
||||
echo "Not installed: fzf"
|
||||
exit -1
|
||||
|
||||
@@ -73,3 +73,5 @@ bind-key -n M-7 select-window -t 7
|
||||
bind-key -n M-8 select-window -t 8
|
||||
bind-key -n M-9 select-window -t 9
|
||||
bind-key -n M-0 select-window -t 10
|
||||
|
||||
bind-key "a" run-shell "which sesh-select"
|
||||
|
||||
17
zsh/dot-local/bin/sesh-select
Executable file
17
zsh/dot-local/bin/sesh-select
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
exec </dev/tty
|
||||
exec <&1
|
||||
local session
|
||||
session=$(sesh list -id | fzf-tmux -p 70%,60% \
|
||||
--no-sort --ansi --border-label ' Select session ' --prompt '⚡ ' \
|
||||
--header ' ^a all ^t tmux ^g configs ^x zoxide ^d tmux kill ^f find' \
|
||||
--bind 'btab:down,tab:up' \
|
||||
--bind 'ctrl-a:change-prompt(⚡ )+reload(sesh list -id)' \
|
||||
--bind 'ctrl-t:change-prompt(🪟 )+reload(sesh list -t -id)' \
|
||||
--bind 'ctrl-g:change-prompt(⚙️ )+reload(sesh list -c -id)' \
|
||||
--bind 'ctrl-x:change-prompt(📁 )+reload(sesh list -z -id)' \
|
||||
--bind 'ctrl-f:change-prompt(🔎 )+reload(fd -H -d 2 -t d -E .Trash . ~)' \
|
||||
--bind 'ctrl-d:execute(tmux kill-session -t {2..})+change-prompt(⚡ )+reload(sesh list -id)')
|
||||
[[ -z "$session" ]] && return
|
||||
sesh connect $session
|
||||
@@ -22,7 +22,6 @@ plugins=(
|
||||
# Disabled because the highlighting conflicts with autosuggestions
|
||||
# history-substring-search
|
||||
vi-mode
|
||||
tmux
|
||||
colored-man-pages
|
||||
command-not-found
|
||||
zsh-autopair
|
||||
@@ -43,10 +42,6 @@ VI_MODE_SET_CURSOR=true
|
||||
# Might cause issues?
|
||||
KEYTIMEOUT=1
|
||||
|
||||
ZSH_TMUX_AUTOSTART=true
|
||||
ZSH_TMUX_AUTOCONNECT=false
|
||||
ZSH_TMUX_FIXTERM=true
|
||||
|
||||
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
|
||||
autoload -U compinit && compinit
|
||||
source "$ZSH/oh-my-zsh.sh"
|
||||
@@ -60,12 +55,12 @@ export EDITOR=nvim
|
||||
|
||||
alias cl="clear"
|
||||
|
||||
if hash bat 2>/dev/null; then
|
||||
if (( $+commands[hash] )); then
|
||||
export BAT_THEME="gruvbox-dark"
|
||||
alias cat=bat
|
||||
fi
|
||||
|
||||
if hash devcontainer 2>/dev/null; then
|
||||
if (( $+commands[devcontainer] )); then
|
||||
dc() {
|
||||
ORIG_DIR="$PWD"
|
||||
while [[ "$PWD" != / ]] ; do
|
||||
@@ -92,7 +87,7 @@ if hash devcontainer 2>/dev/null; then
|
||||
}
|
||||
fi
|
||||
|
||||
if hash pnpm 2>/dev/null; then
|
||||
if (( $+commands[pnpm] )); then
|
||||
export PNPM_HOME="/home/tim/.local/share/pnpm"
|
||||
case ":$PATH:" in
|
||||
*":$PNPM_HOME:"*) ;;
|
||||
@@ -110,22 +105,22 @@ export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS'
|
||||
--prompt="> " --marker="◆" --pointer=">" --separator="─"
|
||||
--scrollbar="│" --info="right"'
|
||||
|
||||
if hash fd 2>/dev/null; then
|
||||
if (( $+commands[fd] )); then
|
||||
export FZF_DEFAULT_COMMAND="fd --type f --strip-cwd-prefix"
|
||||
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
||||
fi
|
||||
if hash fzf 2>/dev/null; then
|
||||
if (( $+commands[fzf] )); then
|
||||
source <(fzf --zsh)
|
||||
|
||||
if hash paru 2>/dev/null; then
|
||||
if (( $+commands[paru] )); then
|
||||
function pi {
|
||||
paru -Slq | fzf -q "$1" --border-label="Packages" --multi --preview 'paru -Si {1} --color=always' | xargs -ro paru -S
|
||||
paru -Slq | fzf -q "$1" --border-label=" Install package " --multi --preview 'paru -Si {1} --color=always' | xargs -ro paru -S
|
||||
}
|
||||
fi
|
||||
fi
|
||||
|
||||
export _ZO_FZF_OPTS="--tmux"
|
||||
if hash zoxide 2>/dev/null; then
|
||||
if (( $+commands[zoxide] )); then
|
||||
eval "$(zoxide init zsh --cmd cd)"
|
||||
fi
|
||||
|
||||
@@ -142,3 +137,15 @@ for km in viopp visual; do
|
||||
bindkey -M $km $c select-bracketed
|
||||
done
|
||||
done
|
||||
|
||||
ZSH_TMUX_AUTOSTART=true
|
||||
if (( $+commands[tmux] )); then
|
||||
if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" && -z "$INTELLIJ_ENVIRONMENT_READER" && -z "$ZED_TERM" ]]; then
|
||||
if (( $+commands[sesh] )); then
|
||||
sesh-select
|
||||
else
|
||||
tmux new-session
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user