diff options
author | Daniil Rozanov <dev@drozanov.info> | 2024-11-19 01:54:52 +0400 |
---|---|---|
committer | Daniil Rozanov <dev@drozanov.info> | 2024-11-19 01:54:52 +0400 |
commit | 09d3ff48daf832e0830e6a3b363af094ad63a4f1 (patch) | |
tree | df535f75968a494a0df12b85cbf097e3e533316f /zsh | |
parent | 8bb6d89194e25990b8376f9c9700a61103fb7a66 (diff) |
alacritty
Diffstat (limited to 'zsh')
-rw-r--r-- | zsh/.config/zsh/.zshrc | 56 | ||||
-rw-r--r-- | zsh/.config/zsh/aliases.zsh | 2 | ||||
-rw-r--r-- | zsh/.config/zsh/bindings.zsh | 23 | ||||
-rw-r--r-- | zsh/.config/zsh/plugins.zsh | 5 | ||||
-rw-r--r-- | zsh/.config/zsh/prompt.zsh | 73 | ||||
-rw-r--r-- | zsh/.zshenv | 5 |
6 files changed, 49 insertions, 115 deletions
diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 1a0a6ef..f121dae 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -21,16 +21,31 @@ stty stop undef # Disable ctrl-s to freeze terminal. zle_highlight=('paste:none') unsetopt BEEP # Unset beep +# Interactive env +# NOTE: I'd like to propogate this to fzf-tab to not dublicate defaults, but +# if i do so, fzf starts behave strange. So for now there is two places where +# i define its defaults - here and in fzf-tab settigs +export FZF_DEFAULT_OPTS="\ + --height=60%\ + --layout=reverse\ + --info=inline\ + --tmux center,90%,90%\ + --bind='ctrl-y:accept'\ + --bind='ctrl-a:toggle-all'\ + --bind='ctrl-u:preview-half-page-up'\ + --bind='ctrl-d:preview-half-page-down'" + # Plugins source $ZDOTDIR/functions.zsh zsh_add_plugin "zsh-users/zsh-syntax-highlighting" # Syntax highlighting -zsh_add_plugin "zsh-users/zsh-completions" # Bunch of completions for many commands +zsh_add_plugin "zsh-users/zsh-completions" # Completions for many commands zsh_add_plugin "zsh-users/zsh-autosuggestions" # Interact with completions -zsh_add_plugin "zsh-users/zsh-history-substring-search" # Substring history search +zsh_add_plugin "zsh-users/zsh-history-substring-search" # Substr history search zsh_add_plugin "Aloxaf/fzf-tab" # FZF integration +zsh_add_plugin "Freed-Wu/fzf-tab-source" # Many predefined settings for fzf-tab # Colors @@ -46,26 +61,30 @@ zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" zstyle ':completion:*' menu no zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache" -zstyle ':fzf-tab:*' fzf-bindings 'ctrl-j:accept' -zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath' -zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath' +zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup +zstyle ':fzf-tab:*' use-fzf-default-opts yes +zstyle ':fzf-tab:complete:*' fzf-bindings \ + 'ctrl-y:accept' \ + 'ctrl-a:toggle-all' \ + 'ctrl-u:preview-half-page-up' \ + 'ctrl-d:preview-half-page-down' _comp_options+=(globdots) # Include hidden files. # Prompt autoload -Uz vcs_info zstyle ':vcs_info:*' enable git -zstyle ':vcs_info:*' formats "%F{228} %b%f %c%u " +zstyle ':vcs_info:*' formats " %F{228} %b%f%c%u" zstyle ':vcs_info:*' check-for-changes true # This might be expensive zstyle ':vcs_info:*' get-revision true zstyle ':vcs_info:*' check-for-staged-changes true -zstyle ':vcs_info:*' patch-format '%p [%n|%c|%u]' -zstyle ':vcs_info:*' nopatch-format '%p [%n|%c|%u]' +# zstyle ':vcs_info:*' patch-format '%p [%n|%c|%u]' +# zstyle ':vcs_info:*' nopatch-format '%p [%n|%c|%u]' # This is default -zstyle ':vcs_info:*' stagedstr '%B%F{green}+%f%b' -zstyle ':vcs_info:*' unstagedstr '%B%F{red}*%f%b' +zstyle ':vcs_info:*' stagedstr ' %B%F{green}+%f%b' +zstyle ':vcs_info:*' unstagedstr ' %B%F{red}*%f%b' -# TODO: how this unstaged marker looks ugly +# TODO: now this unstaged marker looks ugly # zstyle ':vcs_info:git*+set-message:*' hooks git-untracked # +vi-git-untracked() # { @@ -85,7 +104,7 @@ precmd() } setopt prompt_subst -PROMPT='%B%F{40}%~%f%b ${vcs_info_msg_0_}%F{40}%f ' +PROMPT='%B%F{40}%~%f%b${vcs_info_msg_0_} %F{40}%f ' # Bindings @@ -112,3 +131,16 @@ alias c='clear' # Shell integrations source <(fzf --zsh) + + +# Start tmux + +function start_tmux() { + if type tmux &> /dev/null; then + if [[ -z "$TMUX" && -z $TERMINAL_CONTEXT ]]; then + tmux -2 new-session -A -s home + fi + fi +} + +start_tmux diff --git a/zsh/.config/zsh/aliases.zsh b/zsh/.config/zsh/aliases.zsh deleted file mode 100644 index 937dffc..0000000 --- a/zsh/.config/zsh/aliases.zsh +++ /dev/null @@ -1,2 +0,0 @@ -alias v=nvim -alias la="ls -la" diff --git a/zsh/.config/zsh/bindings.zsh b/zsh/.config/zsh/bindings.zsh deleted file mode 100644 index 82a4fd3..0000000 --- a/zsh/.config/zsh/bindings.zsh +++ /dev/null @@ -1,23 +0,0 @@ -bindkey -s '^o' 'ranger^M' -bindkey -s '^f' 'zi^M' -bindkey -s '^s' 'ncdu^M' -bindkey -s '^z' 'zi^M' -bindkey '^[[P' delete-char - -# Search navigation -autoload -U up-line-or-beginning-search -autoload -U down-line-or-beginning-search -zle -N up-line-or-beginning-search -zle -N down-line-or-beginning-search -bindkey "^p" up-line-or-beginning-search # Up -bindkey "^n" down-line-or-beginning-search # Down -bindkey "^k" up-line-or-beginning-search # Up -bindkey "^j" down-line-or-beginning-search # Down - -# Edit line in vim with ctrl-e: -autoload edit-command-line; zle -N edit-command-line -bindkey '^e' edit-command-line - -# Unbind -bindkey -r "^u" -bindkey -r "^d" diff --git a/zsh/.config/zsh/plugins.zsh b/zsh/.config/zsh/plugins.zsh deleted file mode 100644 index 177835a..0000000 --- a/zsh/.config/zsh/plugins.zsh +++ /dev/null @@ -1,5 +0,0 @@ -source $ZDOTDIR/functions.zsh - -# Plugins -zsh_add_plugin "zsh-users/zsh-autosuggestions" -zsh_add_plugin "zsh-users/zsh-syntax-highlighting" diff --git a/zsh/.config/zsh/prompt.zsh b/zsh/.config/zsh/prompt.zsh deleted file mode 100644 index 3e74427..0000000 --- a/zsh/.config/zsh/prompt.zsh +++ /dev/null @@ -1,73 +0,0 @@ -COLOR_PROMPT_TEXT='009' -COLOR_PROMPT_GLYPH='255' -NUM_DIRS_LEFT_OF_TRUNCATION=1 -NUM_DIRS_RIGHT_OF_TRUNCATION=2 -GLYPH_PROMPT_TRUNCATION_SYMBOL='⋯' -GLYPH_PROMPT_END_SYMBOL='❯' - -set_prompt() { - [[ $NUM_DIRS_LEFT_OF_TRUNCATION -le 0 ]] && NUM_DIRS_LEFT_OF_TRUNCATION=1 - [[ $NUM_DIRS_RIGHT_OF_TRUNCATION -le 0 ]] && NUM_DIRS_RIGHT_OF_TRUNCATION=2 - - local prompt_truncation_symbol="%F{${COLOR_PROMPT_GLYPH}}%B${GLYPH_PROMPT_TRUNCATION_SYMBOL}%b%f" - local prompt_end_symbol="%F{${COLOR_PROMPT_GLYPH}}%B${GLYPH_PROMPT_END_SYMBOL}%b%f" - local total_dirs=$(($NUM_DIRS_LEFT_OF_TRUNCATION+$NUM_DIRS_RIGHT_OF_TRUNCATION+1)) - local dir_path_full="%F{${COLOR_PROMPT_TEXT}}%d%f" - local dir_path_truncated="%F{${COLOR_PROMPT_TEXT}}%-${NUM_DIRS_LEFT_OF_TRUNCATION}d/%f${prompt_truncation_symbol}%F{${COLOR_PROMPT_TEXT}}/%${NUM_DIRS_RIGHT_OF_TRUNCATION}d%f" - - PROMPT="%(${total_dirs}C.${dir_path_truncated}.${dir_path_full}) ${prompt_end_symbol} " -} - -precmd_functions+=(set_prompt) - - -COLOR_GIT_REPOSITORY_TEXT='245' -COLOR_GIT_BRANCH_TEXT='255' -COLOR_GIT_STATUS_CLEAN='010' -COLOR_GIT_STATUS_DIRTY='009' -GLYPH_GIT_BRANCH_SYNC_SYMBOL='«' -GLYPH_GIT_STASH_SYMBOL='∘' -GLYPH_GIT_STATUS_SYMBOL='»' - -set_rprompt() { - local git_branch_name=$(git symbolic-ref --short HEAD 2> /dev/null) - if [[ -z $git_branch_name ]]; then - RPROMPT="" - - return - fi - - local git_remote_commit=$(git rev-parse "origin/$git_branch_name" 2> /dev/null) - local git_local_commit=$(git rev-parse "$git_branch_name" 2> /dev/null) - local git_branch_sync_color=$COLOR_GIT_STATUS_DIRTY - if [[ $git_remote_commit == $git_local_commit ]]; then - git_branch_sync_color=$COLOR_GIT_STATUS_CLEAN - fi - - local git_stash=$(git stash list) - local git_stash_symbol=$GLYPH_GIT_STASH_SYMBOL - if [[ -z $git_stash ]]; then - git_stash_symbol="" - fi - - local git_status=$(git status --porcelain) - local git_stash_color=$COLOR_GIT_STATUS_DIRTY - local git_status_color=$COLOR_GIT_STATUS_DIRTY - if [[ -z $git_status ]]; then - git_stash_color=$COLOR_GIT_STATUS_CLEAN - git_status_color=$COLOR_GIT_STATUS_CLEAN - fi - - local git_repository_path=$(git rev-parse --show-toplevel) - local git_repository_name=$(basename "$git_repository_path") - - local git_repository_text="%F{${COLOR_GIT_REPOSITORY_TEXT}}${git_repository_name}%f" - local git_branch_sync_symbol="%F{${git_branch_sync_color}}%B${GLYPH_GIT_BRANCH_SYNC_SYMBOL}%b%f" - local git_stash_symbol="%F{${git_stash_color}}%B${git_stash_symbol}%b%f" - local git_status_symbol="%F{${git_status_color}}%B${GLYPH_GIT_STATUS_SYMBOL}%b%f" - local git_branch_text="%F{${COLOR_GIT_BRANCH_TEXT}}${git_branch_name}%f" - - RPROMPT="${git_repository_text} ${git_branch_sync_symbol}${git_stash_symbol}${git_status_symbol} ${git_branch_text}" -} - -precmd_functions+=(set_rprompt) diff --git a/zsh/.zshenv b/zsh/.zshenv index 82356e0..a2d91da 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -1,3 +1,7 @@ +# GUIX +export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale" +GUIX_PROFILE="$HOME/.config/guix/current" +. "$GUIX_PROFILE/etc/profile" # XDG Paths export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config} export XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache} @@ -11,3 +15,4 @@ export ZDOTDIR=$XDG_CONFIG_HOME/zsh # User environment variables export EDITOR="nvim" +export PAGER="less" |