clean up zsh config
This commit is contained in:
parent
a8ce70f550
commit
0939a3fb40
15 changed files with 129 additions and 245 deletions
|
@ -1,45 +0,0 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
font_file = "/usr/share/fonts/TTF/SymbolsNerdFontMono-Regular.ttf"
|
||||
if not os.path.exists(font_file):
|
||||
sys.stderr.write("Error: The font file does not exist.\n")
|
||||
sys.exit(1)
|
||||
|
||||
if shutil.which("otfinfo") is None:
|
||||
sys.stderr.write("Error: otfinfo not found.\n")
|
||||
sys.exit(1)
|
||||
|
||||
def create_maps(numbers):
|
||||
start = numbers[0]
|
||||
end = start
|
||||
maps = []
|
||||
|
||||
for number in numbers[1:]:
|
||||
if number == end + 1:
|
||||
end = number
|
||||
else:
|
||||
codepoints = f"U+{start:X}" if start == end else f"U+{start:X}-U+{end:X}"
|
||||
maps.append(f"symbol_map {codepoints} Symbols Nerd Font Mono")
|
||||
|
||||
start = end = number
|
||||
|
||||
codepoints = f"U+{start:X}" if start == end else f"U+{start:X}-U+{end:X}"
|
||||
maps.append(f"symbol_map {codepoints} Symbols Nerd Font Mono")
|
||||
|
||||
return maps
|
||||
|
||||
output = subprocess.check_output(f"otfinfo -u {font_file} | cut -c4-7", shell=True, text=True)
|
||||
numbers = [int(line.strip(), 16) for line in output.strip().split('\n')]
|
||||
maps = create_maps(numbers)
|
||||
|
||||
symbol_map_file = os.path.join(os.getenv("HOME"), ".config", "kitty", "symbol_map.conf")
|
||||
with open(symbol_map_file, "w") as file:
|
||||
for map in maps:
|
||||
file.write(f"{map}\n")
|
||||
|
||||
print("Symbol map written successfully!")
|
|
@ -1,11 +0,0 @@
|
|||
[python]
|
||||
symbol=" "
|
||||
|
||||
[lua]
|
||||
symbol=" "
|
||||
|
||||
[golang]
|
||||
symbol=" "
|
||||
|
||||
[gcloud]
|
||||
symbol=" "
|
|
@ -1,10 +1,3 @@
|
|||
# This file is written by xdg-user-dirs-update
|
||||
# If you want to change or add directories, just edit the line you're
|
||||
# interested in. All local changes will be retained on the next run.
|
||||
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
|
||||
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
|
||||
# absolute path. No other format is supported.
|
||||
|
||||
XDG_DESKTOP_DIR="$HOME"
|
||||
XDG_DOWNLOAD_DIR="$HOME/dl"
|
||||
XDG_TEMPLATES_DIR="$HOME"
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
bat
|
||||
docker
|
||||
docker-compose
|
||||
exa
|
||||
fd
|
||||
grub-customizer
|
||||
kitty
|
||||
neovim
|
||||
pyenv
|
||||
qmk
|
||||
ripgrep
|
||||
starship
|
||||
ttf-jetbrains-mono
|
||||
ttf-nerd-fonts-symbols-mono
|
||||
xclip
|
||||
xdg-desktop-portal-gnome
|
||||
zsh
|
||||
|
||||
# texlive-bin=2023.66984-8
|
|
@ -1,5 +1,8 @@
|
|||
export ZDOTDIR="$HOME/.config/zsh"
|
||||
|
||||
[ -e "$ZDOTDIR/.zshenv" ] && . "$ZDOTDIR/.zshenv"
|
||||
typeset -U path
|
||||
path+="$HOME/bin"
|
||||
|
||||
export DOTS="$HOME/docs/repos/dots"
|
||||
|
||||
# vim: filetype=zsh
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
clear_all_shortcuts yes
|
||||
kitty_mod ctrl+shift
|
||||
|
||||
map kitty_mod+c copy_to_clipboard
|
||||
map kitty_mod+v paste_from_clipboard
|
||||
|
||||
map kitty_mod+p scroll_line_up
|
||||
map kitty_mod+n scroll_line_down
|
||||
map kitty_mod+u scroll_page_up
|
||||
map kitty_mod+d scroll_page_down
|
||||
map kitty_mod+g show_last_command_output
|
||||
map kitty_mod+g launch --stdin-source=@last_cmd_output --stdin-add-formatting --type=overlay less +G -r
|
||||
|
||||
map kitty_mod+equal change_font_size all +1.0
|
||||
map kitty_mod+minus change_font_size all -1.0
|
||||
map kitty_mod+backspace change_font_size all 0
|
||||
|
||||
map kitty_mod+enter new_window
|
||||
map kitty_mod+k next_window
|
||||
map kitty_mod+j previous_window
|
||||
map kitty_mod+q close_window
|
||||
|
||||
map kitty_mod+t new_tab
|
||||
map kitty_mod+l next_tab
|
||||
map kitty_mod+h previous_tab
|
||||
map kitty_mod+o select_tab
|
|
@ -1,20 +1,38 @@
|
|||
symbol_map U+e000-U+e00a,U+ea60-U+ebeb,U+e0a0-U+e0c8,U+e0ca,U+e0cc-U+e0d7,U+e200-U+e2a9,U+e300-U+e3e3,U+e5fa-U+e6b1,U+e700-U+e7c5,U+ed00-U+efc1,U+f000-U+f2ff,U+f000-U+f2e0,U+f300-U+f372,U+f400-U+f533,U+f0001-U+f1af0 Symbols Nerd Font Mono
|
||||
font_family JetBrains Mono
|
||||
font_size 12.0
|
||||
|
||||
enable_audio_bell no
|
||||
disable_ligatures cursor
|
||||
|
||||
scrollback_lines 65536
|
||||
|
||||
enable_audio_bell no
|
||||
enabled_layouts tall
|
||||
tab_bar_style hidden
|
||||
hide_window_decorations yes
|
||||
scrollback_lines 65536
|
||||
tab_bar_style hidden
|
||||
|
||||
clear_all_shortcuts yes
|
||||
kitty_mod ctrl+shift
|
||||
|
||||
map kitty_mod+c copy_to_clipboard
|
||||
map kitty_mod+v paste_from_clipboard
|
||||
|
||||
map kitty_mod+p scroll_line_up
|
||||
map kitty_mod+n scroll_line_down
|
||||
map kitty_mod+u scroll_page_up
|
||||
map kitty_mod+d scroll_page_down
|
||||
map kitty_mod+g show_last_command_output
|
||||
|
||||
map kitty_mod+equal change_font_size all +1.0
|
||||
map kitty_mod+minus change_font_size all -1.0
|
||||
map kitty_mod+backspace change_font_size all 0
|
||||
|
||||
map kitty_mod+enter new_window
|
||||
map kitty_mod+k next_window
|
||||
map kitty_mod+j previous_window
|
||||
map kitty_mod+q close_window
|
||||
|
||||
map kitty_mod+t new_tab
|
||||
map kitty_mod+l next_tab
|
||||
map kitty_mod+h previous_tab
|
||||
map kitty_mod+o select_tab
|
||||
|
||||
include keys.conf
|
||||
include symbol_map.conf
|
||||
include themes/gruvbox.conf
|
||||
|
||||
allow_remote_control socket-only
|
||||
listen_on unix:/tmp/kitty
|
||||
action_alias kitty_scrollback_nvim kitten /home/hadeed/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py
|
||||
map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output
|
||||
|
|
|
@ -1,6 +1,2 @@
|
|||
env ZDOTDIR=$HOME/.config/zsh
|
||||
env REMOTE_HOST=1
|
||||
|
||||
copy --dest .config/zsh --exclude 'dot-' $DOTS/zsh
|
||||
copy --dest .config/zsh/.zshenv $DOTS/zsh/dot-zshenv
|
||||
copy --dest .config/zsh/.zshrc $DOTS/zsh/dot-zshrc
|
||||
copy --dest .zshrc $DOTS/zsh/dot-zshrc
|
||||
remote_kitty if-needed
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
typeset -U path
|
||||
path+="$HOME/bin"
|
||||
path+="$HOME/.local/npm/bin"
|
||||
path+="$HOME/.dotnet/tools"
|
||||
|
||||
export DOTS="$HOME/docs/repos/dots"
|
||||
|
||||
export VISUAL="nvim"
|
||||
export EDITOR="nvim"
|
||||
|
||||
export npm_config_prefix="$HOME/.local/npm"
|
||||
|
||||
if command -v pyenv &> /dev/null; then
|
||||
eval "$(pyenv init -)"
|
||||
fi
|
||||
|
||||
# vim: filetype=zsh
|
100
zsh/dot-zshrc
100
zsh/dot-zshrc
|
@ -1,6 +1,5 @@
|
|||
function create_dir() [ ! -d "$1" ] && mkdir -p "$1"
|
||||
function safe_source() [ -f "$1" ] && source "$1"
|
||||
function zsh_add_file() safe_source "$ZDOTDIR/$1"
|
||||
function zsh_add_plugin() {
|
||||
PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2)
|
||||
|
||||
|
@ -11,17 +10,104 @@ function zsh_add_plugin() {
|
|||
safe_source "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh"
|
||||
}
|
||||
|
||||
zsh_add_file "zsh-aliases"
|
||||
zsh_add_file "zsh-functions"
|
||||
zsh_add_file "zsh-options"
|
||||
zsh_add_file "zsh-completion"
|
||||
if (( $+commands[starship] )); then
|
||||
source <(starship init zsh)
|
||||
else
|
||||
[ ! -d "$HOME/.local/share/zsh/plugins/pure" ] &&
|
||||
git clone "https://github.com/sindresorhus/pure" "$HOME/.local/share/zsh/plugins/pure"
|
||||
|
||||
fpath+="$HOME/.local/share/zsh/plugins/pure"
|
||||
safe_source "$HOME/.local/share/zsh/plugins/pure/pure.zsh"
|
||||
fi
|
||||
|
||||
zsh_add_plugin "mattmc3/ez-compinit"
|
||||
|
||||
zstyle ":completion:*" list-colors ${(s.:.)LS_COLORS}
|
||||
zstyle ":completion:*" matcher-list "m:{a-z}={A-Za-z}"
|
||||
zstyle ":completion:*" menu no
|
||||
zstyle ":completion:*:descriptions" format "[%d]"
|
||||
zstyle ":completion:*:git-checkout:*" sort false
|
||||
zstyle ":fzf-tab:complete:cd:*" fzf-preview "eza -1 --color=always $realpath"
|
||||
|
||||
create_dir "$HOME/.local/state/zsh"
|
||||
|
||||
HISTFILE="$HOME/.local/state/zsh/history"
|
||||
HISTSIZE=65536
|
||||
SAVEHIST=$HISTSIZE
|
||||
|
||||
setopt AUTO_CD
|
||||
setopt HIST_IGNORE_DUPS
|
||||
setopt HIST_VERIFY
|
||||
setopt INC_APPEND_HISTORY
|
||||
setopt MULTIOS
|
||||
setopt NO_BEEP
|
||||
setopt RM_STAR_SILENT
|
||||
|
||||
stty stop undef
|
||||
zle_highlight=("paste:none")
|
||||
|
||||
zsh_add_plugin "Aloxaf/fzf-tab"
|
||||
zsh_add_plugin "ahmubashshir/zinsults"
|
||||
zsh_add_plugin "zdharma-continuum/fast-syntax-highlighting"
|
||||
zsh_add_plugin "zsh-users/zsh-autosuggestions"
|
||||
zsh_add_plugin "zsh-users/zsh-completions"
|
||||
|
||||
zsh_add_file "zsh-bindings"
|
||||
ZVM_INIT_MODE=sourcing
|
||||
ZVM_VI_INSERT_ESCAPE_BINDKEY=jk
|
||||
zsh_add_plugin "jeffreytse/zsh-vi-mode"
|
||||
ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT
|
||||
ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BEAM
|
||||
|
||||
export VISUAL="nvim"
|
||||
export EDITOR="nvim"
|
||||
|
||||
if (( $+commands[pyenv] )); then
|
||||
source <(pyenv init -)
|
||||
fi
|
||||
|
||||
if (( $+commands[fzf] )); then
|
||||
source <(fzf --zsh)
|
||||
fi
|
||||
|
||||
autoload -z edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey "^V" edit-command-line
|
||||
bindkey "^Y" autosuggest-execute
|
||||
bindkey "^F" fzf-cd-widget
|
||||
|
||||
###############################################################################
|
||||
# FUNCTIONS #
|
||||
###############################################################################
|
||||
|
||||
function cc() python -c "from math import *; print($*)"
|
||||
alias cc="noglob cc"
|
||||
|
||||
###############################################################################
|
||||
# ALIASES #
|
||||
###############################################################################
|
||||
|
||||
if [[ -f /etc/os-release ]]; then
|
||||
source /etc/os-release
|
||||
|
||||
if [[ "$ID_LIKE" == *"arch"* ]]; then
|
||||
alias p="sudo pacman -S"
|
||||
alias pu="sudo pacman -Syu"
|
||||
elif [[ "$ID" == "debian" || "$ID_LIKE" == *"debian"* ]]; then
|
||||
alias p="sudo apt install"
|
||||
alias pu="sudo apt update && sudo apt upgrade"
|
||||
fi
|
||||
fi
|
||||
|
||||
alias vi="nvim"
|
||||
|
||||
alias l="eza -x --group-directories-first --icons"
|
||||
alias la="l -a"
|
||||
|
||||
alias ll="l -lbh --git --no-time"
|
||||
alias lla="ll -a"
|
||||
|
||||
alias lt="ll --tree"
|
||||
alias lta="lt -a --ignore-glob=".git""
|
||||
|
||||
alias s="kitty +kitten ssh"
|
||||
|
||||
# vim: filetype=zsh
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
alias p='sudo pacman -S'
|
||||
alias pu='sudo pacman -Syu'
|
||||
|
||||
alias vi='nvim'
|
||||
|
||||
alias l='exa -x --group-directories-first --icons'
|
||||
alias ll='l -lbh --git --no-time'
|
||||
alias lt='ll --tree'
|
||||
|
||||
alias la='l -a'
|
||||
alias lla='ll -a'
|
||||
alias lta='lt -a --ignore-glob=".git"'
|
||||
|
||||
alias s='kitty +kitten ssh'
|
||||
|
||||
# vim: filetype=zsh
|
|
@ -1,8 +0,0 @@
|
|||
autoload -z edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey "^V" edit-command-line
|
||||
|
||||
bindkey '^Y' autosuggest-execute
|
||||
bindkey '^F' find-directory
|
||||
|
||||
# vim: filetype=zsh
|
|
@ -1,14 +0,0 @@
|
|||
create_dir "$HOME/.cache/zsh"
|
||||
autoload -Uz compinit
|
||||
compinit -d "$HOME/.cache/zsh/zcompdump"
|
||||
zmodload zsh/complist
|
||||
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
||||
zstyle ':completion:*:git-*:*' sort false
|
||||
zstyle ':completion:*:descriptions' format '[%d]'
|
||||
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
|
||||
|
||||
zstyle ':fzf-tab:*' fzf-bindings 'space:accept'
|
||||
zstyle ':fzf-tab:*' accept-line enter
|
||||
|
||||
# vim: filetype=zsh
|
|
@ -1,26 +0,0 @@
|
|||
function cc() python -c "from math import *; print($*)"
|
||||
alias cc='noglob cc'
|
||||
|
||||
function save-ssh-key() {
|
||||
mkdir -p "$HOME/.ssh"
|
||||
chmod 700 "$HOME/.ssh"
|
||||
|
||||
mv "$1" "$HOME/.ssh/${1}_${2}"
|
||||
|
||||
if [ -e "$1.pub" ]; then
|
||||
mv -n "$1.pub" "$HOME/.ssh/${1}_${2}.pub"
|
||||
fi
|
||||
}
|
||||
|
||||
function find-directory() {
|
||||
FOLDER=$(fd -t d --hidden | fzf --height="~50%" --reverse)
|
||||
if [ -n "$FOLDER" ]; then
|
||||
BUFFER="cd $FOLDER; l"
|
||||
zle .accept-line
|
||||
else
|
||||
zle reset-prompt
|
||||
fi
|
||||
}
|
||||
zle -N find-directory
|
||||
|
||||
# vim: filetype=zsh
|
|
@ -1,30 +0,0 @@
|
|||
create_dir "$HOME/.local/state/zsh"
|
||||
|
||||
HISTFILE="$HOME/.local/state/zsh/history"
|
||||
HISTSIZE=65536
|
||||
SAVEHIST=$HISTSIZE
|
||||
|
||||
setopt AUTO_CD
|
||||
setopt HIST_IGNORE_DUPS
|
||||
setopt HIST_VERIFY
|
||||
setopt INC_APPEND_HISTORY
|
||||
setopt RM_STAR_SILENT
|
||||
setopt NO_BEEP
|
||||
setopt MULTIOS
|
||||
|
||||
bindkey -e
|
||||
|
||||
stty stop undef
|
||||
zle_highlight=("paste:none")
|
||||
|
||||
if command -v starship &> /dev/null; then
|
||||
eval "$(starship init zsh)"
|
||||
else
|
||||
[ ! -d "$HOME/.local/share/zsh/plugins/pure" ] &&
|
||||
git clone "https://github.com/sindresorhus/pure" "$HOME/.local/share/zsh/plugins/pure"
|
||||
|
||||
fpath+="$HOME/.local/share/zsh/plugins/pure"
|
||||
safe_source "$HOME/.local/share/zsh/plugins/pure/pure.zsh"
|
||||
fi
|
||||
|
||||
# vim: filetype=zsh
|
Loading…
Reference in a new issue