diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-05-20 19:51:28 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-05-20 19:51:28 +0530 |
| commit | a787eb168e06123845dada65a02133c8a7489d5a (patch) | |
| tree | 8cabb82afcd1f52ed126ada5eb63dd23d5d6a0a3 /config | |
| parent | 4f70d9db94f29bf8625bb5f43f22720952f71da8 (diff) | |
| download | nixos-config-a787eb168e06123845dada65a02133c8a7489d5a.tar.gz nixos-config-a787eb168e06123845dada65a02133c8a7489d5a.zip | |
Update zsh config
Diffstat (limited to '')
| -rw-r--r-- | config/zsh/aliases/dev.zsh | 17 | ||||
| -rw-r--r-- | config/zsh/aliases/ls.zsh | 1 | ||||
| -rw-r--r-- | config/zsh/aliases/system.zsh | 12 | ||||
| -rw-r--r-- | config/zsh/plugins/fzf-jobs.zsh | 11 | ||||
| -rw-r--r-- | config/zsh/plugins/magic-enter.zsh | 3 | ||||
| -rw-r--r-- | config/zsh/plugins/sudo.zsh | 3 | ||||
| -rw-r--r-- | config/zsh/plugins/timer.zsh | 13 |
7 files changed, 40 insertions, 20 deletions
diff --git a/config/zsh/aliases/dev.zsh b/config/zsh/aliases/dev.zsh index 064eba4..2071024 100644 --- a/config/zsh/aliases/dev.zsh +++ b/config/zsh/aliases/dev.zsh @@ -3,7 +3,7 @@ alias remi="wyrd $REMINDER_FILE"; alias aws="docker run --rm -it amazon/aws-cli" -alias pop_run="cd ~/dev/pop && just run" +alias pop_run="sh -c 'cd ~/dev/pop && just run'" # nix shell with zsh nix-zsh() { nix-shell --run "WITH_NIX_PREFIX='${NX_PREFIX:-':'}' zsh" "$@"; } @@ -80,18 +80,3 @@ p__nvim_virtual_terminal() { vt "$BUFFER"; } zle -N p__nvim_virtual_terminal; bindkey '^T' p__nvim_virtual_terminal; - -synsearch() { - local search_cmd='biome search {q} --no-errors-on-unmatched --skip-errors | awk "/search/ {print \$1}"'; - local preview_lines=10; - local preview_cmd="bat --style=full --color=always --line-range \$(printf '%s' {} | cut -d: -f2):+$preview_lines \$(printf '%s' {} | cut -d: -f1)"; - - (fzf --multi --wrap --ansi --disabled -q "$1" \ - --bind "start:reload:$search_cmd" \ - --bind "change:reload:$search_cmd" \ - --preview "$preview_cmd" \ - < /dev/null) \ - | awk -F: -v q="'" '{ print "+" q "call cursor(" $2 "," $3 ")" q " " $1 }' \ - | xargs -r "$EDITOR"; -} - diff --git a/config/zsh/aliases/ls.zsh b/config/zsh/aliases/ls.zsh index 88fabf0..a3a484a 100644 --- a/config/zsh/aliases/ls.zsh +++ b/config/zsh/aliases/ls.zsh @@ -2,7 +2,6 @@ alias trash="ls \$TRASH_TMP_DIR"; # List files aliases -alias ls="lsd"; alias l="ls -1"; alias la='ls -a'; alias ll='ls -alF'; diff --git a/config/zsh/aliases/system.zsh b/config/zsh/aliases/system.zsh index ba86182..85db5ef 100644 --- a/config/zsh/aliases/system.zsh +++ b/config/zsh/aliases/system.zsh @@ -48,3 +48,15 @@ limit_memory() { local lim=${1:-100M}; shift 1; systemd-run --user --scope -p MemoryHigh="$lim" -p MemorySwapMax="$lim" "$@"; } + +# KDE connect aliases +phone() { + local device=$(kdeconnect-cli -a --id-only) + if [ -z "$device" ]; then + echo "Device not found" + return 1 + fi + kdeconnect-cli --device "$device" "$@" +} +phone_file() { phone --share "$@"; } +phone_text() { phone --share-text "$@"; } diff --git a/config/zsh/plugins/fzf-jobs.zsh b/config/zsh/plugins/fzf-jobs.zsh new file mode 100644 index 0000000..0765466 --- /dev/null +++ b/config/zsh/plugins/fzf-jobs.zsh @@ -0,0 +1,11 @@ + +fzf-fg() { + local job=$(jobs | fzf | sed 's/^\[\(.\+\)\].*/\1/g') + if ! [ -z "$job" ]; then + fg %"$job" + fi; + zle send-break || true +} + +zle -N fzf-fg; +bindkey '^X' fzf-fg; diff --git a/config/zsh/plugins/magic-enter.zsh b/config/zsh/plugins/magic-enter.zsh index 5d50316..accccc0 100644 --- a/config/zsh/plugins/magic-enter.zsh +++ b/config/zsh/plugins/magic-enter.zsh @@ -1,3 +1,6 @@ +MAGIC_ENTER_GIT_COMMAND='git status'; +MAGIC_ENTER_OTHER_COMMAND='ls'; + # Bind quick stuff to enter! # # Pressing enter in a git directory runs `git status` diff --git a/config/zsh/plugins/sudo.zsh b/config/zsh/plugins/sudo.zsh index fd43b93..36091e6 100644 --- a/config/zsh/plugins/sudo.zsh +++ b/config/zsh/plugins/sudo.zsh @@ -12,9 +12,6 @@ # # ------------------------------------------------------------------------------ -MAGIC_ENTER_GIT_COMMAND='git status'; -MAGIC_ENTER_OTHER_COMMAND='ls'; - sudo-command-line() { [[ -z $BUFFER ]] && zle up-history if [[ $BUFFER == sudo\ * ]]; then diff --git a/config/zsh/plugins/timer.zsh b/config/zsh/plugins/timer.zsh new file mode 100644 index 0000000..73d9673 --- /dev/null +++ b/config/zsh/plugins/timer.zsh @@ -0,0 +1,13 @@ +function preexec() { + timer=$(($(date +%s%0N)/1000000)) +} + +function precmd() { + if [ $timer ]; then + now=$(($(date +%s%0N)/1000000)) + elapsed=$(($now-$timer)) + + export RPROMPT="%F{magenta}${elapsed}ms %{$reset_color%}" + unset timer + fi +} |
