refactor .zshrc
set some options for vi mode started cleaning up the code a bit removed more plugins created init_env function to initialize environment after everything else
This commit is contained in:
@@ -8,13 +8,13 @@ fi
|
|||||||
export ZSH="$HOME/.oh-my-zsh"
|
export ZSH="$HOME/.oh-my-zsh"
|
||||||
export EDITOR='nvim'
|
export EDITOR='nvim'
|
||||||
export GPG_TTY=$(tty)
|
export GPG_TTY=$(tty)
|
||||||
export ZVM_INIT_MODE='sourcing'
|
|
||||||
|
|
||||||
export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git"
|
export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git"
|
||||||
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
||||||
export FZF_ALT_C_COMMAND="fd --type=d --hidden --strip-cwd-prefix --exclude .git"
|
export FZF_ALT_C_COMMAND="fd --type=d --hidden --strip-cwd-prefix --exclude .git"
|
||||||
export FZF_CTRL_T_OPTS="--preview 'bat -n --color=always --line-range :500 {}'"
|
export FZF_CTRL_T_OPTS="--preview 'bat -n --color=always --line-range :500 {}'"
|
||||||
export FZF_ALT_C_OPTS="--preview 'eza --tree --color=always {} | head -200'"
|
export FZF_ALT_C_OPTS="--preview 'eza --tree --color=always {} | head -200'"
|
||||||
|
export ZSH_ALIAS_FINDER_AUTOMATIC=true
|
||||||
|
|
||||||
ZSH_THEME="powerlevel10k/powerlevel10k"
|
ZSH_THEME="powerlevel10k/powerlevel10k"
|
||||||
# DISABLE_AUTO_TITLE="true"
|
# DISABLE_AUTO_TITLE="true"
|
||||||
@@ -29,12 +29,15 @@ export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS'
|
|||||||
--color=info:#eacb8a,prompt:#bf6069,pointer:#b48dac
|
--color=info:#eacb8a,prompt:#bf6069,pointer:#b48dac
|
||||||
--color=marker:#a3be8b,spinner:#b48dac,header:#a3be8b'
|
--color=marker:#a3be8b,spinner:#b48dac,header:#a3be8b'
|
||||||
|
|
||||||
# Plugin Options
|
zvm_after_init_commands+=(init_env)
|
||||||
ZSH_ALIAS_FINDER_AUTOMATIC=true
|
|
||||||
|
|
||||||
function zvm_after_init() {
|
function zvm_config() {
|
||||||
autoload add-zle-hook-widget
|
export ZVM_INIT_MODE='sourcing'
|
||||||
add-zle-hook-widget zle-line-pre-redraw zvm_zle-line-pre-redraw
|
export ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT
|
||||||
|
export ZVM_VI_EDITOR="$VISUAL"
|
||||||
|
export ZVM_VI_SURROUND_BINDKEY='classic'
|
||||||
|
export ZVM_VI_INSERT_ESCAPE_BINDKEY='jk'
|
||||||
|
export ZVM_ESCAPE_KEYTIMEOUT=0.03
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins=(
|
plugins=(
|
||||||
@@ -62,11 +65,11 @@ plugins=(
|
|||||||
web-search
|
web-search
|
||||||
zsh-autosuggestions
|
zsh-autosuggestions
|
||||||
zsh-syntax-highlighting
|
zsh-syntax-highlighting
|
||||||
zsh-vi-mode
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# set up dircolors
|
# set up dircolors
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
|
|
||||||
Darwin)
|
Darwin)
|
||||||
plugins+=(
|
plugins+=(
|
||||||
brew
|
brew
|
||||||
@@ -74,29 +77,41 @@ case $(uname -s) in
|
|||||||
macos
|
macos
|
||||||
)
|
)
|
||||||
|
|
||||||
[[ ! -f $(which gdircolors) ]] || $(test -f $HOME/.dir_colors && eval $(gdircolors $HOME/.dir_colors) || eval $(gdircolors))
|
[[ ! -f $(which gdircolors) ]] || $(test -f "$HOME"/.dircolors && eval $(gdircolors "$HOME"/.dircolors) || eval $(gdircolors))
|
||||||
;;
|
;;
|
||||||
|
|
||||||
Linux)
|
Linux)
|
||||||
plugins+=(
|
plugins+=(
|
||||||
archlinux
|
archlinux
|
||||||
ubuntu
|
ubuntu
|
||||||
)
|
)
|
||||||
|
|
||||||
test -f $HOME/.dir_colors && eval $(dircolors -b $HOME/.dir_colors) || eval $(dircolors -b)
|
test -f "$HOME"/.dircolors && eval $(dircolors -b "$HOME"/.dircolors) || eval $(dircolors -b)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Fix ctrl+r
|
function init_env() {
|
||||||
[[ ! -f $ZSH/custom/plugins/zsh-vi-mode/zsh-vi-mode.plugin.zsh ]] || source $ZSH/custom/plugins/zsh-vi-mode/zsh-vi-mode.plugin.zsh
|
eval "$(zoxide init zsh)"
|
||||||
|
eval "$(fzf --zsh)"
|
||||||
|
|
||||||
|
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
||||||
|
[[ ! -f $HOME/.p10k.zsh ]] || source $HOME/.p10k.zsh
|
||||||
|
|
||||||
|
# Load aliases
|
||||||
|
[[ ! -f $HOME/.aliases ]] || source $HOME/.aliases
|
||||||
|
|
||||||
|
# display mini system info
|
||||||
|
[[ ! -f $(which pfetch) ]] || $(which pfetch)
|
||||||
|
}
|
||||||
|
|
||||||
[[ ! -f $ZSH/oh-my-zsh.sh ]] || source $ZSH/oh-my-zsh.sh
|
[[ ! -f $ZSH/oh-my-zsh.sh ]] || source $ZSH/oh-my-zsh.sh
|
||||||
eval "$(zoxide init zsh)"
|
|
||||||
eval "$(fzf --zsh)"
|
|
||||||
|
|
||||||
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
|
||||||
[[ ! -f $HOME/.p10k.zsh ]] || source $HOME/.p10k.zsh
|
|
||||||
|
|
||||||
|
function zvm_after_init() {
|
||||||
|
autoload add-zle-hook-widget
|
||||||
|
add-zle-hook-widget zle-line-pre-redraw zvm_zle-line-pre-redraw
|
||||||
|
}
|
||||||
|
|
||||||
_fzf_compgen_path() {
|
_fzf_compgen_path() {
|
||||||
fd --hidden --exclude .git . "$1"
|
fd --hidden --exclude .git . "$1"
|
||||||
@@ -126,8 +141,4 @@ _fzf_comprun() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# Load aliases
|
[[ ! -f $ZSH/custom/plugins/zsh-vi-mode/zsh-vi-mode.plugin.zsh ]] || source "$ZSH"/custom/plugins/zsh-vi-mode/zsh-vi-mode.plugin.zsh
|
||||||
[[ ! -f $HOME/.aliases ]] || source $HOME/.aliases
|
|
||||||
|
|
||||||
# display mini system info
|
|
||||||
[[ ! -f $(which pfetch) ]] || $(which pfetch)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user