mirror of
https://github.com/tiyn/dotfiles.git
synced 2026-03-09 18:54:47 +01:00
Compare commits
15 Commits
d3e4da830d
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 1734b04841 | |||
| 727f9265bb | |||
| cfd37d97f2 | |||
| 7dc566ff93 | |||
| a5b238c3ae | |||
| 27ac63f781 | |||
| 3c5691e879 | |||
| 17697e2f8f | |||
| f2c8b6d8e5 | |||
| f33b4e49f0 | |||
| 87e4a1966e | |||
| 8c4b6d593d | |||
| e9d5b3ecd4 | |||
| ec5bfb45d5 | |||
| c8f65d1705 |
@@ -75,10 +75,10 @@ alias contacts="khard"
|
||||
alias paint="kolourpaint"
|
||||
|
||||
# ls(d)
|
||||
alias l="exa --group-directories-first"
|
||||
alias la="exa -la --group-directories-first"
|
||||
alias ll="exa -l --group-directories-first"
|
||||
alias tree="exa --tree --group-directories-first"
|
||||
alias l="exa --group-directories-first --icons"
|
||||
alias la="exa -la --group-directories-first --icons --git"
|
||||
alias ll="exa -l --group-directories-first --icons --git"
|
||||
alias tree="exa --tree --group-directories-first --icons"
|
||||
|
||||
# mkdir
|
||||
alias mkdir="mkdir -p"
|
||||
|
||||
3
.config/eza/theme.yml
Normal file
3
.config/eza/theme.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
extensions:
|
||||
kepub:
|
||||
icon: { glyph: }
|
||||
@@ -1,4 +1,5 @@
|
||||
APV
|
||||
Accuracy
|
||||
Akallabêth
|
||||
Altisaur
|
||||
An
|
||||
@@ -11,6 +12,7 @@ Aule
|
||||
Aules
|
||||
Barros
|
||||
Beek
|
||||
Bela
|
||||
Betterov
|
||||
Boarding
|
||||
Boelsen
|
||||
@@ -83,14 +85,15 @@ Mentos
|
||||
Metzener
|
||||
MiiMii
|
||||
Mint
|
||||
NIM
|
||||
Nate
|
||||
NeoVIM
|
||||
NextCloud
|
||||
Nim
|
||||
Númenor
|
||||
OFFIS
|
||||
Oberweseler
|
||||
Odysee
|
||||
Opam
|
||||
OpenCloud
|
||||
Overwatch
|
||||
Pane
|
||||
@@ -102,10 +105,13 @@ PfingstAka
|
||||
PfingstAkademie
|
||||
Pluribus
|
||||
PopOS
|
||||
Precision
|
||||
Precon
|
||||
Precons
|
||||
PyEnv
|
||||
Rebowl
|
||||
Reeves
|
||||
Rocq
|
||||
Ruschenbaum
|
||||
SPM
|
||||
Sagehorn
|
||||
@@ -125,6 +131,8 @@ TCAV
|
||||
Thinkpad
|
||||
Tjark
|
||||
Tornow
|
||||
TrackPoint
|
||||
UDEV
|
||||
VIM
|
||||
Weizman
|
||||
Willenborg
|
||||
@@ -133,6 +141,9 @@ WinterAkademie
|
||||
Writhing
|
||||
Ziegeleiweg
|
||||
Zimin
|
||||
eKiwi
|
||||
flac
|
||||
inf
|
||||
liquidctl
|
||||
npy
|
||||
zedbraxmen
|
||||
|
||||
@@ -208,11 +208,11 @@ fileviewer *.djvu
|
||||
\ %pc
|
||||
\ vifmimg clear
|
||||
|
||||
" epub
|
||||
filextype *.epub
|
||||
" (k)epub
|
||||
filextype *.epub,*.kepub
|
||||
\ {View in zathura}
|
||||
\ zathura ./%f,
|
||||
fileviewer *.epub
|
||||
fileviewer *.epub,*.kepub
|
||||
\ vifmimg epub %px %py %pw %ph %c
|
||||
\ %pc
|
||||
\ vifmimg clear
|
||||
@@ -434,7 +434,7 @@ set vifminfo=dhistory,savedirs,chistory,state,tui,shistory,
|
||||
" file types
|
||||
set classify=' :dir:/, :exe:, :reg:, :link:'
|
||||
" various file names
|
||||
set classify+=' ::../::, ::*.sh::, ::*.[hc]pp::, ::*.[hc]::, ::/^copying|license$/::, ::.git/,,*.git/::, ::*.epub,,*.fb2,,*.djvu::, ::*.pdf::, ::*.htm,,*.html,,**.[sx]html,,*.xml::'
|
||||
set classify+=' ::../::, ::*.sh::, ::*.[hc]pp::, ::*.[hc]::, ::/^copying|license$/::, ::.git/,,*.git/::, ::*.epub,,*.kepub,,*.fb2,,*.djvu::, ::*.pdf::, ::*.htm,,*.html,,**.[sx]html,,*.xml::'
|
||||
" archives
|
||||
set classify+=' ::*.7z,,*.ace,,*.arj,,*.bz2,,*.cpio,,*.deb,,*.dz,,*.gz,,*.jar,,*.lzh,,*.lzma,,*.rar,,*.rpm,,*.rz,,*.tar,,*.taz,,*.tb2,,*.tbz,,*.tbz2,,*.tgz,,*.tlz,,*.trz,,*.txz,,*.tz,,*.tz2,,*.xz,,*.z,,*.zip,,*.zoo::'
|
||||
" images
|
||||
|
||||
@@ -85,89 +85,189 @@ function +vi-git-stash() {
|
||||
# CUSTOM WIDGETS #
|
||||
##################
|
||||
|
||||
_git_fix_main_master() {
|
||||
_find_venv_upwards() {
|
||||
local dir="$PWD"
|
||||
|
||||
while [[ "$dir" != "/" ]]; do
|
||||
if [[ -f "$dir/pyvenv.cfg" ]]; then
|
||||
echo "$dir"
|
||||
return
|
||||
fi
|
||||
dir=$(dirname "$dir")
|
||||
done
|
||||
}
|
||||
|
||||
_auto_venv() {
|
||||
local venv_dir
|
||||
venv_dir=$(_find_venv_upwards)
|
||||
|
||||
if [[ -n "$VIRTUAL_ENV" && "$VIRTUAL_ENV" != "$venv_dir" ]]; then
|
||||
deactivate 2>/dev/null
|
||||
fi
|
||||
|
||||
if [[ -n "$venv_dir" && "$VIRTUAL_ENV" != "$venv_dir" ]]; then
|
||||
source "$venv_dir/bin/activate"
|
||||
fi
|
||||
}
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd _auto_venv
|
||||
_auto_venv
|
||||
|
||||
_accept_line() {
|
||||
|
||||
# automatically push to remote
|
||||
if [[ "$BUFFER" == "git push" ]]; then
|
||||
local branch
|
||||
branch=$(git symbolic-ref --short HEAD 2>/dev/null)
|
||||
|
||||
if [[ -n "$branch" ]]; then
|
||||
git rev-parse --abbrev-ref --symbolic-full-name @{u} &>/dev/null
|
||||
if [[ $? -ne 0 ]]; then
|
||||
BUFFER="git push -u origin $branch"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# use keifu instead of git log --graph
|
||||
if [[ "$BUFFER" =~ ^([a-zA-Z0-9_-]+)[[:space:]]+([a-zA-Z0-9_-]+)(.*)$ ]]; then
|
||||
|
||||
local cmd=${match[1]}
|
||||
local subcmd=${match[2]}
|
||||
local rest=${match[3]}
|
||||
|
||||
# directly via git log --graph
|
||||
if [[ "$cmd" == "git" && "$subcmd" == "log" && "$rest" == *"--graph"* ]]; then
|
||||
BUFFER="keifu"
|
||||
zle accept-line
|
||||
return
|
||||
fi
|
||||
|
||||
# check for git-alias
|
||||
if [[ "$cmd" == "git" ]]; then
|
||||
local alias_expansion
|
||||
alias_expansion=$(git config --get "alias.$subcmd" 2>/dev/null)
|
||||
|
||||
if [[ -n "$alias_expansion" && "$alias_expansion" == log*--graph* ]]; then
|
||||
BUFFER="keifu"
|
||||
zle accept-line
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# shell-alias
|
||||
if alias "$cmd" &>/dev/null; then
|
||||
local expansion=$(alias "$cmd")
|
||||
expansion=${expansion#*=}
|
||||
expansion=${expansion#\'}
|
||||
expansion=${expansion%\'}
|
||||
|
||||
if [[ "$expansion" =~ --git-dir=([^[:space:]]+) ]]; then
|
||||
local gitdir=${match[1]}
|
||||
|
||||
if [[ "$subcmd" == "log" && "$rest" == *"--graph"* ]]; then
|
||||
BUFFER="(cd $gitdir && keifu)"
|
||||
zle accept-line
|
||||
return
|
||||
fi
|
||||
|
||||
# git-alias within shell-alias
|
||||
local alias_expansion
|
||||
alias_expansion=$(git --git-dir="$gitdir" config --get "alias.$subcmd" 2>/dev/null)
|
||||
|
||||
if [[ -n "$alias_expansion" && "$alias_expansion" == log*--graph* ]]; then
|
||||
BUFFER="(cd $gitdir && keifu)"
|
||||
zle accept-line
|
||||
return
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# swap main and master Fix
|
||||
if [[ $BUFFER == git\ * ]]; then
|
||||
local has_main=0
|
||||
local has_master=0
|
||||
git rev-parse --verify main >/dev/null 2>&1 && has_main=1
|
||||
git rev-parse --verify master >/dev/null 2>&1 && has_master=1
|
||||
if [[ $has_main -eq 1 && $has_master -eq 0 ]]; then
|
||||
if [[ $BUFFER == *" master"* ]]; then
|
||||
BUFFER=${BUFFER//" master"/" main"}
|
||||
fi
|
||||
fi
|
||||
if [[ $has_master -eq 1 && $has_main -eq 0 ]]; then
|
||||
if [[ $BUFFER == *" main"* ]]; then
|
||||
BUFFER=${BUFFER//" main"/" master"}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
zle accept-line
|
||||
}
|
||||
|
||||
zle -N _git_fix_main_master
|
||||
bindkey "^M" _git_fix_main_master
|
||||
zle -N _accept_line
|
||||
bindkey "^M" _accept_line
|
||||
|
||||
#########
|
||||
# STYLE #
|
||||
#########
|
||||
|
||||
# Set style for version control
|
||||
# set style for version control
|
||||
zstyle ':vcs_info:*' enable git
|
||||
zstyle ':vcs_info:git*:*' get-revision true
|
||||
zstyle ':vcs_info:git*:*' check-for-changes true
|
||||
zstyle ':vcs_info:git*' formats "(%s) %c%u %b%m"
|
||||
zstyle ':vcs_info:git*' actionformats "(%s|%a) %12.12i %c%u %b%m"
|
||||
# Show remote ref name and number of commits ahead-of or behind
|
||||
# Show count of stashed changes
|
||||
# show remote ref name and number of commits ahead-of or behind
|
||||
# show count of stashed changes
|
||||
zstyle ':vcs_info:git*+set-message:*' hooks git-st git-stash
|
||||
|
||||
# Set style for completion options
|
||||
# set style for completion options
|
||||
zstyle ':completion:*' menu select
|
||||
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' # Case insensitive completion
|
||||
zmodload zsh/complist
|
||||
_comp_options+=(globdots)
|
||||
|
||||
# Disable sort when completing `git checkout`
|
||||
# disable sort when completing `git checkout`
|
||||
zstyle ':completion:*:git-checkout:*' sort false
|
||||
# Set descriptions format to enable group support
|
||||
# set descriptions format to enable group support
|
||||
zstyle ':completion:*:descriptions' format '[%d]'
|
||||
# Set list-colors to enable filename colorizing
|
||||
# set list-colors to enable filename colorizing
|
||||
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
|
||||
# Preview directory's content with eza when completing cd
|
||||
# preview directory's content with eza when completing cd
|
||||
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
|
||||
# Switch group using `,` and `.`
|
||||
# switch group using `,` and `.`
|
||||
zstyle ':fzf-tab:*' switch-group ',' '.'
|
||||
|
||||
# Set default Vim Cursor shape
|
||||
# set default Vim Cursor shape
|
||||
zle -N zle-keymap-select
|
||||
zle -N zle-line-init
|
||||
echo -ne '\e[5 q'
|
||||
|
||||
# Set default prompt
|
||||
# set default prompt
|
||||
PS1='%B%{$fg[blue]%}[%{$fg[blue]%}%n%{$fg[blue]%}@%{$fg[blue]%}%M %{$fg[blue]%}%~%{$fg[blue]%}]%{$reset_color%}\$%b '
|
||||
RPROMPT='%B%{$fg[blue]%}$vcs_info_msg_0_%{$reset_color%}%b'
|
||||
setopt prompt_subst
|
||||
|
||||
# Copy to x11 clipboard
|
||||
# copy to x11 clipboard
|
||||
x11-clip-wrap-widgets copy $copy_widgets
|
||||
x11-clip-wrap-widgets paste $paste_widgets
|
||||
|
||||
# Enable colors
|
||||
# enable colors
|
||||
autoload -U colors && colors
|
||||
|
||||
# Enable git info in prompt
|
||||
# enable git info in prompt
|
||||
autoload -Uz vcs_info
|
||||
|
||||
# enable smart history search
|
||||
bindkey -M vicmd 'j' history-beginning-search-forward
|
||||
bindkey -M vicmd 'k' history-beginning-search-backward
|
||||
|
||||
###############
|
||||
# KEYBINDINGS #
|
||||
###############
|
||||
|
||||
# Enable vi mode
|
||||
# enable vi mode
|
||||
bindkey -v
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
# Vim bindings in tab mode
|
||||
# vim bindings in tab mode
|
||||
bindkey -M menuselect 'h' vi-backward-char
|
||||
bindkey -M menuselect 'k' vi-up-line-or-history
|
||||
bindkey -M menuselect 'l' vi-forward-char
|
||||
@@ -178,48 +278,50 @@ bindkey -v '^?' backward-delete-char
|
||||
# ADDITIONAL FEATURES #
|
||||
#######################
|
||||
|
||||
# Load alias
|
||||
# load alias
|
||||
[ -f "$HOME/.config/aliasrc" ] && source "$HOME/.config/aliasrc" # Load aliases
|
||||
|
||||
# Disable ctrl-s and ctrl-q.
|
||||
# disable ctrl-s and ctrl-q.
|
||||
stty -ixon
|
||||
|
||||
# Automatically cd if given a directory
|
||||
# automatically cd if given a directory
|
||||
setopt autocd autopushd
|
||||
|
||||
# Enable compinit
|
||||
# enable compinit
|
||||
autoload -Uz compinit && compinit
|
||||
|
||||
# Plugin: command not found notice
|
||||
# plugin: command not found notice
|
||||
[ -f "/usr/share/doc/pkgfile/command-not-found.zsh" ] && source /usr/share/doc/pkgfile/command-not-found.zsh
|
||||
|
||||
# Plugin: fuzzy completion
|
||||
# plugin: fuzzy completion
|
||||
[ -f "/usr/share/zsh/plugins/fzf-tab-git/fzf-tab.plugin.zsh" ] && source /usr/share/zsh/plugins/fzf-tab-git/fzf-tab.plugin.zsh
|
||||
|
||||
# Plugin: autosuggestions
|
||||
# plugin: autosuggestions
|
||||
[ -f "/usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" ] && source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh && bindkey '^ ' autosuggest-accept
|
||||
|
||||
# Plugin: syntax highlighting
|
||||
# plugin: syntax highlighting
|
||||
[ -f "/usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh" ] && source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
|
||||
|
||||
# Plugin: Autopair
|
||||
# plugin: Autopair
|
||||
|
||||
[ -f "/usr/share/zsh/plugins/zsh-autopair/zsh-autopair.plugin.zsh" ] && source /usr/share/zsh/plugins/zsh-autopair/zsh-autopair.plugin.zsh
|
||||
|
||||
# Open shell with tmux always
|
||||
# open shell with tmux always
|
||||
if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
|
||||
tmux attack-session -t $USER || tmux new-session -s $USER
|
||||
fi
|
||||
|
||||
# set up thefuck
|
||||
# thefuck
|
||||
eval $(thefuck --alias)
|
||||
|
||||
# python
|
||||
eval "$(pyenv init -)"
|
||||
|
||||
# opam
|
||||
[[ ! -r "$HOME/.opam/opam-init/init.zsh" ]] || source "$HOME/.opam/opam-init/init.zsh" > /dev/null 2> /dev/null
|
||||
|
||||
##########################
|
||||
# COMMANDS BEFORE PROMPT #
|
||||
##########################
|
||||
|
||||
# Display pfetch when starting zsh
|
||||
pfetch
|
||||
|
||||
@@ -24,3 +24,7 @@
|
||||
conflictStyle = zdiff3
|
||||
[credential]
|
||||
helper = store
|
||||
[alias]
|
||||
graph = log --graph
|
||||
amend = commit --amend --no-edit
|
||||
fpush = push --force-with-lease --force-if-includes
|
||||
|
||||
Reference in New Issue
Block a user