Compare commits

...

5 commits

Author SHA1 Message Date
1d02925c51
refactor: remove setup.sh 2024-02-06 18:25:50 +09:00
ec960de41d
feat: add bashrc, inputrc 2024-02-06 18:25:31 +09:00
2ecb557a02
chore: update zshrc and zshenv 2024-02-06 18:24:02 +09:00
8169d580eb
doc: remove old instructions in README 2024-02-06 18:11:40 +09:00
954bc2cd05
doc: update LICENSE 2024-02-06 18:11:14 +09:00
7 changed files with 45 additions and 68 deletions

View file

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2020-2022 sup39
Copyright (c) 2020-2024 sup39
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,28 +1 @@
# zsh-setup for sup39
## Usage
### Full setup
```zsh
curl https://raw.githubusercontent.com/sup39/zsh-setup/master/setup.sh | sh -
source $HOME/.zshrc
```
Alternatively, use the shortened url:
```zsh
# Download setup file and execute it
curl -sL link.sup39.dev/zsh-setup | sh -
# Finally, source the zshrc file
source $HOME/.zshrc
```
### zshrc only
```zsh
curl https://raw.githubusercontent.com/sup39/zsh-setup/master/zshrc >> $HOME/.zshrc
source $HOME/.zshrc
```
## Content
- `~/.zshenv`
- `~/.zshrc`
- `~/.screenrc`
:bulb: No overwriting if exists

22
bashrc Normal file
View file

@ -0,0 +1,22 @@
## editor
export EDITOR=nvim
alias vi=nvim
## color
alias ls='ls --color=auto'
alias grep='grep --color=auto'
## https://blog.naskya.net/post/6kic0tebueju/#firefish-%e3%82%92%e8%b5%b7%e5%8b%95
alias sudo='sudo '
alias start="bash -c 'systemctl start \$0; journalctl --catalog --pager-end --follow --unit=\$0'"
## PS1
EPS0='\e]0;\u@\h: \w\a'
EPS1='\u@\h'
EPS2=':\w\$'
sup39_update_PS1 () {
bind "set vi-ins-mode-string \"\1${EPS0@P}\e[38;5;49m\2${EPS1@P}\1\e[39m\2${EPS2@P}\""
bind "set vi-cmd-mode-string \"\1${EPS0@P}\e[38;5;200m\2${EPS1@P}\1\e[39m\2${EPS2@P}\""
}
PROMPT_COMMAND=sup39_update_PS1
PS1=' '

3
inputrc Normal file
View file

@ -0,0 +1,3 @@
set editing-mode vi
set show-mode-in-prompt on
"jk": vi-movement-mode

View file

@ -1,5 +0,0 @@
#!/bin/sh
baseURL="https://raw.githubusercontent.com/sup39/zsh-setup/master"
[ -f $HOME/.zshrc ] || curl $baseURL/zshrc -o $HOME/.zshrc
[ -f $HOME/.zshenv ] || curl $baseURL/zshenv -o $HOME/.zshenv
[ -f $HOME/.screenrc ] || curl $baseURL/screenrc -o $HOME/.screenrc

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
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
# use vim mode
bindkey -v
@ -17,42 +23,20 @@ bindkey -Mviins -s jk '\e'
## Edit
# edit zshrc
vizr() {vi $HOME/.zshrc && source $HOME/.zshrc}
vizr() {"${EDITOR:-vi}" $HOME/.zshrc && . $HOME/.zshrc}
# edit zshenv
vize() {vi $HOME/.zshenv && . $HOME/.zshenv}
vize() {"${EDITOR:-vi}" $HOME/.zshenv && . $HOME/.zshenv}
# edit zprofile
vizp() {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
vizp() {"${EDITOR:-vi}" $HOME/.zprofile && . $HOME/.zprofile}
## Alias
alias vi='vim'
alias vi='nvim'
alias vim='nvim'
alias ls='ls --color=auto'
alias certls='certbot certificates'
alias certrenew='certbot certonly --manual --manual-public-ip-logging-ok --preferred-challenges dns-01 --cert-name'
alias rg='grep -r'
alias sudo='sudo '
alias start="bash -c 'systemctl start \$0; journalctl -xefu \$0'"
## Starship
#export STARSHIP_CONFIG=/etc/starship.toml
eval "$(starship init zsh)"