initial commit

This commit is contained in:
Tri Vo Khac committed 2022-10-06 22:00:37 +07:00
commit a2d4f0ff29
20 files changed
+2721

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
.zcompdump
plugins/
+2
View File
@@ -0,0 +1,2 @@
# Set PATH, MANPATH, etc., for Homebrew.
eval "$(/opt/homebrew/bin/brew shellenv)"
+16
View File
@@ -0,0 +1,16 @@
ls -a
rm .DS_Store
micro $ZDOTDIR/.zshrc
micro $ZDOTDIR/.zshrc
ls -a
ls -a
.config
ls
zsh-update-plugins
echo $ZDOTDIR
find "$ZDOTDIR/plugins" -type d -exec test -e '{}/.git' ';'
find "$ZDOTDIR/plugins" -type d -exec test -e '{}/.git' ';' -print0
find "$ZDOTDIR/plugins" -type d -exec test -e '{}/.git' ';' -print0 | xargs -I {} -0 git -C {} pull -q
find "$ZDOTDIR/plugins" -type d -exec test -e '{}/.git' ';' -print0 | xargs -I {} -0
find "$ZDOTDIR/plugins" -type d -exec test -e '{}/.git' ';' -print0 | xargs -I {} -0 git -C {} status -q
find "$ZDOTDIR/plugins" -type d -exec test -e '{}/.git' ';' -print0 | xargs -I {} -0 git -C {} status
+82
View File
@@ -0,0 +1,82 @@
#!/bin/sh
export ZDOTDIR=$HOME/.config/zsh
# HISTFILE=~/.zsh_history
setopt appendhistory
# some useful options (man zshoptions)
setopt autocd extendedglob nomatch menucomplete
setopt interactive_comments
stty stop undef # Disable ctrl-s to freeze terminal.
zle_highlight=('paste:none')
# beeping is annoying
unsetopt BEEP
# completions
autoload -Uz compinit
zstyle ':completion:*' menu select
# zstyle ':completion::complete:lsof:*' menu yes select
zmodload zsh/complist
# compinit
_comp_options+=(globdots) # Include hidden files.
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
# Colors
autoload -Uz colors && colors
# Useful Functions
source "$ZDOTDIR/zsh-functions"
# Normal files to source
zsh_add_file "zsh-exports"
zsh_add_file "zsh-aliases"
zsh_add_file "zsh-prompt"
# Plugins
zsh_add_plugin "zsh-users/zsh-autosuggestions"
zsh_add_plugin "zsh-users/zsh-completions"
zsh_add_plugin "zdharma-continuum/fast-syntax-highlighting"
zsh_add_plugin "hlissner/zsh-autopair"
# zsh_add_completion "esc/conda-zsh-completion" false
# For more plugins: https://github.com/unixorn/awesome-zsh-plugins
# More completions https://github.com/zsh-users/zsh-completions
# Key-bindings
# bindkey -s '^o' 'ranger^M'
# bindkey -s '^f' 'zi^M'
# bindkey -s '^s' 'ncdu^M'
# bindkey -s '^n' 'nvim $(fzf)^M'
# bindkey -s '^v' 'nvim\n'
# bindkey -s '^z' 'zi^M'
# bindkey '^[[P' delete-char
# 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
# bindkey -r "^u"
# bindkey -r "^d"
# FZF
# TODO update for mac
# [ -f /usr/share/fzf/completion.zsh ] && source /usr/share/fzf/completion.zsh
# [ -f /usr/share/fzf/key-bindings.zsh ] && source /usr/share/fzf/key-bindings.zsh
# [ -f /usr/share/doc/fzf/examples/completion.zsh ] && source /usr/share/doc/fzf/examples/completion.zsh
# [ -f /usr/share/doc/fzf/examples/key-bindings.zsh ] && source /usr/share/doc/fzf/examples/key-bindings.zsh
# [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# [ -f $ZDOTDIR/completion/_fnm ] && fpath+="$ZDOTDIR/completion/"
# export FZF_DEFAULT_COMMAND='rg --hidden -l ""'
compinit
# Edit line in vim with ctrl-e:
autoload edit-command-line; zle -N edit-command-line
# bindkey '^e' edit-command-line
# Environment variables set everywhere
export EDITOR="micro"
export TERMINAL="kitty"
export BROWSER="floorp"
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
alias zsh-update-plugins="find "$ZDOTDIR/plugins" -type d -exec test -e '{}/.git' ';' -print0 | xargs -I {} -0 git -C {} pull -q"
alias ls="lsd"
alias cat="bat"
+33
View File
@@ -0,0 +1,33 @@
#!/bin/sh
# HISTFILE="$XDG_DATA_HOME"/zsh/history
HISTSIZE=1000000
SAVEHIST=1000000
export PATH="$HOME/.local/bin":$PATH
export MANPAGER='nvim +Man!'
export MANWIDTH=999
# export PATH=$HOME/.cargo/bin:$PATH
# export PATH=$HOME/.local/share/go/bin:$PATH
# export GOPATH=$HOME/.local/share/go
# export PATH=$HOME/.fnm:$PATH
# export PATH="$HOME/.local/share/neovim/bin":$PATH
#export PATH="$PATH:./node_modules/.bin"
# eval "$(fnm env)"
eval "$(zoxide init zsh)"
# eval "`pip completion --zsh`"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
# __conda_setup="$("$HOME/.miniconda/bin/conda" 'shell.zsh' 'hook' 2> /dev/null)"
# if [ $? -eq 0 ]; then
# eval "$__conda_setup"
# else
# if [ -f "$HOME/.miniconda/etc/profile.d/conda.sh" ]; then
# . "$HOME/.miniconda/etc/profile.d/conda.sh"
# else
# export PATH="$HOME/.miniconda/bin:$PATH"
# fi
# fi
# unset __conda_setup
# <<< conda initialize <<<
+37
View File
@@ -0,0 +1,37 @@
# Function to source files if they exist
function zsh_add_file() {
[ -f "$ZDOTDIR/$1" ] && source "$ZDOTDIR/$1"
}
function zsh_add_plugin() {
PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2)
if [ -d "$ZDOTDIR/plugins/$PLUGIN_NAME" ]; then
# For plugins
zsh_add_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh" || \
zsh_add_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh"
else
git clone "https://github.com/$1.git" "$ZDOTDIR/plugins/$PLUGIN_NAME"
fi
}
function zsh_add_completion() {
PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2)
if [ -d "$ZDOTDIR/plugins/$PLUGIN_NAME" ]; then
# For completions
completion_file_path=$(ls $ZDOTDIR/plugins/$PLUGIN_NAME/_*)
fpath+="$(dirname "${completion_file_path}")"
zsh_add_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh"
else
git clone "https://github.com/$1.git" "$ZDOTDIR/plugins/$PLUGIN_NAME"
fpath+=$(ls $ZDOTDIR/plugins/$PLUGIN_NAME/_*)
[ -f $ZDOTDIR/.zccompdump ] && $ZDOTDIR/.zccompdump
fi
completion_file="$(basename "${completion_file_path}")"
if [ "$2" = true ] && compinit "${completion_file:1}"
}
function mach_java_mode() {
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
}
+9
View File
@@ -0,0 +1,9 @@
#!/bin/sh
STARSHIP_HOME=$HOME/.config/starship
[ ! -d "$STARSHIP_HOME" ] && mkdir -p "$STARSHIP_HOME"
[ ! -f "$STARSHIP_HOME/starship.toml" ] && touch "$STARSHIP_HOME/starship.toml"
export STARSHIP_CONFIG=$STARSHIP_HOME/starship.toml
eval "$(starship init zsh)"
+2
View File
@@ -0,0 +1,2 @@
export ZDOTDIR=~/.config/zsh
[[ -f $ZDOTDIR/.zshenv ]] && . $ZDOTDIR/.zshenv