diff --git a/.aliases b/.config/zsh/.aliases similarity index 74% rename from .aliases rename to .config/zsh/.aliases index 8de99e0..ea8f5c3 100644 --- a/.aliases +++ b/.config/zsh/.aliases @@ -1,4 +1,4 @@ -alias af=alias-finder +# alias af=alias-finder alias ls=lsd alias lt="lsd --tree" alias rake='noglob bundled_rake' @@ -6,8 +6,6 @@ alias weather='curl wttr.in/?0' alias gdm='gd master' alias s='gst .' alias d='gd .' -alias ratslap="~/Downloads/ratslap/ratslap" -alias charmce="/usr/local/bin/charmce" alias intel="sudo prime-select intel" alias nvidia="sudo prime-select nvidia" alias pls="sudo" @@ -23,23 +21,26 @@ alias suod="sudo" alias sduo="sudo" alias zz='z -c' # restrict matches to subdirs of $PWD alias zi='z -I' # use fzf to select in multiple matches -alias j=z -alias ji='z -I' -alias jj='z -c' -alias jb='z -b' +alias h=z +alias hi='z -I' +alias hh='z -c' +alias hb='z -b' alias t="todo.sh" alias ta="todo.sh add" alias tl="todo.sh list" alias td="todo.sh do" alias tp="todo.sh pri" -alias vim="nvim" -alias viz="vim ~/.zshrc" +alias vim="lvim" +alias viz="vim ${ZDOTDIR:-$HOME}/.zshrc" alias vit="vim ~/.tmux.conf" alias vip="vim ~/.config/polybar/config" alias viv="vim ~/.vimrc" alias viw="vim ~/.which-key.vim" -alias via="vim ~/.aliases" +alias via="vim ${ZDOTDIR:-$HOME}/.aliases" alias vi3="vim ~/.config/i3/config" -alias connect="sudo vpnc kartaca-vpn" -alias disconnect="sudo vpnc-disconnect" +alias viq="vim ~/.config/qtile/config.py" +alias top='htop' +alias cp='cp -ri' +alias mv='mv -i' +alias mkdir='mkdir -p' alias dotfiles='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME' diff --git a/.p10k.zsh b/.config/zsh/.p10k.zsh similarity index 92% rename from .p10k.zsh rename to .config/zsh/.p10k.zsh index 5bcc67a..2f2df1b 100644 --- a/.p10k.zsh +++ b/.config/zsh/.p10k.zsh @@ -1,11 +1,11 @@ -# Generated by Powerlevel10k configuration wizard on 2021-04-23 at 12:14 +03. -# Based on romkatv/powerlevel10k/config/p10k-classic.zsh, checksum 40036. -# Wizard options: nerdfont-complete + powerline, small icons, classic, unicode, dark, -# angled separators, sharp heads, flat tails, 2 lines, dotted, no frame, sparse, -# many icons, fluent, transient_prompt, instant_prompt=verbose. +# Generated by Powerlevel10k configuration wizard on 2022-01-24 at 17:54 +03. +# Based on romkatv/powerlevel10k/config/p10k-lean.zsh, checksum 59558. +# Wizard options: nerdfont-complete + powerline, large icons, unicode, lean, 24h time, +# 2 lines, dotted, no frame, light-ornaments, sparse, many icons, concise, +# transient_prompt, instant_prompt=verbose. # Type `p10k configure` to generate another config. # -# Config for Powerlevel10k with classic powerline prompt style. Type `p10k configure` to generate +# Config for Powerlevel10k with lean prompt style. Type `p10k configure` to generate # your own config based on it. # # Tip: Looking for a nice color? Here's a one-liner to print colormap. @@ -33,7 +33,6 @@ typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( # =========================[ Line #1 ]========================= os_icon # os identifier - context # user@hostname dir # current directory vcs # git status # =========================[ Line #2 ]========================= @@ -78,18 +77,21 @@ haskell_stack # haskell version from stack (https://haskellstack.org/) kubecontext # current kubernetes context (https://kubernetes.io/) terraform # terraform workspace (https://www.terraform.io) + # terraform_version # terraform version (https://www.terraform.io) aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) aws_eb_env # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) azure # azure account name (https://docs.microsoft.com/en-us/cli/azure) gcloud # google cloud cli account and project (https://cloud.google.com/) google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production) + toolbox # toolbox name (https://github.com/containers/toolbox) + context # user@hostname nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) ranger # ranger shell (https://github.com/ranger/ranger) nnn # nnn shell (https://github.com/jarun/nnn) + xplr # xplr shell (https://github.com/sayanarijit/xplr) vim_shell # vim shell indicator (:sh) midnight_commander # midnight commander shell (https://midnight-commander.org/) nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) - # vi_mode # vi mode (you don't need this if you've enabled prompt_char) # vpn_ip # virtual private network indicator # load # CPU load # disk_usage # disk usage @@ -98,9 +100,9 @@ todo # todo items (https://github.com/todotxt/todo.txt-cli) timewarrior # timewarrior tracking status (https://timewarrior.net/) taskwarrior # taskwarrior task count (https://taskwarrior.org/) - # time # current time + time # current time # =========================[ Line #2 ]========================= - # newline # \n + newline # ip # ip address and bandwidth usage for a specified network interface # public_ip # public IP address # proxy # system-wide http/https/ftp proxy @@ -113,7 +115,14 @@ typeset -g POWERLEVEL9K_MODE=nerdfont-complete # When set to `moderate`, some icons will have an extra space after them. This is meant to avoid # icon overlap when using non-monospace fonts. When set to `none`, spaces are not added. - typeset -g POWERLEVEL9K_ICON_PADDING=none + typeset -g POWERLEVEL9K_ICON_PADDING=moderate + + # Basic style options that define the overall look of your prompt. You probably don't want to + # change them. + typeset -g POWERLEVEL9K_BACKGROUND= # transparent background + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol # When set to true, icons appear before content on both sides of the prompt. When set # to false, icons go after content. If empty or not set, icons go before content in the left @@ -126,13 +135,12 @@ # Or for a specific segment in specific state: # # POWERLEVEL9K_DIR_NOT_WRITABLE_ICON_BEFORE_CONTENT=false - typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT= + typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT=true # Add an empty line before each prompt. typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true - # Connect left prompt lines with these symbols. You'll probably want to use the same color - # as POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND below. + # Connect left prompt lines with these symbols. typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX= typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX= typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX= @@ -141,54 +149,45 @@ typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX= typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX= - # Filler between left and right prompt on the first prompt line. You can set it to ' ', '·' or - # '─'. The last two make it easier to see the alignment between left and right prompt and to - # separate prompt from command output. You might want to set POWERLEVEL9K_PROMPT_ADD_NEWLINE=false - # for more compact prompt if using using this option. + # The left end of left prompt. + typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL= + # The right end of right prompt. + typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL= + + # Ruler, a.k.a. the horizontal line before each prompt. If you set it to true, you'll + # probably want to set POWERLEVEL9K_PROMPT_ADD_NEWLINE=false above and + # POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' below. + typeset -g POWERLEVEL9K_SHOW_RULER=false + typeset -g POWERLEVEL9K_RULER_CHAR='─' # reasonable alternative: '·' + typeset -g POWERLEVEL9K_RULER_FOREGROUND=242 + + # Filler between left and right prompt on the first prompt line. You can set it to '·' or '─' + # to make it easier to see the alignment between left and right prompt and to separate prompt + # from command output. It serves the same purpose as ruler (see above) without increasing + # the number of prompt lines. You'll probably want to set POWERLEVEL9K_SHOW_RULER=false + # if using this. You might also like POWERLEVEL9K_PROMPT_ADD_NEWLINE=false for more compact + # prompt. typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR='·' - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_BACKGROUND= - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_GAP_BACKGROUND= if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then - # The color of the filler. You'll probably want to match the color of POWERLEVEL9K_MULTILINE - # ornaments defined above. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=240 + # The color of the filler. + typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=242 + # Add a space between the end of left prompt and the filler. + typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=' ' + # Add a space between the filler and the start of right prompt. + typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL=' ' # Start filler from the edge of the screen if there are no left segments on the first line. typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}' # End filler on the edge of the screen if there are no right segments on the first line. typeset -g POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='%{%}' fi - # Default background color. - typeset -g POWERLEVEL9K_BACKGROUND=236 - - # Separator between same-color segments on the left. - typeset -g POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='%244F\uE0B1' - # Separator between same-color segments on the right. - typeset -g POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='%244F\uE0B3' - # Separator between different-color segments on the left. - typeset -g POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0B0' - # Separator between different-color segments on the right. - typeset -g POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\uE0B2' - # The right end of left prompt. - typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B0' - # The left end of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B2' - # The left end of left prompt. - typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL='' - # The right end of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL='' - # Left prompt terminator for lines without any segments. - typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL= - #################################[ os_icon: os identifier ]################################## # OS identifier color. - typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=255 + typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND= # Custom icon. # typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='⭐' ################################[ prompt_char: prompt symbol ]################################ - # Transparent background. - typeset -g POWERLEVEL9K_PROMPT_CHAR_BACKGROUND= # Green prompt symbol if the last command succeeded. typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=76 # Red prompt symbol if the last command failed. @@ -203,11 +202,9 @@ typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='▶' typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true # No line terminator if prompt_char is the last segment. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL= + typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='' # No line introducer if prompt_char is the first segment. typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL= - # No surrounding whitespace. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_{LEFT,RIGHT}_WHITESPACE= ##################################[ dir: current directory ]################################## # Default current directory color. @@ -341,7 +338,7 @@ # typeset -g POWERLEVEL9K_DIR_CLASSES=() # Custom prefix. - # typeset -g POWERLEVEL9K_DIR_PREFIX='%246Fin ' + # typeset -g POWERLEVEL9K_DIR_PREFIX='%fin ' #####################################[ vcs: git status ]###################################### # Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon. @@ -349,12 +346,11 @@ # Untracked files icon. It's really a question mark, your font isn't broken. # Change the value of this parameter to show a different icon. - # typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?' - typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON=' ' + typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?' # Formatter for Git status. # - # Example output: master ⇣42⇡42 *42 merge ~42 +42 !42 ?42. + # Example output: master wip ⇣42⇡42 *42 merge ~42 +42 !42 ?42. # # You can edit the function to customize how Git status looks. # @@ -372,7 +368,7 @@ if (( $1 )); then # Styling for up-to-date Git status. - local meta='%246F' # grey foreground + local meta='%f' # default foreground local clean='%76F' # green foreground local modified='%178F' # yellow foreground local untracked='%39F' # blue foreground @@ -407,19 +403,24 @@ # Otherwise show the first 12 … the last 12. # Tip: To always show tag name in full without truncation, delete the next line. (( $#tag > 32 )) && tag[13,-13]="…" # <-- this line - res+="${meta} ${clean}${tag//\%/%%}" + res+="${meta}#${clean}${tag//\%/%%}" fi # Display the current Git commit if there is no branch and no tag. # Tip: To always display the current Git commit, delete the next line. [[ -z $VCS_STATUS_LOCAL_BRANCH && -z $VCS_STATUS_TAG ]] && # <-- this line - res+="${meta} ${clean}${VCS_STATUS_COMMIT[1,8]}" + res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}" # Show tracking branch name if it differs from local branch. if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" fi + # Display "wip" if the latest commit's summary contains "wip" or "WIP". + if [[ $VCS_STATUS_COMMIT_SUMMARY == (|*[^[:alnum:]])(wip|WIP)(|[^[:alnum:]]*) ]]; then + res+=" ${modified}wip" + fi + # ⇣42 if behind the remote. (( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}⇣${VCS_STATUS_COMMITS_BEHIND}" # ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42. @@ -431,15 +432,15 @@ # ⇢42 if ahead of the push remote; no leading space if also behind: ⇠42⇢42. (( VCS_STATUS_PUSH_COMMITS_AHEAD )) && res+="${clean}⇢${VCS_STATUS_PUSH_COMMITS_AHEAD}" # *42 if have stashes. - (( VCS_STATUS_STASHES )) && res+=" ${clean} ${VCS_STATUS_STASHES}" + (( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}" # 'merge' if the repo is in an unusual state. [[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}" # ~42 if have merge conflicts. (( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}" # +42 if have staged changes. - (( VCS_STATUS_NUM_STAGED )) && res+=" ${modified} ${VCS_STATUS_NUM_STAGED}" + (( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}" # !42 if have unstaged changes. - (( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified} ${VCS_STATUS_NUM_UNSTAGED}" + (( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}" # ?42 if have untracked files. It's really a question mark, your font isn't broken. # See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon. # Remove the next line if you don't want to see untracked files at all. @@ -483,7 +484,7 @@ # Custom icon. # typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION='⭐' # Custom prefix. - typeset -g POWERLEVEL9K_VCS_PREFIX='%246Fon ' + # typeset -g POWERLEVEL9K_VCS_PREFIX='%fon ' # Show status of repositories of these types. You can add svn and/or hg if you are # using them. If you do, your prompt may become slow even when your current directory @@ -538,19 +539,19 @@ # Show this many fractional digits. Zero means round to seconds. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 # Execution time color. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=248 + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=101 # Duration format: 1d 2h 3m 4s. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' # Custom icon. # typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION='⭐' # Custom prefix. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='%246Ftook ' + # typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='%ftook ' #######################[ background_jobs: presence of background jobs ]####################### # Don't show the number of background jobs. typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false # Background jobs color. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=37 + typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=70 # Custom icon. # typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='⭐' @@ -648,7 +649,7 @@ # .NET Core version from asdf. typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_FOREGROUND=134 # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_SHOW_ON_UPGLOB='*.foo|*.bar' + # typeset -g POWERLEVEL9K_ASDF_DOTNET_SHOW_ON_UPGLOB='*.foo|*.bar' # Flutter version from asdf. typeset -g POWERLEVEL9K_ASDF_FLUTTER_FOREGROUND=38 @@ -721,6 +722,12 @@ # Custom icon. # typeset -g POWERLEVEL9K_NNN_VISUAL_IDENTIFIER_EXPANSION='⭐' + ##################[ xplr: xplr shell (https://github.com/sayanarijit/xplr) ]################## + # xplr shell color. + typeset -g POWERLEVEL9K_XPLR_FOREGROUND=72 + # Custom icon. + # typeset -g POWERLEVEL9K_XPLR_VISUAL_IDENTIFIER_EXPANSION='⭐' + ###########################[ vim_shell: vim shell indicator (:sh) ]########################### # Vim shell indicator color. typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34 @@ -756,23 +763,6 @@ # Custom icon. # typeset -g POWERLEVEL9K_DISK_USAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' - ###########[ vi_mode: vi mode (you don't need this if you've enabled prompt_char) ]########### - # Text and color for normal (a.k.a. command) vi mode. - typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL - typeset -g POWERLEVEL9K_VI_MODE_NORMAL_FOREGROUND=106 - # Text and color for visual vi mode. - typeset -g POWERLEVEL9K_VI_VISUAL_MODE_STRING=VISUAL - typeset -g POWERLEVEL9K_VI_MODE_VISUAL_FOREGROUND=68 - # Text and color for overtype (a.k.a. overwrite and replace) vi mode. - typeset -g POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVERTYPE - typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_FOREGROUND=172 - # Text and color for insert vi mode. - typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING= - typeset -g POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=66 - - # Custom icon. - # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' - ######################################[ ram: free RAM ]####################################### # RAM color. typeset -g POWERLEVEL9K_RAM_FOREGROUND=66 @@ -875,7 +865,7 @@ # Custom icon. # typeset -g POWERLEVEL9K_CONTEXT_VISUAL_IDENTIFIER_EXPANSION='⭐' # Custom prefix. - typeset -g POWERLEVEL9K_CONTEXT_PREFIX='%246Fwith ' + # typeset -g POWERLEVEL9K_CONTEXT_PREFIX='%fwith ' ###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]### # Python virtual environment color. @@ -941,10 +931,10 @@ # # The default format has the following logic: # - # 1. Display "$P9K_CONTENT $P9K_PYENV_PYTHON_VERSION" if $P9K_PYENV_PYTHON_VERSION is not - # empty and unequal to $P9K_CONTENT. - # 2. Otherwise display just "$P9K_CONTENT". - typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_PYENV_PYTHON_VERSION:#$P9K_CONTENT}:+ $P9K_PYENV_PYTHON_VERSION}' + # 1. Display just "$P9K_CONTENT" if it's equal to "$P9K_PYENV_PYTHON_VERSION" or + # starts with "$P9K_PYENV_PYTHON_VERSION/". + # 2. Otherwise display "$P9K_CONTENT $P9K_PYENV_PYTHON_VERSION". + typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_CONTENT:#$P9K_PYENV_PYTHON_VERSION(|/*)}:+ $P9K_PYENV_PYTHON_VERSION}' # Custom icon. # typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION='⭐' @@ -1167,43 +1157,10 @@ # Custom icon. # typeset -g POWERLEVEL9K_HASKELL_STACK_VISUAL_IDENTIFIER_EXPANSION='⭐' - ################[ terraform: terraform workspace (https://www.terraform.io) ]################# - # Don't show terraform workspace if it's literally "default". - typeset -g POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT=false - # POWERLEVEL9K_TERRAFORM_CLASSES is an array with even number of elements. The first element - # in each pair defines a pattern against which the current terraform workspace gets matched. - # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) - # that gets matched. If you unset all POWERLEVEL9K_TERRAFORM_*CONTENT_EXPANSION parameters, - # you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_TERRAFORM_CLASSES defines the workspace class. Patterns are tried in order. The - # first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( - # '*prod*' PROD - # '*test*' TEST - # '*' OTHER) - # - # If your current terraform workspace is "project_test", its class is TEST because "project_test" - # doesn't match the pattern '*prod*' but does match '*test*'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_FOREGROUND=28 - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' - typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( - # '*prod*' PROD # These values are examples that are unlikely - # '*test*' TEST # to match your needs. Customize them as needed. - '*' OTHER) - typeset -g POWERLEVEL9K_TERRAFORM_OTHER_FOREGROUND=38 - # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' - #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# - # Show kubecontext only when the the command you are typing invokes one of these tools. + # Show kubecontext only when the command you are typing invokes one of these tools. # Tip: Remove the next line to always show kubecontext. - typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|fluxctl|stern' + typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|flux|fluxctl|stern' # Kubernetes context classes for the purpose of using different colors, icons and expansions with # different contexts. @@ -1285,10 +1242,49 @@ POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}' # Custom prefix. - typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%246Fat ' + # typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%fat ' + + ################[ terraform: terraform workspace (https://www.terraform.io) ]################# + # Don't show terraform workspace if it's literally "default". + typeset -g POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT=false + # POWERLEVEL9K_TERRAFORM_CLASSES is an array with even number of elements. The first element + # in each pair defines a pattern against which the current terraform workspace gets matched. + # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) + # that gets matched. If you unset all POWERLEVEL9K_TERRAFORM_*CONTENT_EXPANSION parameters, + # you'll see this value in your prompt. The second element of each pair in + # POWERLEVEL9K_TERRAFORM_CLASSES defines the workspace class. Patterns are tried in order. The + # first match wins. + # + # For example, given these settings: + # + # typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( + # '*prod*' PROD + # '*test*' TEST + # '*' OTHER) + # + # If your current terraform workspace is "project_test", its class is TEST because "project_test" + # doesn't match the pattern '*prod*' but does match '*test*'. + # + # You can define different colors, icons and content expansions for different classes: + # + # typeset -g POWERLEVEL9K_TERRAFORM_TEST_FOREGROUND=28 + # typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' + # typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' + typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( + # '*prod*' PROD # These values are examples that are unlikely + # '*test*' TEST # to match your needs. Customize them as needed. + '*' OTHER) + typeset -g POWERLEVEL9K_TERRAFORM_OTHER_FOREGROUND=38 + # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' + + #############[ terraform_version: terraform version (https://www.terraform.io) ]############## + # Terraform version color. + typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=38 + # Custom icon. + # typeset -g POWERLEVEL9K_TERRAFORM_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' #[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]# - # Show aws only when the the command you are typing invokes one of these tools. + # Show aws only when the command you are typing invokes one of these tools. # Tip: Remove the next line to always show aws. typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|awless|terraform|pulumi|terragrunt' @@ -1322,6 +1318,12 @@ typeset -g POWERLEVEL9K_AWS_DEFAULT_FOREGROUND=208 # typeset -g POWERLEVEL9K_AWS_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' + # AWS segment format. The following parameters are available within the expansion. + # + # - P9K_AWS_PROFILE The name of the current AWS profile. + # - P9K_AWS_REGION The region associated with the current AWS profile. + typeset -g POWERLEVEL9K_AWS_CONTENT_EXPANSION='${P9K_AWS_PROFILE//\%/%%}${P9K_AWS_REGION:+ ${P9K_AWS_REGION//\%/%%}}' + #[ aws_eb_env: aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) ]# # AWS Elastic Beanstalk environment color. typeset -g POWERLEVEL9K_AWS_EB_ENV_FOREGROUND=70 @@ -1329,7 +1331,7 @@ # typeset -g POWERLEVEL9K_AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION='⭐' ##########[ azure: azure account name (https://docs.microsoft.com/en-us/cli/azure) ]########## - # Show azure only when the the command you are typing invokes one of these tools. + # Show azure only when the command you are typing invokes one of these tools. # Tip: Remove the next line to always show azure. typeset -g POWERLEVEL9K_AZURE_SHOW_ON_COMMAND='az|terraform|pulumi|terragrunt' # Azure account name color. @@ -1338,9 +1340,9 @@ # typeset -g POWERLEVEL9K_AZURE_VISUAL_IDENTIFIER_EXPANSION='⭐' ##########[ gcloud: google cloud account and project (https://cloud.google.com/) ]########### - # Show gcloud only when the the command you are typing invokes one of these tools. + # Show gcloud only when the command you are typing invokes one of these tools. # Tip: Remove the next line to always show gcloud. - typeset -g POWERLEVEL9K_GCLOUD_SHOW_ON_COMMAND='gcloud|gcs' + typeset -g POWERLEVEL9K_GCLOUD_SHOW_ON_COMMAND='gcloud|gcs|gsutil' # Google cloud color. typeset -g POWERLEVEL9K_GCLOUD_FOREGROUND=32 @@ -1379,7 +1381,7 @@ # typeset -g POWERLEVEL9K_GCLOUD_VISUAL_IDENTIFIER_EXPANSION='⭐' #[ google_app_cred: google application credentials (https://cloud.google.com/docs/authentication/production) ]# - # Show google_app_cred only when the the command you are typing invokes one of these tools. + # Show google_app_cred only when the command you are typing invokes one of these tools. # Tip: Remove the next line to always show google_app_cred. typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_SHOW_ON_COMMAND='terraform|pulumi|terragrunt' @@ -1432,6 +1434,16 @@ # Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced by '%%'. typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_CONTENT_EXPANSION='${P9K_GOOGLE_APP_CRED_PROJECT_ID//\%/%%}' + ##############[ toolbox: toolbox name (https://github.com/containers/toolbox) ]############### + # Toolbox color. + typeset -g POWERLEVEL9K_TOOLBOX_FOREGROUND=178 + # Don't display the name of the toolbox if it matches fedora-toolbox-*. + typeset -g POWERLEVEL9K_TOOLBOX_CONTENT_EXPANSION='${P9K_TOOLBOX_NAME:#fedora-toolbox-*}' + # Custom icon. + # typeset -g POWERLEVEL9K_TOOLBOX_VISUAL_IDENTIFIER_EXPANSION='⭐' + # Custom prefix. + # typeset -g POWERLEVEL9K_TOOLBOX_PREFIX='%fin ' + ###############################[ public_ip: public IP address ]############################### # Public IP color. typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=94 @@ -1460,14 +1472,16 @@ # The following parameters are accessible within the expansion: # # Parameter | Meaning - # ----------------------+--------------- - # P9K_IP_IP | IP address - # P9K_IP_INTERFACE | network interface - # P9K_IP_RX_BYTES | total number of bytes received - # P9K_IP_TX_BYTES | total number of bytes sent - # P9K_IP_RX_RATE | receive rate (since last prompt) - # P9K_IP_TX_RATE | send rate (since last prompt) - typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='${P9K_IP_RX_RATE:+%70F⇣$P9K_IP_RX_RATE }${P9K_IP_TX_RATE:+%215F⇡$P9K_IP_TX_RATE }%38F$P9K_IP_IP' + # ----------------------+------------------------------------------- + # P9K_IP_IP | IP address + # P9K_IP_INTERFACE | network interface + # P9K_IP_RX_BYTES | total number of bytes received + # P9K_IP_TX_BYTES | total number of bytes sent + # P9K_IP_RX_BYTES_DELTA | number of bytes received since last prompt + # P9K_IP_TX_BYTES_DELTA | number of bytes sent since last prompt + # P9K_IP_RX_RATE | receive rate (since last prompt) + # P9K_IP_TX_RATE | send rate (since last prompt) + typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='$P9K_IP_IP${P9K_IP_RX_RATE:+ %70F⇣$P9K_IP_RX_RATE}${P9K_IP_TX_RATE:+ %215F⇡$P9K_IP_TX_RATE}' # Show information for the first network interface whose name matches this regular expression. # Run `ifconfig` or `ip -4 a show` to see the names of all network interfaces. typeset -g POWERLEVEL9K_IP_INTERFACE='[ew].*' @@ -1531,7 +1545,7 @@ # Custom icon. # typeset -g POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION='⭐' # Custom prefix. - typeset -g POWERLEVEL9K_TIME_PREFIX='%246Fat ' + # typeset -g POWERLEVEL9K_TIME_PREFIX='%fat ' # Example of a user-defined prompt segment. Function prompt_example will be called on every # prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or diff --git a/.config/zsh/.zlogin b/.config/zsh/.zlogin new file mode 100644 index 0000000..ac4d342 --- /dev/null +++ b/.config/zsh/.zlogin @@ -0,0 +1,26 @@ +# +# Executes commands at login post-zshrc. +# +# Authors: +# Sorin Ionescu +# + +# Execute code that does not affect the current session in the background. +{ + # Compile the completion dump to increase startup speed. + zcompdump="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/zcompdump" + if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then + zcompile "$zcompdump" + fi +} &! + +# Execute code only if STDERR is bound to a TTY. +if [[ -o INTERACTIVE && -t 2 ]]; then + + # Print a random, hopefully interesting, adage. + if (( $+commands[fortune] )); then + fortune -s + print + fi + +fi >&2 diff --git a/.config/zsh/.zlogout b/.config/zsh/.zlogout new file mode 100644 index 0000000..b5d9858 --- /dev/null +++ b/.config/zsh/.zlogout @@ -0,0 +1,19 @@ +# +# Executes commands at logout. +# +# Authors: +# Sorin Ionescu +# + +# Execute code only if STDERR is bound to a TTY. +[[ -o INTERACTIVE && -t 2 ]] && { + +SAYINGS=( + "So long and thanks for all the fish.\n -- Douglas Adams" + "Good morning! And in case I don't see ya, good afternoon, good evening and goodnight.\n --Truman Burbank" +) + +# Print a randomly-chosen message: +echo $SAYINGS[$(($RANDOM % ${#SAYINGS} + 1))] + +} >&2 diff --git a/.config/zsh/.zpreztorc b/.config/zsh/.zpreztorc new file mode 100644 index 0000000..115dc24 --- /dev/null +++ b/.config/zsh/.zpreztorc @@ -0,0 +1,237 @@ +# +# Sets Prezto options. +# +# Authors: +# Sorin Ionescu +# + +# +# General +# + +# Set case-sensitivity for completion, history lookup, etc. +# zstyle ':prezto:*:*' case-sensitive 'yes' + +# Color output (auto set to 'no' on dumb terminals). +zstyle ':prezto:*:*' color 'yes' + +# Add additional directories to load prezto modules from +# zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto-contrib + +# Allow module overrides when pmodule-dirs causes module name collisions +# zstyle ':prezto:load' pmodule-allow-overrides 'yes' + +# Set the Zsh modules to load (man zshmodules). +# zstyle ':prezto:load' zmodule 'attr' 'stat' + +# Set the Zsh functions to load (man zshcontrib). +# zstyle ':prezto:load' zfunction 'zargs' 'zmv' + +# Set the Prezto modules to load (browse modules). +# The order matters. +zstyle ':prezto:load' pmodule \ + 'environment' \ + 'terminal' \ + 'editor' \ + 'history' \ + 'directory' \ + 'spectrum' \ + 'utility' \ + 'rsync' \ + 'tmux' \ + 'completion' \ + 'syntax-highlighting' \ + 'history-substring-search' \ + 'autosuggestions' \ + 'prompt' + + # 'archive' \ archive things + # 'rsync' \ rsync-copy rsync-move + # 'git' \ use oh my zsh git + # https://github.com/Asocia/prezto/tree/master/modules/spectrum +# +# Autosuggestions +# + +# Set the query found color. +zstyle ':prezto:module:autosuggestions:color' found 'fg=32,bold' + +# +# Completions +# + +# Set the entries to ignore in static '/etc/hosts' for host completion. +# zstyle ':prezto:module:completion:*:hosts' etc-host-ignores \ +# '0.0.0.0' '127.0.0.1' + +# +# Editor +# + +# Set the key mapping style to 'emacs' or 'vi'. +zstyle ':prezto:module:editor' key-bindings 'vi' + +# Auto convert .... to ../.. +zstyle ':prezto:module:editor' dot-expansion 'yes' + +# Allow the zsh prompt context to be shown. +zstyle ':prezto:module:editor' ps-context 'yes' + +# +# Git +# + +# Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'. +# zstyle ':prezto:module:git:status:ignore' submodules 'all' + +# +# GNU Utility +# + +# Set the command prefix on non-GNU systems. +# zstyle ':prezto:module:gnu-utility' prefix 'g' + +# +# History Substring Search +# + +# Set the query found color. +# zstyle ':prezto:module:history-substring-search:color' found '' + +# Set the query not found color. +# zstyle ':prezto:module:history-substring-search:color' not-found '' + +# Set the search globbing flags. +# zstyle ':prezto:module:history-substring-search' globbing-flags '' + +# +# macOS +# + +# Set the keyword used by `mand` to open man pages in Dash.app +# zstyle ':prezto:module:osx:man' dash-keyword 'manpages' + +# +# Pacman +# + +# Set the Pacman frontend. +# zstyle ':prezto:module:pacman' frontend 'yaourt' + +# +# Prompt +# + +# Set the prompt theme to load. +# Setting it to 'random' loads a random theme. +# Auto set to 'off' on dumb terminals. +zstyle ':prezto:module:prompt' theme 'powerlevel10k' + +# Set the working directory prompt display length. +# By default, it is set to 'short'. Set it to 'long' (without '~' expansion) +# for longer or 'full' (with '~' expansion) for even longer prompt display. +# zstyle ':prezto:module:prompt' pwd-length 'short' + +# Set the prompt to display the return code along with an indicator for non-zero +# return codes. This is not supported by all prompts. +# zstyle ':prezto:module:prompt' show-return-val 'yes' + +# +# Python +# + +# Auto switch the Python virtualenv on directory change. +# zstyle ':prezto:module:python:virtualenv' auto-switch 'yes' + +# Automatically initialize virtualenvwrapper if pre-requisites are met. +# zstyle ':prezto:module:python:virtualenv' initialize 'yes' + +# +# Ruby +# + +# Auto switch the Ruby version on directory change. +# zstyle ':prezto:module:ruby:chruby' auto-switch 'yes' + +# +# Screen +# + +# Auto start a session when Zsh is launched in a local terminal. +# zstyle ':prezto:module:screen:auto-start' local 'yes' + +# Auto start a session when Zsh is launched in a SSH connection. +# zstyle ':prezto:module:screen:auto-start' remote 'yes' + +# +# SSH +# + +# Set the SSH identities to load into the agent. +# zstyle ':prezto:module:ssh:load' identities 'id_rsa' 'id_rsa2' 'id_github' + +# +# Syntax Highlighting +# + +# Set syntax highlighters. +# By default, only the main highlighter is enabled. +zstyle ':prezto:module:syntax-highlighting' highlighters \ + 'main' \ + 'brackets' \ + 'pattern' \ + 'line' \ + 'cursor' \ + 'root' +# +# Set syntax highlighting styles. +# zstyle ':prezto:module:syntax-highlighting' styles \ +# 'builtin' 'bg=blue' \ +# 'command' 'bg=blue' \ +# 'function' 'bg=blue' +# +# Set syntax pattern styles. +# zstyle ':prezto:module:syntax-highlighting' pattern \ +# 'rm*-rf*' 'fg=white,bold,bg=red' + +# +# Terminal +# + +# Auto set the tab and window titles. +# zstyle ':prezto:module:terminal' auto-title 'yes' + +# Set the window title format. +# zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s' + +# Set the tab title format. +# zstyle ':prezto:module:terminal:tab-title' format '%m: %s' + +# Set the terminal multiplexer title format. +# zstyle ':prezto:module:terminal:multiplexer-title' format '%s' + +# +# Tmux +# + +# Auto start a session when Zsh is launched in a local terminal. +zstyle ':prezto:module:tmux:auto-start' local 'yes' + +# Auto start a session when Zsh is launched in a SSH connection. +# zstyle ':prezto:module:tmux:auto-start' remote 'yes' + +# Integrate with iTerm2. +# zstyle ':prezto:module:tmux:iterm' integrate 'yes' + +# Set the default session name: +session_name=$(echo $TERM | cut -d"-" -f1) +zstyle ':prezto:module:tmux:session' name $session_name + +# +# Utility +# + +# Enabled safe options. This aliases cp, ln, mv and rm so that they prompt +# before deleting or overwriting files. Set to 'no' to disable this safer +# behavior. +# zstyle ':prezto:module:utility' safe-ops 'yes' diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile new file mode 100644 index 0000000..a230f09 --- /dev/null +++ b/.config/zsh/.zprofile @@ -0,0 +1,65 @@ +# +# Executes commands at login pre-zshrc. +# +# Authors: +# Sorin Ionescu +# + +export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" + +# +# Browser +# + +if [[ "$OSTYPE" == darwin* ]]; then + export BROWSER='open' +fi + +# +# Editors +# + +export EDITOR='vim' +export VISUAL="$EDITOR" +export PAGER='less' + +# +# Language +# + +if [[ -z "$LANG" ]]; then + export LANG='en_US.UTF-8' +fi + +# +# Paths +# + +# Ensure path arrays do not contain duplicates. +typeset -gU cdpath fpath mailpath path + +# Set the list of directories that cd searches. +# cdpath=( +# $cdpath +# ) + +# Set the list of directories that Zsh searches for programs. +path=( + /usr/local/{bin,sbin} + $path +) + +# +# Less +# + +# Set the default Less options. +# Mouse-wheel scrolling has been disabled by -X (disable screen clearing). +# Remove -X to enable it. +export LESS='-g -i -M -R -S -w -X -z-4' + +# Set the Less input preprocessor. +# Try both `lesspipe` and `lesspipe.sh` as either might exist on a system. +if (( $#commands[(i)lesspipe(|.sh)] )); then + export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-" +fi diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv new file mode 100644 index 0000000..556f323 --- /dev/null +++ b/.config/zsh/.zshenv @@ -0,0 +1,11 @@ +# +# Defines environment variables. +# +# Authors: +# Sorin Ionescu +# Şahin Akkaya + +# Ensure that a non-login, non-interactive shell has a defined environment. +if [[ ( "$SHLVL" -eq 1 && ! -o LOGIN ) && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then + source "${ZDOTDIR:-$HOME}/.zprofile" +fi diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc new file mode 100644 index 0000000..d824fc2 --- /dev/null +++ b/.config/zsh/.zshrc @@ -0,0 +1,100 @@ +# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc. +# Initialization code that may require console input (password prompts, [y/n] +# confirmations, etc.) must go above this block; everything else may go below. +if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +fi + +# +# Executes commands at the start of an interactive session. +# +# Authors: +# Sorin Ionescu +# + + +# Source Prezto. +if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then + source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" +fi + + +# Customize to your needs... +source "${ZDOTDIR:-$HOME}/.aliases" + +ZSH_AUTOSUGGEST_STRATEGY=(history completion) +ZSH_AUTOSUGGEST_MANUAL_REBIND=true + + +export PATH=$PATH:$HOME/.pyenv/bin/ + +# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh. +[[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh + +### Added by Zinit's installer +if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then + print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f" + command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit" + command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \ + print -P "%F{33} %F{34}Installation successful.%f%b" || \ + print -P "%F{160} The clone has failed.%f%b" +fi + +source "$HOME/.local/share/zinit/zinit.git/zinit.zsh" +autoload -Uz _zinit +(( ${+_comps} )) && _comps[zinit]=_zinit + +# Load a few important annexes, without Turbo +# (this is currently required for annexes) +zinit light-mode for \ + zdharma-continuum/zinit-annex-as-monitor \ + zdharma-continuum/zinit-annex-bin-gem-node \ + zdharma-continuum/zinit-annex-patch-dl \ + zdharma-continuum/zinit-annex-rust + +### End of Zinit's installer chunk + +zinit snippet OMZ::plugins/git/git.plugin.zsh +zinit light skywind3000/z.lua + +# ZVM +function zvm_config() { + ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT + # ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLOCK + ZVM_LAZY_KEYBINDINGS=true + ZVM_VI_INSERT_ESCAPE_BINDKEY=kj +} + +zinit ice depth=1 +zinit light jeffreytse/zsh-vi-mode + +# The plugin will auto execute this zvm_after_init function +function zvm_after_init() { + [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + + bindkey '^b' backward-word + bindkey '^f' forward-word + bindkey '^g' autosuggest-accept + # allow ctrl-r and ctrl-s to search the history + bindkey '^r' history-incremental-search-backward + bindkey '^s' history-incremental-search-forward + + + # allow ctrl-a and ctrl-e to move to beginning/end of line + bindkey '^a' beginning-of-line + bindkey '^e' end-of-line + + + # allow ctrl-h, ctrl-w, ctrl-? for char and word deletion (standard behaviour) + bindkey '^h' backward-delete-char + bindkey '^w' backward-kill-word + + + bindkey '^x' fzf-cd-widget + bindkey "\e\e" fuck-command-line + bindkey "\e[1;3D" dirhistory_zle_dirhistory_back + bindkey "\e[1;3C" dirhistory_zle_dirhistory_future + bindkey "\e[1;3A" dirhistory_zle_dirhistory_up + bindkey "\e[1;3B" dirhistory_zle_dirhistory_down +} + diff --git a/.zshrc b/.zshrc deleted file mode 100644 index 9a8fb6e..0000000 --- a/.zshrc +++ /dev/null @@ -1,132 +0,0 @@ -# Always start a tmux session when opening up terminal -if type tmux &> /dev/null; then - session_name=${TERMINAL_NAME:-Terminal} - #if not inside a tmux session, start a new session - if [[ $HOST == "ubuntu" && -z "$TMUX" ]]; then - ( TERM=xterm-256color tmux -2 new-session -A -s $session_name || false) - # || false makes Konsole happy while quitting. It doesn't ask for - # confirmation. Since we are in tmux, it doesn't matter if we really - # wanted to quit or not - fi -fi -# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. -# Initialization code that may require console input (password prompts, [y/n] -# confirmations, etc.) must go above this block, everything else may go below. -if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then - source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" -fi - -# secret environment variables goes in /etc/environment -# sudoedit /etc/environment - -# If you come from bash you might have to change your $PATH. -# export PATH=$HOME/bin:/usr/local/bin:$PATH -# Path to your oh-my-zsh installation. -# export TERM="xterm-256color" -export ZSH="$HOME/.oh-my-zsh" - -POWERLEVEL9K_MODE='nerdfont-complete' -ZSH_THEME="powerlevel10k/powerlevel10k" - -# Uncomment the following line to use hyphen-insensitive completion. -# Case-sensitive completion must be off. _ and - will be interchangeable. -# HYPHEN_INSENSITIVE="true" - -# Uncomment the following line to enable command auto-correction. -# ENABLE_CORRECTION="true" - -# Uncomment the following line to display red dots whilst waiting for completion. -COMPLETION_WAITING_DOTS="true" - -# Uncomment the following line if you want to disable marking untracked files -# under VCS as dirty. This makes repository status check for large repositories -# much, much faster. -DISABLE_UNTRACKED_FILES_DIRTY="true" - -# Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. -# You can set one of the optional three formats: -# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" -# or set a custom format using the strftime function format specifications, -# see 'man strftime' for details. -HIST_STAMPS="mm/dd/yyyy" - -# plugins=() -plugins=( - gitignore alias-finder zsh-autosuggestions pip last-working-dir dirhistory history thefuck command-not-found git extract zsh-syntax-highlighting docker docker-compose zsh-vi-mode z.lua pyenv-lazy -) -# plugins+=(zsh-prompt-benchmark) - - -ZVM_LAZY_KEYBINDINGS=false -ZVM_VI_INSERT_ESCAPE_BINDKEY=kj - - -source $ZSH/oh-my-zsh.sh -source ~/.p10k.zsh - -# https://stackoverflow.com/questions/28028740/git-tab-completion-in-zsh-throwing-errors -zstyle ':completion:*:*:git:*' script ~/.git-completion.bash -fpath=(~/.zsh $fpath) - -unsetopt nomatch - -export LANG=en_US.UTF-8 -export VISUAL=nvim -export EDITOR="$VISUAL" -export PYTHONBREAKPOINT=ipdb.set_trace -export ZSH_AUTOSUGGEST_USE_ASYNC=true -export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=32' -export ZSH_AUTOSUGGEST_MANUAL_REBIND=true -export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -l -g ""' -export FZF_DEFAULT_OPTS='--bind change:top' -# export TERM_ITALICS=false -export PATH="$HOME/.poetry/bin:$PATH" -export PATH=$PATH:$HOME/scripts - - -# . /usr/share/autojump/autojump.sh -export PATH="/snap/bin:$PATH" -export PYENV_VIRTUALENV_DISABLE_PROMPT=1 - - -# If not in tmux session, add battery and time to prompt -[[ -n $TMUX ]] || POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS+=(battery time) - - -# https://github.com/jeffreytse/zsh-vi-mode#execute-extra-commands -function my_bindings() { - # easy bindings instead of ctrl + arrow keys - bindkey '^b' backward-word - bindkey '^f' forward-word - bindkey '^g' autosuggest-accept - bindkey "\e\e" fuck-command-line - bindkey "\e[1;3D" dirhistory_zle_dirhistory_back - bindkey "\e[1;3C" dirhistory_zle_dirhistory_future - bindkey "\e[1;3A" dirhistory_zle_dirhistory_up - bindkey "\e[1;3B" dirhistory_zle_dirhistory_down -} - -chbackground() { - if [ "$3" == "" ] - then - wal -st -i ~/Pictures/Wallpapers/Desktop --backend=haishoku --iterative - python3 ~/scripts/misc/adjust_terminal_colors.py $1 $2 - ~/scripts/misc/restart_dunst.sh - else - python3 ~/scripts/misc/adjust_terminal_colors.py $1 $2 dummy - fi - -} - -chcolors() { - chbackground $1 $2 dummy -} - - -zvm_after_init_commands+=('[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh') -zvm_after_init_commands+=(my_bindings) -ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT # Always starting with insert mode for each command line -ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLOCK - -autoload -U compinit; compinit -y