diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ff0f187 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "zsh/zsh-syntax-highlighting"] + path = zsh/zsh-syntax-highlighting + url = git@github.com:zsh-users/zsh-syntax-highlighting.git +[submodule "zsh/zsh-autosuggestions"] + path = zsh/zsh-autosuggestions + url = git@github.com:zsh-users/zsh-autosuggestions.git diff --git a/zsh/zsh-autosuggestions b/zsh/zsh-autosuggestions new file mode 160000 index 0000000..ae315de --- /dev/null +++ b/zsh/zsh-autosuggestions @@ -0,0 +1 @@ +Subproject commit ae315ded4dba10685dbbafbfa2ff3c1aefeb490d diff --git a/zsh/zsh-syntax-highlighting b/zsh/zsh-syntax-highlighting new file mode 160000 index 0000000..3a4b212 --- /dev/null +++ b/zsh/zsh-syntax-highlighting @@ -0,0 +1 @@ +Subproject commit 3a4b212c7d8263a12bef176b10737748b752a579 diff --git a/zshrc b/zshrc new file mode 100644 index 0000000..aaf2c53 --- /dev/null +++ b/zshrc @@ -0,0 +1,74 @@ +export PATH=$HOME/go/bin:$HOME/.local/bin:$HOME/.cargo/bin:$PATH +if which ruby >/dev/null && which gem >/dev/null; then + PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin:$PATH" +fi + +eval $(thefuck --alias) + +autoload -Uz vcs_info + +export EDITOR="nvim" +alias vim=nvim +alias ls='ls --color=auto' + +precmd_vcs_info() { + vcs_info +} +precmd_functions+=(precmd_vcs_info) + +zstyle ':vcs_info:git:*' formats '%F{245}%b %m%u%c%f ' +zstyle ':vcs_info:*' enable git +setopt prompt_subst + +if [ "$SSH_CONNECTION" ]; then + PROMPT_HOST="%F{yellow}[ssh] $HOST%f " +fi +export PROMPT='$PROMPT_HOST%(?..%F{red}%? )%f%20<…<%~%<<$(pretty-git-prompt) %F{117}>%f ' + +HISTSIZE=20000 +HISTFILE=~/.zsh_history +SAVEHIST=20000 +HISTDUP=erase +setopt appendhistory +setopt sharehistory +setopt incappendhistory + +bindkey -v +bindkey '^R' history-incremental-search-backward +KEYTIMEOUT=1 + +function zle-keymap-select zle-line-init { + case $KEYMAP in + vicmd) print -n -- "\E]50;CursorShape=0\C-G";; # block cursor + viins|main) print -n -- "\E]50;CursorShape=1\C-G";; # line cursor + esac + + zle reset-prompt + zle -R +} + +function zle-line-finish { + print -n -- "\E]50;CursorShape=0\C-G" # block cursor +} + +zle -N zle-line-init +zle -N zle-line-finish +zle -N zle-keymap-select + +setopt autocd menucomplete + +first-tab() { + if [[ $#BUFFER == 0 ]]; then + BUFFER="cd " + CURSOR=3 + zle list-choices + else + zle expand-or-complete + fi +} +zle -N first-tab +bindkey '^I' first-tab +zstyle ':completion:*' menu select + +source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh +source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh