diff options
Diffstat (limited to 'config/zsh')
| -rw-r--r-- | config/zsh/aliases.zsh | 7 | ||||
| -rw-r--r-- | config/zsh/aliases/dev.zsh | 31 | ||||
| -rw-r--r-- | config/zsh/aliases/edit.zsh | 4 | ||||
| -rw-r--r-- | config/zsh/aliases/git.zsh | 14 | ||||
| -rw-r--r-- | config/zsh/aliases/ls.zsh | 24 | ||||
| -rw-r--r-- | config/zsh/config.zsh | 8 | ||||
| -rw-r--r-- | config/zsh/init.zsh | 10 | ||||
| -rw-r--r-- | config/zsh/plugins/fzf-cd.zsh | 4 | ||||
| -rw-r--r-- | config/zsh/plugins/timer.zsh | 1 | ||||
| -rw-r--r-- | config/zsh/theme.zsh | 1 | ||||
| -rw-r--r-- | config/zsh/zshrc | 1 |
11 files changed, 36 insertions, 69 deletions
diff --git a/config/zsh/aliases.zsh b/config/zsh/aliases.zsh index 9eb564a..9c0d1f8 100644 --- a/config/zsh/aliases.zsh +++ b/config/zsh/aliases.zsh @@ -6,7 +6,7 @@ alias grep="grep --color=auto"; # Application shortcuts alias emedit="emacsclient -c -n"; alias e="sensible-editor"; -alias v="nvim"; +alias k="kak-tmux"; alias o='open $(fzf)'; alias j='just'; @@ -38,3 +38,8 @@ alias szathura="swallow zathura"; # Dictionary dict() { curl dict://dict.org/d:$1; } +countdown() { + date; + sleep "$1" && notify-send -u critical "${2:-"Timer done"}" +} + diff --git a/config/zsh/aliases/dev.zsh b/config/zsh/aliases/dev.zsh index 65922a1..fa0bf5c 100644 --- a/config/zsh/aliases/dev.zsh +++ b/config/zsh/aliases/dev.zsh @@ -23,19 +23,6 @@ far() { fd "$file_r" | sad "$matcher_r" "$result" -p diff-so-fancy "$@"; } -# :: FileType Filename -calc() { - local syntax="${1:-javascript}" - shift - nvim -c \ - "let g:startify_disable_at_vimenter = 1 |\ - set bt=nofile ls=0 |\ - hi ColorColumn ctermbg=NONE |\ - hi VertSplit ctermbg=NONE |\ - hi NonText ctermfg=0 |\ - Codi $syntax" "$@" -} - get_node_script_runner() { # TODO: Check .engines.* # jq -r .engines.pnpm package.json @@ -64,21 +51,3 @@ bindkey '^B' p__run_npm_script; fix-interpreter() { nix-shell -p patchelf --run "patchelf --set-interpreter \$(patchelf --print-interpreter \$(which mkdir)) $@" } - - -# Terminal through neovim -vt() { - nvim +term \ - +'norm i' \ - +"lua vim.fn.feedkeys([[$1]])" \ - +'lua vim.go.termguicolors = false' \ - +'set nonumber norelativenumber signcolumn=no' \ - +'autocmd TermClose * execute "qa"' \ - +'hi @_phenax.term-title guibg=#1a1824 guifg=#8e7ae3 gui=bold' \ - +'set winbar=%#@_phenax.term-title#%=nvim-term%='; -} - -p__nvim_virtual_terminal() { vt "$BUFFER"; } -zle -N p__nvim_virtual_terminal; -bindkey '^T' p__nvim_virtual_terminal; - diff --git a/config/zsh/aliases/edit.zsh b/config/zsh/aliases/edit.zsh index fe14d92..2111430 100644 --- a/config/zsh/aliases/edit.zsh +++ b/config/zsh/aliases/edit.zsh @@ -4,7 +4,7 @@ alias eemacs='gemacs && emedit Emacs.org'; alias eorg='gnotes && sensible-editor index.md'; alias ezsh='gzsh && sensible-editor zshrc'; alias edot='sensible-editor ~/nixos/scripts/dotfiles.sh'; -alias evim='gvim && sensible-editor init.lua'; +alias evim='gvim && sensible-editor'; alias edwm='gdwm && sensible-editor config.def.h'; alias ebar='gbar && sensible-editor blocks.h'; @@ -13,4 +13,4 @@ alias equte='gqute && sensible-editor config.py'; alias eas='sensible-editor ~/nixos/packages/dwm/autostart.sh'; alias emime="sensible-editor ~/nixos/scripts/bin/open"; -alias fedit='sensible-editor `fzf`' +alias fe='sensible-editor `fzf`' diff --git a/config/zsh/aliases/git.zsh b/config/zsh/aliases/git.zsh index c33781d..9611a16 100644 --- a/config/zsh/aliases/git.zsh +++ b/config/zsh/aliases/git.zsh @@ -54,14 +54,14 @@ alias grc='git rebase --continue' # egc : Open files in last commit # egc HEAD~1 : Open files in commit before the last one egc() { - nvim $(git show --name-only --pretty="" "$@"); + sensible-editor $(git show --name-only --pretty="" "$@"); } # Open files in diff # egd : Open files changed (HEAD) # egd origin/main : Open files diff between origin/main egd() { - nvim $(git diff --name-only ${1:-HEAD}); + sensible-editor $(git diff --name-only ${1:-HEAD}); } grename() { @@ -98,3 +98,13 @@ gco() { fi } +ghpr() { + if [ -f '.github/pull_request_template.md' ]; then + gh pr create -e -a "@me" -T 'pull_request_template.md' "$@" || true + else + gh pr create -e -a "@me" "$@" || true + fi + + xdg-open "$(gh pr view --json url -q .url)" +} + diff --git a/config/zsh/aliases/ls.zsh b/config/zsh/aliases/ls.zsh index a3a484a..4e763fd 100644 --- a/config/zsh/aliases/ls.zsh +++ b/config/zsh/aliases/ls.zsh @@ -1,28 +1,18 @@ -# Trash -alias trash="ls \$TRASH_TMP_DIR"; - # List files aliases -alias l="ls -1"; -alias la='ls -a'; -alias ll='ls -alF'; -alias lt='ls --tree'; +alias ll="ls -lh --time-style=+ --group-directories-first --color=always"; alias la='ls -A'; alias lsize='du -h -d1'; -lc () { # lf with cd to navigated directory on quit +alias l='daffm'; +alias lt='daffm'; + +# cd to navigated directory on quit +lc () { tmp="$(mktemp)" - lf -last-dir-path="$tmp" "$@" + DAFFM_LAST_DIR_PATH="$tmp" daffm -c @lastcd if [ -f "$tmp" ]; then dir="$(cat "$tmp")" rm -f "$tmp" [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" fi } - -lfshow() { - local TMP_F="$(mktemp)"; - lf -selection-path "$TMP_F" "$@" >/dev/null 2>&1; - local res="$(< "$TMP_F")"; - rm -f "$TMP_F"; - echo "$res" -} diff --git a/config/zsh/config.zsh b/config/zsh/config.zsh index eb409fa..2b3b1e9 100644 --- a/config/zsh/config.zsh +++ b/config/zsh/config.zsh @@ -1,14 +1,14 @@ -export VISUAL='nvim' -export EDITOR="nvim" +export VISUAL='kak-tmux' +export EDITOR="kak-tmux" export TERMINAL="st" export BROWSER="qutebrowser" export PRIVATE_BROWSER="$BROWSER ':open -p'"; export READER="zathura" -export FILE="lf" +export FILE="daffm" export FZF_DEFAULT_OPTS="--layout=reverse --height 40%" export HISTCONTROL=ignoreboth -export LS_COLORS='di=35:ln=36:or=31:mi=31:ex=32:*.ts=36'; +export LS_COLORS='di=96:ln=36:or=31:mi=31:ex=32:*.gitignore=90'; diff --git a/config/zsh/init.zsh b/config/zsh/init.zsh index 5fca111..8b13789 100644 --- a/config/zsh/init.zsh +++ b/config/zsh/init.zsh @@ -1,11 +1 @@ -export TRASH_TMP_DIR=/tmp/.trash-cache; - -# [[ ! -d "$TRASH_TMP_DR" ]] && mkdir -p $TRASH_TMP_DIR; - -#export rmrf() { - #for var in "$@"; do - #mv $var $TRASH_TMP_DIR; - #done -#} - diff --git a/config/zsh/plugins/fzf-cd.zsh b/config/zsh/plugins/fzf-cd.zsh index 02b85e7..9d47e17 100644 --- a/config/zsh/plugins/fzf-cd.zsh +++ b/config/zsh/plugins/fzf-cd.zsh @@ -1,6 +1,6 @@ fzf-change-dir-cwd() { # fzf + cd in cwd - selected=$(find . -maxdepth 1 -type d | fzf); + selected=$(fd --type d --maxdepth 1 --hidden --no-ignore | fzf); if [ ! -z "$selected" ] && [ "$selected" != "$(pwd)" ]; then cd $selected; fi @@ -11,7 +11,7 @@ zle -N fzf-change-dir-cwd; bindkey '^O' fzf-change-dir-cwd; fzf-change-dir() { - local result=$(find -type d | fzf); + local result=$(fd --type d --hidden --no-ignore | fzf); if ! [[ -z "$result" ]]; then cd "$result" fi diff --git a/config/zsh/plugins/timer.zsh b/config/zsh/plugins/timer.zsh index 3610877..5505657 100644 --- a/config/zsh/plugins/timer.zsh +++ b/config/zsh/plugins/timer.zsh @@ -1,5 +1,6 @@ function preexec() { timer=$(($(date +%s%0N)/1000000)) + echo -n "\\x1b]133;A\\x1b\\" # OSC 133 for marking prompt } function precmd() { diff --git a/config/zsh/theme.zsh b/config/zsh/theme.zsh index e2f476b..2f591a3 100644 --- a/config/zsh/theme.zsh +++ b/config/zsh/theme.zsh @@ -25,6 +25,7 @@ p_dir() { # Prompt terminal status p_status() { [[ ! -z "$WITH_NIX_PREFIX" ]] && echo -n "$(segment "[NIX:$WITH_NIX_PREFIX] " black $COL_ACCENT)"; + [[ "$TERM" = "tmux-256color" ]] && echo -n "$(segment "[tmux]" black $COL_ACCENT)"; echo -n "%(?..$(segment 'x' black $COL_STATUS_ERROR))" echo -n "%(1j.$(segment '(jobs: %j)' black $COL_STATUS_BG).)" } diff --git a/config/zsh/zshrc b/config/zsh/zshrc index 32392ab..806697d 100644 --- a/config/zsh/zshrc +++ b/config/zsh/zshrc @@ -3,6 +3,7 @@ setopt auto_cd; setopt inc_append_history; export LESS="-R --chop-long-lines" # less no wrapping +export MANPAGER="nvim +Man\!" # man pager with nvim export SAVEHIST=10000 # export HISTSIZE=50000 |
