This commit is contained in:
2023-07-11 10:41:59 +03:00
commit d14a10c8a7
47 changed files with 2297 additions and 0 deletions

2
zsh/.config/zsh/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.zcompdump
plugins

15
zsh/.config/zsh/.zshrc Normal file
View File

@@ -0,0 +1,15 @@
# Paths.
export ZDOTDIR="$HOME/.config/zsh"
# Utils.
source "$ZDOTDIR/functions"
# Include files.
zsh_include_file "includes/environment"
zsh_include_file "includes/aliases"
zsh_include_file "includes/prompt"
zsh_include_file "includes/nvm"
# Add plugins.
# zsh_add_plugin "hlissner/zsh-autopair"
zsh_add_plugin "zsh-users/zsh-syntax-highlighting"

18
zsh/.config/zsh/functions Normal file
View File

@@ -0,0 +1,18 @@
#!/bin/sh
# Function to source files if they exist.
function zsh_include_file() {
[ -f "$ZDOTDIR/$1" ] && source "$ZDOTDIR/$1"
}
# Add plugin.
function zsh_add_plugin() {
PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2)
if [ -d "$ZDOTDIR/plugins/$PLUGIN_NAME" ]; then
# For plugins
zsh_include_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh" || \
zsh_include_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh"
else
git clone "https://github.com/$1.git" "$ZDOTDIR/plugins/$PLUGIN_NAME"
fi
}

View File

@@ -0,0 +1,7 @@
#!/bin/sh
alias rm="rm -i"
alias mv="mv -i"
alias ls="ls --color=auto"
alias grep="grep --color=auto"

View File

@@ -0,0 +1,4 @@
#!/bin/sh
export EDITOR="vim"
export TERMINAL="alacritty"

View File

@@ -0,0 +1,7 @@
#!/bin/sh
# NVM.
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# nvm use --lts 1> /dev/null
# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

View File

@@ -0,0 +1,39 @@
#!/bin/sh
# autoload vcs and colors
autoload -Uz vcs_info
autoload -U colors && colors
# enable only git
zstyle ':vcs_info:*' enable git
# setup a hook that runs before every ptompt.
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
setopt prompt_subst
# add a function to check for untracked files in the directory.
# from https://github.com/zsh-users/zsh/blob/master/Misc/vcs_info-examples
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
+vi-git-untracked(){
if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \
git status --porcelain | grep '??' &> /dev/null ; then
# This will show the marker if there are any untracked files in repo.
# If instead you want to show the marker only if there are untracked
# files in $PWD, use:
#[[ -n $(git ls-files --others --exclude-standard) ]] ; then
hook_com[staged]+='!' # signify new files with a bang
fi
}
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:git:*' formats " %{$fg[blue]%}(%{$fg[red]%}%m%u%c%{$fg[yellow]%}%{$fg[magenta]%} %b%{$fg[blue]%})"
PROMPT="%F{blue}[%f%n%F{red}@%f%m%F{blue}]%f %F{blue}%~%f"
# Git info.
PROMPT+="\$vcs_info_msg_0_"
PROMPT+="
%F{blue}->%f "