Added init scripts for shells.
This commit is contained in:
parent
552acea022
commit
bee642d0e4
58
.config/bash/bashrc
Normal file
58
.config/bash/bashrc
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# ~/.config/bash/bashrc
|
||||
LOCATION=".config/bash/bashrc"
|
||||
|
||||
# This file gets run in two cases:
|
||||
# 1. non-login interactive shell
|
||||
# 2. remote shell (over ssh or similar)
|
||||
#
|
||||
# #2 happens when you run "ssh user@host bash" explicitly.
|
||||
# In this case, /etc/bash.bashrc has not been previous executed (unlike #1).
|
||||
#
|
||||
# Sauce:
|
||||
# - https://blog.flowblok.id.au/2013-02/shell-startup-scripts.html
|
||||
# - https://heptapod.host/flowblok/shell-startup/-/blob/branch/default/.bashrc
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
function _mordu {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_n {
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_nl {
|
||||
[ "$DEBUG" ] && echo "$*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION"
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Sourcing env.bash ===
|
||||
_mordu "Sourcing Env Vars from ~/.config/bash/env.bash."
|
||||
source "$HOME"/.config/bash/env.bash
|
||||
LOCATION=".config/bash/bashrc"
|
||||
_mordu "Finished sourcing Env Vars from ~/.config/bash/env.bash."
|
||||
# }}} === Sourcing env.bash ===
|
||||
|
||||
# {{{ === Interactive Shell Sanity Check ===
|
||||
# If not running interactively, don't do anything
|
||||
[[ $- != *i* ]] && return
|
||||
# }}} === Interactive Shell Sanity Check ===
|
||||
|
||||
# {{{ === Source System Wide bashrc ===
|
||||
_mordu "Sourcing /etc/bashrc."
|
||||
if [ -f /etc/bashrc ]; then
|
||||
source /etc/bashrc
|
||||
fi
|
||||
_mordu "Finished sourcing /etc/bashrc."
|
||||
# }}} === Source System Wide bashrc ===
|
||||
|
||||
# {{{ === Source interactive.bash ===
|
||||
_mordu "Sourcing Interactive Shell settings from ~/.config/bash/interactive.bash."
|
||||
source "$HOME"/.config/bash/interactive.bash
|
||||
LOCATION=".config/bash/bashrc"
|
||||
_mordu "Finished sourcing Interactive Shell settings from ~/.config/bash/interactive.bash."
|
||||
# }}} === Source interactive.bash ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
45
.config/bash/env.bash
Normal file
45
.config/bash/env.bash
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# ~/.config/bash/env.bash
|
||||
LOCATION="bash/env.bash"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
function _mordu {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_n {
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_nl {
|
||||
[ "$DEBUG" ] && echo "$*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Sanity Proof Interactive Env with BASH_ENV ===
|
||||
# We need to set BASH_ENV, for *non-interactive* shells.
|
||||
# (unlike $ENV, which is for interactive shells)
|
||||
_mordu "Setting BASH_ENV to pass Env Vars to non-interactive shells we might start."
|
||||
export BASH_ENV=~/.config/bash/env.bash
|
||||
# }}} === Sanity Proof Interactive Env with BASH_ENV ===
|
||||
|
||||
# {{{ === Configure HISTFILE Home ===
|
||||
_mordu "Configuring HISTFILE Home."
|
||||
if [ ! -d "$HOME"/.local/share/bash/ ] ; then
|
||||
_mordu "Could not fine ~/.local/share/bash/. Creating."
|
||||
mkdir -p "$HOME"/.local/share/bash
|
||||
fi
|
||||
|
||||
HISTFILE="$HOME"/.local/share/bash/${HOST//\./_}_bash_history
|
||||
export HISTFILE
|
||||
# }}} === Configure HISTFILE Home ===
|
||||
|
||||
# {{{ === Source Posix-Common Env Vars ===
|
||||
_mordu "Sourcing Env Vars from ~/.config/posix-common/env.sh."
|
||||
source "$HOME"/.config/posix-common/env.sh
|
||||
LOCATION="bash/env.bash"
|
||||
_mordu "Finished sourcing Env Vars from ~/.config/posix-common/env.sh."
|
||||
# }}} === Source Posix-Common Env Vars ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
58
.config/bash/interactive.bash
Normal file
58
.config/bash/interactive.bash
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# ~/.config/bash/interactive.bash
|
||||
LOCATION="bash/interactive.bash"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
function _mordu {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_n {
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_nl {
|
||||
[ "$DEBUG" ] && echo "$*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Source Posix Common Interactive Shell Settings ===
|
||||
_mordu "Sourcing Interactive Shell settings from ~/.config/posix-common/interactive.sh."
|
||||
source "$HOME"/.config/posix-common/interactive.sh
|
||||
LOCATION="bash/interactive.bash"
|
||||
_mordu "Finished sourcing Interactive Shell settings from ~/.config/posix-common/interactive.sh."
|
||||
# }}} === Source Posix Common Interactive Shell Settings ===
|
||||
|
||||
# {{{ === Load Bash Completion Framework ===
|
||||
# Right now this is just grabbed from FreeBSD init scripts. It
|
||||
# likely needs extending to work elsewhere.
|
||||
|
||||
if [ -f /usr/local/share/bash-completion/bash_completion.sh ] ; then
|
||||
_mordu "Bash completion found at /usr/local/share/bash-completion.sh. Loading."
|
||||
source /usr/local/share/bash-completion/bash_completion.sh
|
||||
elif [ -f /usr/share/bash-completion/bash_completion ] ; then
|
||||
_mordu "Bash completion found at /usr/share/bash-completion/bash_completion. Loading."
|
||||
source /usr/share/bash-completion/bash_completion
|
||||
fi
|
||||
|
||||
# }}} === Load Bash Completion Framework ===
|
||||
|
||||
# {{{ === Source prompt.bash ===
|
||||
_mordu "Sourcing bash prompt from ~/.config/bash/prompt.bash."
|
||||
source "$HOME"/.config/bash/prompt.bash
|
||||
LOCATION="bash/interactive.bash"
|
||||
_mordu "Finished sourcing bash prompt from ~/.config/bash/prompt.bash."
|
||||
# }}} === Source prompt.bash ===
|
||||
|
||||
# {{{ === FZF Completions === TODO: FIX
|
||||
#_mordu "Enabling FZF Completions."
|
||||
#if [ -d /usr/share/fzf ] ; then
|
||||
# for fzfrc in /usr/share/fzf/*.bash ; do
|
||||
# _mordu "Sourcing $fzfrc."
|
||||
# source $fzfrc
|
||||
# done
|
||||
#fi
|
||||
# }}} === FZF Completions ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
27
.config/bash/login.bash
Normal file
27
.config/bash/login.bash
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# ~/.config/bash/login.bash
|
||||
LOCATION="bash/login.bash"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
function _mordu {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_n {
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_nl {
|
||||
[ "$DEBUG" ] && echo "$*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Source Posix Common login.sh ===
|
||||
_mordu "Sourcing Login Shell settings from ~/.config/posix-common/login.sh."
|
||||
source "$HOME"/.config/posix-common/login.sh
|
||||
LOCATION="bash/login.bash"
|
||||
_mordu "Finished sourcing Login Shell settings from ~/.config/posix-common/login.sh."
|
||||
# }}} === Source Posix Common login.sh ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
35
.config/bash/logout.bash
Normal file
35
.config/bash/logout.bash
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# ~/.config/bash/logout.bash
|
||||
LOCATION="bash/logout.bash"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
function _mordu {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_n {
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_nl {
|
||||
[ "$DEBUG" ] && echo "$*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Source Posix Common logout.sh ===
|
||||
_mordu "Performing logout actions from ~/.config/posix-common/logout.sh."
|
||||
source "$HOME"/.config/posix-common/logout.sh
|
||||
LOCATION="bash/logout.bash"
|
||||
_mordu "Finished sourcing ~/.config/posix-common/logout.sh."
|
||||
# }}} === Source Posix Common logout.sh ===
|
||||
|
||||
# {{{ === Garbage Collection ===
|
||||
# Remove any stale .bash_history files still sitting around the homedir.
|
||||
if [ -f "$HOME"/.bash_history ] ; then
|
||||
_mordu "Found a stale ~/.bash_history file that shouldn't be there. Deleting it."
|
||||
rm "$HOME"/.bash_history
|
||||
fi
|
||||
# }}} === Garbage Collection ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
53
.config/bash/profile.bash
Normal file
53
.config/bash/profile.bash
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# ~/.config/bash/profile.bash
|
||||
LOCATION="bash/profile.bash"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
function _mordu {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_n {
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_nl {
|
||||
[ "$DEBUG" ] && echo "$*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Source env.bash ===
|
||||
# 1. Ensure ~/.config/bash/env.bash gets run first
|
||||
_mordu "Sourcing Env Vars from ~/.config/bash/env.bash."
|
||||
source "$HOME"/.config/bash/env.bash
|
||||
LOCATION="bash/profile.bash"
|
||||
_mordu "Finished sourcing Env Vars from ~/.config/bash/env.bash."
|
||||
# }}} === Source env.bash ===
|
||||
|
||||
# {{{ === Sanity Proof BASH_ENV. ===
|
||||
# 2. Prevent BASH_ENV from being sourced later, since we need to use $BASH_ENV
|
||||
# for non-login non-interactive shells. We don't export it, as we may have a
|
||||
# non-login non-interactive shell as a child.
|
||||
_mordu "Sanity proofing BASH_ENV by setting it to nothing."
|
||||
BASH_ENV=
|
||||
# }}} === Sanity Proof BASH_ENV. ===
|
||||
|
||||
# {{{ === Source login.bash ===
|
||||
_mordu "Sourcing Login Shell settings from ~/.config/bash/login.bash."
|
||||
source "$HOME"/.config/bash/login.bash
|
||||
LOCATION="bash/profile.bash"
|
||||
_mordu "Finished sourcing Login Shell settings from ~/.config/bash/login.bash."
|
||||
# }}} === Source login.bash ===
|
||||
|
||||
# {{{ === Source interactive.bash ===
|
||||
# 4. Run ~/.config/etc/bash/interactive.bash if this is an interactive shell.
|
||||
if [ "$PS1" ]; then
|
||||
_mordu "Sourcing Interactive Shell settings from ~/.config/bash/interactive.bash."
|
||||
source "$HOME"/.config/bash/interactive.bash
|
||||
LOCATION="bash/profile.bash"
|
||||
_mordu "Finished sourcing Interactive Shell settings from ~/.config/bash/interactive.bash."
|
||||
fi
|
||||
# }}} === Source interactive.bash ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
35
.config/bash/prompt.bash
Normal file
35
.config/bash/prompt.bash
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# ~/.config/bash/prompt.bash
|
||||
LOCATION="bash/prompt.bash"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
function _mordu {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_n {
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_nl {
|
||||
[ "$DEBUG" ] && echo "$*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Configure Starship (with fallback) ===
|
||||
# Check if starship prompt is available and use it if it is.
|
||||
if command -v starship >/dev/null ; then
|
||||
_mordu "Starship found. Setting as shell prompt."
|
||||
eval "$(starship init bash)"
|
||||
else
|
||||
_mordu "Starship not found. Falling back to plain prompt."
|
||||
# Basic plain prompt.
|
||||
HOST=$(uname -n)
|
||||
export HOST
|
||||
PS1='[$USER@$HOST:$PWD]\n(bash) $ '
|
||||
export PS1
|
||||
fi
|
||||
# }}} === Configure Starship (with fallback) ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
180
.config/fish/conf.d/custom-fzf.fish
Normal file
180
.config/fish/conf.d/custom-fzf.fish
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
#~/.config/fish/conf.d/custom-fzf.fish
|
||||
set LOCATION "fish/conf.d/custom-fzf.fish"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
# set -l DEBUG y # Comment this out to disable DEBUGing.
|
||||
function _mordu
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $argv"
|
||||
end
|
||||
|
||||
function _mordu_n
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $argv"
|
||||
end
|
||||
|
||||
function _mordu_nl
|
||||
[ "$DEBUG" ] && echo "$argv"
|
||||
end
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Function: fzf-cd-widget "Change directory" ===
|
||||
# Set up the default, mnemonic key bindings unless the user has chosen to customize them
|
||||
# function fzf-cd-widget -d "Change directory"
|
||||
# set -l commandline (__fzf_parse_commandline)
|
||||
# set -l dir $commandline[1]
|
||||
# set -l fzf_query $commandline[2]
|
||||
# set -l prefix $commandline[3]
|
||||
|
||||
# test -n "$FZF_ALT_C_COMMAND"; or set -l FZF_ALT_C_COMMAND "
|
||||
# command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \
|
||||
# -o -type d -print 2> /dev/null | sed 's@^\./@@'"
|
||||
# test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40%
|
||||
# begin
|
||||
# set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS"
|
||||
# eval "$FZF_ALT_C_COMMAND | "(__fzfcmd)' +m --query "'$fzf_query'"' | read -l result
|
||||
|
||||
# if [ -n "$result" ]
|
||||
# cd $result
|
||||
|
||||
# # Remove last token from commandline.
|
||||
# commandline -t ""
|
||||
# commandline -it -- $prefix
|
||||
# end
|
||||
# end
|
||||
|
||||
# commandline -f repaint
|
||||
# end
|
||||
# }}} === Function: fzf-cd-widget "Change directory" ===
|
||||
|
||||
# {{{ === Function: fzf "Main fzf function. User fzf-tmux if in Tmux." ===
|
||||
# Check if fzf is being ran inside of TMUX or not.
|
||||
# function fzf --wraps=fzf --description="Use fzf-tmux if in tmux session"
|
||||
# if set --query TMUX
|
||||
# fzf-tmux $argv
|
||||
# else
|
||||
# command fzf $argv
|
||||
# end
|
||||
# }}} === Function: fzf "Main fzf function. User fzf-tmux if in Tmux." ===
|
||||
|
||||
# {{{ === Function: __fzfcmd "Fzf Tmux Test." ===
|
||||
function __fzfcmd
|
||||
test -n "$FZF_TMUX"; or set FZF_TMUX 0
|
||||
test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40%
|
||||
if [ -n "$FZF_TMUX_OPTS" ]
|
||||
echo "fzf-tmux $FZF_TMUX_OPTS -- "
|
||||
else if [ $FZF_TMUX -eq 1 ]
|
||||
echo "fzf-tmux -d$FZF_TMUX_HEIGHT -- "
|
||||
else
|
||||
echo "fzf"
|
||||
end
|
||||
end
|
||||
# }}} === Function: __fzfcmd "Fzf Tmux Test." ===
|
||||
|
||||
# {{{ === Function: __fzf_parse_commandline ===
|
||||
function __fzf_parse_commandline -d 'Parse the current command line token and return split of existing filepath, fzf query, and optional -option= prefix'
|
||||
set -l commandline (commandline -t)
|
||||
|
||||
# strip -option= from token if present
|
||||
set -l prefix (string match -r -- '^-[^\s=]+=' $commandline)
|
||||
set commandline (string replace -- "$prefix" '' $commandline)
|
||||
|
||||
# eval is used to do shell expansion on paths
|
||||
eval set commandline $commandline
|
||||
|
||||
if [ -z $commandline ]
|
||||
# Default to current directory with no --query
|
||||
set dir '.'
|
||||
set fzf_query ''
|
||||
else
|
||||
set dir (__fzf_get_dir $commandline)
|
||||
if [ "$dir" = "." -a (string sub -l 1 -- $commandline) != '.' ]
|
||||
# if $dir is "." but commandline is not a relative path, this means no file path found
|
||||
set fzf_query $commandline
|
||||
else
|
||||
# Also remove trailing slash after dir, to "split" input properly
|
||||
set fzf_query (string replace -r "^$dir/?" -- '' "$commandline")
|
||||
end
|
||||
end
|
||||
echo $dir
|
||||
echo $fzf_query
|
||||
echo $prefix
|
||||
end
|
||||
# }}} === Function: __fzf_parse_commandline ===
|
||||
|
||||
# {{{ === Function: __fzf_get_dir ===
|
||||
function __fzf_get_dir -d 'Find the longest existing filepath from input string'
|
||||
set dir $argv
|
||||
|
||||
# Strip all trailing slashes. Ignore if $dir is root dir (/)
|
||||
if [ (string length -- $dir) -gt 1 ]
|
||||
set dir (string replace -r '/*$' -- '' $dir)
|
||||
end
|
||||
|
||||
# Iteratively check if dir exists and strip tail end of path
|
||||
while [ ! -d "$dir" ]
|
||||
# If path is absolute, this can keep going until ends up at /
|
||||
# If path is relative, this can keep going until entire input is consumed, dirname returns "."
|
||||
set dir (dirname -- "$dir")
|
||||
end
|
||||
echo $dir
|
||||
end
|
||||
# }}} === Function: __fzf_get_dir ===
|
||||
|
||||
# {{{ === Configure FZF Keybindings ===
|
||||
# if not set --query fzf_fish_custom_keybindings
|
||||
# # \cf is Ctrl+f
|
||||
# # bind \cf __fzf_search_current_dir
|
||||
# # bind \cr __fzf_search_history
|
||||
# # # The following two key binding use Alt as an additional modifier key to avoid conflicts
|
||||
# # bind \e\cl __fzf_search_git_log
|
||||
|
||||
# # set up the same key bindings for insert mode if using fish_vi_key_bindings
|
||||
# if test "$fish_key_bindings" = fish_vi_key_bindings -o "$fish_key_bindings" = fish_hybrid_key_bindings
|
||||
# # bind --mode insert \cf __fzf_search_current_dir
|
||||
# # bind --mode insert \cr __fzf_search_history
|
||||
# # bind --mode insert \e\cl __fzf_search_git_log
|
||||
# end
|
||||
# end
|
||||
|
||||
# function _mgk-fzf_uninstall --on-event fzf_uninstall
|
||||
# # Not going to erase FZF_DEFAULT_OPTS because too hard to tell if it was set by the user or by this plugin
|
||||
# if not set --query fzf_fish_custom_keybindings
|
||||
# # bind --erase --all \cf
|
||||
# # bind --erase --all \cr
|
||||
# # bind --erase --all \e\cl
|
||||
|
||||
# set_color --italics cyan
|
||||
# echo "mgk-fzf.fish key bindings removed"
|
||||
# set_color normal
|
||||
# end
|
||||
|
||||
# #set --erase __fzf_search_vars_cmd
|
||||
# functions --erase _mgk_fzf_uninstall
|
||||
# end
|
||||
|
||||
# Vi View Mode FZF Bindings
|
||||
#bind \ec fzf-cd-widget
|
||||
bind \ec '__fzf_cd'
|
||||
bind \eC '__fzf_cd --hidden'
|
||||
bind \cg '__fzf_open'
|
||||
bind \co '__fzf_open --editor'
|
||||
bind \cf '__fzf_search_current_dir'
|
||||
bind \cr '__fzf_search_history'
|
||||
bind \e\cs '__fzf_search_git_status'
|
||||
bind \e\cl '__fzf_search_git_log'
|
||||
|
||||
# Vi Insert Mode FZF Bindings
|
||||
if bind -M insert > /dev/null 2>&1
|
||||
# bind --mode insert \ec fzf-cd-widget
|
||||
bind --mode insert \ec '__fzf_cd'
|
||||
bind --mode insert \eC '__fzf_cd --hidden'
|
||||
bind --mode insert \cg '__fzf_open'
|
||||
bind --mode insert \co '__fzf_open --editor'
|
||||
bind --mode insert \cf '__fzf_search_current_dir'
|
||||
bind --mode insert \cr '__fzf_search_history'
|
||||
bind --mode insert \e\cs '__fzf_search_git_status'
|
||||
bind --mode insert \e\cl '__fzf_search_git_log'
|
||||
end
|
||||
# }}} === Configure FZF Keybindings ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
64
.config/fish/conf.d/load-posix-profiles.fish
Normal file
64
.config/fish/conf.d/load-posix-profiles.fish
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
# ~/.config/fish/conf.d/load-posix-profiles.fish
|
||||
set LOCATION "fish/conf.d/load-posix-profiles.fish"
|
||||
|
||||
# This file will help ensure our shell environment is in compliance with the
|
||||
# distribution / operating systems standards by sourcing /etc/profile. Which
|
||||
# will hopefully pull in /etc/profile.d/*.sh settings as well.
|
||||
#
|
||||
# Also, we will pull in the environment variables, aliases, and functions from
|
||||
# our posix configuration. This lets us to avoid having to repeat ourselves
|
||||
# with some basic things like setting environment variables. (Would not be a
|
||||
# problem if I did not insist on wanting to run so many different shells.)
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#set -l DEBUG y # Comment this out to disable DEBUGing.
|
||||
function _mordu
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $argv"
|
||||
end
|
||||
|
||||
function _mordu_n
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $argv"
|
||||
end
|
||||
|
||||
function _mordu_nl
|
||||
[ "$DEBUG" ] && echo "$argv"
|
||||
end
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Source login.fish (If interactive.) ===
|
||||
# If this instance is found to be a Login Shell, ensure all environment
|
||||
# variables and other OS-specific gets loaded.
|
||||
if status --is-login
|
||||
_mordu "This appears to be a Login Shell. Sourcing ~/.config/fish/login.fish."
|
||||
source "$HOME"/.config/fish/login.fish
|
||||
set -l LOCATION "fish/conf.d/load-posix-profiles.fish"
|
||||
_mordu "Finished sourcing ~/.config/fish/login.fish."
|
||||
end
|
||||
# }}} === Source login.fish (If interactive.) ===
|
||||
|
||||
# {{{ === Source interactive.fish (If interactive.) ===
|
||||
# For Interactive Shell instances, be sure that the user has access to all the
|
||||
# expected functions, aliases, etc. I try to centralize the really simple
|
||||
# stuff under ~/.config/posix-common so I have access to those resources from
|
||||
# both Bash, Fish, or other.
|
||||
if status --is-interactive
|
||||
_mordu "This appears to be an Interactive Shell. Sourcing ~/.config/fish/interactive.fish."
|
||||
source "$HOME"/.config/fish/interactive.fish
|
||||
set -l LOCATION "fish/conf.d/load-posix-profiles.fish"
|
||||
_mordu "Finished sourcing ~/.config/fish/interactive.fish."
|
||||
end
|
||||
# }}} === Source interactive.fish (If interactive.) ===
|
||||
|
||||
# {{{ === Source logout.fish (If logging out.) ===
|
||||
# Fish doesn't have a '.logout' file, but does have support for the
|
||||
# functionality through the use of a shell hook. Another opportunity to
|
||||
# centralize settings under ~/.config/posix-common.
|
||||
_mordu "Coupling Fish logout function with ~/.config/posix-common/logout.sh through ~/.config/fish/logout.fish."
|
||||
function on_exit --on-event fish_exit
|
||||
source "$HOME"/.config/fish/logout.fish
|
||||
set -l LOCATION "fish/conf.d/load-posix-profiles.fish"
|
||||
end
|
||||
# }}} === Source logout.fish (If logging out.) ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
33
.config/fish/config.fish
Normal file
33
.config/fish/config.fish
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# ~/.config/fish/config.fish
|
||||
set LOCATION "fish/config.fish"
|
||||
|
||||
# Fish specific configuration file. Generally speaking, try to
|
||||
# prioritize POSIX compatability for any added functionality. If
|
||||
# possible, try to add any desired function, alias, or the like to
|
||||
# ~/.config/posix-common/[..] where possible.
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#set -l DEBUG y # Comment this out to disable DEBUGing.
|
||||
function _mordu
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $argv"
|
||||
end
|
||||
|
||||
function _mordu_n
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $argv"
|
||||
end
|
||||
|
||||
function _mordu_nl
|
||||
[ "$DEBUG" ] && echo "$argv"
|
||||
end
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Primary Fish Configuration Section ===
|
||||
set fish_greeting # Disable fish greeting.
|
||||
|
||||
# Prepend hostname tocommand history file if possible
|
||||
|
||||
set -x fish_history (echo "$HOST"|sed 's/\./_/g')_fish
|
||||
# }}} === Primary Fish Configuration Section ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
9
.config/fish/functions-old/blkpng2jpg.fish
Normal file
9
.config/fish/functions-old/blkpng2jpg.fish
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# ~/.config/fish/functions/blkpng2jpg.fish
|
||||
# Author: Lord_Devi
|
||||
# Desc: Bulk convert all png files to jpg. Saves on space when
|
||||
# working with papez. (Will remove transparencies.)
|
||||
if type -qf parallel and type -qf convert
|
||||
function blkpng2jpg
|
||||
parallel convert '{}' '{.}.jpg' ::: *.png
|
||||
end
|
||||
end
|
||||
12
.config/fish/functions-old/catp.fish
Normal file
12
.config/fish/functions-old/catp.fish
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# ~/.config/fish/functions/catp.fish
|
||||
# Author: Lord_Devi
|
||||
# Desc: Fish function to be a really quick 'cat picture'
|
||||
# command. Using 'pixcat' for Kitty.
|
||||
if type -qf pixcat
|
||||
function catp
|
||||
for i in $argv
|
||||
echo "Displaying Image: $i"
|
||||
command pixcat r -W 800 -H 600 --align left $i
|
||||
end
|
||||
end
|
||||
end
|
||||
11
.config/fish/functions-old/fixperms.fish
Normal file
11
.config/fish/functions-old/fixperms.fish
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# ~/.config/fish/functions/fixperms.fish
|
||||
# Author: Lord_Devi
|
||||
# Desc: Function for helping to quickly set the perms on both files
|
||||
# and directories in a home directory.
|
||||
#
|
||||
# Directories = 755 (drwxr-xr-x)
|
||||
# Files = 644 (.rw-r--r--)
|
||||
function fixperms
|
||||
find $argv -type d -exec chmod 755 {} \;
|
||||
find $argv -type f -exec chmod 644 {} \;
|
||||
end
|
||||
7
.config/fish/functions-old/getdate.fish
Normal file
7
.config/fish/functions-old/getdate.fish
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# ~/.config/fish/functions/getdate.fish
|
||||
# Author: Lord_Devi
|
||||
# Desc: Just a command I find handy to insert readable American style
|
||||
# dates into filenames and shit.
|
||||
function getdate
|
||||
command date +%m-%d-%Y
|
||||
end
|
||||
35
.config/fish/functions-old/gsu.fish
Normal file
35
.config/fish/functions-old/gsu.fish
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# ~/.config/fish/functions/gsu.fish
|
||||
# Screenshotting tool which allows for screenshotting of seperate screens more easily than others.
|
||||
|
||||
if type -qf gsu
|
||||
function gsu1
|
||||
command gsu \
|
||||
-d 1 \
|
||||
~/pix/scrots/$argv.jpg
|
||||
end
|
||||
function gsu2
|
||||
command gsu \
|
||||
-d 2 \
|
||||
~/pix/scrots/$argv.jpg
|
||||
end
|
||||
function gsu3
|
||||
command gsu \
|
||||
-d 3 \
|
||||
~/pix/scrots/$argv.jpg
|
||||
end
|
||||
function gsu4
|
||||
command gsu \
|
||||
-d 4 \
|
||||
~/pix/scrots/$argv.jpg
|
||||
end
|
||||
function gsu5
|
||||
command gsu \
|
||||
-d 5 \
|
||||
~/pix/scrots/$argv.jpg
|
||||
end
|
||||
function gsu6
|
||||
command gsu \
|
||||
-d 6 \
|
||||
~/pix/scrots/$argv.jpg
|
||||
end
|
||||
end
|
||||
25
.config/fish/functions-old/ls.fish
Normal file
25
.config/fish/functions-old/ls.fish
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Look for ls's cooler brother 'lsd' and default to it if found.
|
||||
|
||||
if type -qf lsd
|
||||
function ls
|
||||
command lsd \
|
||||
-F \
|
||||
--color=always \
|
||||
--icon=always \
|
||||
--date relative \
|
||||
--size short \
|
||||
$argv
|
||||
end
|
||||
else if type -qf colorls
|
||||
function ls
|
||||
command colorls -FG $argv
|
||||
end
|
||||
else
|
||||
function ls
|
||||
command ls -F $argv
|
||||
end
|
||||
end
|
||||
|
||||
alias ll="ls -l"
|
||||
alias la="ls -A"
|
||||
alias lla="ls -lA"
|
||||
8
.config/fish/functions-old/rands.fish
Normal file
8
.config/fish/functions-old/rands.fish
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# ~/.config/fish/functions/rands.fish
|
||||
# Author: Lord_Devi
|
||||
# Desc: Generates a short random string. Useful for inserting random
|
||||
# strings into filenames.
|
||||
function rands
|
||||
set -l LENGTH 12
|
||||
tr -dc A-Za-z0-9 </dev/urandom | head -c $LENGTH
|
||||
end
|
||||
26
.config/fish/functions-old/yt-dl.fish
Normal file
26
.config/fish/functions-old/yt-dl.fish
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# ~/.config/fish/functions/yt-dl.fish
|
||||
# Author: Lord_Devi
|
||||
# Desc: Functions for downloading entire youtube channels and such.
|
||||
# Needs work.
|
||||
|
||||
function f_yt-dl
|
||||
youtube-dl "$argv[1]" \
|
||||
--download-archive ~/.config/youtube-dl/youtube-dl-seen.conf \
|
||||
--prefer-free-formats \
|
||||
--playlist-end $argv[2] \
|
||||
--write-description \
|
||||
--output "~/vidz/yt-dl/%(uploader)s/%(upload_date)s - %(title)s.%(ext)s"
|
||||
end
|
||||
|
||||
function f_yt-dl-user
|
||||
f_yt-dl "https://www.youtube.com/user/$argv[1]" 10
|
||||
end
|
||||
|
||||
function f_yt-dl-channel
|
||||
f_yt-dl "https://www.youtube.com/channel/$argv[1]" 10
|
||||
end
|
||||
|
||||
function f_yt-dl-playlist
|
||||
f_yt-dl "https://www.youtube.com/playlist?list=$argv[1]"
|
||||
end
|
||||
|
||||
8
.config/fish/functions/rands.fish
Normal file
8
.config/fish/functions/rands.fish
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# ~/.config/fish/functions/rands.fish
|
||||
# Author: Lord_Devi
|
||||
# Desc: Generates a short random string. Useful for inserting random
|
||||
# strings into filenames.
|
||||
function rands
|
||||
set -l LENGTH 12
|
||||
tr -dc A-Za-z0-9 </dev/urandom | head -c $LENGTH
|
||||
end
|
||||
146
.config/fish/interactive.fish
Normal file
146
.config/fish/interactive.fish
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
# ~/.config/fish/interactive.fish
|
||||
set LOCATION "fish/interactive.fish"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#set -l DEBUG y # Comment this out to disable DEBUGing.
|
||||
function _mordu
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $argv"
|
||||
end
|
||||
|
||||
function _mordu_n
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $argv"
|
||||
end
|
||||
|
||||
function _mordu_nl
|
||||
[ "$DEBUG" ] && echo "$argv"
|
||||
end
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Source Posix Common Aliases ===
|
||||
# Load the posix-common Interactive Shell settings we have setup too.
|
||||
# Initially I was just loading ~/.config/posix-common/interactive.sh like
|
||||
# sh and bash were doing. But Fish cannot actually import functions from
|
||||
# posix-common/functions.d/*. Which is more than half of what
|
||||
# posix-common/interactive.sh does. The other half is sourcing all the
|
||||
# aliases from posix-common/aliases.d/*.
|
||||
# So now we will skip ahead for Fish and just source that aliases directory
|
||||
# directly, skipping posix-common/interactive.sh.
|
||||
|
||||
# >>> DON'T USE THIS BLOCK
|
||||
# _mordu "Sourcing Interactive Shell settings from ~/.config/posix-common/interactive.sh"
|
||||
# replay "source ~/.config/posix-common/interactive.sh"
|
||||
# set -l LOCATION "fish/interactive.fish"
|
||||
# _mordu "Finished sourcing Interactive Shell settings from ~/.config/posix-common/interactive.sh"
|
||||
# <<< DON'T USE THIS BLOCK
|
||||
|
||||
# >>> USE THIS BLOCK
|
||||
# Aliases Second
|
||||
#_mordu "Sourcing Aliases from ~/.config/posix-common/aliases.d/*."
|
||||
#for alias_file in ~/.config/posix-common/aliases.d/*.sh
|
||||
# _mordu "Sourcing $alias_file."
|
||||
# set -l LOCATION "posix-common/aliases.d/$alias_file"
|
||||
# #replay "source $alias_file"
|
||||
#end
|
||||
#set -l LOCATION interactive.fish
|
||||
#_mordu "Finished sourcing Aliases from ~/.config/posix-common/aliases.d/*."
|
||||
# <<< USE THIS BLOCK
|
||||
# }}} === Source Posix Common Aliases ===
|
||||
|
||||
# {{{ === Source Posix Common Environment Variables ===
|
||||
#_mordu "Sourcing Common Env Vars from ~/.config/posix-common/env.sh."
|
||||
#replay "source ~/.config/posix-common/env.sh"
|
||||
#set -l LOCATION "fish/interactive.fish"
|
||||
#_mordu "Finished sourcing Common Env Vars from ~/.config/posix-common/env.sh."
|
||||
# }}} === Source Posix Common Environment Variables ===
|
||||
|
||||
# {{{ === Source prompt.fish ===
|
||||
_mordu "Sourcing Fish prompt from ~/.config/fish/prompt.fish."
|
||||
source "$HOME"/.config/fish/prompt.fish
|
||||
set -l LOCATION "fish/interactive.fish"
|
||||
_mordu "Finished sourcing Fish prompt from ~/.config/fish/prompt.fish."
|
||||
# }}} === Source prompt.fish ===
|
||||
|
||||
# {{{ === Enable VI Mode ===
|
||||
_mordu "Enabling VI mode for command line editing."
|
||||
function fish_hybrid_key_bindings --description \
|
||||
"Vi-style bindings that inherit emacs-style bindings in all modes"
|
||||
for mode in default insert visual
|
||||
fish_default_key_bindings -M $mode
|
||||
end
|
||||
fish_vi_key_bindings --no-erase
|
||||
end
|
||||
set -g fish_key_bindings fish_hybrid_key_bindings
|
||||
# }}} === Enable VI Mode ===
|
||||
|
||||
# {{{ === Configure LS_COLORS ===
|
||||
# ColorLS. Yes, 'lsd' will use it. ;)
|
||||
# Sauce: https://github.com/trapd00r/LS_COLORS
|
||||
#_mordu "Sourcing LS Colors from ~/.config/posix-common/lscolors.sh"
|
||||
#replay 'source ~/.config/posix-common/lscolors.sh'
|
||||
#_mordu "Finished LS Colors from ~/.config/posix-common/lscolors.sh"
|
||||
# }}} === Configure LS_COLORS ===
|
||||
|
||||
# {{{ === Configure 'thefuck' / 'uwu' ===
|
||||
# Neat little tool. Not sure how to load it from
|
||||
# posix-common/aliases.d/ yet. That would be preferred. Right now I
|
||||
# am loading it from interactive.fish and interactive.sh files.
|
||||
if type -qf thefuck
|
||||
_mordu "Configuring 'thefuck' to be referenced as 'uwu'."
|
||||
thefuck --alias uwu | source
|
||||
end
|
||||
# }}} === Configure 'thefuck' / 'uwu' ===
|
||||
|
||||
# {{{ === FZF Completions ===
|
||||
# Load default fzf keybindings
|
||||
# fzf_key_bindings
|
||||
|
||||
# bind --erase --all \ct
|
||||
# bind --erase --all \cr
|
||||
|
||||
# if not set --query fzf_fish_custom_keybindings
|
||||
# # \cf is Ctrl+f
|
||||
# # bind \cf __fzf_search_current_dir
|
||||
# # bind \cr __fzf_search_history
|
||||
# # # The following two key binding use Alt as an additional modifier key to avoid conflicts
|
||||
# # bind \e\cl __fzf_search_git_log
|
||||
|
||||
# # set up the same key bindings for insert mode if using fish_vi_key_bindings
|
||||
# if test "$fish_key_bindings" = fish_vi_key_bindings -o "$fish_key_bindings" = fish_hybrid_key_bindings
|
||||
# # bind --mode insert \cf __fzf_search_current_dir
|
||||
# # bind --mode insert \cr __fzf_search_history
|
||||
# # bind --mode insert \e\cl __fzf_search_git_log
|
||||
# end
|
||||
# end
|
||||
|
||||
# function _mgk-fzf_uninstall --on-event fzf_uninstall
|
||||
# # Not going to erase FZF_DEFAULT_OPTS because too hard to tell if it was set by the user or by this plugin
|
||||
# if not set --query fzf_fish_custom_keybindings
|
||||
# # bind --erase --all \cf
|
||||
# # bind --erase --all \cr
|
||||
# # bind --erase --all \e\cl
|
||||
|
||||
# set_color --italics cyan
|
||||
# echo "mgk-fzf.fish key bindings removed"
|
||||
# set_color normal
|
||||
# end
|
||||
|
||||
# #set --erase __fzf_search_vars_cmd
|
||||
# functions --erase _mgk_fzf_uninstall
|
||||
# end
|
||||
# }}} === FZF Completions ===
|
||||
|
||||
# {{{ === Aliases: Sudo ===
|
||||
_mordu "Setting up sudo aliases."
|
||||
alias firewall-cmd='sudo firewall-cmd'
|
||||
alias fwc='sudo firewall-cmd'
|
||||
alias dnf='sudo dnf'
|
||||
alias systemctl='sudo systemctl'
|
||||
alias lsof='sudo lsof'
|
||||
alias service='sudo service'
|
||||
alias snap='sudo snap'
|
||||
alias sysupdate='dnf mc --refresh && dnf -y update'
|
||||
alias lxc='sudo lxc'
|
||||
# }}} === Aliases: Sudo ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
40
.config/fish/login.fish
Normal file
40
.config/fish/login.fish
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# ~/.config/fish/login.fish
|
||||
set LOCATION "fish/login.fish"
|
||||
|
||||
# Intended to be used to run items we want to load only on login shells.
|
||||
# Env vars that affect non-interactive shells or interactive shells alike.
|
||||
# But perhaps not things like aliases for 'ls' quite yet.
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#set -l DEBUG y # Comment this out to disable DEBUGing.
|
||||
function _mordu
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $argv"
|
||||
end
|
||||
|
||||
function _mordu_n
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $argv"
|
||||
end
|
||||
|
||||
function _mordu_nlk
|
||||
[ "$DEBUG" ] && echo "$argv"
|
||||
end
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Souce System Posix Profile TODO: FIX ===
|
||||
# Load Operating System POSIX environment. Important on Arch, Gentoo
|
||||
# and likely others.
|
||||
#_mordu "Sourcing OS-Specific /etc/profile."
|
||||
#replay "source /etc/profile"
|
||||
#_mordu "Finished sourcing OS-Specific /etc/profile."
|
||||
# }}} === Souce System Posix Profile ===
|
||||
|
||||
# {{{ === Souce User Common Posix Profile TODO: FIX===
|
||||
# Load the posix-common Login Shell settings we have setup too.
|
||||
#_mordu "Sourcing Login Shell settings from ~/.config/posix-common/login.sh"
|
||||
#replay "source ~/.config/posix-common/login.sh"
|
||||
#set -l LOCATIONl "fish/login.fish"
|
||||
#_mordu "Finished sourcing Login Shell settings from ~/.config/posix-common/login.sh"
|
||||
# }}} === Souce User Common Posix Profile ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
27
.config/fish/logout.fish
Normal file
27
.config/fish/logout.fish
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# ~/.config/fish/logout.fish
|
||||
set LOCATION "fish/logout.fish"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#set -l DEBUG y # Comment this out to disable DEBUGing.
|
||||
function _mordu
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $argv"
|
||||
end
|
||||
|
||||
function _mordu_n
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $argv"
|
||||
end
|
||||
|
||||
function _mordu_nl
|
||||
[ "$DEBUG" ] && echo "$argv"
|
||||
end
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Sourcing Posix Common Logout ===
|
||||
#_mordu "Sourcing POSIX logout from ~/.config/posix-common/logout.sh"
|
||||
#replay "source ~/.config/posix-common/logout.sh"
|
||||
#set -l LOCATION "fish/logout.fish"
|
||||
#_mordu "Finished sourcing POSIX logout from ~/.config/posix-common/logout.sh"
|
||||
# }}} === Sourcing Posix Common Logout ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
27
.config/fish/prompt.fish
Normal file
27
.config/fish/prompt.fish
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# ~/.config/fish/prompt.fish
|
||||
set LOCATION "fish/prompt.fish"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#set -l DEBUG y # Comment this out to disable DEBUGing.
|
||||
function _mordu
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $argv"
|
||||
end
|
||||
|
||||
function _mordu_n
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $argv"
|
||||
end
|
||||
|
||||
function _mordu_nl
|
||||
[ "$DEBUG" ] && echo "$argv"
|
||||
end
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Run Starfish Init ===
|
||||
if type -qf starship
|
||||
_mordu "Starship found. Setting as shell prompt."
|
||||
starship init fish | source
|
||||
end
|
||||
# }}} === Run Starfish Init ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
43
.config/git/config
Normal file
43
.config/git/config
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
[init]
|
||||
defaultBranch = master
|
||||
|
||||
[core]
|
||||
askPass =
|
||||
|
||||
[user]
|
||||
email = lord@mgk.one
|
||||
name = Lord_Devi
|
||||
|
||||
[gc]
|
||||
reflogExpire = 200
|
||||
|
||||
[diff]
|
||||
submodule = log
|
||||
|
||||
[status]
|
||||
submodulesummary = 1
|
||||
|
||||
[alias]
|
||||
sdiff = !git diff && git submodule foreach 'git diff'
|
||||
spush = push --recurse-submodules=on-demand
|
||||
supdate = submodule update --remote --merge
|
||||
clone-for-worktrees = "!sh $HOME/.local/bin/git-clone-bare-for-worktrees.sh"
|
||||
clone-bare = "!sh $HOME/.local/bin/git-clone-bare.sh"
|
||||
|
||||
[submodule]
|
||||
recurse = true
|
||||
[pull]
|
||||
rebase = false
|
||||
|
||||
[credential]
|
||||
helper = cache --timeout 7200
|
||||
|
||||
[filter "lfs"]
|
||||
smudge = git-lfs smudge -- %f
|
||||
process = git-lfs filter-process
|
||||
required = true
|
||||
clean = git-lfs clean -- %f
|
||||
|
||||
[ghq]
|
||||
root = ~/proj/git
|
||||
root = ~/.local/opt/git
|
||||
69
.config/git/ignore
Normal file
69
.config/git/ignore
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
# Other Backup Types
|
||||
*.bak
|
||||
*.tmp
|
||||
|
||||
# Archives
|
||||
*.7z
|
||||
*.jar
|
||||
*.rar
|
||||
*.zip
|
||||
*.tgz
|
||||
*.gz
|
||||
*.bzip
|
||||
*.xz
|
||||
*.lzma
|
||||
*.iso
|
||||
*.tar
|
||||
*.dmg
|
||||
*.xpi
|
||||
*.gem
|
||||
*.egg
|
||||
*.deb
|
||||
*.rpm
|
||||
|
||||
# Emacs & Vim Stuff
|
||||
*~
|
||||
\#*\#
|
||||
/.emacs.desktop
|
||||
/.emacs.desktop.lock
|
||||
*.elc
|
||||
auto-save-list
|
||||
tramp
|
||||
.\#*
|
||||
|
||||
## Org-mode
|
||||
.org-id-locations
|
||||
*_archive
|
||||
|
||||
## flymake-mode
|
||||
*_flymake.*
|
||||
|
||||
## eshell files
|
||||
/eshell/history
|
||||
/eshell/lastdir
|
||||
|
||||
## elpa packages
|
||||
/elpa/
|
||||
|
||||
## reftex files
|
||||
*.rel
|
||||
|
||||
## cask packages
|
||||
.cask/
|
||||
dist/
|
||||
|
||||
## Flycheck
|
||||
flycheck_*.el
|
||||
|
||||
## projectiles files
|
||||
.projectile
|
||||
|
||||
## directory configuration
|
||||
.dir-locals.el
|
||||
|
||||
## network security
|
||||
/network-security.data
|
||||
|
||||
## Fish Shell
|
||||
fish_variables
|
||||
fish_history
|
||||
1
.config/posix-common/LS_COLORS
Symbolic link
1
.config/posix-common/LS_COLORS
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../.local/opt/git/git.mgk.one/utils-shell/trapd00r.LS_COLORS/LS_COLORS
|
||||
72
.config/posix-common/aliases.d/common_aliases.sh
Normal file
72
.config/posix-common/aliases.d/common_aliases.sh
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
# ~/.config/posix-common/aliases.d/common-aliases.sh
|
||||
LOCATION="posix-common/aliases.d/common-aliases.sh"
|
||||
|
||||
# Generally speaking, put items that are intended for INTERACTIVE
|
||||
# shells in here. If it is a setting that might be needed by an piece
|
||||
# of software that might get ran during non-interactive shells - put
|
||||
# that in common-envs.sh instead.
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Aliases: 'cd' Related ===
|
||||
# Change Directory shortcuts, commonly needed on BSD's.
|
||||
_mordu "Setting cd related aliases."
|
||||
alias ..='cd ..' # Traverse 1 dir down.
|
||||
alias ...='cd ../..' # Traverse 2 dirs down.
|
||||
alias ....='cd ../../..' # Traverse 3 dirs down.
|
||||
# }}} === Aliases: 'cd' Related ===
|
||||
|
||||
# {{{ === Aliases: Sorting Related ===
|
||||
_mordu "Setting sorting related aliases."
|
||||
# Make sort easier to |s to.
|
||||
alias s='sort'
|
||||
|
||||
# 'esl': "env | sort | less" quickly.
|
||||
alias esl="env|sort|less"
|
||||
# }}} === Aliasess: Sorting Related ===
|
||||
|
||||
# {{{ === Aliases: Emacs Related ===
|
||||
# If Emacs is in in the path, create an alias 'cmacs' for 'console emacs'.
|
||||
if command -v emacs > /dev/null ; then
|
||||
_mordu "Setting emacs related aliases."
|
||||
alias e='emacs' # Because I'm lazy.
|
||||
alias cmacs='emacs -nw' # Start emacs with no window system.
|
||||
fi
|
||||
# }}} === Aliases: Emacs Related ===
|
||||
|
||||
# {{{ === Aliases: 'getdate' - Used for Dating Files ===
|
||||
# getdate - Used to create a date string in my preferred format. I
|
||||
# use it when creating files and such.
|
||||
alias getdate='date +%Y-%m-%d'
|
||||
# }}} === Aliases: 'getdate' - Used for Dating Files ===
|
||||
|
||||
# {{{ === Aliases: 'purgebaks' - Used for Purging Vim and Emacs Backups ===
|
||||
# purgebaks - An incredibly destructive recursive vim/emacs backup
|
||||
# file deleter. Use with caution. I would prefer enhancing this
|
||||
# to move the files into a backup folder inside of
|
||||
# ~/.cache/something with (getdate) applied to the filenames. But
|
||||
# for now, this will simply search a subdirectory for anything
|
||||
# like ~foobar.txt or #foobar.txt# and deletes them
|
||||
alias purgebaks='find -name "\#*" -print -delete;find -name "*~" -print -delete'
|
||||
# }}} === Aliases: 'purgebaks' - Used for Purging Vim and Emacs Backups ===
|
||||
|
||||
# {{{ === Aliases: 'grep' Related. ===
|
||||
# Grep, handy to do things like 'cat foobar.txt|g secretcode'
|
||||
alias g='grep -i'
|
||||
# }}} === Aliases: 'grep' Related. ===
|
||||
|
||||
# {{{ === Misc Leftover Aliases. ===
|
||||
alias reload-fonts="sudo fc-cache -v"
|
||||
|
||||
pghq() {
|
||||
GHQ_ROOT="$HOME/proj/git" ghq $*
|
||||
}
|
||||
# }}} === Misc Leftover Aliases. ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
61
.config/posix-common/aliases.d/less-and-bat.sh
Normal file
61
.config/posix-common/aliases.d/less-and-bat.sh
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# ~/.config/posix-common/aliases.d/less-and-bat.sh
|
||||
LOCATION="posix-common/aliases.d/less-and-bat.sh"
|
||||
|
||||
# Generally speaking, put items that are intended for INTERACTIVE
|
||||
# shells in here. If it is a setting that might be needed by an piece
|
||||
# of software that might get ran during non-interactive shells - put
|
||||
# that in common-envs.sh instead.
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Environment Setup: Less & Bat Related ===
|
||||
# Themes that work: ansi, gruvbox-dark
|
||||
# Note: 'bat' is also configured as our default pager, but is
|
||||
# referenced from ~/.config/posix-common/env.d/common-envs.sh.
|
||||
_mordu "Setting up 'less', and 'bat' related environment."
|
||||
|
||||
# First clean up after less, and make sure a cache dir exists for it.
|
||||
if [ ! -d "$HOME"/.cache/less ]; then
|
||||
_mordu "$HOME/.cache/less/ not found. Creating."
|
||||
mkdir -p "$HOME"/.cache/less # Make the less cache dir for the history if needed.
|
||||
fi
|
||||
|
||||
# We will set up less's preferred env even if we end up using
|
||||
# 'bat'. Just to keep things clean for those edge cases.
|
||||
_mordu "Setting LESSKEY and LESSHISTFILE."
|
||||
LESSKEY="$XDG_CONFIG_HOME"/less/lesskey
|
||||
LESSHISTFILE="$XDG_CACHE_HOME"/less/$(echo "$HOST"|sed 's/\./_/g')_less_history
|
||||
export LESSKEY LESSHISTFILE
|
||||
|
||||
# Check if there is a '.lesshst' making a mess in our homedir or
|
||||
# not and get rid of it if there is.
|
||||
if [ -f "$HOME/.lesshst" ]; then
|
||||
_mordu "Found a stale ~/.lesshst file. Deleting."
|
||||
rm "$HOME"/.lesshst # Just get rid of it. I don't need it.
|
||||
fi
|
||||
# }}} === Environment Setup: Less & Bat Related ===
|
||||
|
||||
# {{{ === Aliases: Less and Bat Related ===
|
||||
# Now the important part - Try to use 'bat' as our default pager
|
||||
# if it is possible. Sometimes bat doesn't always play nice, but
|
||||
# let's assume it will 99% of the time.
|
||||
if command -v bat > /dev/null ; then
|
||||
#alias bat='bat --style=changes,header,grid,numbers,snip --color=always'
|
||||
#alias batnl='bat --style=header,grid,snip'
|
||||
alias l='less'
|
||||
alias c='cat'
|
||||
#alias b='bat'
|
||||
alias man='batman'
|
||||
alias diff='batdiff'
|
||||
fi
|
||||
PAGER=less
|
||||
export PAGER
|
||||
# }}} === Aliases: Less and Bat Related ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
47
.config/posix-common/aliases.d/ls-and-lsd.sh
Normal file
47
.config/posix-common/aliases.d/ls-and-lsd.sh
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
# ~/.config/posix-common/aliases.d/ls-and-lsd.sh
|
||||
LOCATION="posix-common/aliases.d/ls-and-lsd.sh"
|
||||
|
||||
# Generally speaking, put items that are intended for INTERACTIVE
|
||||
# shells in here. If it is a setting that might be needed by an piece
|
||||
# of software that might get ran during non-interactive shells - put
|
||||
# that in common-envs.sh instead.
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Aliases: 'ls' Related ===
|
||||
# 'ls' - Colorize if possible, and create shortcuts
|
||||
if command -v lsd > /dev/null 2>&1; then # Typically I have this on Linux.
|
||||
_mordu "Found 'lsd', configuring aliases for it."
|
||||
alias ls='lsd -F --color=auto --icon=auto --date relative --size short'
|
||||
elif command -v colorls > /dev/null ; then # This is OpenBSD usually.
|
||||
alias ls='colorls -FGh'
|
||||
elif [ "$(uname)" = 'Linux' ]; then # If it is Linux we can assume gnu ls.
|
||||
alias ls='ls -Fh --color=auto --time-style=long-iso' # Set color to auto and enable classify.
|
||||
else
|
||||
alias ls='ls -Fh' # At least ensure --classify is on.
|
||||
fi
|
||||
|
||||
_mordu "Creating 'ls' related aliases."
|
||||
alias ll="exa -l"
|
||||
alias la="exa -A"
|
||||
alias lla="exa -lA"
|
||||
|
||||
# 'lt' Tree basically, but for all files minus '.' and '..'.
|
||||
# Also with preference for 'lsd --tree' over 'tree -a'
|
||||
if command -v lsd > /dev/null ; then # Typically I have this on Linux.
|
||||
_mordu "Creating tree related aliases using lsd'."
|
||||
alias lt='lsd --tree'
|
||||
alias lta='lt -A'
|
||||
elif command -v tree > /dev/null ; then
|
||||
alias lt='tree'
|
||||
alias lta='lt -a'
|
||||
fi
|
||||
# }}} === Aliases: 'ls' Related ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
24
.config/posix-common/aliases.d/net-aliases.sh
Normal file
24
.config/posix-common/aliases.d/net-aliases.sh
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# ~/.config/posix-common/aliases.d/net-aliases.sh
|
||||
LOCATION="posix-common/aliases.d/net-aliases.sh"
|
||||
|
||||
# These are shortcuts for comming networking things I do.
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Aliases ===
|
||||
|
||||
# Firewall-cmd stuff.
|
||||
|
||||
alias fw='firewall-cmd'
|
||||
alias fwls='fw --list-all'
|
||||
alias fwlsa='fw --list-all-zones'
|
||||
alias fwgaz='fw --get-active-zones'
|
||||
# }}} === Aliases ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
28
.config/posix-common/aliases.d/sudo-related.sh
Normal file
28
.config/posix-common/aliases.d/sudo-related.sh
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# ~/.config/posix-common/aliases.d/sudo-related.sh
|
||||
LOCATION="posix-common/aliases.d/sudo-related.sh"
|
||||
|
||||
# Generally speaking, put items that are intended for INTERACTIVE
|
||||
# shells in here. If it is a setting that might be needed by an piece
|
||||
# of software that might get ran during non-interactive shells - put
|
||||
# that in common-envs.sh instead.
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Aliases: Sudo Related ===
|
||||
alias firewall-cmd='sudo firewall-cmd'
|
||||
alias dnf='sudo dnf'
|
||||
alias lsof='sudo lsof'
|
||||
alias service='sudo service'
|
||||
alias nmcli='sudo nmcli'
|
||||
#alias systemctl='sudo systemctl'
|
||||
#alias journalctl='sudo journalctl'
|
||||
|
||||
# }}} === Aliases: Sudo Related ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
29
.config/posix-common/aliases.d/xdg-related.sh
Normal file
29
.config/posix-common/aliases.d/xdg-related.sh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# ~/.config/posix-common/aliases.d/xdg-related.sh
|
||||
LOCATION="posix-common/aliases.d/xdg-related.sh"
|
||||
|
||||
# Generally speaking, put items that are intended for INTERACTIVE
|
||||
# shells in here. If it is a setting that might be needed by an piece
|
||||
# of software that might get ran during non-interactive shells - put
|
||||
# that in common-envs.sh instead.
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Aliases: XDG Related ===
|
||||
# XDG wget
|
||||
WGETRC="$XDG_CONFIG_HOME"/wget/wgetrc
|
||||
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget_hsts"'
|
||||
export WGETRC
|
||||
|
||||
# XDG Weechat
|
||||
WEECHAT_HOME="$XDG_CONFIG_HOME"/weechat
|
||||
alias weechat='weechat -d "$XDG_CONFIG_HOME"/weechat'
|
||||
export WEECHAT_HOME
|
||||
# }}} === Aliases: XDG Related ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
128
.config/posix-common/env.d/common_envs.sh
Normal file
128
.config/posix-common/env.d/common_envs.sh
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
# ~/.config/posix-common/env.d/common_envs.sh
|
||||
LOCATION=".config/posix-common/env.d/common_envs.sh"
|
||||
|
||||
# Not just for exporting Environment Variables, but also useful for
|
||||
# running conditional tests, creating directories, moving files, etc.
|
||||
#
|
||||
# There is some cross over between this file and
|
||||
# ~/.config/posix-common/env_local.sh. Both are intended for
|
||||
# environment variables which are going to be needed frequently. And
|
||||
# both will be polled for non-login as well as login shells. As well
|
||||
# as interactive shells.
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Source env_functions.sh ===
|
||||
_mordu "Sourcing env_functions.sh."
|
||||
. "$HOME"/.config/posix-common/env_functions.sh
|
||||
LOCATION=".config/posix-common/env.d/common_envs.sh"
|
||||
_mordu "Finished sourcing env_functions.sh."
|
||||
# }}} === Source env_functions.sh ===
|
||||
|
||||
# {{{ === Configure Cargo's Environment ===
|
||||
_mordu "Configuring CARGO_HOME and adding to PATH."
|
||||
export CARGO_HOME="$HOME"/.local/opt/cargo
|
||||
pathprepend "$HOME"/.local/opt/cargo/bin PATH
|
||||
|
||||
if [ ! -d "$HOME"/.local/opt/cargo/bin ]; then
|
||||
_mordu "Did not find ~/.local/opt/cargo/bin. Creating."
|
||||
mkdir -p "$HOME"/.local/opt/cargo/bin
|
||||
fi
|
||||
# }}} === Configure Cargo's Environment ===
|
||||
|
||||
# {{{ === Configure Go's Environment ===
|
||||
_mordu "Configuring GO_HOME and adding to PATH."
|
||||
export GOPATH="$HOME"/.local/opt/go
|
||||
pathprepend "$HOME"/.local/opt/go/bin PATH
|
||||
|
||||
if [ ! -d "$HOME"/.local/opt/go/bin ]; then
|
||||
_mordu "Did not find ~/.local/opt/go/bin. Creating."
|
||||
mkdir -p "$HOME"/.local/opt/go/bin
|
||||
fi
|
||||
# }}} === Configure GO's Environment ===
|
||||
|
||||
# {{{ === Configure GUIX's Environment ===
|
||||
## GUIX bin and Profile can be set if it looks like it exists.
|
||||
#if [ -d "$HOME"/.config/guix/current/bin ]; then
|
||||
# _mordu "Found GUIX installed. Setting up PATH and GUIX_PROFILE."
|
||||
# pathprepend "$HOME"/.config/guix/current/bin
|
||||
# GUIX_PROFILE="$HOME/.config/guix/current"
|
||||
# export GUIX_PROFILE
|
||||
#fi
|
||||
# }}} === Configure GUIX's Environment ===
|
||||
|
||||
# {{{ === Manage ~/.local/bin ===
|
||||
## Add ~/.local/bin to PATH, make it if it doesn't exist.
|
||||
if [ ! -d "$HOME"/.local/bin ]; then
|
||||
_mordu "Did not find ~/.local/bin. Creating."
|
||||
mkdir -p "$HOME"/.local/bin
|
||||
fi
|
||||
_mordu "Adding ~/.local/bin to PATH"
|
||||
pathprepend "$HOME"/.local/bin PATH
|
||||
# }}} === Manage ~/.local/bin ===
|
||||
|
||||
# {{{ === PATH Sanity Checking ===
|
||||
# The current directory ( . ) should never be in $PATH
|
||||
_mordu "Trimming current dir from PATH."
|
||||
pathremove . PATH
|
||||
pathremove "" PATH
|
||||
# }}} === PATH Sanity Checking ===
|
||||
|
||||
# {{{ === Manage ~/.local/share/man ===
|
||||
if [ ! -d "$HOME"/.local/share/man ]; then
|
||||
_mordu "Did not find ~/.local/share/man. Creating."
|
||||
mkdir -p "$HOME"/.local/share/man
|
||||
fi
|
||||
|
||||
_mordu "Adding ~/.local/share/man to MANPATH."
|
||||
MANPATH=":$HOME/.local/share/man"
|
||||
export MANPATH
|
||||
# }}} === Manage ~/.local/share/man ===
|
||||
|
||||
# {{{ === Editor Related: Emacs, NeoVim, Vim, etc. ===
|
||||
_mordu "Configuring EDITOR."
|
||||
if command -v emacs > /dev/null ; then
|
||||
_mordu "Setting EDITOR to: emacs"
|
||||
EDITOR='emacs'
|
||||
elif command -v nvim > /dev/null ; then
|
||||
_mordu "Setting EDITOR to: nvim"
|
||||
EDITOR='nvim'
|
||||
elif command -v vim > /dev/null ; then
|
||||
_mordu "Setting EDITOR to: vim"
|
||||
EDITOR='vim'
|
||||
elif command -v vi > /dev/null ; then
|
||||
_mordu "Setting EDITOR to: vi"
|
||||
EDITOR='vi'
|
||||
elif command -v nano > /dev/null ; then
|
||||
_mordu "Setting EDITOR to: nano"
|
||||
EDITOR='nano'
|
||||
fi
|
||||
|
||||
VISUAL=$EDITOR
|
||||
export EDITOR VISUAL
|
||||
# }}} === Editor Related: Emacs, NeoVim, Vim, etc. ===
|
||||
|
||||
# {{{ === Shell Related ===
|
||||
# Set FZF's appearance.
|
||||
export FZF_DEFAULT_OPTS="--color=dark --border=rounded"
|
||||
# }}} === Shell Related ===
|
||||
|
||||
# {{{ === Xorg Related Environment ===
|
||||
GTK2_RC_FILES="$HOME/.config/gtk-2.0/gtkrc"
|
||||
export GTK2_RC_FILES
|
||||
|
||||
# For QT Theme management via qt5ct
|
||||
QT_QPA_PLATFORMTHEME=qt5ct
|
||||
export QT_QPA_PLATFORMTHEME
|
||||
|
||||
#GDK_SCALE=2
|
||||
#GDK_DPI_SCALE=0.5
|
||||
# }}} === Xorg Related Environment ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
49
.config/posix-common/env.sh
Normal file
49
.config/posix-common/env.sh
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# ~/.config/posix-common/env.sh
|
||||
LOCATION="posix-common/env.sh"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Set ENV Variable for Sanity Proofing Init ===
|
||||
# We need to set $ENV so that if you use shell X as your login shell,
|
||||
# and then start "sh" as a non-login interactive shell the startup scripts will
|
||||
# correctly run.
|
||||
_mordu "Protecting Interactive functionality by setting ENV."
|
||||
ENV="$HOME"/.config/sh/interactive.sh
|
||||
export ENV
|
||||
# }}} === Set ENV Variable for Sanity Proofing Init ===
|
||||
|
||||
# {{{ === Configure UMASK ===
|
||||
# 0022 is more common with its g+rw. But 0077's strict o+rw only is good enough likely.
|
||||
_mordu "Setting umask to g-rw from g+rw on new files."
|
||||
umask 0077
|
||||
# }}} === Configure UMASK ===
|
||||
|
||||
# {{{ === Source Posix Common env_local.sh ===
|
||||
# env_local is a useful place to put high priority Env Vars that could be
|
||||
# expected to be used in both interactive and non-interactive shells. (I think.
|
||||
# lol)
|
||||
_mordu "Sourcing Env Vars from ~/.config/posix-common/env_local.sh."
|
||||
. "$HOME"/.config/posix-common/env_local.sh
|
||||
LOCATION="posix-common/env.sh"
|
||||
_mordu "Finished sourcing Env Vars from ~/.config/posix-common/env_local.sh."
|
||||
# }}} === Source Posix Common env_local.sh ===
|
||||
|
||||
# {{{ === Source Posix Common env.d/*.sh ===
|
||||
_mordu "Sourcing Env Vars from ~/.config/posix-common/env.d/*.sh."
|
||||
for env_file in "$HOME"/.config/posix-common/env.d/*.sh; do
|
||||
_mordu "Sourcing $env_file."
|
||||
# shellcheck source=/dev/null
|
||||
. "$env_file"
|
||||
done
|
||||
unset -v env_file
|
||||
LOCATION="posix-common/env.sh"
|
||||
_mordu "Finished sourcing Env Vars from ~/.config/posix-common/env.d/*.sh."
|
||||
# }}} === Source Posix Common env.d/*.sh ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
62
.config/posix-common/env_functions.sh
Normal file
62
.config/posix-common/env_functions.sh
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# ~/.config/posix-common/env_functions.sh
|
||||
LOCATION="posix-common/env_functions.sh"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === PATH Management Functions ===
|
||||
_mordu "Creating PATH management functions."
|
||||
# Usage: indirect_expand PATH -> $PATH
|
||||
indirect_expand () {
|
||||
env |sed -n "s/^$1=//p"
|
||||
}
|
||||
|
||||
# Usage: pathremove /path/to/bin [PATH]
|
||||
# Eg, to remove ~/bin from $PATH
|
||||
# pathremove ~/bin PATH
|
||||
pathremove () {
|
||||
local IFS=':'
|
||||
local newpath
|
||||
local dir
|
||||
local var=${2:-PATH}
|
||||
# Bash has ${!var}, but this is not portable.
|
||||
for dir in $(indirect_expand "$var"); do
|
||||
IFS=''
|
||||
if [ "$dir" != "$1" ]; then
|
||||
newpath="$newpath:$dir"
|
||||
fi
|
||||
done
|
||||
export "$var"="${newpath#:}"
|
||||
}
|
||||
|
||||
# Usage: pathprepend /path/to/bin [PATH]
|
||||
# Eg, to prepend ~/bin to $PATH
|
||||
# pathprepend ~/bin PATH
|
||||
pathprepend () {
|
||||
# if the path is already in the variable,
|
||||
# remove it so we can move it to the front
|
||||
pathremove "$1" "$2"
|
||||
#[ -d "${1}" ] || return
|
||||
local var="${2:-PATH}"
|
||||
local value=$(indirect_expand "$var")
|
||||
export "${var}=${1}${value:+:${value}}"
|
||||
}
|
||||
|
||||
# Usage: pathappend /path/to/bin [PATH]
|
||||
# Eg, to append ~/bin to $PATH
|
||||
# pathappend ~/bin PATH
|
||||
pathappend () {
|
||||
pathremove "${1}" "${2}"
|
||||
#[ -d "${1}" ] || return
|
||||
var=${2:-PATH}
|
||||
value=$(indirect_expand "$var")
|
||||
export "$var=${value:+${value}:}${1}"
|
||||
}
|
||||
# }}} === PATH Management Functions ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
89
.config/posix-common/env_local.sh
Normal file
89
.config/posix-common/env_local.sh
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
# ~/.config/posix-common/env_local.sh
|
||||
LOCATION="posix-common/env_local.sh"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Set HOST ===
|
||||
# Set HOST as per FQDN of currently running host.
|
||||
_mordu "Setting HOST."
|
||||
if [ "$(uname)" = "Linux" ] ; then
|
||||
HOST="$(hostname -f)"
|
||||
elif [ "$(uname)" = "OpenBSD" ] ; then
|
||||
HOST="$(hostname)"
|
||||
fi
|
||||
export HOST
|
||||
# }}} === Set HOST ===
|
||||
|
||||
# {{{ === Load XDG Environment Variables ===
|
||||
_mordu "Setting XDG Environment Variables."
|
||||
XDG_CONFIG_HOME="$HOME/.config"
|
||||
XDG_CACHE_HOME="$HOME/.cache"
|
||||
XDG_DATA_HOME="$HOME/.local/share"
|
||||
XDG_DATA_DIRS="/usr/local/share:/usr/share"
|
||||
XDG_CONFIG_DIRS="/etc/xdg"
|
||||
# The xdg user-dirs below usually aren't handled as Env Vars. I
|
||||
# find it simplifies things for me right now.
|
||||
XDG_DESKTOP_DIR="$HOME/.local/desktop"
|
||||
XDG_DOCUMENTS_DIR="$HOME/dox"
|
||||
XDG_DOWNLOAD_DIR="$HOME/dl"
|
||||
XDG_MUSIC_DIR="$HOME/mzk"
|
||||
XDG_PICTURES_DIR="$HOME/pix"
|
||||
XDG_PROJECTS_DIR="$HOME/dox/proj"
|
||||
XDG_PUBLICSHARE_DIR="$HOME/pub"
|
||||
XDG_TEMPLATES_DIR="$HOME/.local/templates"
|
||||
XDG_VIDEOS_DIR="$HOME/vidz"
|
||||
|
||||
export XDG_CONFIG_HOME XDG_CACHE_HOME XDG_DATA_HOME XDG_DATA_DIRS \
|
||||
XDG_CONFIG_DIRS XDG_DESKTOP_DIR XDG_DOCUMENTS_DIR XDG_DOWNLOAD_DIR \
|
||||
XDG_MUSIC_DIR XDG_PICTURES_DIR XDG_PROJECTS_DIR XDG_PUBLICSHARE_DIR \
|
||||
XDG_TEMPLATES_DIR XDG_VIDEOS_DIR
|
||||
# }}} === Load XDG Environment Variables ===
|
||||
|
||||
# {{{ === Configure XDG-USER-DIRS with xdg-user-dirs-update ===
|
||||
if command -v xdg-user-dirs-update > /dev/null ; then
|
||||
_mordu "Configuring XDG-USER-DIRS with xdg-user-dirs-update."
|
||||
xdg-user-dirs-update --set DOCUMENTS "$XDG_DOCUMENTS_DIR"
|
||||
xdg-user-dirs-update --set DESKTOP "$XDG_DESKTOP_DIR"
|
||||
xdg-user-dirs-update --set DOWNLOAD "$XDG_DOWNLOAD_DIR"
|
||||
xdg-user-dirs-update --set MUSIC "$XDG_MUSIC_DIR"
|
||||
xdg-user-dirs-update --set PICTURES "$XDG_PICTURES_DIR"
|
||||
xdg-user-dirs-update --set TEMPLATES "$XDG_TEMPLATES_DIR"
|
||||
xdg-user-dirs-update --set VIDEOS "$XDG_VIDEOS_DIR"
|
||||
xdg-user-dirs-update --set PUBLICSHARE "$XDG_PUBLICSHARE_DIR"
|
||||
fi
|
||||
# }}} === Configure XDG-USER-DIRS with xdg-user-dirs-update ===
|
||||
|
||||
# {{{ === Create XDG-USER-DIRS if Not Already Made ===
|
||||
# Let's make sure the XDG dirs exist. There is a good argument to
|
||||
# be made that we keep this mkdir stuff solely in a boostrap
|
||||
# phase, and not in a login or interactive shell phase of things.
|
||||
# I will try to see if this helps with my sanity or if it is a bad
|
||||
# idea later after trying for a while.
|
||||
_mordu "Creating XDD-USER-DIRS that do not already exist."
|
||||
for _xdgdir in "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME" \
|
||||
"$XDG_DATA_HOME" "$XDG_DESKTOP_DIR" "$XDG_DOCUMENTS_DIR" \
|
||||
"$XDG_DOCUMENTS_DIR" "$XDG_DOWNLOAD_DIR" "$XDG_MUSIC_DIR" \
|
||||
"$XDG_PICTURES_DIR" "$XDG_PUBLICSHARE_DIR" \
|
||||
"$XDG_TEMPLATES_DIR" "$XDG_VIDEOS_DIR" "$XDG_PROJECTS_DIR"
|
||||
do
|
||||
[ ! -d "$_xdgdir" ] && mkdir -p "$_xdgdir"
|
||||
done
|
||||
# }}} === Create XDG-USER-DIRS if Not Already Made ===
|
||||
|
||||
# {{{ === XDG Misc Remaining ===
|
||||
_mordu "XDGing readline."
|
||||
INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
|
||||
export INPUTRC
|
||||
|
||||
CALCHISTFILE="$HOME/.cache/calc_history"
|
||||
export CALCHISTFILE
|
||||
|
||||
# }}} === XDG Misc Remaining ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
BIN
.config/posix-common/fastfetch-logo.jpg
Normal file
BIN
.config/posix-common/fastfetch-logo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
23
.config/posix-common/functions.d/bookmarks.sh
Normal file
23
.config/posix-common/functions.d/bookmarks.sh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# ~/.config/posix-common/functions.d/common_functions.sh
|
||||
LOCATION="posix-common/functions.d/bookmarks.sh"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Buku Stuff ===
|
||||
_mordu "Creating buku bookmark functions."
|
||||
|
||||
|
||||
alias b='buku --suggest'
|
||||
|
||||
b-taglist() {
|
||||
buku --np -t | awk 'gsub( /\(|\)$/, "" ) { $1 = $NF; $NF = ""; print }'
|
||||
}
|
||||
# }}} === Buku Stuff ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
53
.config/posix-common/functions.d/common_functions.sh
Normal file
53
.config/posix-common/functions.d/common_functions.sh
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# ~/.config/posix-common/functions.d/common_functions.sh
|
||||
LOCATION="posix-common/functions.d/common_functions.sh"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Func: 'fixperms' ===
|
||||
# Recursively set DIRS to 755, and FILES to 644.
|
||||
# Function to help me quickly set the perms on both files
|
||||
# and directories in a home directory. Also helps sanitize shit I grab
|
||||
# off of USB's or NTFS drives.
|
||||
_mordu "Creating fixperms function."
|
||||
fixperms() {
|
||||
find "$@" -type d -exec chmod 755 {} \;
|
||||
find "$@" -type f -exec chmod 644 {} \;
|
||||
}
|
||||
# }}} === Func: 'fixperms' ===
|
||||
|
||||
# {{{ === Func: 'rands' ===
|
||||
# 'rands' stands for "Random String". It generates a
|
||||
# short 12 character random string. I use it to help name bulk-name
|
||||
# files like pictures and such.
|
||||
_mordu "Creating rands function."
|
||||
rands() {
|
||||
LENGTH=12
|
||||
tr -dc A-Za-z0-9 </dev/urandom | head -c $LENGTH
|
||||
}
|
||||
# }}} === Func: 'rands' ===
|
||||
|
||||
# {{{ 'macgen' : Generate a random valid MAC addy.
|
||||
macgen() {
|
||||
echo 00-60-2f$(od -txC -An -N3 /dev/random|tr \ -)
|
||||
}
|
||||
# }}} 'macgen' : Generate a random valid MAC addy.
|
||||
|
||||
# {{{ === Func: 'ansp' Ansible Playbook ===
|
||||
_mordu "Creating 'ansp' function."
|
||||
ansp () {
|
||||
ansible-playbook $1 --extra-vars "targets=$2"
|
||||
}
|
||||
# }}}=== Func: 'ansp' Ansible Playbook ===
|
||||
|
||||
# {{{ SSH Tunnel Manager
|
||||
sshtm() {
|
||||
ssh-tunnel-manager.sh --config ~/.config/ssh-tunnel-manager/ssh-tunnel-manager.conf $*
|
||||
}
|
||||
# }}} SSH Tunnel Manager
|
||||
_mordu "Finished processing $LOCATION."
|
||||
78
.config/posix-common/interactive.sh
Normal file
78
.config/posix-common/interactive.sh
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
# ~/.config/posix-common/interactive.sh
|
||||
LOCATION="posix-common/interactive.sh"
|
||||
|
||||
# Anything we might expect to want or need in an interactive shell should be added from here somehow.
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Source all Functions ===
|
||||
_mordu "Sourcing Functions from ~/.config/posix-common/functions.d/*."
|
||||
for functions_file in "$HOME"/.config/posix-common/functions.d/*.sh; do
|
||||
# shellcheck source=/dev/null
|
||||
LOCATION="posix-common/functions.d/$functions_file"
|
||||
. "$functions_file"
|
||||
done
|
||||
unset -v functions_file
|
||||
LOCATION="posix-common/interactive.sh"
|
||||
_mordu "Finished sourcing Functions from ~/.config/posix-common/functions.d/*."
|
||||
# }}} === Source all Functions ===
|
||||
|
||||
# {{{ === Source all Aliases ===
|
||||
_mordu "Sourcing Aliases from ~/.config/posix-common/aliases.d/*."
|
||||
for alias_file in "$HOME"/.config/posix-common/aliases.d/*.sh; do
|
||||
# shellcheck source=/dev/null
|
||||
_mordu "Sourcing $alias_file."
|
||||
LOCATION="posix-common/aliases.d/$alias_file"
|
||||
. "$alias_file"
|
||||
done
|
||||
unset -v alias_file
|
||||
LOCATION="posix-common/interactive.sh"
|
||||
_mordu "Finished sourcing Aliases from ~/.config/posix-common/aliases.d/*."
|
||||
# }}} === Source all Aliases ===
|
||||
|
||||
# {{{ === LS_COLORS ===
|
||||
# Sauce: https://github.com/trapd00r/LS_COLORS
|
||||
_mordu "Sourcing LS_COLORS from ~/.config/posix-common/lscolors.sh"
|
||||
. "$HOME"/.config/posix-common/lscolors.sh
|
||||
_mordu "Finished sourcing LS_COLORS from ~/.config/posix-common/lscolors.sh"
|
||||
# }}} === LS_COLORS ===
|
||||
|
||||
# {{{ === Configure 'thefuck' as 'uwu'. ===
|
||||
# Pretty awesome little tool.
|
||||
if [ ! "$0" = "sh" ] ; then
|
||||
if command -v thefuck >/dev/null ; then
|
||||
eval "$(thefuck --alias uwu)"
|
||||
fi
|
||||
fi
|
||||
# }}} === Configure 'thefuck' as 'uwu'. ===
|
||||
|
||||
# {{{ === Garbage Collection ===
|
||||
# Last minute homedir cleanup. Just to present the user (me) with
|
||||
# as 'clean' a working environment, let's check for some commonly
|
||||
# left over files in HOME that shouldn't be there, and delete
|
||||
# them. Files like shell_history files that were not removed yet.
|
||||
|
||||
# Remove any stale .bash_history files still sitting around the homedir.
|
||||
if [ -f "$HOME"/.bash_history ] ; then
|
||||
_mordu "Deleting stale ~/.bash_history."
|
||||
rm "$HOME"/.bash_history
|
||||
fi
|
||||
# }}} === Garbage Collection ===
|
||||
|
||||
# {{{ === Post Login Fun i.e. Fortune ===
|
||||
# Post-login fun. Right now just fortune, but would like other. Disabled temporarily.
|
||||
#if command -v fortune > /dev/null ; then
|
||||
# fortune ~/.local/share/fortunes/lotr
|
||||
#fi
|
||||
#fastfetch --logo-type kitty --kitty ~/.config/posix-common/fastfetch-logo.jpg --logo-height 17 --logo-padding-left 3 --logo-padding-right 1 -s Title:Separator:OS:Kernel:Packages:Processes:CPU:GPU:Memory:LocalIP:Shell:Uptime:Player:Media:Theme:Font
|
||||
|
||||
fortune ~/.local/share/fortunes/lotr | lolcat
|
||||
# }}} === Post Login Fun i.e. Fortune ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
36
.config/posix-common/login.sh
Normal file
36
.config/posix-common/login.sh
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# ~/.config/posix-common/login.sh
|
||||
LOCATION="posix-common/login.sh"
|
||||
|
||||
# Environment variables that don't need to be set for every terminal you open,
|
||||
# put here. These envrionment variables get set once upon login and that's it.
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Personal Information ===
|
||||
_mordu "Setting PIM data."
|
||||
NAME='Lord_Devi'
|
||||
EMAIL='lord@mgk.one'
|
||||
export NAME EMAIL
|
||||
# }}} === Personal Information ===
|
||||
|
||||
# {{{ === Localizations ===
|
||||
_mordu "Setting localization environment variables."
|
||||
LANG='en_US.UTF-8'
|
||||
LC_ALL=$LANG
|
||||
LC_COLLATE=$LANG
|
||||
LC_CTYPE=$LANG
|
||||
LC_MESSAGES=$LANG
|
||||
LC_MONETARY=$LANG
|
||||
LC_NUMERIC=$LANG
|
||||
LC_TIME=$LANG
|
||||
export LANG LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC \
|
||||
LC_TIME
|
||||
# }}} === Localizations ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
17
.config/posix-common/logout.sh
Normal file
17
.config/posix-common/logout.sh
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# ~/.config/posix-common/logout.sh
|
||||
LOCATION="posix-common/logout.sh"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Clear Screen on Logout ===
|
||||
# When leaving the console, clear the screen to increase privacy
|
||||
clear
|
||||
# }}} === Clear Screen on Logout ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
2
.config/posix-common/lscolors.sh
Executable file
2
.config/posix-common/lscolors.sh
Executable file
File diff suppressed because one or more lines are too long
31
.config/posix-common/profile.sh
Normal file
31
.config/posix-common/profile.sh
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# ~/.config/posix-common/profile.sh
|
||||
LOCATION="posix-common/profile.sh"
|
||||
|
||||
# Sourced by 'sh', or bash in 'sh' compatability mode.
|
||||
# WARNING: if you delete .bash_profile, this file becomes part of bash's startup
|
||||
# sequence, which means this file suddenly has to cater for two different
|
||||
# shells.
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
function _mordu {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Source env.sh ===
|
||||
_mordu "Sourcing Env Vars from ~/.config/sh/env.sh."
|
||||
. "$HOME"/.config/sh/env.sh
|
||||
LOCATION="posix-common/profile.sh"
|
||||
_mordu "Finished sourcing Env Vars from ~/.config/sh/env.sh."
|
||||
# }}} === Source env.sh ===
|
||||
|
||||
# {{{ === Source login.sh ===
|
||||
_mordu "Sourcing Login Shell settings from ~/.config/sh/login.sh."
|
||||
. "$HOME"/.config/sh/login.sh
|
||||
LOCATION="posix-common/profile.sh"
|
||||
_mordu "Finished sourcing Login Shell settings from ~/.config/sh/login.sh."
|
||||
# }}} === Source login.sh ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
19
.config/readline/inputrc
Normal file
19
.config/readline/inputrc
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Vi mode for all the readline apps.
|
||||
$include /etc/inputrc
|
||||
|
||||
TAB:complete
|
||||
set editing-mode vi
|
||||
|
||||
"\C-p":history-search-backward
|
||||
"\C-n":history-search-forward
|
||||
|
||||
set bell-style none
|
||||
set colored-stats On
|
||||
set completion-ignore-case On
|
||||
set completion-prefix-display-length 3
|
||||
set disable-completion Off
|
||||
set mark-symlinked-directories On
|
||||
set show-all-if-ambiguous On
|
||||
set show-all-if-unmodified On
|
||||
set visible-stats On
|
||||
|
||||
22
.config/sh/env.sh
Normal file
22
.config/sh/env.sh
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# ~/.config/sh/env.sh
|
||||
LOCATION="sh/env.sh"
|
||||
|
||||
# WARNING: this will not be run for non-login, non-env.shells.
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Source Posix Common env.sh ===
|
||||
_mordu "Sourcing Env Vars from ~/.config/posix-common/env.sh."
|
||||
# Run ~/.config/posix-common/env.sh, to get $ENV.
|
||||
. "$HOME"/.config/posix-common/env.sh
|
||||
LOCATION="sh/env.sh"
|
||||
_mordu "Finished sourcing Env Vars from ~/.config/posix-common/env.sh."
|
||||
# }}} === Source Posix Common env.sh ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
65
.config/sh/interactive.sh
Normal file
65
.config/sh/interactive.sh
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
# ~/.config/sh/interactive.sh
|
||||
LOCATION="sh/interactive.sh"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Source Posix Common interactive.sh ===
|
||||
_mordu "Sourcing Interactive Shell settings from ~/.config/posix-common/interactive.sh."
|
||||
. "$HOME"/.config/posix-common/interactive.sh
|
||||
LOCATION="sh/interactive.sh"
|
||||
_mordu "Finished sourcing Interactive Shell settings from ~/.config/posix-common/interactive.sh."
|
||||
# }}} === Source Posix Common interactive.sh ===
|
||||
|
||||
# {{{ === FreeBSD Tweaks ===
|
||||
# Some FreeBSD related sh(1) nicities.
|
||||
# Let sh(1) know it's at home, despite /home being a symlink.
|
||||
# shellcheck disable=SC3000-SC4000
|
||||
if [ "$PWD" != "$HOME" ] && [ "$PWD" -ef "$HOME" ] ; then cd || exit ; fi
|
||||
|
||||
# Query terminal size; useful for serial lines.
|
||||
if [ -x /usr/bin/resizewin ] ; then /usr/bin/resizewin -z ; fi
|
||||
# }}} === FreeBSD Tweaks ===
|
||||
|
||||
# {{{ === Configure the HISTFILE for sh ===
|
||||
# Set HISTFILE. Normally I put this in env.sh or similar, but
|
||||
# ~/.config/sh/env.sh doesn't get called by interactive sh shells,
|
||||
# and I want it to be.
|
||||
_mordu "Setting HISTFILE to avoid homedir spam."
|
||||
if [ -d "$HOME"/.local/share/sh/ ] ; then
|
||||
_mordu "$HOME/.local/share/sh/ not found. Creating."
|
||||
mkdir -p "$HOME"/.local/share/sh
|
||||
fi
|
||||
HISTFILE="$HOME/.local/share/sh/$(echo "$HOST"|sed 's/\./_/g')_sh_history"
|
||||
export HISTFILE
|
||||
# }}} === Configure the HISTFILE for sh ===
|
||||
|
||||
# {{{ === Sourcing prompt.sh ===
|
||||
_mordu "Sourcing sh prompt from ~/.config/sh/prompt.sh."
|
||||
. "$HOME"/.config/sh/prompt.sh
|
||||
LOCATION="sh/interactive.sh"
|
||||
_mordu "Finished sourcing sh prompt from ~/.config/sh/prompt.sh."
|
||||
# }}} === Sourcing prompt.sh ===
|
||||
|
||||
# {{{ === Enable vi mode for 'sh' ===
|
||||
# This had a surprise for me when bash's sh emulation mode is
|
||||
# being used for 'sh'. Bash (sh) disables TAB completion when set
|
||||
# to vi mode. So we have to rebind completion to TAB. But 'bind'
|
||||
# is not available on Ksh, which also uses our 'sh' scripts for
|
||||
# this level of init. So we need to have a conditional testing
|
||||
# for bind first. Then if it is available, we can go ahead and
|
||||
# tell it to ensure TAB is properly calling the completion
|
||||
# framework for bash.
|
||||
# Update: Can't actually get 'bind TAB:complete" to work! It works
|
||||
# fine in a live shell, but when that same shell calls this from an
|
||||
# init script: no go.
|
||||
_mordu "Enabling Vi mode for command line."
|
||||
set -o vi
|
||||
# }}} === Enable vi mode for 'sh' ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
19
.config/sh/login.sh
Normal file
19
.config/sh/login.sh
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# ~/.config/sh/login.sh
|
||||
LOCATION="sh/login.sh"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Sourcing Posix Common login.sh ===
|
||||
_mordu "Sourcing Login Shell settings from ~/.config/posix-common/login.sh."
|
||||
. "$HOME"/.config/posix-common/login.sh
|
||||
LOCATION="sh/login.sh"
|
||||
_mordu "Finished sourcing Login Shell settings from ~/.config/posix-common/login.sh."
|
||||
# }}} === Sourcing Posix Common login.sh ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
28
.config/sh/prompt.sh
Normal file
28
.config/sh/prompt.sh
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# ~/.config/sh/prompt.sh
|
||||
LOCATION="sh/prompt.sh"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
_mordu() {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Setup Starship as Prompt (with fallback) ===
|
||||
if command -v starship >/dev/null ; then
|
||||
_mordu "Starship found. Setting as shell prompt."
|
||||
STATUS=$?
|
||||
NUM_JOBS=$(jobs -p | wc -l)
|
||||
PS1="$(starship prompt --status="$STATUS" --jobs="$NUM_JOBS")"
|
||||
else
|
||||
_mordu "Starship not found. Falling back to plain prompt."
|
||||
# Basic plain prompt.
|
||||
HOST=$(uname -n)
|
||||
export HOST
|
||||
PS1='[$USER@$HOST:$PWD]\n(sh) $ '
|
||||
export PS1
|
||||
fi
|
||||
# }}} === Setup Starship as Prompt (with fallback) ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
4
.config/zsh/.zcompcache/RPMs
Normal file
4
.config/zsh/.zcompcache/RPMs
Normal file
File diff suppressed because one or more lines are too long
4
.config/zsh/.zcompcache/SYS_ALL_UNITS--system
Normal file
4
.config/zsh/.zcompcache/SYS_ALL_UNITS--system
Normal file
File diff suppressed because one or more lines are too long
4
.config/zsh/.zcompcache/SYS_ALL_UNITS--user
Normal file
4
.config/zsh/.zcompcache/SYS_ALL_UNITS--user
Normal file
File diff suppressed because one or more lines are too long
4
.config/zsh/.zcompcache/SYS_REALLY_ALL_UNITS--system
Normal file
4
.config/zsh/.zcompcache/SYS_REALLY_ALL_UNITS--system
Normal file
File diff suppressed because one or more lines are too long
4
.config/zsh/.zcompcache/SYS_REALLY_ALL_UNITS--user
Normal file
4
.config/zsh/.zcompcache/SYS_REALLY_ALL_UNITS--user
Normal file
File diff suppressed because one or more lines are too long
4
.config/zsh/.zcompcache/VAGRANT_VMS
Normal file
4
.config/zsh/.zcompcache/VAGRANT_VMS
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
_vagrant_vms=( ${(Q)"${(z)$(<<\EO:_vagrant_vms
|
||||
'default' 'The'
|
||||
EO:_vagrant_vms
|
||||
)}"} )
|
||||
4
.config/zsh/.zcompcache/dnf-groups
Normal file
4
.config/zsh/.zcompcache/dnf-groups
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
package_groups=( ${(Q)"${(z)$(<<\EO:package_groups
|
||||
'custom-environment' 'minimal-environment' 'workstation-product-environment' 'cloud-server-environment' 'kde-desktop-environment' 'xfce-desktop-environment' 'phosh-desktop-environment' 'lxde-desktop-environment' 'lxqt-desktop-environment' 'cinnamon-desktop-environment' 'mate-desktop-environment' 'sugar-desktop-environment' 'deepin-desktop-environment' 'budgie-desktop-environment' 'developer-workstation-environment' 'web-server-environment' 'infrastructure-server-environment' 'basic-desktop-environment' 'i3-desktop-environment' 'sway-desktop-environment' 'server-product-environment' 'container-management' 'development-tools' 'headless-management' 'libreoffice' 'rpm-development-tools' 'security-lab' 'text-internet' 'vlc' 'hardware-support' 'system-tools' '3d-printing' 'admin-tools' 'audio' 'authoring-and-publishing' 'budgie-desktop' 'budgie-desktop-apps' 'c-development' 'cloud-infrastructure' 'cloud-management' 'compiz' 'd-development' 'design-suite' 'desktop-accessibility' 'domain-client' 'editors' 'education' 'electronic-lab' 'engineering-and-scientific' 'freeipa-server' 'kf6-software-development' 'mate-applications' 'milkymist' 'network-server' 'neuron-modelling-simulators' 'office' 'python-classroom' 'python-science' 'robotics-suite' 'supplemental packages) (swaywm-extended' 'window-managers' 'gnome-desktop' 'graphical-internet' 'K Desktop Environment) (kde-desktop' 'fonts' 'games' 'sound-and-video'
|
||||
EO:package_groups
|
||||
)}"} )
|
||||
2158
.config/zsh/.zcompdump
Normal file
2158
.config/zsh/.zcompdump
Normal file
File diff suppressed because it is too large
Load diff
28
.config/zsh/.zlogout
Normal file
28
.config/zsh/.zlogout
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# ~/.config/zsh/logout.zsh
|
||||
LOCATION="zsh/logout.zsh"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
function _mordu {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_n {
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_nl {
|
||||
[ "$DEBUG" ] && echo "$*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Source Posix Common logout.sh ===
|
||||
_mordu "Sourcing logout actions from ~/.config/posix-common/logout.sh."
|
||||
source "$HOME"/.config/posix-common/logout.sh
|
||||
LOCATION="zsh/logout.zsh"
|
||||
_mordu "Completed sourcing ~/.config/posix-common/logout.sh."
|
||||
}
|
||||
# }}} === Source Posix Common logout.sh ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
65
.config/zsh/.zshenv
Normal file
65
.config/zsh/.zshenv
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
# ~/.config/zsh/env.zsh
|
||||
LOCATION="zsh/env.zsh"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to enable DEBUGing.
|
||||
function _mordu {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_n {
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_nl {
|
||||
[ "$DEBUG" ] && echo "$*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Source Posix Common env.sh ===
|
||||
_mordu "Sourcing Env Vars from ~/.config/posix-common/env.sh."
|
||||
source "$HOME"/.config/posix-common/env.sh
|
||||
LOCATION="zsh/env.zsh"
|
||||
_mordu "Completed sourcing environment variables from ~/.config/posix-common/env.sh."
|
||||
# }}} === Source Posix Common env.sh ===
|
||||
|
||||
# {{{ === Configure initial ZSH specific settings. ===
|
||||
_mordu "Configuring initial ZSH specific settings needed for the rest of the shell setup."
|
||||
# Set ZDOTDIR to allow us to move zsh init files into XDG config.
|
||||
ZDOTDIR="$HOME/.config/zsh"
|
||||
export ZDOTDIR
|
||||
|
||||
# Create a functions directory in ~/.config/zsh/functions.
|
||||
#typeset -U FPATH fpath
|
||||
#if [ -d "$HOME/.config/zsh/functions" ] ; then
|
||||
# _mordu "Could not find ~/.config/zsh/functions. Creating."
|
||||
# mkdir -p ~/.config/zsh/functions
|
||||
#fi
|
||||
#_mordu "Setting fpath."
|
||||
#fpath=("$HOME/.config/zsh/functions" "$fpath")
|
||||
#export FPATH
|
||||
# }}} === Configure initial ZSH specific settings. ===
|
||||
|
||||
# {{{ === ZSH History settings. ===
|
||||
_mordu "Configuring ZSH command history settings."
|
||||
if [ ! -d "$HOME/.local/share/zsh/" ] ; then
|
||||
_mordu "Could not find ~/.local/share/zsh. Creating it Master."
|
||||
mkdir -p "$HOME"/.local/share/zsh
|
||||
fi
|
||||
|
||||
# Set location with hostname prepended.
|
||||
export HISTFILE="$HOME/.local/share/zsh/${HOST//\./_}_zsh_history"
|
||||
|
||||
# Without SAVEHIST zsh won't work.
|
||||
export SAVEHIST=10000
|
||||
export HISTSIZE=10000
|
||||
|
||||
setopt hist_ignore_all_dups # Don't add duplicate commands to histfile.
|
||||
setopt hist_find_no_dups # Don't recall dupes either.
|
||||
# (Shouldn't be needed but set anyway.)
|
||||
setopt append_history # Append to the history as we go. Not just on logout.
|
||||
setopt share_history # Share appended history with other terminals.
|
||||
# }}} === ZSH History settings. ===
|
||||
|
||||
_mordu "Finished processing $LOCATION"
|
||||
242
.config/zsh/.zshrc
Normal file
242
.config/zsh/.zshrc
Normal file
|
|
@ -0,0 +1,242 @@
|
|||
# ~/.config/zsh/interactive.zsh
|
||||
LOCATION=".config/zsh/interactive.zsh"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
function _mordu {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_n {
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_nl {
|
||||
[ "$DEBUG" ] && echo "$*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Source Posix Common interactive.sh ===
|
||||
_mordu "Sourcing interactive shell settings from ~/.config/posix-common/interactive.sh."
|
||||
source "$HOME"/.config/posix-common/interactive.sh
|
||||
LOCATION="zsh/interactive.zsh"
|
||||
_mordu "Completed sourcing interactive shell settings from ~/.config/posix-common/interactive.sh."
|
||||
# }}} === Source Posix Common interactive.sh ===
|
||||
|
||||
# {{{ === Zinit Bootstrap ===
|
||||
_mordu "Performing ZINIT bootstrap."
|
||||
ZINIT_HOME="$HOME/.local/share/zinit/zinit.git"
|
||||
if [ ! -d $ZINIT_HOME ]; then
|
||||
mkdir -p "$(dirname $ZINIT_HOME)"
|
||||
fi
|
||||
if [ ! -d $ZINIT_HOME/.git ]; then
|
||||
ghq get git.mgk.one/zsh/zdharma-continuum.zinit.git
|
||||
fi
|
||||
|
||||
source "${ZINIT_HOME}/zinit.zsh"
|
||||
|
||||
|
||||
_mordu "Enabling Turbo mode for Zinit."
|
||||
MY_ZINIT_USE_TURBO=true
|
||||
|
||||
# Create an type of alias for loading modules more easily.
|
||||
_icemgk () {zinit ice from"git.mgk.one" proto"https" $*}
|
||||
|
||||
# Shortcut for plugin locations
|
||||
ZPLUGS="$HOME/.local/opt/git/git.mgk.one/zsh"
|
||||
# Use mgkload to switch between 'load' and 'light' if desired.
|
||||
mgkload=light
|
||||
|
||||
_mordu "Enabling important annexes."
|
||||
_icemgk
|
||||
zinit $mgkload "$ZPLUGS"/zdharma-continuum.zinit-annex-meta-plugins
|
||||
|
||||
# Example sourcing locally instead:
|
||||
#zinit depth=1 lucid light-mode for \
|
||||
# ~/.local/git/zinit-annex-as-monitor
|
||||
|
||||
_icemgk
|
||||
zinit $mgkload "$ZPLUGS"/zdharma-continuum.zinit-annex-bin-gem-node
|
||||
|
||||
_icemgk
|
||||
zinit $mgkload "$ZPLUGS"/zdharma-continuum.zinit-annex-patch-dl
|
||||
|
||||
_icemgk
|
||||
zinit $mgkload "$ZPLUGS"/zdharma-continuum.zinit-annex-rust
|
||||
_mordu "Important annexes loaded."
|
||||
# }}} End Zinit Bootstrap
|
||||
|
||||
# {{{ === Prompt setup. ===
|
||||
#_mordu "Sourcing Zsh prompt from ~/.config/zsh/prompt.zsh."
|
||||
#source "$HOME"/.config/zsh/prompt.zsh
|
||||
#LOCATION="zsh/interactive.zsh"
|
||||
#_mordu "Finished sourcing Zsh prompt from ~/.config/zsh/prompt.zsh."
|
||||
|
||||
_mordu "Setting prompt to powerlevel10k."
|
||||
_icemgk
|
||||
zinit $mgkload "$ZPLUGS"/romkatv.powerlevel10k
|
||||
. "$HOME"/.config/zsh/prompt.zsh
|
||||
|
||||
# }}} === Prompt setup. ===
|
||||
|
||||
# {{{ === VI mode for zsh. ===
|
||||
_mordu "Enabling vi mode for Zsh."
|
||||
bindkey -v # First enable vi mode for zsh.
|
||||
KEYTIMEOUT=1 # Next reduce the delay zsh has between mode switches.
|
||||
bindkey "^?" backward-delete-char # Tame the backspace key in insert mode.
|
||||
export KEYTIMEOUT
|
||||
# }}} === VI mode for zsh. ===
|
||||
|
||||
# {{{ === Misc Shell Settings. ===
|
||||
_mordu "Configuring misc shell settings such as beeps and notifies."
|
||||
# Disable beeps
|
||||
unsetopt beep
|
||||
|
||||
# Report status of background jobs instantly.
|
||||
setopt notify
|
||||
# }}} === Misc Shell Settings. ===
|
||||
|
||||
# {{{1 === Completions ===
|
||||
|
||||
# {{{2 == Load zsh-completions & compinit ==
|
||||
_mordu "Configuring completion framework."
|
||||
_icemgk atload"zicompinit; zicdreplay" blockf lucid wait
|
||||
zinit $mgkload "$ZPLUGS"/zsh-users.zsh-completions
|
||||
# }}} == Load zsh-completions & compinit ==
|
||||
|
||||
# {{{2 === Set Misc Completion Options ==
|
||||
# cd to directory by typing its name.
|
||||
setopt autocd
|
||||
|
||||
# Enhanced wildcards.
|
||||
setopt extendedglob
|
||||
|
||||
# Print an error when filename completion fails.
|
||||
setopt nomatch
|
||||
|
||||
# Enable completions cache.
|
||||
zstyle ':completion::complete:*' use-cache 1
|
||||
|
||||
# Complete using aliases as well as executables.
|
||||
setopt complete_aliases
|
||||
# }}} == Set Misc Completion Options ==
|
||||
|
||||
# {{{2 == Fish Style Completion ==
|
||||
# Each 'string in quotes' is tried in order until one them succeeds.
|
||||
# r:|[.]=** does .bar -> foo.bar
|
||||
# r:?|[-_]=** does f-b -> foo-bar and F_B -> FOO_BAR
|
||||
# l:?|=[-_] does foobar -> foo-bar and FOOBAR -> FOO_BAR
|
||||
# m:{[:lower:]-}={[:upper:]_} does foo-bar -> FOO_BAR
|
||||
# r:|?=** does fbr -> foo-bar and bar -> foo-bar
|
||||
|
||||
# The below was my last current preference for fuzzy matching.
|
||||
zstyle ':completion:*:complete:*' matcher-list \
|
||||
'r:|[.]=** r:?|[-_]=** l:?|=[-_] m:{[:lower:]-}={[:upper:]_}' \
|
||||
'r:|?=** m:{[:lower:]}={[:upper:]}'
|
||||
# }}} == Fish Style Completion ==
|
||||
|
||||
# {{{2 == FZF Completion Settings ==
|
||||
_mordu "Setting up fzf-tab for enhanced fuzzy searching with a tui."
|
||||
_icemgk lucid wait
|
||||
zinit $mgkload "$ZPLUGS"/aloxaf.fzf-tab
|
||||
|
||||
# disable sort when completing `git checkout`
|
||||
zstyle ':completion:*:git-checkout:*' sort false
|
||||
|
||||
# set descriptions format to enable group support
|
||||
zstyle ':completion:*:descriptions' format '[%d]'
|
||||
|
||||
# set list-colors to enable filename colorizing
|
||||
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||
|
||||
## Display group descriptions as headers.
|
||||
zstyle ':fzf-tab:*' show-group full
|
||||
|
||||
## preview directory's content with exa when completing cd BROKEN
|
||||
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'lsd -1 --color=always --icon=always $realpath'
|
||||
zstyle ':fzf-tab:complete:cd:*' popup-pad 90 0
|
||||
|
||||
# switch group using `,` and `.`
|
||||
zstyle ':fzf-tab:*' switch-group ',' '.'
|
||||
|
||||
# Add some handy keybindings
|
||||
zstyle ':fzf-tab:*' fzf-bindings 'ctrl-s:toggle' 'ctrl-a:toggle-all'
|
||||
|
||||
# give a preview of commandline arguments when completing `kill`
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
|
||||
zstyle ':fzf-tab:complete:(kill|ps):argument-rest' fzf-preview \
|
||||
'[[ $group == "[process ID]" ]] && ps --pid=$word -o cmd --no-headers -w -w'
|
||||
zstyle ':fzf-tab:complete:(kill|ps):argument-rest' fzf-flags --preview-window=down:3:wrap
|
||||
|
||||
# Systemd unit status preview.
|
||||
zstyle ':fzf-tab:complete:systemctl-*:*' fzf-preview 'SYSTEMD_COLORS=1 systemctl status $word'
|
||||
|
||||
# Enable cat preview using lessfilter TODO Too small
|
||||
# BUG: This is creating an annoying preview box in command previews.
|
||||
zstyle ':fzf-tab:complete:*:*' fzf-preview 'less ${(Q)realpath}'
|
||||
|
||||
# Enable previews for environment variables.
|
||||
zstyle ':fzf-tab:complete:(-command-|-parameter-|-brace-parameter-|export|unset|expand):*' \
|
||||
fzf-preview 'echo ${(P)word}'
|
||||
|
||||
# Enable previews for git.
|
||||
# it is an example. you can change it
|
||||
zstyle ':fzf-tab:complete:git-(add|diff|restore):*' fzf-preview \
|
||||
'git diff $word | delta'
|
||||
zstyle ':fzf-tab:complete:git-log:*' fzf-preview \
|
||||
'git log --color=always $word'
|
||||
zstyle ':fzf-tab:complete:git-help:*' fzf-preview \
|
||||
'git help $word | bat -plman --color=always'
|
||||
zstyle ':fzf-tab:complete:git-show:*' fzf-preview \
|
||||
'case "$group" in
|
||||
"commit tag") git show --color=always $word ;;
|
||||
*) git show --color=always $word | delta ;;
|
||||
esac'
|
||||
zstyle ':fzf-tab:complete:git-checkout:*' fzf-preview \
|
||||
'case "$group" in
|
||||
"modified file") git diff $word | delta ;;
|
||||
"recent commit object name") git show --color=always $word | delta ;;
|
||||
*) git log --color=always $word ;;
|
||||
esac'
|
||||
|
||||
# Preview for tldr
|
||||
zstyle ':fzf-tab:complete:tldr:argument-1' fzf-preview 'tldr --color always $word'
|
||||
|
||||
zstyle ':fzf-tab:complete:-command-:*' fzf-preview \
|
||||
\u00a6 '(out=$(tldr --color always "$word") 2>/dev/null && echo $out) || (out=$(MANWIDTH=$FZF_PREVIEW_COLUMNS man "$word") 2>/dev/null && echo $out) || (out=$(which "$word") && echo $out) || echo "${(P)word}"'
|
||||
|
||||
# }}} == FZF Completion Settings ==
|
||||
|
||||
# }}} === Completions ===
|
||||
|
||||
# {{{ === Zsh Autosuggestions ===
|
||||
_mordu "Configuring autosuggestions."
|
||||
_icemgk lucid wait
|
||||
zinit $mgkload "$ZPLUGS"/zsh-users.zsh-autosuggestions
|
||||
|
||||
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||
# }}} End Zsh Autosuggestions
|
||||
|
||||
# {{{ === Fast Syntax Highlighting ===
|
||||
_mordu "Configuring syntax highlighting."
|
||||
_icemgk lucid wait
|
||||
zinit $mgkload "$ZPLUGS"/zdharma-continuum.fast-syntax-highlighting
|
||||
# }}} End Fast Syntax Highlighting
|
||||
|
||||
# {{{ === Command History Searching ===
|
||||
_mordu "Configuring command history recall."
|
||||
_icemgk lucid wait
|
||||
#zinit $mgkload git/pub/by-name/history-search-multi-word.git
|
||||
zinit $mgkload "$ZPLUGS"/joshskidmore.zsh-fzf-history-search
|
||||
# }}}=== Command History Searching ===
|
||||
|
||||
# {{{ === Source conf.d/ Config Scripts ===
|
||||
_mordu "Loading configs from ~/.config/zsh/conf.d/*."
|
||||
for config in "$HOME"/.config/zsh/conf.d/* ; do
|
||||
_mordu "Sourcing $config."
|
||||
source $config
|
||||
done
|
||||
# }}} === Source conf.d/ Config Scripts ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
129
.config/zsh/conf.d/zoxide.zsh
Normal file
129
.config/zsh/conf.d/zoxide.zsh
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
# =============================================================================
|
||||
#
|
||||
# Utility functions for zoxide.
|
||||
#
|
||||
|
||||
# pwd based on the value of _ZO_RESOLVE_SYMLINKS.
|
||||
function __zoxide_pwd() {
|
||||
\builtin pwd -L
|
||||
}
|
||||
|
||||
# cd + custom logic based on the value of _ZO_ECHO.
|
||||
function __zoxide_cd() {
|
||||
# shellcheck disable=SC2164
|
||||
\builtin cd -- "$@"
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# Hook configuration for zoxide.
|
||||
#
|
||||
|
||||
# Hook to add new entries to the database.
|
||||
function __zoxide_hook() {
|
||||
# shellcheck disable=SC2312
|
||||
\command zoxide add -- "$(__zoxide_pwd)"
|
||||
}
|
||||
|
||||
# Initialize hook.
|
||||
# shellcheck disable=SC2154
|
||||
if [[ ${precmd_functions[(Ie)__zoxide_hook]:-} -eq 0 ]] && [[ ${chpwd_functions[(Ie)__zoxide_hook]:-} -eq 0 ]]; then
|
||||
chpwd_functions+=(__zoxide_hook)
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# When using zoxide with --no-cmd, alias these internal functions as desired.
|
||||
#
|
||||
|
||||
__zoxide_z_prefix='z#'
|
||||
|
||||
# Jump to a directory using only keywords.
|
||||
function __zoxide_z() {
|
||||
# shellcheck disable=SC2199
|
||||
if [[ "$#" -eq 0 ]]; then
|
||||
__zoxide_cd ~
|
||||
elif [[ "$#" -eq 1 ]] && [[ "$1" = '-' ]]; then
|
||||
if [[ -n "${OLDPWD}" ]]; then
|
||||
__zoxide_cd "${OLDPWD}"
|
||||
else
|
||||
# shellcheck disable=SC2016
|
||||
\builtin printf 'zoxide: $OLDPWD is not set'
|
||||
return 1
|
||||
fi
|
||||
elif [[ "$#" -eq 1 ]] && [[ -d "$1" ]]; then
|
||||
__zoxide_cd "$1"
|
||||
elif [[ "$@[-1]" == "${__zoxide_z_prefix}"* ]]; then
|
||||
# shellcheck disable=SC2124
|
||||
\builtin local result="${@[-1]}"
|
||||
__zoxide_cd "${result:${#__zoxide_z_prefix}}"
|
||||
else
|
||||
\builtin local result
|
||||
# shellcheck disable=SC2312
|
||||
result="$(\command zoxide query --exclude "$(__zoxide_pwd)" -- "$@")" &&
|
||||
__zoxide_cd "${result}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Jump to a directory using interactive search.
|
||||
function __zoxide_zi() {
|
||||
\builtin local result
|
||||
result="$(\command zoxide query -i -- "$@")" && __zoxide_cd "${result}"
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# Commands for zoxide. Disable these using --no-cmd.
|
||||
#
|
||||
|
||||
\builtin unalias z &>/dev/null || \builtin true
|
||||
function z() {
|
||||
__zoxide_z "$@"
|
||||
}
|
||||
|
||||
\builtin unalias zi &>/dev/null || \builtin true
|
||||
function zi() {
|
||||
__zoxide_zi "$@"
|
||||
}
|
||||
|
||||
if [[ -o zle ]]; then
|
||||
function __zoxide_z_complete() {
|
||||
# Only show completions when the cursor is at the end of the line.
|
||||
# shellcheck disable=SC2154
|
||||
[[ "${#words[@]}" -eq "${CURRENT}" ]] || return
|
||||
|
||||
if [[ "${#words[@]}" -eq 2 ]]; then
|
||||
_files -/
|
||||
elif [[ "${words[-1]}" == '' ]]; then
|
||||
\builtin local result
|
||||
# shellcheck disable=SC2086,SC2312
|
||||
if result="$(\command zoxide query --exclude "$(__zoxide_pwd)" -i -- ${words[2,-1]})"; then
|
||||
__zoxide_result="${result}"
|
||||
else
|
||||
__zoxide_result=''
|
||||
fi
|
||||
\builtin printf '\e[5n'
|
||||
fi
|
||||
}
|
||||
|
||||
function __zoxide_z_complete_helper() {
|
||||
\builtin local result="${__zoxide_z_prefix}${__zoxide_result}"
|
||||
# shellcheck disable=SC2296
|
||||
[[ -n "${__zoxide_result}" ]] && LBUFFER="${LBUFFER}${(q-)result}"
|
||||
\builtin zle reset-prompt
|
||||
}
|
||||
|
||||
\builtin zle -N __zoxide_z_complete_helper
|
||||
\builtin bindkey "\e[0n" __zoxide_z_complete_helper
|
||||
if [[ "${+functions[compdef]}" -ne 0 ]]; then
|
||||
\compdef -d z
|
||||
\compdef -d zi
|
||||
\compdef __zoxide_z_complete z
|
||||
fi
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# To initialize zoxide, add this to your configuration (usually ~/.zshrc):
|
||||
#
|
||||
# eval "$(zoxide init zsh)"
|
||||
1
.config/zsh/env.zsh
Symbolic link
1
.config/zsh/env.zsh
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
.zshenv
|
||||
1
.config/zsh/interactive.zsh
Symbolic link
1
.config/zsh/interactive.zsh
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
.zshrc
|
||||
1
.config/zsh/logout.zsh
Symbolic link
1
.config/zsh/logout.zsh
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
.zlogout
|
||||
1744
.config/zsh/prompt.zsh
Normal file
1744
.config/zsh/prompt.zsh
Normal file
File diff suppressed because it is too large
Load diff
48
.config/zsh/prompt.zsh.old
Normal file
48
.config/zsh/prompt.zsh.old
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# ~/.config/zsh/prompt.zsh
|
||||
LOCATION="zsh/prompt.zsh"
|
||||
|
||||
# {{{ === Script Debug Settings ===
|
||||
#DEBUG=y # Comment this out to disable DEBUGing.
|
||||
function _mordu {
|
||||
[ "$DEBUG" ] && echo ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_n {
|
||||
[ "$DEBUG" ] && echo -n ">>> Mordu@$LOCATION: $*"
|
||||
}
|
||||
|
||||
function _mordu_nl {
|
||||
[ "$DEBUG" ] && echo "$*"
|
||||
}
|
||||
_mordu "Beginning processing $LOCATION."
|
||||
# }}} === Script Debug Settings ===
|
||||
|
||||
# {{{ === Load Powerlevel10k Prompt. ===
|
||||
# Check if starship prompt is available and use it if it is.
|
||||
if command -v starship >/dev/null ; then
|
||||
# Starship prompt.
|
||||
_mordu "Starship found. Setting as shell prompt."
|
||||
eval "$(starship init zsh)"
|
||||
else
|
||||
# Plain prompt.
|
||||
_mordu "Starship not found. Falling back to plain prompt."
|
||||
precmd() { print -rP "[%n@%m:%/]" }
|
||||
PROMPT='(zsh) %# '
|
||||
fi
|
||||
# }}} === Load Powerlevel10k Prompt. ===
|
||||
|
||||
## {{{ === Load Starship Prompt. ===
|
||||
## Check if starship prompt is available and use it if it is.
|
||||
#if command -v starship >/dev/null ; then
|
||||
# # Starship prompt.
|
||||
# _mordu "Starship found. Setting as shell prompt."
|
||||
# eval "$(starship init zsh)"
|
||||
#else
|
||||
# # Plain prompt.
|
||||
# _mordu "Starship not found. Falling back to plain prompt."
|
||||
# precmd() { print -rP "[%n@%m:%/]" }
|
||||
# PROMPT='(zsh) %# '
|
||||
#fi
|
||||
# }}} === Load Starship Prompt. ===
|
||||
|
||||
_mordu "Finished processing $LOCATION."
|
||||
Loading…
Reference in a new issue