Merge branch 'home' into p53

This commit is contained in:
Loïc Gremaud 2023-05-05 11:27:54 +02:00
commit e12fbd0689
No known key found for this signature in database
GPG Key ID: ACD9F65FA7E19986
4 changed files with 47 additions and 1 deletions

14
scripts/tmux-cht.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
selected=`cat ~/.tmux-cht-languages ~/.tmux-cht-command | fzf`
if [[ -z $selected ]]; then
exit 0
fi
read -p "Enter Query: " query
if grep -qs "$selected" ~/.tmux-cht-languages; then
query=`echo $query | tr ' ' '+'`
tmux neww bash -c "echo \"curl cht.sh/$selected/$query/\" & curl cht.sh/$selected/$query & while [ : ]; do sleep 1; done"
else
tmux neww bash -c "curl -s cht.sh/$selected~$query | less"
fi

26
scripts/tmux-sessionizer Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
if [[ $# -eq 1 ]]; then
selected=$1
else
selected=$(find ~/Documents/Arcanite/ ~/Documents/PolyLAN/ ~/Documents/ -mindepth 1 -maxdepth 1 -type d | fzf)
fi
if [[ -z $selected ]]; then
exit 0
fi
selected_name=$(basename "$selected" | tr . _)
tmux_running=$(pgrep tmux)
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
tmux new-session -s $selected_name -c $selected
exit 0
fi
if ! tmux has-session -t=$selected_name 2> /dev/null; then
tmux new-session -ds $selected_name -c $selected
fi
tmux switch-client -t $selected_name

View File

@ -19,7 +19,9 @@ bind -n M-d select-pane -R
# reload conf
bind r source-file ~/.tmux.conf
setw -g mode-keys vi
set-window-option -g mode-keys vi
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
# change color
#set -g pane-border-style 'fg=#660033'
@ -54,3 +56,6 @@ run -b '~/.tmux/plugins/tpm/tpm'
set -s escape-time 0
set-option -g default-terminal "screen-256color"
bind-key -r f run-shell "tmux neww ~/Documents/dotfiles/scripts/tmux-sessionizer"
bind-key -r i run-shell "tmux neww tmux-cht.sh"

View File

@ -12,6 +12,7 @@ alias mg='python manage.py migrate'
alias gp='git push'
alias ga!='git commit --amend --no-edit --date now'
alias n='cd . && nvim -S'
alias v='nvim'
alias vi='nvim'
alias vim='nvim'