chore: update zshrc and zshenv

This commit is contained in:
sup39 2024-02-06 18:24:02 +09:00
parent 8169d580eb
commit 2ecb557a02
Signed by: sup39
GPG key ID: 111C00916C1641E5
2 changed files with 19 additions and 35 deletions

2
zshenv
View file

@ -1 +1 @@
export EDITOR=vim export EDITOR=nvim

52
zshrc
View file

@ -9,6 +9,12 @@ HISTSIZE=1000 # memory
SAVEHIST=1000 # file SAVEHIST=1000 # file
setopt appendhistory setopt appendhistory
## Plugins
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
## Shift-Tab to accept suggestion
bindkey '\E[Z' autosuggest-accept
## Input ## Input
# use vim mode # use vim mode
bindkey -v bindkey -v
@ -17,42 +23,20 @@ bindkey -Mviins -s jk '\e'
## Edit ## Edit
# edit zshrc # edit zshrc
vizr() {vi $HOME/.zshrc && source $HOME/.zshrc} vizr() {"${EDITOR:-vi}" $HOME/.zshrc && . $HOME/.zshrc}
# edit zshenv # edit zshenv
vize() {vi $HOME/.zshenv && . $HOME/.zshenv} vize() {"${EDITOR:-vi}" $HOME/.zshenv && . $HOME/.zshenv}
# edit zprofile # edit zprofile
vizp() {vi $HOME/.zprofile && . $HOME/.zprofile} vizp() {"${EDITOR:-vi}" $HOME/.zprofile && . $HOME/.zprofile}
# edit vimrc
viv() {vi $HOME/.vim/sup39/vimrc}
viV() {vi $HOME/.vimrc}
## Completion
# setup
autoload -U compinit; compinit -u
ZSHC_ROOT=$HOME/.zsh_complete
# edit
vizc() { [ -z $1 ] && local fn=$ZSHC_ROOT/$1 && vi $fn && [ -f $fn ] && . $fn }
compdef "_files -W $ZSHC_ROOT" vizc # completion for vizc
# source
sczc() {source <(find "$ZSHC_ROOT" -name "*.zsh" -exec cat {} \;)}
[ -d "$ZSHC_ROOT" ] && sczc # auto source once
## PS1
function zle-line-init zle-keymap-select {
local host='%m'
case $KEYMAP in
vicmd) # normal mode
PS1="%F{200}%n@$host%f:%1~%# ";;
main) # insert mode
PS1="%F{49}%n@$host%f:%1~%# ";;
esac
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
## Alias ## Alias
alias vi='vim' alias vi='nvim'
alias vim='nvim'
alias ls='ls --color=auto' alias ls='ls --color=auto'
alias certls='certbot certificates' alias rg='grep -r'
alias certrenew='certbot certonly --manual --manual-public-ip-logging-ok --preferred-challenges dns-01 --cert-name' alias sudo='sudo '
alias start="bash -c 'systemctl start \$0; journalctl -xefu \$0'"
## Starship
#export STARSHIP_CONFIG=/etc/starship.toml
eval "$(starship init zsh)"