0
0
Joe 1 год назад
Родитель
Сommit
c863b04432
4 измененных файлов с 185 добавлено и 0 удалено
  1. 6 0
      .config/zsh/.gitignore
  2. 73 0
      .config/zsh/.zshenv
  3. 101 0
      .config/zsh/.zshrc
  4. 5 0
      .github/README.md

+ 6 - 0
.config/zsh/.gitignore

@@ -0,0 +1,6 @@
+# ignore everything...
+*
+!.gitignore
+# ...except for these:
+!.zshrc
+!.zshenv

+ 73 - 0
.config/zsh/.zshenv

@@ -0,0 +1,73 @@
+################################################################################
+# $PATH and similar
+################################################################################
+export GOPATH="$HOME/.go"
+
+PATH="/opt/homebrew/bin:${PATH}"
+PATH="/opt/homebrew/sbin:${PATH}"
+PATH="/opt/homebrew/opt/ruby/bin:${PATH}"
+
+PATH="${HOME}/.scripts:${PATH}"
+
+PATH="${PATH}:/usr/local/bin"
+
+PATH="${GOPATH}/bin:${PATH}"
+PATH="${HOME}/.gem/bin:${PATH}"
+PATH="${HOME}/.cargo/bin:${PATH}"
+PATH="${HOME}/.poetry/bin:${PATH}"
+PATH="${HOME}/.rvm/bin:${PATH}"
+
+export PATH
+
+################################################################################
+# Color palette and dark mode
+################################################################################
+
+source $XDG_CONFIG_HOME/jonathandarker/palette.sh
+export LIGHTMODE_TOGGLE_FLAG_FILE="$XDG_RUNTIME_DIR/lightmode.toggled.flag"
+if [ -f $LIGHTMODE_TOGGLE_FLAG_FILE ]; then
+    export JONATHANDARKER_COLOR_BG="$JONATHANDARKER_COLOR_15"
+    export JONATHANDARKER_COLOR_BA="$JONATHANDARKER_COLOR_07"
+    export JONATHANDARKER_COLOR_FG="$JONATHANDARKER_COLOR_00"
+    export JONATHANDARKER_COLOR_FA="$JONATHANDARKER_COLOR_08"
+fi
+
+################################################################################
+# Aliases
+################################################################################
+
+alias n="nvim"
+alias lg="lazygit"
+alias ld="lazydocker"
+
+# git
+alias g="git"
+alias gs="git s"
+alias gl="git l"
+
+# ls
+alias ls="lsd -a"
+alias la="lsd -la"
+
+# clear
+alias c="clear && NEW_LINE_BEFORE_PROMPT=0"
+alias clear="clear && NEW_LINE_BEFORE_PROMPT=0"
+
+#python
+alias python="python3"
+alias py="python3"
+
+################################################################################
+# nvm
+# Lazy-loaded, using logic from https://github.com/undg/zsh-nvm-lazy-load
+################################################################################
+export NVM_DIR="$HOME/.nvm"
+load-nvm() {
+    [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
+    [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
+}
+nvm() { unset -f nvm; load-nvm; nvm "$@" }
+node() { unset -f node; load-nvm; node "$@"; }
+npm() { unset -f npm; load-nvm; npm "$@"; }
+pnpm() { unset -f pnpm; load-nvm; pnpm "$@"; }
+yarn() { unset -f yarn; load-nvm; yarn "$@"; }

+ 101 - 0
.config/zsh/.zshrc

@@ -0,0 +1,101 @@
+################################################################################
+# ZSH Configuration
+#
+# Note: in order for files in ~/.config/ to be picked up, be sure to set the
+# global XDG_* and ZDOTDIR paths. On macOS, these is set at /etc/zshenv, and
+# look something like the following block:
+#
+# export XDG_CONFIG_HOME=$HOME/.config
+# export XDG_CACHE_HOME=$HOME/.cache
+# export XDG_DATA_HOME=$HOME/.local/share
+# export XDG_STATE_HOME=$HOME/.local/state
+# export XDG_RUNTIME_DIR=$HOME/.run
+# export XDG_DATA_DIRS=/usr/local/share:/usr/share
+# export XDG_CONFIG_DIRS=/etc/xdg
+# export ZDOTDIR=$XDG_CONFIG_HOME/zsh
+#
+################################################################################
+
+################################################################################
+# Basic configuration
+################################################################################
+
+export TERM=alacritty
+export LANG=en_US.UTF-8
+
+export HISTSIZE=50000
+export SAVEHIST=50000
+export HISTORY_IGNORE="(ls|lsd|la|cd|pwd|exit)*"
+setopt INC_APPEND_HISTORY
+setopt HIST_IGNORE_ALL_DUPS
+setopt HIST_IGNORE_SPACE
+setopt HIST_REDUCE_BLANKS
+
+################################################################################
+# Prompt
+################################################################################
+# A pleasant, informative, and transient prompt. Made possible by an arcane
+# incantation from [powerlevel10k](https://github.com/romkatv/powerlevel10k/),
+# as described in the project's issue tracker:
+# https://github.com/romkatv/powerlevel10k/issues/888#issuecomment-657969840
+
+autoload -Uz vcs_info
+precmd_vcs_info() { vcs_info }
+setopt prompt_subst
+zstyle ':vcs_info:git:*' formats '%F{3}%F{8} %b '
+
+set-long-prompt() {
+    if [ "$NEW_LINE_BEFORE_PROMPT" -eq 1 ]; then
+        print ''
+    else
+        NEW_LINE_BEFORE_PROMPT=1
+    fi
+    PROMPT='%F{3}%F{8} %d %0(?..%F{3}%F{8} %? )${vcs_info_msg_0_}%F{3}󰒋%F{8} %m %F{3}%F{8} %n
+%F{3}$ %f%k'
+}
+set-short-prompt() {
+  if [[ $PROMPT != '%F{3}$ %f%k' ]]; then
+    PROMPT='%F{3}$ %f%k'
+    zle .reset-prompt
+  fi
+}
+precmd_functions=(
+    set-long-prompt
+    precmd_vcs_info
+)
+
+zle-line-finish() {
+    set-short-prompt
+}
+zle -N zle-line-finish
+trap 'set-short-prompt; return 130' INT
+
+################################################################################
+# Potentially interactive execution
+################################################################################
+
+# Load SSH key into keychain
+if [[ $OSTYPE == darwin* ]] then
+  ssh-add --apple-use-keychain ~/.ssh/id_rsa >/dev/null 2>&1
+else
+  eval `keychain --eval --quiet id_rsa`
+fi
+
+################################################################################
+# fzf
+################################################################################
+
+if command -v fzf >> /dev/null; then
+    eval "$(fzf --zsh)"
+fi
+
+################################################################################
+# From github.com/zsh-users:
+# * zsh-autosuggestions
+# * zsh-syntax-highlighting
+# Both can be installed through Homebrew.
+################################################################################
+if command -v brew >> /dev/null; then
+    source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
+    source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
+fi

+ 5 - 0
.github/README.md

@@ -35,6 +35,11 @@ distributed version control system.
 A color scheme inspired by [JetBrain's](https://www.jetbrains.com/)
 A color scheme inspired by [JetBrain's](https://www.jetbrains.com/)
 [Darcula](https://jetbrains.com/help/idea/configuring-colors-and-fonts.html).
 [Darcula](https://jetbrains.com/help/idea/configuring-colors-and-fonts.html).
 
 
+### [zsh (`~/.config/zsh/`)](./.config/zsh/)
+
+Run commands for [zsh](https://www.zsh.org/), a shell designed for interactive
+use.
+
 </td>
 </td>
 <td>
 <td>
 </td>
 </td>