diff --git a/.lnk.pc b/.lnk.pc index d5f2976..0f866fc 100644 --- a/.lnk.pc +++ b/.lnk.pc @@ -1,5 +1,4 @@ .config/cortile -.config/keyb .config/kitty .config/yazi/keymap.toml .config/yazi/theme.toml diff --git a/.local/share/stew/Stewfile.lock.json b/.local/share/stew/Stewfile.lock.json index 87536a3..2e39443 100644 --- a/.local/share/stew/Stewfile.lock.json +++ b/.local/share/stew/Stewfile.lock.json @@ -86,11 +86,11 @@ "source": "github", "owner": "eza-community", "repo": "eza", - "tag": "v0.23.0", - "asset": "eza_x86_64-unknown-linux-gnu.zip", + "tag": "v0.23.3", + "asset": "eza_x86_64-unknown-linux-gnu.tar.gz", "binary": "eza", - "url": "https://api.github.com/repos/eza-community/eza/releases/assets/274134723", - "binaryHash": "731df137afcd9fd25e8151673040832dc3aaa487524c5c04e59e026f1c38b4db" + "url": "https://api.github.com/repos/eza-community/eza/releases/assets/293111574", + "binaryHash": "10457dde35808517d09bcd3bfb6bc386000d06c2126e34b9071e09470a8f7cd8" }, { "source": "github", @@ -196,11 +196,11 @@ "source": "github", "owner": "espressif", "repo": "esptool", - "tag": "v5.0.2", - "asset": "esptool-v5.0.2-linux-amd64.tar.gz", + "tag": "v4.10.0", + "asset": "esptool-v4.10.0-linux-amd64.tar.gz", "binary": "esptool", - "url": "https://api.github.com/repos/espressif/esptool/releases/assets/277777433", - "binaryHash": "f6276472f7613c4d3642abce79a62ccafd83fc49ab62a95281a965d2193380b8" + "url": "https://api.github.com/repos/espressif/esptool/releases/assets/293757695", + "binaryHash": "80d6e6b48e0022f1e6065eb91e6aa147a69d8bd6344bc27631bb35a64c1ff580" }, { "source": "github", @@ -231,6 +231,16 @@ "binary": "navi", "url": "https://api.github.com/repos/denisidoro/navi/releases/assets/224750154", "binaryHash": "c643ff670ced4b47887c887ff0877c156497642b8d25dd9ae279d1d68c27e9bb" + }, + { + "source": "github", + "owner": "jgm", + "repo": "pandoc", + "tag": "3.8", + "asset": "pandoc-3.8-linux-amd64.tar.gz", + "binary": "pandoc", + "url": "https://api.github.com/repos/jgm/pandoc/releases/assets/290434288", + "binaryHash": "6f7d39d982adf4dddae6dc1d1a8eff8f0d765d891243b0bef4cab9f385cc320c" } ] } \ No newline at end of file diff --git a/.zsh_plugins.txt b/.zsh_plugins.txt new file mode 100644 index 0000000..3e3b5b4 --- /dev/null +++ b/.zsh_plugins.txt @@ -0,0 +1,23 @@ +# vim: set filetype=sh nospell : + +mattmc3/zephyr path:plugins/color +mattmc3/zephyr path:plugins/completion +mattmc3/zephyr path:plugins/editor +mattmc3/zephyr path:plugins/zfunctions + +zsh-users/zsh-autosuggestions + +zsh-users/zsh-history-substring-search + +3v1n0/zsh-bash-completions-fallback + +Sam-programs/zsh-calc + +MichaelAquilina/zsh-you-should-use + +mattmc3/zman + +# NOTE: syntax highlighting needs to be last +zdharma-continuum/fast-syntax-highlighting +# jeffreytse/zsh-vi-mode +jeffreytse/zsh-vi-mode diff --git a/.zsh_plugins.zsh b/.zsh_plugins.zsh new file mode 100644 index 0000000..99aa652 --- /dev/null +++ b/.zsh_plugins.zsh @@ -0,0 +1,24 @@ +fpath+=( "$HOME/.cache/antidote/mattmc3/zephyr/plugins/color" ) +source "$HOME/.cache/antidote/mattmc3/zephyr/plugins/color/color.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/mattmc3/zephyr/plugins/completion" ) +source "$HOME/.cache/antidote/mattmc3/zephyr/plugins/completion/completion.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/mattmc3/zephyr/plugins/editor" ) +source "$HOME/.cache/antidote/mattmc3/zephyr/plugins/editor/editor.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/mattmc3/zephyr/plugins/zfunctions" ) +source "$HOME/.cache/antidote/mattmc3/zephyr/plugins/zfunctions/zfunctions.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/zsh-users/zsh-autosuggestions" ) +source "$HOME/.cache/antidote/zsh-users/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/zsh-users/zsh-history-substring-search" ) +source "$HOME/.cache/antidote/zsh-users/zsh-history-substring-search/zsh-history-substring-search.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/3v1n0/zsh-bash-completions-fallback" ) +source "$HOME/.cache/antidote/3v1n0/zsh-bash-completions-fallback/zsh-bash-completions-fallback.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/Sam-programs/zsh-calc" ) +source "$HOME/.cache/antidote/Sam-programs/zsh-calc/zsh-calc.zsh" +fpath+=( "$HOME/.cache/antidote/MichaelAquilina/zsh-you-should-use" ) +source "$HOME/.cache/antidote/MichaelAquilina/zsh-you-should-use/zsh-you-should-use.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/mattmc3/zman" ) +source "$HOME/.cache/antidote/mattmc3/zman/zman.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/zdharma-continuum/fast-syntax-highlighting" ) +source "$HOME/.cache/antidote/zdharma-continuum/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/jeffreytse/zsh-vi-mode" ) +source "$HOME/.cache/antidote/jeffreytse/zsh-vi-mode/zsh-vi-mode.plugin.zsh" diff --git a/.zshenv b/.zshenv new file mode 100644 index 0000000..12042cd --- /dev/null +++ b/.zshenv @@ -0,0 +1,98 @@ +# vim: set filetype=sh nospell: + +export STOW_DIR="$HOME/.local/stow" +# export SKIM_DEFAULT_OPTIONS='--bind="ctrl-k:up" --bind="ctrl-j:down"' + +## Set XDG directories +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_STATE_HOME="$HOME/.local/state" +export XDG_CACHE_HOME="$HOME/.cache" + +export XDG_DATA_DIRS="/usr/local/share:/usr/share" +export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/applications" + +# Desktop files (used by desktop environments within both X11 and Wayland) are +# # looked for in XDG_DATA_DIRS; make sure it includes the relevant directory for +# # snappy applications' desktop files. +snap_xdg_path="/var/lib/snapd/desktop" +if [ -n "${XDG_DATA_DIRS##*${snap_xdg_path}}" ] && [ -n "${XDG_DATA_DIRS##*${snap_xdg_path}:*}" ]; then + export XDG_DATA_DIRS="${XDG_DATA_DIRS}:${snap_xdg_path}" +fi + +# set XDG_DATA_DIRS to include Flatpak installations +if command -v flatpak >/dev/null; then + + new_dirs=$( + ( + unset G_MESSAGES_DEBUG + echo "${XDG_DATA_HOME:-"$HOME/.local/share"}/flatpak" + GIO_USE_VFS=local flatpak --installations + ) | ( + new_dirs= + while read -r install_path; do + share_path=$install_path/exports/share + case ":$XDG_DATA_DIRS:" in + *":$share_path:"*) : ;; + *":$share_path/:"*) : ;; + *) new_dirs=${new_dirs:+${new_dirs}:}$share_path ;; + esac + done + echo "$new_dirs" + ) + ) + + export XDG_DATA_DIRS + XDG_DATA_DIRS="${new_dirs:+${new_dirs}:}${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +fi + +# lua library paths +# eval "$(luarocks-5.4 path --bin)" + +## Path for go(lang) +# Go compiler: +path+="/usr/local/go/bin" +# Local go programs +export GOPATH="$HOME/go" +path+=$GOPATH/bin + +## Personal scripts +path+="$HOME/scripts" + +if [ -d "$HOME/bin" ]; then + path+=$HOME/bin +fi + +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/.local/bin" ]; then + path+=$HOME/.local/bin +fi + +# git-fuzzy path +path+=$HOME/scripts/git-fuzzy/bin + +# set PATH so it includes cargo if it exists +if [ -d "$HOME/.cargo/bin" ]; then + path+=/home/bryan/.cargo/bin +fi + +. "$HOME/.cargo/env" + +## lua +## luaenv +# see: https://github.com/cehoffman/luaenv +# +# Install luaenv: +# git clone https://github.com/cehoffman/luaenv.git ~/.luaenv +# +# Install lua-build plugin: +# git clone https://github.com/cehoffman/lua-build.git ~/.luaenv/plugins/lua-build +# +# Install luaenv-luarocks: +# git clone https://github.com/xpol/luaenv-luarocks.git ~/.luaenv/plugins/luaenv-luarocks +# +path+="$HOME/.luaenv/bin" +eval "$(luaenv init -)" + +# Add all directories under ~/lua to path +path+=$(ls -Dd $HOME/lua/*) diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..aec5b14 --- /dev/null +++ b/.zshrc @@ -0,0 +1,76 @@ +# vim: set filetype=sh nospell : +# + +# Clone antidote ( https://antidote.sh ) +[[ -d ${ZDOTDIR:-~}/.antidote ]] || + git clone --depth=1 https://github.com/mattmc3/antidote.git ${ZDOTDIR:-~}/.antidote +# source antidote +source ${ZDOTDIR:-~}/.antidote/antidote.zsh +zstyle ':antidote:bundle' use-friendly-names 'yes' +antidote load + +plugins+=(fzf) + +## zoxide stuff - zoxide is a better cd utility +eval "$(zoxide init zsh)" + +## starship +eval "$(starship init zsh)" + +## FZF extras +[[ -e "$HOME/.fzf-extras/fzf-extras.sh" ]] && + source "$HOME/.fzf-extras/fzf-extras.sh" + +# This function is automatically called by zsh-vi-mode plugin +# Set keybindings here so that they aren't overridden by zsh-vi-mode +function zvm_after_init() { + # set vi mode + bindkey -v + # set ctrl-p and ctrl-n for vi insert mode + bindkey -v '^P' history-substring-search-up #up-history + bindkey -v '^N' history-substring-search-down #down-history + + # mattmc3/zephyr path:plugins/editor + bindkey '^Z' symmetric-ctrl-z + bindkey '^S' prepend-sudo + + # Alt+Enter + # To make shift+enter work in zsh we map Shift+Enter to Alt+Enter in kitty. + # There are autocommands in Neovim that set a user variable in kitty when we are in Neovim and unsets it when we exit. + # This allows us to unmap Shift+Enter in kitty when inside Neovim. + # By doing this we can use Shift+Enter for `forward-word`, which is autosuggest partial accept + # in the autosuggest plugin in zsh, without interfering with the mapping in nvim. + bindkey '^[^M' forward-word + # bindkey '^R' fzf-history-widget + + # [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + # Source skim keybindings. Skim repo is cloned into stow directory + # so we can use stow to install the man page. The stow binary still has + # to be installed seperately. + source "$STOW_DIR/skim/shell/key-bindings.zsh" + + # 'navi' interactive cheatsheet (https://github.com/denisidoro/navi) + # the plugin binds ^g to the widget so we need to source it here + eval "$(navi widget zsh)" +} + +export NVM_DIR="$HOME/.config/nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion + +# 'try' utility (https://github.com/tobi/try) +# creates/manages directories for experiments +eval "$(~/.local/bin/try.rb init ~/projects/tries)" + +# Tab completions for lnk +eval "$(lnk completion zsh)" + +# Source anything in .zshrc.d. +for _rc in ${ZDOTDIR:-$HOME}/.zshrc.d/*.zsh; do + # Ignore tilde files. + + if [[ $_rc:t != '~'* ]]; then + source "$_rc" + fi +done +unset _rc diff --git a/.zshrc.d/aliases.zsh b/.zshrc.d/aliases.zsh new file mode 100644 index 0000000..d64469e --- /dev/null +++ b/.zshrc.d/aliases.zsh @@ -0,0 +1,35 @@ +# vim: set filetype=sh nospell: + +## Use the kitty ssh kitten so that terminfo will be copied over to the remote +## otherwise the remote doesn't recognize kitty terminal +alias ssh="kitten ssh" +alias mosh='mosh --ssh="kitten ssh"' + +# Show process names by default with pgrep +alias pgrep='pgrep -l' + +# Use ov as less +alias less=ov + +alias fd=fdfind + +# Use eza as ls +alias la="eza -a --sort time --group-directories-first" +alias ls="eza --sort time --group-directories-first" +alias ll="eza -l --sort time --group-directories-first" +alias lsd="eza -D --sort time" +alias lsf="eza -f --sort time" + +alias grep='grep --color=auto' +alias fgrep='fgrep --color=auto' +alias egrep='egrep --color=auto' + +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + +## Use main clipbard by default with xclip +alias xclip="xclip -selection clipboard" + +# Qalc +alias q=qalc diff --git a/.zshrc.d/colors.zsh b/.zshrc.d/colors.zsh new file mode 100644 index 0000000..388e08f --- /dev/null +++ b/.zshrc.d/colors.zsh @@ -0,0 +1,18 @@ +COLOR_1='\033[1;34m' # Primary color +COLOR_2='\033[0;96m' # Secondary color +COLOR_LIGHT='\033[2m' + +COLOR_ERROR='\033[1;31m' +COLOR_WARN='\033[0;33m' +COLOR_SUCCESS='\033[0;32m' + +TEXT_RESET='\033[0m' +TEXT_ITAL='\e[3m' +TEXT_ULINE='\e[4m' + +CYAN_B='\033[1;96m' +YELLOW='\033[0;93m' +RED_B='\033[1;31m' +GREEN='\033[0;32m' +PURPLE='\033[0;35m' + diff --git a/.zshrc.d/environment.zsh b/.zshrc.d/environment.zsh new file mode 100644 index 0000000..d190b1a --- /dev/null +++ b/.zshrc.d/environment.zsh @@ -0,0 +1,59 @@ +# vim: set filetype=sh nospell: + +export PAGER='ov' +export VISUAL='nvim' +export EDITOR='nvim' + +export MANPAGER="sh -c 'col -bx | bat -l man -p'" +export MANROFFOPT="-c" + +export BAT_PAGER="ov -FX" + +# Set language. +export LANG=${LANG:-en_US.UTF-8} + +# Reduce key delay +export KEYTIMEOUT=${KEYTIMEOUT:-1} + +# Ensure path arrays do not contain duplicates. +typeset -gU cdpath fpath mailpath path + +### History settings ### +setopt BANG_HIST # Treat the '!' character specially during expansion. +setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format. +setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history. +setopt HIST_FIND_NO_DUPS # Do not display a previously found event. +setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate. +setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again. +setopt HIST_IGNORE_SPACE # Do not record an event starting with a space. +setopt HIST_REDUCE_BLANKS # Remove extra blanks from commands added to the history list. +setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file. +setopt HIST_VERIFY # Do not execute immediately upon history expansion. +setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits. +setopt NO_HIST_BEEP # Don't beep when accessing non-existent history. +setopt NO_SHARE_HISTORY # Don't share history between all sessions. +setopt HIST_REDUCE_BLANKS # Remove superfluous blanks from each command line being added to the history. + +export HIST_STAMPS="yyyy-mm-dd" +export HISTFILE=~/.zsh_history +export HISTORY_IGNORE="(ls|cd|pwd|exit|fg|hstr)*" +export SAVEHIST=1000 # increase history file size (default is 500) +export HISTSIZE=1000 # increase history size (default is 500) + +export HSTR_CONFIG=prompt-bottom,hicolor,raw-history-view +export HSTR_PROMPT=">" + +# for `zsh-users/zsh-history-substring-search` plugin +HISTORY_SUBSTRING_SEARCH_PREFIXED=1 # Match against the start of each history entry. + +# for `Sam-programs/zsh-calc` plugin +CALC_CMD="qalc -t -c -f <(echo \$BUFFER)" + +# zsh-vi-mode stuff +ZVM_VI_HIGHLIGHT_FOREGROUND=black +ZVM_VI_HIGHLIGHT_BACKGROUND=green +ZVM_NORMAL_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BLOCK +ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BEAM +ZVM_VISUAL_MODE_CURSOR=$ZVM_CURSOR_BLOCK +ZVM_VISUAL_LINE_MODE_CURSOR=$ZVM_CURSOR_BLOCK +ZVM_OPPEND_MODE_CURSOR=$ZVM_CURSOR_BLINKING_UNDERLINE diff --git a/.zshrc.d/functions.zsh b/.zshrc.d/functions.zsh new file mode 100644 index 0000000..b638399 --- /dev/null +++ b/.zshrc.d/functions.zsh @@ -0,0 +1,90 @@ +# vim: set filetype=sh nospell: + +source ~/.zshrc.d/colors.zsh + +## Use bat as cat, except use glow for Markdown files +function cat() { + if [[ $# -eq 1 ]]; then + extension=$([[ "$1" = *.* ]] && echo ".${1##*.}" || echo '') + if [[ "$extension" == ".md" ]]; then + glow --pager -w0 $1 + elif [[ "$extension" == ".html" ]]; then + reader $1 | ov + elif [[ "$extension" == ".json" ]]; then + bat $1 | jq --color-output | bat + else + bat $1 + fi + else + bat $@ + fi +} + +## Use bat to colorize help text +## alias bathelp='bat --plain --language=help' +function help() { + "$@" --help 2>&1 | bat --plain --language=help +} + +## If there is no man page for given command then use help +function man() { + $(whence -p man) $@ + [[ $? -ne 0 ]] && help $1 || true +} + +## Syntax highlighting for apropos +function apropos() { + $(whence -p apropos) "$@" | bat +} + +## Make directory and cd into it +function mcd() { + mkdir $@ + cd $_ +} + +## List dot files +function lsdot() { + eza -d $@ .??* 2>/dev/null +} + +## Wrapper for yazi to provide ability to change current working directory when exiting yazi +function y() { + local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" + yazi "$@" --cwd-file="$tmp" + if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then + builtin cd -- "$cwd" + fi + rm -f -- "$tmp" +} + +function hstr() { + local cmd_file="$(mktemp -t "hist-cmd.XXXXXX")" + 1>&2 2>"$cmd_file" /usr/bin/hstr + + local cmd="$(cat $cmd_file)" + echo "$cmd" >>"$HISTFILE" + echo "$cmd" + eval "$cmd" + rm "$cmd_file" +} + +# set kitty user var `in_editor` when inside sk (skim fuzzy finder) +# need to use whence to find path of executible, functions can be recursive +# so if we don't do this it will just keep calling the sk() function +function sk() { + kitten @ set-user-var in_editor=1 + $(whence -p sk) "$@" + kitten @ set-user-var in_editor +} + +function fzf() { + echo "fzf not installed, using sk (skim)" + sk +} + +function plz() { + last_command=$(fc -l -n -1) + echo "${COLOR_1}Okay, ${COLOR_SUCCESS}${TEXT_ITAL}sudo${TEXT_RESET} ${COLOR_SUCCESS}${last_command}. ${COLOR_1}You're welcome.${TEXT_RESET}" + echo "$last_command" | xargs sudo +} diff --git a/.zshrc.d/options.zsh b/.zshrc.d/options.zsh new file mode 100644 index 0000000..6bf237b --- /dev/null +++ b/.zshrc.d/options.zsh @@ -0,0 +1,19 @@ +# vim: set filetype=sh nospell: + +setopt extended_glob # Use extended globbing syntax (#,~,^). +setopt glob_dots # Don't hide dotfiles from glob patterns. +setopt NO_rm_star_silent # Ask for confirmation for `rm *' or `rm path/*' + +setopt combining_chars # Combine 0-len chars with the base character (eg: accents). +setopt interactive_comments # Enable comments in interactive shell. +setopt rc_quotes # Allow 'Hitchhikers''s Guide' instead of 'Hitchhikers'\''s Guide'. +setopt NO_mail_warning # Don't print a warning message if a mail file has been accessed. +setopt NO_beep # Don't beep on error in line editor. + +# Set Zsh options related to job control. +setopt auto_resume # Attempt to resume existing job before creating a new process. +setopt long_list_jobs # List jobs in the long format by default. +setopt notify # Report status of background jobs immediately. +setopt NO_bg_nice # Don't run all background jobs at a lower priority. +setopt NO_check_jobs # Don't report on jobs when shell exit. +setopt NO_hup # Don't kill jobs on shell exit. diff --git a/pc.lnk/.config/keyb b/pc.lnk/.config/keyb deleted file mode 120000 index 215caa5..0000000 --- a/pc.lnk/.config/keyb +++ /dev/null @@ -1 +0,0 @@ -lnk/.config/keyb \ No newline at end of file diff --git a/.config/keyb/config.yml b/pc.lnk/.config/keyb/config.yml similarity index 100% rename from .config/keyb/config.yml rename to pc.lnk/.config/keyb/config.yml diff --git a/.config/keyb/cortile.yml b/pc.lnk/.config/keyb/cortile.yml similarity index 100% rename from .config/keyb/cortile.yml rename to pc.lnk/.config/keyb/cortile.yml diff --git a/.config/keyb/keyb.yml b/pc.lnk/.config/keyb/keyb.yml similarity index 100% rename from .config/keyb/keyb.yml rename to pc.lnk/.config/keyb/keyb.yml diff --git a/.config/keyb/keyb.yml.bak b/pc.lnk/.config/keyb/keyb.yml.bak similarity index 100% rename from .config/keyb/keyb.yml.bak rename to pc.lnk/.config/keyb/keyb.yml.bak diff --git a/.config/keyb/kitty.yml b/pc.lnk/.config/keyb/kitty.yml similarity index 100% rename from .config/keyb/kitty.yml rename to pc.lnk/.config/keyb/kitty.yml diff --git a/.config/keyb/merge.lua b/pc.lnk/.config/keyb/merge.lua similarity index 100% rename from .config/keyb/merge.lua rename to pc.lnk/.config/keyb/merge.lua diff --git a/pc.lnk/.zsh_plugins.txt b/pc.lnk/.zsh_plugins.txt deleted file mode 120000 index 51a07c5..0000000 --- a/pc.lnk/.zsh_plugins.txt +++ /dev/null @@ -1 +0,0 @@ -.config/lnk/.zsh_plugins.txt \ No newline at end of file diff --git a/pc.lnk/.zsh_plugins.txt b/pc.lnk/.zsh_plugins.txt new file mode 100644 index 0000000..3e3b5b4 --- /dev/null +++ b/pc.lnk/.zsh_plugins.txt @@ -0,0 +1,23 @@ +# vim: set filetype=sh nospell : + +mattmc3/zephyr path:plugins/color +mattmc3/zephyr path:plugins/completion +mattmc3/zephyr path:plugins/editor +mattmc3/zephyr path:plugins/zfunctions + +zsh-users/zsh-autosuggestions + +zsh-users/zsh-history-substring-search + +3v1n0/zsh-bash-completions-fallback + +Sam-programs/zsh-calc + +MichaelAquilina/zsh-you-should-use + +mattmc3/zman + +# NOTE: syntax highlighting needs to be last +zdharma-continuum/fast-syntax-highlighting +# jeffreytse/zsh-vi-mode +jeffreytse/zsh-vi-mode diff --git a/pc.lnk/.zsh_plugins.zsh b/pc.lnk/.zsh_plugins.zsh deleted file mode 120000 index 68f936e..0000000 --- a/pc.lnk/.zsh_plugins.zsh +++ /dev/null @@ -1 +0,0 @@ -.config/lnk/.zsh_plugins.zsh \ No newline at end of file diff --git a/pc.lnk/.zsh_plugins.zsh b/pc.lnk/.zsh_plugins.zsh new file mode 100644 index 0000000..99aa652 --- /dev/null +++ b/pc.lnk/.zsh_plugins.zsh @@ -0,0 +1,24 @@ +fpath+=( "$HOME/.cache/antidote/mattmc3/zephyr/plugins/color" ) +source "$HOME/.cache/antidote/mattmc3/zephyr/plugins/color/color.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/mattmc3/zephyr/plugins/completion" ) +source "$HOME/.cache/antidote/mattmc3/zephyr/plugins/completion/completion.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/mattmc3/zephyr/plugins/editor" ) +source "$HOME/.cache/antidote/mattmc3/zephyr/plugins/editor/editor.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/mattmc3/zephyr/plugins/zfunctions" ) +source "$HOME/.cache/antidote/mattmc3/zephyr/plugins/zfunctions/zfunctions.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/zsh-users/zsh-autosuggestions" ) +source "$HOME/.cache/antidote/zsh-users/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/zsh-users/zsh-history-substring-search" ) +source "$HOME/.cache/antidote/zsh-users/zsh-history-substring-search/zsh-history-substring-search.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/3v1n0/zsh-bash-completions-fallback" ) +source "$HOME/.cache/antidote/3v1n0/zsh-bash-completions-fallback/zsh-bash-completions-fallback.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/Sam-programs/zsh-calc" ) +source "$HOME/.cache/antidote/Sam-programs/zsh-calc/zsh-calc.zsh" +fpath+=( "$HOME/.cache/antidote/MichaelAquilina/zsh-you-should-use" ) +source "$HOME/.cache/antidote/MichaelAquilina/zsh-you-should-use/zsh-you-should-use.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/mattmc3/zman" ) +source "$HOME/.cache/antidote/mattmc3/zman/zman.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/zdharma-continuum/fast-syntax-highlighting" ) +source "$HOME/.cache/antidote/zdharma-continuum/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh" +fpath+=( "$HOME/.cache/antidote/jeffreytse/zsh-vi-mode" ) +source "$HOME/.cache/antidote/jeffreytse/zsh-vi-mode/zsh-vi-mode.plugin.zsh" diff --git a/pc.lnk/.zshenv b/pc.lnk/.zshenv deleted file mode 120000 index 2108988..0000000 --- a/pc.lnk/.zshenv +++ /dev/null @@ -1 +0,0 @@ -.config/lnk/.zshenv \ No newline at end of file diff --git a/pc.lnk/.zshenv b/pc.lnk/.zshenv new file mode 100644 index 0000000..12042cd --- /dev/null +++ b/pc.lnk/.zshenv @@ -0,0 +1,98 @@ +# vim: set filetype=sh nospell: + +export STOW_DIR="$HOME/.local/stow" +# export SKIM_DEFAULT_OPTIONS='--bind="ctrl-k:up" --bind="ctrl-j:down"' + +## Set XDG directories +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_STATE_HOME="$HOME/.local/state" +export XDG_CACHE_HOME="$HOME/.cache" + +export XDG_DATA_DIRS="/usr/local/share:/usr/share" +export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/applications" + +# Desktop files (used by desktop environments within both X11 and Wayland) are +# # looked for in XDG_DATA_DIRS; make sure it includes the relevant directory for +# # snappy applications' desktop files. +snap_xdg_path="/var/lib/snapd/desktop" +if [ -n "${XDG_DATA_DIRS##*${snap_xdg_path}}" ] && [ -n "${XDG_DATA_DIRS##*${snap_xdg_path}:*}" ]; then + export XDG_DATA_DIRS="${XDG_DATA_DIRS}:${snap_xdg_path}" +fi + +# set XDG_DATA_DIRS to include Flatpak installations +if command -v flatpak >/dev/null; then + + new_dirs=$( + ( + unset G_MESSAGES_DEBUG + echo "${XDG_DATA_HOME:-"$HOME/.local/share"}/flatpak" + GIO_USE_VFS=local flatpak --installations + ) | ( + new_dirs= + while read -r install_path; do + share_path=$install_path/exports/share + case ":$XDG_DATA_DIRS:" in + *":$share_path:"*) : ;; + *":$share_path/:"*) : ;; + *) new_dirs=${new_dirs:+${new_dirs}:}$share_path ;; + esac + done + echo "$new_dirs" + ) + ) + + export XDG_DATA_DIRS + XDG_DATA_DIRS="${new_dirs:+${new_dirs}:}${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +fi + +# lua library paths +# eval "$(luarocks-5.4 path --bin)" + +## Path for go(lang) +# Go compiler: +path+="/usr/local/go/bin" +# Local go programs +export GOPATH="$HOME/go" +path+=$GOPATH/bin + +## Personal scripts +path+="$HOME/scripts" + +if [ -d "$HOME/bin" ]; then + path+=$HOME/bin +fi + +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/.local/bin" ]; then + path+=$HOME/.local/bin +fi + +# git-fuzzy path +path+=$HOME/scripts/git-fuzzy/bin + +# set PATH so it includes cargo if it exists +if [ -d "$HOME/.cargo/bin" ]; then + path+=/home/bryan/.cargo/bin +fi + +. "$HOME/.cargo/env" + +## lua +## luaenv +# see: https://github.com/cehoffman/luaenv +# +# Install luaenv: +# git clone https://github.com/cehoffman/luaenv.git ~/.luaenv +# +# Install lua-build plugin: +# git clone https://github.com/cehoffman/lua-build.git ~/.luaenv/plugins/lua-build +# +# Install luaenv-luarocks: +# git clone https://github.com/xpol/luaenv-luarocks.git ~/.luaenv/plugins/luaenv-luarocks +# +path+="$HOME/.luaenv/bin" +eval "$(luaenv init -)" + +# Add all directories under ~/lua to path +path+=$(ls -Dd $HOME/lua/*) diff --git a/pc.lnk/.zshrc b/pc.lnk/.zshrc deleted file mode 120000 index 5cce917..0000000 --- a/pc.lnk/.zshrc +++ /dev/null @@ -1 +0,0 @@ -.config/lnk/.zshrc \ No newline at end of file diff --git a/pc.lnk/.zshrc b/pc.lnk/.zshrc new file mode 100644 index 0000000..aec5b14 --- /dev/null +++ b/pc.lnk/.zshrc @@ -0,0 +1,76 @@ +# vim: set filetype=sh nospell : +# + +# Clone antidote ( https://antidote.sh ) +[[ -d ${ZDOTDIR:-~}/.antidote ]] || + git clone --depth=1 https://github.com/mattmc3/antidote.git ${ZDOTDIR:-~}/.antidote +# source antidote +source ${ZDOTDIR:-~}/.antidote/antidote.zsh +zstyle ':antidote:bundle' use-friendly-names 'yes' +antidote load + +plugins+=(fzf) + +## zoxide stuff - zoxide is a better cd utility +eval "$(zoxide init zsh)" + +## starship +eval "$(starship init zsh)" + +## FZF extras +[[ -e "$HOME/.fzf-extras/fzf-extras.sh" ]] && + source "$HOME/.fzf-extras/fzf-extras.sh" + +# This function is automatically called by zsh-vi-mode plugin +# Set keybindings here so that they aren't overridden by zsh-vi-mode +function zvm_after_init() { + # set vi mode + bindkey -v + # set ctrl-p and ctrl-n for vi insert mode + bindkey -v '^P' history-substring-search-up #up-history + bindkey -v '^N' history-substring-search-down #down-history + + # mattmc3/zephyr path:plugins/editor + bindkey '^Z' symmetric-ctrl-z + bindkey '^S' prepend-sudo + + # Alt+Enter + # To make shift+enter work in zsh we map Shift+Enter to Alt+Enter in kitty. + # There are autocommands in Neovim that set a user variable in kitty when we are in Neovim and unsets it when we exit. + # This allows us to unmap Shift+Enter in kitty when inside Neovim. + # By doing this we can use Shift+Enter for `forward-word`, which is autosuggest partial accept + # in the autosuggest plugin in zsh, without interfering with the mapping in nvim. + bindkey '^[^M' forward-word + # bindkey '^R' fzf-history-widget + + # [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + # Source skim keybindings. Skim repo is cloned into stow directory + # so we can use stow to install the man page. The stow binary still has + # to be installed seperately. + source "$STOW_DIR/skim/shell/key-bindings.zsh" + + # 'navi' interactive cheatsheet (https://github.com/denisidoro/navi) + # the plugin binds ^g to the widget so we need to source it here + eval "$(navi widget zsh)" +} + +export NVM_DIR="$HOME/.config/nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion + +# 'try' utility (https://github.com/tobi/try) +# creates/manages directories for experiments +eval "$(~/.local/bin/try.rb init ~/projects/tries)" + +# Tab completions for lnk +eval "$(lnk completion zsh)" + +# Source anything in .zshrc.d. +for _rc in ${ZDOTDIR:-$HOME}/.zshrc.d/*.zsh; do + # Ignore tilde files. + + if [[ $_rc:t != '~'* ]]; then + source "$_rc" + fi +done +unset _rc diff --git a/pc.lnk/.zshrc.d/aliases.zsh b/pc.lnk/.zshrc.d/aliases.zsh deleted file mode 120000 index 01e208a..0000000 --- a/pc.lnk/.zshrc.d/aliases.zsh +++ /dev/null @@ -1 +0,0 @@ -../.config/lnk/.zshrc.d/aliases.zsh \ No newline at end of file diff --git a/pc.lnk/.zshrc.d/aliases.zsh b/pc.lnk/.zshrc.d/aliases.zsh new file mode 100644 index 0000000..77fe841 --- /dev/null +++ b/pc.lnk/.zshrc.d/aliases.zsh @@ -0,0 +1,37 @@ +# vim: set filetype=sh nospell: + +## Use the kitty ssh kitten so that terminfo will be copied over to the remote +## otherwise the remote doesn't recognize kitty terminal +alias ssh="kitten ssh" +alias mosh='mosh --ssh="kitten ssh"' + +# Show process names by default with pgrep +alias pgrep='pgrep -l' + +# Use ov as less +alias less=ov + +alias fd=fdfind + +# Use eza as ls +local eza_args="--sort=time --group-directories-first --icons=auto" +alias la="eza -a $eza_args" +alias ls="eza $eza_args" +alias ll="eza -l $eza_args" +alias lla="eza -l -a $eza_args" +alias lsd="eza -D $eza_args" +alias lsf="eza -f $eza_args" + +alias grep='grep --color=auto' +alias fgrep='fgrep --color=auto' +alias egrep='egrep --color=auto' + +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + +## Use main clipbard by default with xclip +alias xclip="xclip -selection clipboard" + +# Qalc +alias q=qalc diff --git a/pc.lnk/.zshrc.d/colors.zsh b/pc.lnk/.zshrc.d/colors.zsh deleted file mode 120000 index f1c5a43..0000000 --- a/pc.lnk/.zshrc.d/colors.zsh +++ /dev/null @@ -1 +0,0 @@ -../.config/lnk/.zshrc.d/colors.zsh \ No newline at end of file diff --git a/pc.lnk/.zshrc.d/colors.zsh b/pc.lnk/.zshrc.d/colors.zsh new file mode 100644 index 0000000..388e08f --- /dev/null +++ b/pc.lnk/.zshrc.d/colors.zsh @@ -0,0 +1,18 @@ +COLOR_1='\033[1;34m' # Primary color +COLOR_2='\033[0;96m' # Secondary color +COLOR_LIGHT='\033[2m' + +COLOR_ERROR='\033[1;31m' +COLOR_WARN='\033[0;33m' +COLOR_SUCCESS='\033[0;32m' + +TEXT_RESET='\033[0m' +TEXT_ITAL='\e[3m' +TEXT_ULINE='\e[4m' + +CYAN_B='\033[1;96m' +YELLOW='\033[0;93m' +RED_B='\033[1;31m' +GREEN='\033[0;32m' +PURPLE='\033[0;35m' + diff --git a/pc.lnk/.zshrc.d/environment.zsh b/pc.lnk/.zshrc.d/environment.zsh deleted file mode 120000 index c187b18..0000000 --- a/pc.lnk/.zshrc.d/environment.zsh +++ /dev/null @@ -1 +0,0 @@ -../.config/lnk/.zshrc.d/environment.zsh \ No newline at end of file diff --git a/pc.lnk/.zshrc.d/environment.zsh b/pc.lnk/.zshrc.d/environment.zsh new file mode 100644 index 0000000..d190b1a --- /dev/null +++ b/pc.lnk/.zshrc.d/environment.zsh @@ -0,0 +1,59 @@ +# vim: set filetype=sh nospell: + +export PAGER='ov' +export VISUAL='nvim' +export EDITOR='nvim' + +export MANPAGER="sh -c 'col -bx | bat -l man -p'" +export MANROFFOPT="-c" + +export BAT_PAGER="ov -FX" + +# Set language. +export LANG=${LANG:-en_US.UTF-8} + +# Reduce key delay +export KEYTIMEOUT=${KEYTIMEOUT:-1} + +# Ensure path arrays do not contain duplicates. +typeset -gU cdpath fpath mailpath path + +### History settings ### +setopt BANG_HIST # Treat the '!' character specially during expansion. +setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format. +setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history. +setopt HIST_FIND_NO_DUPS # Do not display a previously found event. +setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate. +setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again. +setopt HIST_IGNORE_SPACE # Do not record an event starting with a space. +setopt HIST_REDUCE_BLANKS # Remove extra blanks from commands added to the history list. +setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file. +setopt HIST_VERIFY # Do not execute immediately upon history expansion. +setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits. +setopt NO_HIST_BEEP # Don't beep when accessing non-existent history. +setopt NO_SHARE_HISTORY # Don't share history between all sessions. +setopt HIST_REDUCE_BLANKS # Remove superfluous blanks from each command line being added to the history. + +export HIST_STAMPS="yyyy-mm-dd" +export HISTFILE=~/.zsh_history +export HISTORY_IGNORE="(ls|cd|pwd|exit|fg|hstr)*" +export SAVEHIST=1000 # increase history file size (default is 500) +export HISTSIZE=1000 # increase history size (default is 500) + +export HSTR_CONFIG=prompt-bottom,hicolor,raw-history-view +export HSTR_PROMPT=">" + +# for `zsh-users/zsh-history-substring-search` plugin +HISTORY_SUBSTRING_SEARCH_PREFIXED=1 # Match against the start of each history entry. + +# for `Sam-programs/zsh-calc` plugin +CALC_CMD="qalc -t -c -f <(echo \$BUFFER)" + +# zsh-vi-mode stuff +ZVM_VI_HIGHLIGHT_FOREGROUND=black +ZVM_VI_HIGHLIGHT_BACKGROUND=green +ZVM_NORMAL_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BLOCK +ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BEAM +ZVM_VISUAL_MODE_CURSOR=$ZVM_CURSOR_BLOCK +ZVM_VISUAL_LINE_MODE_CURSOR=$ZVM_CURSOR_BLOCK +ZVM_OPPEND_MODE_CURSOR=$ZVM_CURSOR_BLINKING_UNDERLINE diff --git a/pc.lnk/.zshrc.d/functions.zsh b/pc.lnk/.zshrc.d/functions.zsh deleted file mode 120000 index 0d74ac2..0000000 --- a/pc.lnk/.zshrc.d/functions.zsh +++ /dev/null @@ -1 +0,0 @@ -../.config/lnk/.zshrc.d/functions.zsh \ No newline at end of file diff --git a/pc.lnk/.zshrc.d/functions.zsh b/pc.lnk/.zshrc.d/functions.zsh new file mode 100644 index 0000000..b638399 --- /dev/null +++ b/pc.lnk/.zshrc.d/functions.zsh @@ -0,0 +1,90 @@ +# vim: set filetype=sh nospell: + +source ~/.zshrc.d/colors.zsh + +## Use bat as cat, except use glow for Markdown files +function cat() { + if [[ $# -eq 1 ]]; then + extension=$([[ "$1" = *.* ]] && echo ".${1##*.}" || echo '') + if [[ "$extension" == ".md" ]]; then + glow --pager -w0 $1 + elif [[ "$extension" == ".html" ]]; then + reader $1 | ov + elif [[ "$extension" == ".json" ]]; then + bat $1 | jq --color-output | bat + else + bat $1 + fi + else + bat $@ + fi +} + +## Use bat to colorize help text +## alias bathelp='bat --plain --language=help' +function help() { + "$@" --help 2>&1 | bat --plain --language=help +} + +## If there is no man page for given command then use help +function man() { + $(whence -p man) $@ + [[ $? -ne 0 ]] && help $1 || true +} + +## Syntax highlighting for apropos +function apropos() { + $(whence -p apropos) "$@" | bat +} + +## Make directory and cd into it +function mcd() { + mkdir $@ + cd $_ +} + +## List dot files +function lsdot() { + eza -d $@ .??* 2>/dev/null +} + +## Wrapper for yazi to provide ability to change current working directory when exiting yazi +function y() { + local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" + yazi "$@" --cwd-file="$tmp" + if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then + builtin cd -- "$cwd" + fi + rm -f -- "$tmp" +} + +function hstr() { + local cmd_file="$(mktemp -t "hist-cmd.XXXXXX")" + 1>&2 2>"$cmd_file" /usr/bin/hstr + + local cmd="$(cat $cmd_file)" + echo "$cmd" >>"$HISTFILE" + echo "$cmd" + eval "$cmd" + rm "$cmd_file" +} + +# set kitty user var `in_editor` when inside sk (skim fuzzy finder) +# need to use whence to find path of executible, functions can be recursive +# so if we don't do this it will just keep calling the sk() function +function sk() { + kitten @ set-user-var in_editor=1 + $(whence -p sk) "$@" + kitten @ set-user-var in_editor +} + +function fzf() { + echo "fzf not installed, using sk (skim)" + sk +} + +function plz() { + last_command=$(fc -l -n -1) + echo "${COLOR_1}Okay, ${COLOR_SUCCESS}${TEXT_ITAL}sudo${TEXT_RESET} ${COLOR_SUCCESS}${last_command}. ${COLOR_1}You're welcome.${TEXT_RESET}" + echo "$last_command" | xargs sudo +} diff --git a/pc.lnk/.zshrc.d/options.zsh b/pc.lnk/.zshrc.d/options.zsh deleted file mode 120000 index 5ad3040..0000000 --- a/pc.lnk/.zshrc.d/options.zsh +++ /dev/null @@ -1 +0,0 @@ -../.config/lnk/.zshrc.d/options.zsh \ No newline at end of file diff --git a/pc.lnk/.zshrc.d/options.zsh b/pc.lnk/.zshrc.d/options.zsh new file mode 100644 index 0000000..6bf237b --- /dev/null +++ b/pc.lnk/.zshrc.d/options.zsh @@ -0,0 +1,19 @@ +# vim: set filetype=sh nospell: + +setopt extended_glob # Use extended globbing syntax (#,~,^). +setopt glob_dots # Don't hide dotfiles from glob patterns. +setopt NO_rm_star_silent # Ask for confirmation for `rm *' or `rm path/*' + +setopt combining_chars # Combine 0-len chars with the base character (eg: accents). +setopt interactive_comments # Enable comments in interactive shell. +setopt rc_quotes # Allow 'Hitchhikers''s Guide' instead of 'Hitchhikers'\''s Guide'. +setopt NO_mail_warning # Don't print a warning message if a mail file has been accessed. +setopt NO_beep # Don't beep on error in line editor. + +# Set Zsh options related to job control. +setopt auto_resume # Attempt to resume existing job before creating a new process. +setopt long_list_jobs # List jobs in the long format by default. +setopt notify # Report status of background jobs immediately. +setopt NO_bg_nice # Don't run all background jobs at a lower priority. +setopt NO_check_jobs # Don't report on jobs when shell exit. +setopt NO_hup # Don't kill jobs on shell exit.