From ceab2c49e62052c196cae7ccbe0b6ca7005ef235 Mon Sep 17 00:00:00 2001 From: TheK4n Date: Fri, 28 Oct 2022 22:33:00 +0300 Subject: [PATCH 1/7] ref func: py --- sub/bash/functions | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sub/bash/functions b/sub/bash/functions index 1c4176c..2e1aa0b 100644 --- a/sub/bash/functions +++ b/sub/bash/functions @@ -152,7 +152,11 @@ docker_ips() { py() { - test -z "$@" && ipython -i -c "q = exit" || python3 $@ + if [ -z "$@" -a -n "$(which ipython)" ]; then + ipython -i -c "q = exit" + else + python3 $@ + fi } From 8405299676f7b7105602d68a7d727becd55de9c9 Mon Sep 17 00:00:00 2001 From: TheK4n Date: Sun, 30 Oct 2022 21:10:16 +0300 Subject: [PATCH 2/7] zsh completion for poetry --- sub/zsh/completion | 1 + 1 file changed, 1 insertion(+) diff --git a/sub/zsh/completion b/sub/zsh/completion index 0b833bf..ae3c014 100644 --- a/sub/zsh/completion +++ b/sub/zsh/completion @@ -1,5 +1,6 @@ # enable completion features +fpath+=~/.zfunc autoload -Uz compinit compinit -d ~/.cache/zcompdump zstyle ':completion:*:*:*:*:*' menu select From d940cab887e81ec43910585c1ae16614790ee868 Mon Sep 17 00:00:00 2001 From: TheK4n Date: Mon, 31 Oct 2022 21:36:22 +0300 Subject: [PATCH 3/7] fix: pyenv --- sub/zsh/other | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sub/zsh/other b/sub/zsh/other index 2b35d0a..43ba5a1 100644 --- a/sub/zsh/other +++ b/sub/zsh/other @@ -25,6 +25,8 @@ if [ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then fi -export PYENV_ROOT="$HOME/.pyenv" -command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" -eval "$(pyenv init -)" +if [ -n "$(command -v pyenv >/dev/null)" ]; then + export PYENV_ROOT="$HOME/.pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + eval "$(pyenv init -)" +fi From d6124155b6384fe6d5af6d7da6f26de14ac7c0d6 Mon Sep 17 00:00:00 2001 From: TheK4n Date: Tue, 1 Nov 2022 16:01:06 +0300 Subject: [PATCH 4/7] zsh vi mode, bash fix yank-last-arg --- sub/bash/shopt | 2 ++ sub/zsh/options | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sub/bash/shopt b/sub/bash/shopt index 5b1d069..1d95db3 100644 --- a/sub/bash/shopt +++ b/sub/bash/shopt @@ -8,3 +8,5 @@ shopt -s checkwinsize ## Update col/lines after commands shopt -s cdspell ## Fixes minor spelling errors in cd paths shopt -s no_empty_cmd_completion ## Stops empty line tab comp shopt -s dirspell 2>/dev/null ## Tab comp can fix dir name typos + +bind '"\e."':yank-last-arg diff --git a/sub/zsh/options b/sub/zsh/options index 6a470aa..f2f3f70 100644 --- a/sub/zsh/options +++ b/sub/zsh/options @@ -14,7 +14,8 @@ WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word PROMPT_EOL_MARK="" # configure key keybindings -bindkey -e # emacs key bindings +bindkey -v +bindkey -M viins 'jk' vi-cmd-mode bindkey ' ' magic-space # do history expansion on space bindkey '^[[3;5~' kill-word # ctrl + Supr bindkey '^[[3~' delete-char # delete @@ -27,5 +28,4 @@ bindkey '^[[F' end-of-line # end bindkey '^[[Z' undo # shift + tab undo last action bindkey '^K' up-line-or-history bindkey '^J' down-line-or-history -bindkey '^E' vi-forward-word -bindkey '^B' vi-backward-word +bindkey -M viins '\e.' insert-last-word From 6586a386afc086d81e61bd9107679a718ef9665c Mon Sep 17 00:00:00 2001 From: TheK4n Date: Tue, 1 Nov 2022 16:18:14 +0300 Subject: [PATCH 5/7] zsh vi mode upd --- sub/zsh/options | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sub/zsh/options b/sub/zsh/options index f2f3f70..b02bde8 100644 --- a/sub/zsh/options +++ b/sub/zsh/options @@ -19,13 +19,12 @@ bindkey -M viins 'jk' vi-cmd-mode bindkey ' ' magic-space # do history expansion on space bindkey '^[[3;5~' kill-word # ctrl + Supr bindkey '^[[3~' delete-char # delete -bindkey '^[[1;5C' forward-word # ctrl + -> -bindkey '^[[1;5D' backward-word # ctrl + <- bindkey '^[[5~' beginning-of-buffer-or-history # page up bindkey '^[[6~' end-of-buffer-or-history # page down bindkey '^[[H' beginning-of-line # home bindkey '^[[F' end-of-line # end bindkey '^[[Z' undo # shift + tab undo last action -bindkey '^K' up-line-or-history -bindkey '^J' down-line-or-history +bindkey '^U' kill-whole-line +bindkey -M vicmd '^U' kill-whole-line +bindkey -M viins '^U' kill-whole-line bindkey -M viins '\e.' insert-last-word From 845867e20ec2994eae1a2566c7abad852ed65454 Mon Sep 17 00:00:00 2001 From: TheK4n Date: Tue, 1 Nov 2022 20:41:41 +0300 Subject: [PATCH 6/7] add functions dir --- functions/bluetooth | 4 ++++ sub/zsh/options | 2 ++ 2 files changed, 6 insertions(+) create mode 100755 functions/bluetooth diff --git a/functions/bluetooth b/functions/bluetooth new file mode 100755 index 0000000..449be4f --- /dev/null +++ b/functions/bluetooth @@ -0,0 +1,4 @@ +#!/bin/sh + +bssid="$(bluetoothctl devices | dmenu -p "Devices: " -l 20 | cut -d' ' -f2)" +bluetoothctl connect "$bssid" diff --git a/sub/zsh/options b/sub/zsh/options index b02bde8..5c0783e 100644 --- a/sub/zsh/options +++ b/sub/zsh/options @@ -24,6 +24,8 @@ bindkey '^[[6~' end-of-buffer-or-history # page down bindkey '^[[H' beginning-of-line # home bindkey '^[[F' end-of-line # end bindkey '^[[Z' undo # shift + tab undo last action +bindkey '^K' up-line-or-history +bindkey '^J' down-line-or-history bindkey '^U' kill-whole-line bindkey -M vicmd '^U' kill-whole-line bindkey -M viins '^U' kill-whole-line From cb432b45aa8bbdd1dd9cefb9ea633018cb19076c Mon Sep 17 00:00:00 2001 From: TheK4n Date: Tue, 1 Nov 2022 20:46:12 +0300 Subject: [PATCH 7/7] add functions --- functions/killer | 4 ++++ functions/wifi | 5 +++++ 2 files changed, 9 insertions(+) create mode 100755 functions/killer create mode 100644 functions/wifi diff --git a/functions/killer b/functions/killer new file mode 100755 index 0000000..f647204 --- /dev/null +++ b/functions/killer @@ -0,0 +1,4 @@ +#!/bin/sh + +pidd="$(ps -u $USER -o pid,%mem,%cpu,comm | sort -b -k2 -r | sed -n '1!p' | dmenu -i -l 15 | awk '{print $1}')" +kill -15 "$pidd" diff --git a/functions/wifi b/functions/wifi new file mode 100644 index 0000000..13a3fa0 --- /dev/null +++ b/functions/wifi @@ -0,0 +1,5 @@ +#!/bin/sh + +bssid="$(nmcli -f BSSID,SSID,SIGNAL,RATE,BARS,SECURITY dev wifi list | sed -n '1!p' | dmenu -p "WiFi: " -l 20 | cut -d' ' -f1)" +pass="$(echo "" | dmenu -p "Password: ")" +nmcli device wifi connect "$bssid" "password" "$pass"