diff options
Diffstat (limited to '')
57 files changed, 792 insertions, 0 deletions
diff --git a/profile/.profile b/profile/.profile new file mode 100644 index 0000000..b05eafb --- /dev/null +++ b/profile/.profile @@ -0,0 +1,26 @@ +#!/bin/sh + +if [ "$(umask)" = "000" ] || [ "$(umask)" = "0000" ] +then + umask 0022 +fi + +if [ -f "/etc/profile.env" ] +then + # shellcheck disable=SC1091 + . "/etc/profile.env" +fi + +for i in /etc/profile.d/*.sh +do + # shellcheck disable=SC1090 + [ -r "$i" ] && . "$i" +done + +for i in "${HOME}"/.profile.d/*.sh +do + # shellcheck disable=SC1090 + [ -r "$i" ] && . "$i" +done + +export PROFILE_SOURCED="1" diff --git a/profile/.profile.d/00_lang.sh b/profile/.profile.d/00_lang.sh new file mode 100644 index 0000000..060c6c1 --- /dev/null +++ b/profile/.profile.d/00_lang.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +export LC_COLLATE=C +export LC_MESSAGES=C diff --git a/profile/.profile.d/10_xdg.sh b/profile/.profile.d/10_xdg.sh new file mode 100644 index 0000000..8a7cebe --- /dev/null +++ b/profile/.profile.d/10_xdg.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +_local="${HOME}/.local" + +export XDG_CACHE_HOME="${_local}/var/cache" +export XDG_CONFIG_HOME="${_local}/etc" +export XDG_DATA_HOME="${_local}/var/lib" +export XDG_DESKTOP_DIR="${HOME}/tmp" +export XDG_DOCUMENTS_DIR="${HOME}/doc" +export XDG_DOWNLOAD_DIR="${HOME}/tmp" +export XDG_MUSIC_DIR="${HOME}/music" +export XDG_PICTURES_DIR="${HOME}/tmp" +export XDG_PUBLICSHARE_DIR="${HOME}/tmp" +export XDG_RUNTIME_DIR="${_local}/var/run" +export XDG_TEMPLATES_DIR="${HOME}/tmp" +export XDG_VIDEOS_DIR="${HOME}/tmp" + +unset _local + +_xdg_dirs=" +${XDG_CACHE_HOME} +${XDG_CONFIG_HOME} +${XDG_DATA_HOME} +${XDG_DESKTOP_DIR} +${XDG_DOCUMENTS_DIR} +${XDG_DOWNLOAD_DIR} +${XDG_MUSIC_DIR} +${XDG_PICTURES_DIR} +${XDG_PUBLICSHARE_DIR} +${XDG_RUNTIME_DIR} +${XDG_TEMPLATES_DIR} +${XDG_VIDEOS_DIR} +" + +for _xdg_dir in ${_xdg_dirs}; do + [ ! -d "${_xdg_dir}" ] && mkdir -p "${_xdg_dir}" +done + +unset _xdg_dir _xdg_dirs diff --git a/profile/.profile.d/20_history.sh b/profile/.profile.d/20_history.sh new file mode 100644 index 0000000..b7f42bc --- /dev/null +++ b/profile/.profile.d/20_history.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +export HISTFILE="${XDG_DATA_HOME}/.histfile" +export HISTSIZE=100000 diff --git a/profile/.profile.d/30_manpath.sh b/profile/.profile.d/30_manpath.sh new file mode 100644 index 0000000..af4273e --- /dev/null +++ b/profile/.profile.d/30_manpath.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +manpath_append() { + [ ! -d "${1}" ] && return + echo "${MANPATH}" | grep -q "\(:\|^\)${1}\(:\|$\)" && return + export MANPATH="${MANPATH}:${1}" +} + +manpath_prepend() { + [ ! -d "${1}" ] && return + echo "${MANPATH}" | grep -q "\(:\|^\)${1}\(:\|$\)" && return + export MANPATH="${1}:${MANPATH}" +} + +manpath_prepend "/usr/share/man" +manpath_prepend "/usr/local/share/man" +manpath_prepend "${HOME}/.local/share/man" diff --git a/profile/.profile.d/30_path.sh b/profile/.profile.d/30_path.sh new file mode 100644 index 0000000..1469162 --- /dev/null +++ b/profile/.profile.d/30_path.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +export PATH="/sbin:/bin:/usr/sbin:/usr/bin" + +path_prepend() { + [ ! -d "${1}" ] && return + echo "${PATH}" | grep -q "\(:\|^\)${1}\(:\|$\)" && return + export PATH="${1}:${PATH}" +} + +path_append() { + [ ! -d "${1}" ] && return + echo "${PATH}" | grep -q "\(:\|^\)${1}\(:\|$\)" && return + export PATH="${PATH}:${1}" +} + +path_append "/usr/local/bin" +path_append "${HOME}/.bin" +path_append "${HOME}/.local/bin" diff --git a/profile/.profile.d/40_nix.sh b/profile/.profile.d/40_nix.sh new file mode 100644 index 0000000..ede32bf --- /dev/null +++ b/profile/.profile.d/40_nix.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +nix_sh="${HOME}/.nix-profile/etc/profile.d/nix.sh" + +if [ -e "${nix_sh}" ]; then + # shellcheck disable=SC1090 + . "${nix_sh}" + + export NIXPKGS_ALLOW_UNFREE="1" + + hm_session_vars="$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" + if [ -e "${hm_session_vars}" ]; then + # shellcheck disable=SC1090 + . "${hm_session_vars}" + fi + unset hm_session_vars +fi + +unset nix_sh diff --git a/profile/.profile.d/50_browser.sh b/profile/.profile.d/50_browser.sh new file mode 100644 index 0000000..0a15ba1 --- /dev/null +++ b/profile/.profile.d/50_browser.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +_browsers=" +qutebrowser +chromium +chromium-browser +firefox +lynx +w3m +elinks +links +" + +for _browser in ${_browsers}; do + # shellcheck disable=SC2139 + if command -v "${_browser}" >/dev/null 2>&1; then + export BROWSER="${_browser}" + + alias b="${BROWSER}" + if ! command -v br >/dev/null 2>&1; then + alias br="${BROWSER}" + fi + + break + fi +done + +unset _browser _browsers diff --git a/profile/.profile.d/50_diff.sh b/profile/.profile.d/50_diff.sh new file mode 100644 index 0000000..9253657 --- /dev/null +++ b/profile/.profile.d/50_diff.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +_diffs=" +colordiff +diff +" + +for _diff in ${_diffs}; do + # shellcheck disable=SC2139 + if command -v "${_diff}" >/dev/null 2>&1; then + export DIFF="${_diff}" + + alias d="${DIFF}" + if ! command -v di >/dev/null 2>&1; then + alias di="${DIFF}" + fi + + break + fi +done + +unset _diff _diffs diff --git a/profile/.profile.d/50_editor.sh b/profile/.profile.d/50_editor.sh new file mode 100644 index 0000000..b3203fb --- /dev/null +++ b/profile/.profile.d/50_editor.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +_editors=" +nvim +vim +vi +emacs +nano +ed +" + +for _editor in ${_editors}; do + # shellcheck disable=SC2139 + if command -v "${_editor}" >/dev/null 2>&1; then + export EDITOR="${_editor}" VISUAL="${_editor}" + + alias e="${EDITOR}" + if ! command -v ed >/dev/null 2>&1; then + alias ed="${EDITOR}" + fi + + break + fi +done + +unset _editor _editors diff --git a/profile/.profile.d/50_pager.sh b/profile/.profile.d/50_pager.sh new file mode 100644 index 0000000..4270919 --- /dev/null +++ b/profile/.profile.d/50_pager.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +_pagers=" +bat +less +more +cat +" + +for _pager in ${_pagers}; do + # shellcheck disable=SC2139 + if command -v "${_pager}" >/dev/null 2>&1; then + export PAGER="${_pager}" MANPAGER="${_pager}" + + alias p="${PAGER}" + if ! command -v pa >/dev/null 2>&1; then + alias pa="${PAGER}" + fi + + break + fi +done + +unset _pager _pagers diff --git a/profile/.profile.d/60_devtoolset.sh b/profile/.profile.d/60_devtoolset.sh new file mode 100644 index 0000000..fcc1816 --- /dev/null +++ b/profile/.profile.d/60_devtoolset.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if [ -f "/opt/rh/devtoolset-9/enable" ]; then + source scl_source enable "devtoolset-9" +fi diff --git a/profile/.profile.d/60_dotnet.sh b/profile/.profile.d/60_dotnet.sh new file mode 100644 index 0000000..5d4992b --- /dev/null +++ b/profile/.profile.d/60_dotnet.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +if command -v dotnet >/dev/null 2>&1; then + path_append "${HOME}/.dotnet/tools" + + export DOTNET_CLI_TELEMETRY_OPTOUT="1" + export DOTNET_SKIP_FIRST_TIME_EXPERIENCE="1" + + if command -v nuget >/dev/null 2>&1; then + export NUGET_CERT_REVOCATION_MODE="online" + export NUGET_PERSIST_DG="false" + export NUGET_RESTORE_MSBUILD_VERBOSITY="normal" + export NUGET_SHOW_STACK="true" + export NUGET_XMLDOC_MODE="skip" + fi +fi diff --git a/profile/.profile.d/60_go.sh b/profile/.profile.d/60_go.sh new file mode 100644 index 0000000..252c46c --- /dev/null +++ b/profile/.profile.d/60_go.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +if command -v go >/dev/null 2>&1; then + export GO111MODULE="on" + export GOPATH="${HOME}/.go" + + path_append "${GOPATH}/bin" +fi diff --git a/profile/.profile.d/60_haskell.sh b/profile/.profile.d/60_haskell.sh new file mode 100644 index 0000000..3ba7324 --- /dev/null +++ b/profile/.profile.d/60_haskell.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if command -v cabal >/dev/null 2>&1; then + path_append "${HOME}/.cabal/bin" +fi diff --git a/profile/.profile.d/60_java.sh b/profile/.profile.d/60_java.sh new file mode 100644 index 0000000..e9ddf25 --- /dev/null +++ b/profile/.profile.d/60_java.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +export _JAVA_AWT_WM_NONREPARENTING="1" +export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on" + +if command -v java >/dev/null 2>&1; then + if [ -n "${JAVA_HOME}" ]; then + export JAVA_HOME="${HOME}/.gentoo/java-config-2/current-user-vm" + fi + path_append "${JAVA_HOME}/bin" + manpath_append "${JAVA_HOME}/man" +fi diff --git a/profile/.profile.d/60_lisp.sh b/profile/.profile.d/60_lisp.sh new file mode 100644 index 0000000..e450d24 --- /dev/null +++ b/profile/.profile.d/60_lisp.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +_implementations=" +sbcl +ccl +clasp +clisp +ecl +abcl +" + +for _implementation in ${_implementations}; do + # shellcheck disable=SC2139 + if command -v "$_implementation" >/dev/null 2>&1; then + if command -v rlwrap >/dev/null 2>&1; then + alias lisp="rlwrap $_implementation" + else + alias lisp="$_implementation" + fi + + break + fi +done + +unset _implementation _implementations diff --git a/profile/.profile.d/60_ocaml.sh b/profile/.profile.d/60_ocaml.sh new file mode 100644 index 0000000..b981b3d --- /dev/null +++ b/profile/.profile.d/60_ocaml.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +if command -v opam >/dev/null 2>&1; then + if [ -f "${HOME}/.opam/opam-init/init.sh" ]; then + # shellcheck disable=SC1091 + . "${HOME}/.opam/opam-init/init.sh" >/dev/null 2>&1 + fi +fi diff --git a/profile/.profile.d/60_python.sh b/profile/.profile.d/60_python.sh new file mode 100644 index 0000000..9329cdf --- /dev/null +++ b/profile/.profile.d/60_python.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +_implementations=" +python +python3 +python2 +" + +for _implementation in ${_implementations}; do + if command -v "${_implementation}" >/dev/null 2>&1; then + if [ -f "${HOME}/.pystartup" ]; then + export PYTHONSTARTUP="${HOME}/.pystartup" + fi + + break + fi +done + +unset _implementation _implementations diff --git a/profile/.profile.d/60_rust.sh b/profile/.profile.d/60_rust.sh new file mode 100644 index 0000000..1b6fd36 --- /dev/null +++ b/profile/.profile.d/60_rust.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +if command -v cargo >/dev/null 2>&1; then + export CARGO_HOME="${HOME}/.cargo" + export CARGO_CACHE_RUSTC_INFO="0" + + path_append "${CARGO_HOME}/bin" +fi diff --git a/profile/.profile.d/90_alias.sh b/profile/.profile.d/90_alias.sh new file mode 100644 index 0000000..39dc364 --- /dev/null +++ b/profile/.profile.d/90_alias.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +if cp --help | grep -q "\--progress-bar" 2>&1 >/dev/null; then + alias cp="cp -i -r -g" +else + alias cp="cp -i -r" +fi + +if mv --help | grep -q "\--progress-bar" 2>&1 >/dev/null; then + alias mv="mv -i -g" +else + alias mv="mv -i" +fi + +if rm --help | grep -q "\--interactive\[=WHEN\]" 2>&1 >/dev/null; then + alias rm="rm -I" +else + alias rm="rm -i" +fi + +alias c="cd" + +alias ln="ln -i" + +alias mkdir="mkdir -p" +alias rmdir="rmdir -p" + +alias grep="grep --color=auto" +alias egrep="egrep --color=auto" +alias fgrep="fgrep --color=auto" + +alias du="du -h" + +alias df="df -h" diff --git a/profile/.profile.d/90_functions.sh b/profile/.profile.d/90_functions.sh new file mode 100644 index 0000000..a5b63ec --- /dev/null +++ b/profile/.profile.d/90_functions.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +count() { + printf "%d\n" "${#}" +} + +dec2hex() { + printf "0x%X\n" "${1}" +} + +hex2dec() { + printf "%d\n" "0x${1}" +} + +ff() { + find . -type f -iname "${@}" -ls +} + +mkcd() { + mkdir -p "${1}" && + builtin cd "${1}" || + return +} + +mvcd() { + mv -i -- "${PWD}" "${1}" && + builtin cd . || + return +} + +cald() { + printf "\t\t%s\n\n" "$(date)" && cal -m -3 +} + +cheat() { + curl "cheat.sh/${1}" +} + +myip() { + dig -4 +short @resolver1.opendns.com myip.opendns.com A +} + +myip6() { + dig -6 +short @resolver1.opendns.com myip.opendns.com AAAA +} + +if ! command -v sponge >/dev/null 2>&1; then + sponge() { + _tmp="$(mktemp)" || return 1 + + cat >"${_tmp}" + cat -- "${_tmp}" + rm -f -- "${_tmp}" + + unset _tmp + } +fi diff --git a/profile/.profile.d/ag.sh b/profile/.profile.d/ag.sh new file mode 100644 index 0000000..2ddded0 --- /dev/null +++ b/profile/.profile.d/ag.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if command -v ag >/dev/null 2>&1; then + alias ag="ag --color --smart-case" +fi diff --git a/profile/.profile.d/bat.sh b/profile/.profile.d/bat.sh new file mode 100644 index 0000000..205da87 --- /dev/null +++ b/profile/.profile.d/bat.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +if command -v bat >/dev/null 2>&1; then + export BAT_THEME="base16" + + if [ "${MANPAGER}" == "bat" ]; then + export MANPAGER="sh -c 'col -bx | bat -l man -p'" + fi +fi diff --git a/profile/.profile.d/bear.sh b/profile/.profile.d/bear.sh new file mode 100644 index 0000000..7309b7c --- /dev/null +++ b/profile/.profile.d/bear.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# shellcheck disable=SC2139 + +if command -v bear >/dev/null 2>&1; then + _implementations=" +remake +make +" + + for _implementation in ${_implementations}; do + if command -v "${_implementation}" >/dev/null 2>&1; then + if command -v nproc >/dev/null 2>&1; then + alias m="bear ${_implementation} --jobs=$(($(nproc) + 1))" + else + alias m="bear ${_implementation}" + fi + alias mc="${_implementation} clean" + + break + fi + done + unset _implementation _implementations +fi diff --git a/profile/.profile.d/beet.sh b/profile/.profile.d/beet.sh new file mode 100644 index 0000000..2c2fd9a --- /dev/null +++ b/profile/.profile.d/beet.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +if command -v beet >/dev/null 2>&1; then + export BEETSDIR="${XDG_DATA_HOME}/beets" + + _beets_config="${XDG_CONFIG_HOME}/beets/config.yaml" + if [ -f "${_beets_config}" ]; then + # shellcheck disable=SC2139 + alias beet="beet -c ${_beets_config}" + fi +fi + +unset _beets_config diff --git a/profile/.profile.d/ccache.sh b/profile/.profile.d/ccache.sh new file mode 100644 index 0000000..895f9f0 --- /dev/null +++ b/profile/.profile.d/ccache.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +if command -v ccache >/dev/null 2>&1; then + export CCACHE_DIR="${HOME}/.ccache" + if [ -d "/usr/lib/ccache/bin" ]; then + export CCACHE_PATH="/usr/lib/ccache/bin:${PATH}" + else + export CCACHE_PATH="${PATH}" + fi +fi diff --git a/profile/.profile.d/df.sh b/profile/.profile.d/df.sh new file mode 100644 index 0000000..26a767b --- /dev/null +++ b/profile/.profile.d/df.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if command -v df >/dev/null 2>&1; then + alias disk="df --human-readable --exclude-type=tmpfs --exclude-type=devtmpfs" +fi diff --git a/profile/.profile.d/docker.sh b/profile/.profile.d/docker.sh new file mode 100644 index 0000000..b034b51 --- /dev/null +++ b/profile/.profile.d/docker.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +if command -v docker >/dev/null 2>&1; then + alias dk="docker" + alias dk-ip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'" + alias dk-pid="docker inspect --format '{{ .State.Pid }}'" + alias dk-rm-all="docker rm \$(docker ps --quiet --all)" + alias dk-rm-exited="docker rm \$(docker ps --quiet --format 'status=exited')" + alias dk-rmi-all="docker rmi \$(docker images --quiet --all)" + alias dk-rmi-dangling="docker rmi \$(docker images --quiet --format 'dangling=true')" + alias dk-stop-all="docker stop \$(docker ps --quiet --format 'status=running')" +fi diff --git a/profile/.profile.d/doom.sh b/profile/.profile.d/doom.sh new file mode 100644 index 0000000..ad91c9f --- /dev/null +++ b/profile/.profile.d/doom.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if [ -x "${HOME}/.emacs.d/bin/doom" ]; then + path_append "${HOME}/.emacs.d/bin" +fi diff --git a/profile/.profile.d/free.sh b/profile/.profile.d/free.sh new file mode 100644 index 0000000..ac04417 --- /dev/null +++ b/profile/.profile.d/free.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if command -v free >/dev/null 2>&1; then + alias ram="free --human --wide" +fi diff --git a/profile/.profile.d/fzf.sh b/profile/.profile.d/fzf.sh new file mode 100644 index 0000000..3942b01 --- /dev/null +++ b/profile/.profile.d/fzf.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +if command -v fzf >/dev/null 2>&1; then + export FZF_DEFAULT_COMMAND="" + export FZF_DEFAULT_OPTS="--height 20% --reverse --border" +fi diff --git a/profile/.profile.d/git.sh b/profile/.profile.d/git.sh new file mode 100644 index 0000000..d0b5e8f --- /dev/null +++ b/profile/.profile.d/git.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +if command -v git >/dev/null 2>&1; then + if command -v hub >/dev/null 2>&1; then + alias git="hub" + fi + alias g="git" + + if command -v delta >/dev/null 2>&1; then + export GIT_PAGER="delta" + fi +fi diff --git a/profile/.profile.d/gnupg.sh b/profile/.profile.d/gnupg.sh new file mode 100644 index 0000000..d5d531f --- /dev/null +++ b/profile/.profile.d/gnupg.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +if command -v gpg >/dev/null 2>&1; then + GPG_TTY="$(tty)" + export GPG_TTY + + if command -v ssh >/dev/null 2>&1 && + command -v gpgconf >/dev/null 2>&1; then + unset SSH_AGENT_PID + if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne "${$}" ]; then + SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + export SSH_AUTH_SOCK + fi + fi + + if command -v gpg-connect-agent >/dev/null 2>&1 && + [ "${TERM}" != "linux" ]; then + gpg-connect-agent updatestartuptty /bye >/dev/null 2>&1 + fi +fi diff --git a/profile/.profile.d/grep.sh b/profile/.profile.d/grep.sh new file mode 100644 index 0000000..013a8ed --- /dev/null +++ b/profile/.profile.d/grep.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +if command -v grep >/dev/null 2>&1; then + alias gr="grep" + + if command -v batgrep >/dev/null 2>&1; then + alias gr="batgrep" + fi +fi + +if command -v egrep >/dev/null 2>&1; then + alias egr="egrep" +fi + +if command -v pgrep >/dev/null 2>&1; then + alias pgr="pgrep" +fi diff --git a/profile/.profile.d/hledger.sh b/profile/.profile.d/hledger.sh new file mode 100644 index 0000000..b656ba2 --- /dev/null +++ b/profile/.profile.d/hledger.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if command -v hledger >/dev/null 2>&1; then + export LEDGER_FILE="${XDG_DOCUMENTS_DIR}/accounting/current.journal" +fi diff --git a/profile/.profile.d/jot.sh b/profile/.profile.d/jot.sh new file mode 100644 index 0000000..21ff224 --- /dev/null +++ b/profile/.profile.d/jot.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if command -v jot >/dev/null 2>&1 && + command -v tput >/dev/null 2>&1; then + # shellcheck disable=SC2139 + alias hr="jot -b '═' -s '' '$(tput cols)'" +fi diff --git a/profile/.profile.d/less.sh b/profile/.profile.d/less.sh new file mode 100644 index 0000000..9418348 --- /dev/null +++ b/profile/.profile.d/less.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +if command -v less >/dev/null 2>&1; then + export LESSHISTFILE="/dev/null" + export LESSHISTSIZE=0 +fi diff --git a/profile/.profile.d/llvm.sh b/profile/.profile.d/llvm.sh new file mode 100644 index 0000000..f62b09b --- /dev/null +++ b/profile/.profile.d/llvm.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +_llvm_root="/usr/lib/llvm" + +if [ -d "${_llvm_root}" ]; then + for _version in "${_llvm_root}"/*; do + path_append "${_version}/bin" + manpath_append "${_version}/share/man" + done +fi + +unset _version _llvm_root diff --git a/profile/.profile.d/ls.sh b/profile/.profile.d/ls.sh new file mode 100644 index 0000000..385caf8 --- /dev/null +++ b/profile/.profile.d/ls.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# shellcheck disable=SC2139 + +_gnu_ls="--color=always --human-readable --group-directories-first --indicator-style=classify --author" +_bsd_ls="-G -p" + +if ls --color "${HOME}" >/dev/null 2>&1; then + alias ls="ls ${_gnu_ls} -C" + alias la="ls ${_gnu_ls} -C -A" + alias ll="ls ${_gnu_ls} -l -A" +else + if command -v gls >/dev/null 2>&1; then + alias ls="gls ${_gnu_ls} -C" + alias la="gls ${_gnu_ls} -C -A" + alias ll="gls ${_gnu_ls} -l -A" + else + alias ls="ls ${_bsd_ls}" + alias la="ls ${_bsd_ls} -A" + alias ll="ls ${_bsd_ls} -A -l" + fi +fi + +alias l="ll" + +unset _bsd_ls _gnu_ls diff --git a/profile/.profile.d/man.sh b/profile/.profile.d/man.sh new file mode 100644 index 0000000..54d3513 --- /dev/null +++ b/profile/.profile.d/man.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if command -v man >/dev/null 2>&1; then + export MANOPT="--no-hyphenation" + + alias man="LANG=\"C\" LC_MESSAGES=\"C\" man" +fi diff --git a/profile/.profile.d/mpd.sh b/profile/.profile.d/mpd.sh new file mode 100644 index 0000000..8ed7310 --- /dev/null +++ b/profile/.profile.d/mpd.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if command -v mpd >/dev/null 2>&1; then + export MPD_HOST="/var/lib/mpd/mpd.socket" +fi diff --git a/profile/.profile.d/nnn.sh b/profile/.profile.d/nnn.sh new file mode 100644 index 0000000..3890592 --- /dev/null +++ b/profile/.profile.d/nnn.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +if command -v nnn >/dev/null 2>&1; then + export NNN_BMS="h:~;s:~/src;d:~/downloads;e:/etc;u:/usr;p:/etc/portage;t:/tmp" + export NNN_PLUG="j:autojump" + export NNN_MULTISCRIPT=1 + export NNN_NO_AUTOSELECT=1 + export NNN_OPENER="nuke" + export NNN_QUOTE_ON=1 + export NNN_TMPFILE="${XDG_CACHE_HOME}/nnn" + export NNN_TRASH=0 + export NNN_USE_EDITOR=1 + + alias f="nnn" + + # shellcheck disable=SC2139 + alias ncp="cat ${NNN_TMPFILE}/.selection | tr '\0' '\n'" +fi diff --git a/profile/.profile.d/open.sh b/profile/.profile.d/open.sh new file mode 100644 index 0000000..8d0cd22 --- /dev/null +++ b/profile/.profile.d/open.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ "$(uname)" = "Linux" ]; then + if grep -q Microsoft /proc/version; then + alias open="explorer.exe" + elif command -v "xdg-open" >/dev/null 2>&1; then + alias open="xdg-open" + fi +fi + +if command -v "open" >/dev/null 2>&1; then + o() { + if [ "${#}" -eq 0 ]; then + open "${PWD}" + else + open "${@}" + fi + } +fi diff --git a/profile/.profile.d/pass.sh b/profile/.profile.d/pass.sh new file mode 100644 index 0000000..c8831b1 --- /dev/null +++ b/profile/.profile.d/pass.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +_impls=" +gopass +pass +" + +for _impl in ${_impls}; do + if command -v "${_impl}" >/dev/null 2>&1; then + export PASSWORD_STORE_DIR="${XDG_DATA_HOME}/password-store" + + break + fi +done + +unset _impl _impls diff --git a/profile/.profile.d/rsync.sh b/profile/.profile.d/rsync.sh new file mode 100644 index 0000000..cbbda1a --- /dev/null +++ b/profile/.profile.d/rsync.sh @@ -0,0 +1,12 @@ +#!/bin/sh +#shellcheck disable=SC2139 + +if command -v rsync >/dev/null 2>&1; then + _rsync_cp="rsync --archive --compress --verbose --progress --human-readable" + + alias rsync-cp="${_rsync_cp}" + alias rsync-mv="${_rsync_cp} --remove-source-files" + alias rsync-sync="${_rsync_cp} --update --delete" + + unset _rsync_cp +fi diff --git a/profile/.profile.d/shellcheck.sh b/profile/.profile.d/shellcheck.sh new file mode 100644 index 0000000..73b12e3 --- /dev/null +++ b/profile/.profile.d/shellcheck.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if command -v shellcheck >/dev/null 2>&1; then + alias sc="shellcheck" +fi diff --git a/profile/.profile.d/svn.sh b/profile/.profile.d/svn.sh new file mode 100644 index 0000000..9fa1219 --- /dev/null +++ b/profile/.profile.d/svn.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if command -v svn >/dev/null 2>&1; then + alias s="svn" +fi diff --git a/profile/.profile.d/torrentinfo.sh b/profile/.profile.d/torrentinfo.sh new file mode 100644 index 0000000..77c3833 --- /dev/null +++ b/profile/.profile.d/torrentinfo.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if command -v torrentinfo >/dev/null 2>&1; then + alias torrentinfo="torrentinfo --everything" +fi diff --git a/profile/.profile.d/uim.sh b/profile/.profile.d/uim.sh new file mode 100644 index 0000000..d8b6202 --- /dev/null +++ b/profile/.profile.d/uim.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +if command -v uim-xim >/dev/null 2>&1; then + export GTK_IM_MODULE="uim" + export QT_IM_MODULE="uim" + export SHORT_DESC="UIM" + export UIM_FEP="skk" + export XIM="uim" + export XIM_ARGS= + export XIM_PROGRAM="uim-xim" + export XMODIFIERS="@im=uim" +fi diff --git a/profile/.profile.d/units.sh b/profile/.profile.d/units.sh new file mode 100644 index 0000000..7b19142 --- /dev/null +++ b/profile/.profile.d/units.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +if command -v units >/dev/null 2>&1; then + # shellcheck disable=SC2139 + alias units="units --history=${XDG_DATA_HOME}/units_history" +fi diff --git a/profile/.profile.d/urxvt.sh b/profile/.profile.d/urxvt.sh new file mode 100644 index 0000000..c08a63d --- /dev/null +++ b/profile/.profile.d/urxvt.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +if command -v urxvt >/dev/null 2>&1; then + export RXVT_SOCKET="${XDG_RUNTIME_DIR}/urxvtd.socket" + export URXVT_PERL_LIB="${XDG_DATA_HOME}/urxvt/ext" +fi diff --git a/profile/.profile.d/vi.sh b/profile/.profile.d/vi.sh new file mode 100644 index 0000000..d93b91d --- /dev/null +++ b/profile/.profile.d/vi.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +_implementations=" +vim +vi +" + +for _implementation in ${_implementations}; do + # shellcheck disable=SC2139 + command -v "${_implementation}" >/dev/null 2>&1 && + alias vim="${_implementation}" && + alias vi="${_implementation}" && + alias v="${_implementation}" && + break +done + +unset _implementation _implementations diff --git a/profile/.profile.d/wakatime.sh b/profile/.profile.d/wakatime.sh new file mode 100644 index 0000000..ff1ba89 --- /dev/null +++ b/profile/.profile.d/wakatime.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +if command -v wakatime >/dev/null 2>&1; then + export WAKATIME_HOME="${HOME}/.wakatime" + + [ ! -d "${WAKATIME_HOME}" ] && + mkdir -p "${WAKATIME_HOME}" +fi diff --git a/profile/.profile.d/wget.sh b/profile/.profile.d/wget.sh new file mode 100644 index 0000000..de72b2b --- /dev/null +++ b/profile/.profile.d/wget.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +if command -v wget >/dev/null 2>&1; then + # shellcheck disable=SC2139 + alias wget="wget --hsts-file=${XDG_DATA_HOME}/wget-hsts" +fi diff --git a/profile/.profile.d/wine.sh b/profile/.profile.d/wine.sh new file mode 100644 index 0000000..8f078ce --- /dev/null +++ b/profile/.profile.d/wine.sh @@ -0,0 +1,13 @@ +#!/bin/sh +#shellcheck disable=SC2139 + +if command -v wine >/dev/null 2>&1; then + export WINEARCH="win64" + export WINEDEBUG="+all" + export WINEDLLOVERRIDES="winemenubuilder.exe=d" + export WINEPREFIX="${HOME}/.wine" + + if command -v xrandr >/dev/null 2>&1; then + alias wine-run="wine explorer.exe /desktop=default,$(xrandr | grep '\*' | cut -d' ' -f4)" + fi +fi diff --git a/profile/@install b/profile/@install new file mode 100755 index 0000000..d2073f2 --- /dev/null +++ b/profile/@install @@ -0,0 +1,10 @@ +#!/bin/sh + +[ ! -d "${HOME}/.profile.d" ] && \ + mkdir -p "${HOME}/.profile.d" + +stow \ + --target="${HOME}" \ + --ignore="^@.*" \ + --verbose \ + profile |