add zsh config and started personal conf system
This commit is contained in:
parent
413701af78
commit
0855df7610
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
user/.config/zsh/personal/*
|
9
.gitmodules
vendored
9
.gitmodules
vendored
@ -1,3 +1,12 @@
|
|||||||
[submodule "source-software/dwm"]
|
[submodule "source-software/dwm"]
|
||||||
path = source-software/dwm
|
path = source-software/dwm
|
||||||
url = https://git.jakubb.xyz/jakub/dwm
|
url = https://git.jakubb.xyz/jakub/dwm
|
||||||
|
[submodule "user/.local/share/zsh/plugins/zsh-autosuggestions"]
|
||||||
|
path = user/.local/share/zsh/plugins/zsh-autosuggestions
|
||||||
|
url = https://github.com/zsh-users/zsh-autosuggestions
|
||||||
|
[submodule "user/.local/share/zsh/plugins/zsh-syntax-highlighting"]
|
||||||
|
path = user/.local/share/zsh/plugins/zsh-syntax-highlighting
|
||||||
|
url = https://github.com/zsh-users/zsh-syntax-highlighting
|
||||||
|
[submodule "user/.local/share/zsh/plugins/powerlevel10k"]
|
||||||
|
path = user/.local/share/zsh/plugins/powerlevel10k
|
||||||
|
url = https://github.com/romkatv/powerlevel10k
|
||||||
|
BIN
personal/archives/zsh.zip
Normal file
BIN
personal/archives/zsh.zip
Normal file
Binary file not shown.
7
personal/pack.sh
Normal file
7
personal/pack.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# zip and encrypt configs for git backup
|
||||||
|
|
||||||
|
dir="$PWD"
|
||||||
|
cd ../user/.config/zsh/personal
|
||||||
|
zip --encrypt ../../../../personal/archives/zsh.zip ./*
|
||||||
|
cd "$dir"
|
5
personal/unpack.sh
Normal file
5
personal/unpack.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Unpack for normal install
|
||||||
|
|
||||||
|
unzip ./archives/zsh.zip -d ../user/.config/zsh/personal
|
||||||
|
|
1
root/etc/zsh/zshenv
Normal file
1
root/etc/zsh/zshenv
Normal file
@ -0,0 +1 @@
|
|||||||
|
export ZDOTDIR="$HOME/.config/zsh"
|
37
user/.config/zsh/.zshenv
Normal file
37
user/.config/zsh/.zshenv
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# default programs
|
||||||
|
export EDITOR="nvim"
|
||||||
|
export TERMINAL="st"
|
||||||
|
# export BROWSER="firefox"
|
||||||
|
|
||||||
|
# xdg dirs
|
||||||
|
export XDG_DATA_HOME="$HOME/.local/share"
|
||||||
|
export XDG_CONFIG_HOME="$HOME/.config"
|
||||||
|
export XDG_STATE_HOME="$HOME/.local/state"
|
||||||
|
export XDG_CACHE_HOME="$HOME/.cache"
|
||||||
|
|
||||||
|
|
||||||
|
# cleaning .home
|
||||||
|
export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv
|
||||||
|
export ANDROID_HOME="$XDG_DATA_HOME"/android
|
||||||
|
export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc
|
||||||
|
export GNUPGHOME="$XDG_DATA_HOME"/gnupg
|
||||||
|
export LESSHISTFILE="$XDG_CACHE_HOME"/less/history
|
||||||
|
export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority
|
||||||
|
export PASSWORD_STORE_DIR="$HOME"/pass
|
||||||
|
export WINEPREFIX="$XDG_DATA_HOME"/wine
|
||||||
|
export XINITRC="$XDG_CONFIG_HOME"/X11/xinitrc
|
||||||
|
export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java
|
||||||
|
export HISTFILE="${XDG_STATE_HOME}"/bash/history
|
||||||
|
|
||||||
|
# Set program to get sudo password for mounting drives
|
||||||
|
export SUDO_ASKPASS="$HOME/.local/bin/dmenu-askpass"
|
||||||
|
|
||||||
|
# path
|
||||||
|
export PATH=~/.local/bin/:$PATH
|
||||||
|
|
||||||
|
# themeing
|
||||||
|
export QT_QPA_PLATFORMTHEME="qt5ct"
|
||||||
|
alias mbsync="mbsync -c $XDG_CONFIG_HOME/isync/mbsyncrc"
|
||||||
|
|
||||||
|
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/personal/zshenv" ] && \
|
||||||
|
source "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/personal/zshenv"
|
80
user/.config/zsh/.zshrc
Normal file
80
user/.config/zsh/.zshrc
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
# vars used for config
|
||||||
|
zsh_cache="${XDG_CACHE_HOME:-$HOME/.cache}/zsh"
|
||||||
|
[ -d "$zsh_cache" ] || mkdir -p "$zsh_cache"
|
||||||
|
zsh_config="${XDG_CONFIG_HOME:-$HOME/.config}/zsh"
|
||||||
|
[ -d "$zsh_config" ] || mkdir -p "$zsh_config"
|
||||||
|
zsh_plugins="${XDF_DATA_HOME:-$HOME/.local/share}/zsh/plugins"
|
||||||
|
[ -d "$zsh_plugins" ] || mkdir -p "$zsh_plugins"
|
||||||
|
|
||||||
|
# enable Powerlevel10k instant prompt - should stay close to the top
|
||||||
|
if [[ -r "$zsh_cache/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
||||||
|
source "$zsh_cache/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# basic options
|
||||||
|
setopt autocd
|
||||||
|
setopt interactive_comments
|
||||||
|
unsetopt beep
|
||||||
|
stty stop undef
|
||||||
|
autoload -U colors && colors
|
||||||
|
PS1="%B%{$fg[blue]%}%n%{$fg[cyan]%}@%{$fg[blue]%}%M %{$fg[cyan]%}%~ >%{$reset_color%} "
|
||||||
|
|
||||||
|
# history
|
||||||
|
HISTFILE=$zsh_cache/hist
|
||||||
|
HISTSIZE=10000000000
|
||||||
|
SAVEHIST=1000000
|
||||||
|
|
||||||
|
# tab complete
|
||||||
|
autoload -Uz compinit
|
||||||
|
zstyle ':completion:*' menu select
|
||||||
|
zmodload zsh/complist
|
||||||
|
compinit -d "$zsh_cache/zcompdump"
|
||||||
|
_comp_options+=(globdots) # include hidden files.
|
||||||
|
|
||||||
|
# use vim keybinds
|
||||||
|
bindkey -v
|
||||||
|
export KEYTIMEOUT=1
|
||||||
|
|
||||||
|
# vim keys in completion menu
|
||||||
|
bindkey -M menuselect 'h' vi-backward-char
|
||||||
|
bindkey -M menuselect 'k' vi-up-line-or-history
|
||||||
|
bindkey -M menuselect 'l' vi-forward-char
|
||||||
|
bindkey -M menuselect 'j' vi-down-line-or-history
|
||||||
|
bindkey -v '^?' backward-delete-char
|
||||||
|
bindkey '^[[P' delete-char
|
||||||
|
|
||||||
|
# change cursor shape for different vi modes.
|
||||||
|
function zle-keymap-select () {
|
||||||
|
case $KEYMAP in
|
||||||
|
vicmd) echo -ne '\e[1 q';; # block
|
||||||
|
viins|main) echo -ne '\e[5 q';; # beam
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
zle -N zle-keymap-select
|
||||||
|
zle-line-init() {
|
||||||
|
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
|
||||||
|
echo -ne "\e[5 q"
|
||||||
|
}
|
||||||
|
zle -N zle-line-init
|
||||||
|
echo -ne '\e[5 q' # Use beam shape cursor on startup.
|
||||||
|
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
|
||||||
|
|
||||||
|
# Edit line in vim with ctrl-e:
|
||||||
|
autoload edit-command-line; zle -N edit-command-line
|
||||||
|
bindkey '^e' edit-command-line
|
||||||
|
bindkey -M vicmd '^[[P' vi-delete-char
|
||||||
|
bindkey -M vicmd '^e' edit-command-line
|
||||||
|
bindkey -M visual '^[[P' vi-delete
|
||||||
|
|
||||||
|
# Load aliases
|
||||||
|
source "$zsh_config/alias"
|
||||||
|
|
||||||
|
# source plugin configs
|
||||||
|
source "$zsh_config/p10k.zsh"
|
||||||
|
|
||||||
|
# source plugins
|
||||||
|
[ "$TERM" != 'linux' ] && source "$zsh_plugins/powerlevel10k/powerlevel10k.zsh-theme"
|
||||||
|
source "$zsh_plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
||||||
|
source "$zsh_plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||||
|
|
||||||
|
neofetch
|
173
user/.config/zsh/alias
Normal file
173
user/.config/zsh/alias
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
# configure some coreutils
|
||||||
|
alias ls='ls -AhN --color=always --group-directories-first' \
|
||||||
|
rm='rm -r' \
|
||||||
|
mv='mv -i' \
|
||||||
|
cp='cp -i' \
|
||||||
|
mkdir='mkdir -p'
|
||||||
|
|
||||||
|
# cd up dirs
|
||||||
|
alias ...='cd ../..' \
|
||||||
|
....='cd ../../..' \
|
||||||
|
.....='cd ../../../..' \
|
||||||
|
......='cd ../../../../..' \
|
||||||
|
.......='cd ../../../../../..' \
|
||||||
|
........='cd ../../../../../../..' \
|
||||||
|
.........='cd ../../../../../../../..' \
|
||||||
|
..........='cd ../../../../../../../../..' \
|
||||||
|
...........='cd ../../../../../../../../../..'
|
||||||
|
|
||||||
|
# shortucts
|
||||||
|
## programs
|
||||||
|
alias music='ncmpcpp' \
|
||||||
|
e="$EDITOR" \
|
||||||
|
f='lf' \ e="$EDITOR" \
|
||||||
|
nw="$TERMINAL 2> /dev/null & disown" \
|
||||||
|
copy="xclip -selection clipboard" \
|
||||||
|
dl='curl -LO' \
|
||||||
|
drdr="dragon-drop -a -x"
|
||||||
|
|
||||||
|
## git
|
||||||
|
alias ga='git add' \
|
||||||
|
gA='git add -A' \
|
||||||
|
gch='git checkout' \
|
||||||
|
gC='git clone' \
|
||||||
|
gc='git commit' \
|
||||||
|
gca='git commit --amend' \
|
||||||
|
gd='git diff' \
|
||||||
|
gl='git log' \
|
||||||
|
gp='git push' \
|
||||||
|
gP='git pull' \
|
||||||
|
gprs='git pull --recurse-submodules'\
|
||||||
|
gr='git reset' \
|
||||||
|
gR='git reset --hard' \
|
||||||
|
gS='git status'
|
||||||
|
|
||||||
|
gnr () {
|
||||||
|
[ -z $1 ] && {
|
||||||
|
echo 'Please enter a repo name'
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
git init
|
||||||
|
git remote add origin 'gitea@git.jakubb.xyz:jakub/'"$1"'.git'
|
||||||
|
git add -A
|
||||||
|
git commit -m "init"
|
||||||
|
git push -u origin -o repo.private=false master
|
||||||
|
}
|
||||||
|
|
||||||
|
gnpr () {
|
||||||
|
[ -z $1 ] && {
|
||||||
|
echo 'Please enter a repo name'
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
git init
|
||||||
|
git remote add origin 'gitea@git.jakubb.xyz:jakub/'"$1"'.git'
|
||||||
|
git add -A
|
||||||
|
git commit -m "init"
|
||||||
|
git push -u origin -o repo.private=true master
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gnhr () {
|
||||||
|
[ -z $1 ] && {
|
||||||
|
echo 'Please enter a repo name'
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
git init
|
||||||
|
git remote add origin 'gitea@git.jakubb.xyz:34mdh/'"$1"'.git'
|
||||||
|
git add -A
|
||||||
|
git commit -m "init"
|
||||||
|
git push -u origin -o repo.private=false master
|
||||||
|
}
|
||||||
|
|
||||||
|
gnphr () {
|
||||||
|
[ -z $1 ] && {
|
||||||
|
echo 'Please enter a repo name'
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
git init
|
||||||
|
git remote add origin 'gitea@git.jakubb.xyz:34mdh/'"$1"'.git'
|
||||||
|
git add -A
|
||||||
|
git commit -m "init"
|
||||||
|
git push -u origin -o repo.private=true master
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## make
|
||||||
|
alias mk='make' \
|
||||||
|
mkc='make clean' \
|
||||||
|
smi='sudo make install ' \
|
||||||
|
smic='sudo make install clean'
|
||||||
|
|
||||||
|
## clean up after patch
|
||||||
|
alias pc="rm *.orig; rm -i *.rej"
|
||||||
|
|
||||||
|
# updating
|
||||||
|
update-zsh-plugins() {
|
||||||
|
for dir in "${XDF_DATA_HOME:-$HOME/.local/share}/zsh/plugins"/*; do
|
||||||
|
git -C "$dir" pull
|
||||||
|
done
|
||||||
|
kill -42 "$( pidof dwmblocks )"
|
||||||
|
}
|
||||||
|
update-nvim-plugins() {
|
||||||
|
nvim --headless -c 'PackerSync'
|
||||||
|
kill -42 "$( pidof dwmblocks )"
|
||||||
|
}
|
||||||
|
update-all() {
|
||||||
|
update-zsh-plugins
|
||||||
|
#update-nvim-plugins
|
||||||
|
yay
|
||||||
|
}
|
||||||
|
|
||||||
|
alias upsh='update-zsh-plugins' \
|
||||||
|
upn='update-nvim-plugins' \
|
||||||
|
upa='update-all'
|
||||||
|
|
||||||
|
# quit shortcuts
|
||||||
|
alias ZZ='exit' \
|
||||||
|
ZQ='exit' \
|
||||||
|
q='exit' \
|
||||||
|
qw='exit' \
|
||||||
|
|
||||||
|
# use lf to cd
|
||||||
|
lf() {
|
||||||
|
export LF_CD_FILE=/var/tmp/.lfcd-$$
|
||||||
|
command lf-run $@
|
||||||
|
if [ -s "$LF_CD_FILE" ]; then
|
||||||
|
local DIR="$(realpath "$(cat "$LF_CD_FILE")")"
|
||||||
|
if [ "$DIR" != "$PWD" ]; then
|
||||||
|
cd "$DIR"
|
||||||
|
fi
|
||||||
|
rm "$LF_CD_FILE"
|
||||||
|
fi
|
||||||
|
unset LF_CD_FILE
|
||||||
|
}
|
||||||
|
|
||||||
|
# long commands
|
||||||
|
srch() {
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo 'Please enter a search pattern'
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
find -name '*'"$1"'*'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
alias rspw='systemctl restart --user pipewire-pulse.socket pipewire-pulse.service pipewire.socket pipewire.service' \
|
||||||
|
rfa="source ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/alias" \
|
||||||
|
ushp='update-zsh-plugins' \
|
||||||
|
unp='update-nvim-plugins'
|
||||||
|
|
||||||
|
generate_password() {
|
||||||
|
if [ "$1" = '-s' ]; then
|
||||||
|
tr -dc 'A-Za-z0-9' </dev/urandom | head -c "$1" ; echo
|
||||||
|
else
|
||||||
|
tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' </dev/urandom | head -c "$1" ; echo
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
alias hsn='hugo server --noHTTPCache'
|
||||||
|
|
||||||
|
# source personal aliases
|
||||||
|
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/personal/alias" ] && \
|
||||||
|
source "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/personal/alias"
|
1761
user/.config/zsh/p10k.zsh
Normal file
1761
user/.config/zsh/p10k.zsh
Normal file
File diff suppressed because it is too large
Load Diff
1
user/.local/share/zsh/plugins/powerlevel10k
Submodule
1
user/.local/share/zsh/plugins/powerlevel10k
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 2b7da93df04acd04d84f5de827e5b14077839a4b
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit c3d4e576c9c86eac62884bd47c01f6faed043fc5
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit e0165eaa730dd0fa321a6a6de74f092fe87630b0
|
Loading…
Reference in New Issue
Block a user