Stow restructuring
This commit is contained in:
parent
685e4dbe8b
commit
097cbd1c6d
53 changed files with 62 additions and 205 deletions
25
fish/.config/fish/conf.d/00-emacs.fish
Normal file
25
fish/.config/fish/conf.d/00-emacs.fish
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Copyright © 2019 Marcel Kapfer <opensource@mmk2410.org>
|
||||
# MIT License
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# Run zsh when using emacs
|
||||
# Current problem with fish seems to be the theme
|
||||
if test $TERM = "eterm-color"
|
||||
exec zsh
|
||||
end
|
52
fish/.config/fish/conf.d/00-env.fish
Normal file
52
fish/.config/fish/conf.d/00-env.fish
Normal file
|
@ -0,0 +1,52 @@
|
|||
# Copyright © 2019 Marcel Kapfer <opensource@mmk2410.org>
|
||||
# MIT License
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
set -x ARCHFLAGS -arch_x86_64
|
||||
|
||||
set -e LANG
|
||||
set -e LC_CTYPE
|
||||
set -Ux LANG "en_DK.UTF-8"
|
||||
set -Ux LC_TYPE "en_DK.UTF-8"
|
||||
|
||||
set -e GPG_TTY
|
||||
set -Ux GPG_TTY (tty)
|
||||
|
||||
set -e EDITOR
|
||||
set -Ux EDITOR "emacsclient -t"
|
||||
|
||||
if test -z "$VISUAL"
|
||||
set -Ux VISUAL "emacsclient -t"
|
||||
end
|
||||
|
||||
if test -z "$GIT_EDITOR"
|
||||
set -Ux GIT_EDITOR es
|
||||
end
|
||||
|
||||
if test -z "$GOPATH"
|
||||
set -Ux GOPATH ~/.go
|
||||
end
|
||||
|
||||
if test -z "$XDG_CURRENT_DESKTOP"
|
||||
set -Ux XDG_CURRENT_DESKTOP GNOME
|
||||
end
|
||||
|
||||
if test -z "$QT_QPA_PLATFORMTHEME"
|
||||
set -Ux QT_QPA_PLATFORMTHEME qt5ct
|
||||
end
|
31
fish/.config/fish/conf.d/10-abbr.fish
Normal file
31
fish/.config/fish/conf.d/10-abbr.fish
Normal file
|
@ -0,0 +1,31 @@
|
|||
# Copyright © 2019 Marcel Kapfer <opensource@mmk2410.org>
|
||||
# MIT License
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# Fish Abbrevations
|
||||
# Those are expanded before execution
|
||||
# See: https://fishshell.com/docs/current/commands.html#abbr
|
||||
|
||||
if status --is-interactive
|
||||
abbr --add l ls
|
||||
abbr --add ping ping -c 3
|
||||
abbr --add pingtest ping -c 3 mmk2410.org
|
||||
abbr --add g git
|
||||
abbr --add s sudo
|
||||
end
|
45
fish/.config/fish/conf.d/10-alias.fish
Normal file
45
fish/.config/fish/conf.d/10-alias.fish
Normal file
|
@ -0,0 +1,45 @@
|
|||
# Copyright © 2019 Marcel Kapfer <opensource@mmk2410.org>
|
||||
# MIT License
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
if status --is-interactive
|
||||
alias grep="grep --color=auto"
|
||||
alias df="df -h"
|
||||
alias du="du -c -h"
|
||||
alias mkdir="mkdir -p -v"
|
||||
alias ln="ln -i"
|
||||
alias chown="chown --preserve-root"
|
||||
alias chmod="chmod --preserve-root"
|
||||
alias chgrp="chgrp --preserve-root"
|
||||
alias ps="ps aux k%cpu"
|
||||
alias q="exit"
|
||||
alias Q="exit"
|
||||
alias x="exit"
|
||||
alias o="xdg-open"
|
||||
alias vim="nvim"
|
||||
alias e="es"
|
||||
end
|
||||
|
||||
function ls --wraps exa --description "alias ls=exa --git, if installed"
|
||||
if type -q exa
|
||||
exa --git $argv
|
||||
else
|
||||
command ls $argv
|
||||
end
|
||||
end
|
25
fish/.config/fish/conf.d/40-nix.fish
Normal file
25
fish/.config/fish/conf.d/40-nix.fish
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Copyright © 2019 Marcel Kapfer <opensource@mmk2410.org>
|
||||
# MIT License
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# Source the Nix profile, if it exists.
|
||||
set -l NIX_PROFILE $HOME/.nix-profile/etc/profile.d/nix.fish
|
||||
if test -e $NIX_PROFILE
|
||||
source $NIX_PROFILE
|
||||
end
|
47
fish/.config/fish/conf.d/60-debian.fish
Normal file
47
fish/.config/fish/conf.d/60-debian.fish
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Copyright © 2019 Marcel Kapfer <opensource@mmk2410.org>
|
||||
# MIT License
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# Debian Packaging
|
||||
|
||||
# quilt
|
||||
alias dquilt="quilt --quiltrc=$HOME/.quiltrc-dpkg"
|
||||
|
||||
# Variables
|
||||
set -x DEBUILD_DPKG_BUILDPACKAGE_OPTS "-i -I -us -uc"
|
||||
set -x DEBUILD_LINTIAN_OPTS "-i -I --show-overrides"
|
||||
set -x DEBSIGN_KEYID "9FE01C39F74551D434116394CADE6F0C09F21B09"
|
||||
|
||||
if test -z $DEBFULLNAME
|
||||
set -Ux DEBFULLNAME "Marcel Kapfer"
|
||||
end
|
||||
|
||||
if test -z $DEBEMAIL
|
||||
set -Ux DEBEMAIL "opensource@mmk2410.org"
|
||||
end
|
||||
|
||||
# pbuilder customization
|
||||
|
||||
set -x PDEBUILD_PBUILDER cowbuild
|
||||
set -x HOOKDIR /var/cache/pbuilder/hooks
|
||||
set -x MIRRORSITE http://httpredir.debian.org/debian/
|
||||
set -x APTCACHE /var/cache/apt/archives
|
||||
set -x BUILDRESULT ../
|
||||
set -x EXTRAPACKAGES lintian
|
||||
set -x DEBBUILDOPTS -j4
|
40
fish/.config/fish/conf.d/90-emacs-vterm.fish
Normal file
40
fish/.config/fish/conf.d/90-emacs-vterm.fish
Normal file
|
@ -0,0 +1,40 @@
|
|||
function vterm_printf;
|
||||
if [ -n "$TMUX" ]
|
||||
# tell tmux to pass the escape sequences through
|
||||
printf "\ePtmux;\e\e]%s\007\e\\" "$argv"
|
||||
else if string match -q -- "screen*" "$TERM"
|
||||
# GNU screen (screen, screen-256color, screen-256color-bce)
|
||||
printf "\eP\e]%s\007\e\\" "$argv"
|
||||
else
|
||||
printf "\e]%s\e\\" "$argv"
|
||||
end
|
||||
end
|
||||
|
||||
function vterm_prompt_end;
|
||||
vterm_printf '51;A'(whoami)'@'(hostname)':'(pwd)
|
||||
end
|
||||
functions --copy fish_prompt vterm_old_fish_prompt
|
||||
function fish_prompt --description 'Write out the prompt; do not replace this. Instead, put this at end of your file.'
|
||||
# Remove the trailing newline from the original prompt. This is done
|
||||
# using the string builtin from fish, but to make sure any escape codes
|
||||
# are correctly interpreted, use %b for printf.
|
||||
printf "%b" (string join "\n" (vterm_old_fish_prompt))
|
||||
vterm_prompt_end
|
||||
end
|
||||
|
||||
function vterm_cmd --description 'Run an Emacs command among the ones been defined in vterm-eval-cmds.'
|
||||
set -l vterm_elisp ()
|
||||
for arg in $argv
|
||||
set -a vterm_elisp (printf '"%s" ' (string replace -a -r '([\\\\"])' '\\\\\\\\$1' $arg))
|
||||
end
|
||||
vterm_printf '51;E'(string join '' $vterm_elisp)
|
||||
end
|
||||
|
||||
function find_file
|
||||
set -q argv[1]; or set argv[1] "."
|
||||
vterm_cmd find-file (realpath "$argv")
|
||||
end
|
||||
|
||||
function say
|
||||
vterm_cmd message "%s" "$argv"
|
||||
end
|
32
fish/.config/fish/conf.d/99-x.fish
Normal file
32
fish/.config/fish/conf.d/99-x.fish
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Copyright © 2019 Marcel Kapfer <opensource@mmk2410.org>
|
||||
# MIT License
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# Automatically start X at login
|
||||
# source: https://wiki.archlinux.org/index.php/Fish#Start_X_at_login
|
||||
# This must be at the bottom of this file
|
||||
#if status --is-login
|
||||
# if test -z "$DISPLAY" -a $XDG_VTNR = 1
|
||||
# # Unlock GPG keyring befor starting X.
|
||||
# # This makes some things easier.
|
||||
# echo "gpg unlock" | gpg -se -r me@mmk2410.org > /dev/null
|
||||
# pulseaudio -D # start pulseaudio before X is started
|
||||
# exec startx -- -keeptty
|
||||
# end
|
||||
#end
|
138
fish/.config/fish/conf.d/nix-env.fish
Normal file
138
fish/.config/fish/conf.d/nix-env.fish
Normal file
|
@ -0,0 +1,138 @@
|
|||
# Setup Nix
|
||||
|
||||
# We need to distinguish between single-user and multi-user installs.
|
||||
# This is difficult because there's no official way to do this.
|
||||
# We could look for the presence of /nix/var/nix/daemon-socket/socket but this will fail if the
|
||||
# daemon hasn't started yet. /nix/var/nix/daemon-socket will exist if the daemon has ever run, but
|
||||
# I don't think there's any protection against accidentally running `nix-daemon` as a user.
|
||||
# We also can't just look for /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh because
|
||||
# older single-user installs used the default profile instead of a per-user profile.
|
||||
# We can still check for it first, because all multi-user installs should have it, and so if it's
|
||||
# not present that's a pretty big indicator that this is a single-user install. If it does exist,
|
||||
# we still need to verify the install type. To that end we'll look for a root owner and sticky bit
|
||||
# on /nix/store. Multi-user installs set both, single-user installs don't. It's certainly possible
|
||||
# someone could do a single-user install as root and then manually set the sticky bit but that
|
||||
# would be extremely unusual.
|
||||
|
||||
set -l nix_profile_path /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
set -l single_user_profile_path ~/.nix-profile/etc/profile.d/nix.sh
|
||||
if test -e $nix_profile_path
|
||||
# The path exists. Double-check that this is a multi-user install.
|
||||
# We can't just check for ~/.nix-profile/… because this may be a single-user install running as
|
||||
# the wrong user.
|
||||
|
||||
# stat is not portable. Splitting the output of ls -nd is reliable on most platforms.
|
||||
set -l owner (string split -n ' ' (/bin/ls -nd /nix/store 2>/dev/null))[3]
|
||||
if not test -k /nix/store -a $owner -eq 0
|
||||
# /nix/store is either not owned by root or not sticky. Assume single-user.
|
||||
set nix_profile_path $single_user_profile_path
|
||||
end
|
||||
else
|
||||
# The path doesn't exist. Assume single-user
|
||||
set nix_profile_path $single_user_profile_path
|
||||
end
|
||||
|
||||
if test -e $nix_profile_path
|
||||
# Source the nix setup script
|
||||
# We're going to run the regular Nix profile under bash and then print out a few variables
|
||||
for line in (env -u BASH_ENV bash -c '. "$0"; for name in PATH "${!NIX_@}"; do printf "%s=%s\0" "$name" "${!name}"; done' $nix_profile_path | string split0)
|
||||
set -xg (string split -m 1 = $line)
|
||||
end
|
||||
|
||||
# Insert Nix's fish share directories into fish's special variables.
|
||||
# nixpkgs-installed fish tries to set these up already if NIX_PROFILES is defined, which won't
|
||||
# be the case when sourcing $__fish_data_dir/share/config.fish normally, but might be for a
|
||||
# recursive invocation. To guard against that, we'll only insert paths that don't already exit.
|
||||
# Furthermore, for the vendor_conf.d sourcing, we'll use the pre-existing presence of a path in
|
||||
# $fish_function_path to determine whether we want to source the relevant vendor_conf.d folder.
|
||||
|
||||
# To start, let's locally define NIX_PROFILES if it doesn't already exist.
|
||||
set -al NIX_PROFILES
|
||||
if test (count $NIX_PROFILES) -eq 0
|
||||
set -a NIX_PROFILES $HOME/.nix-profile
|
||||
end
|
||||
# Replicate the logic from nixpkgs version of $__fish_data_dir/__fish_build_paths.fish.
|
||||
set -l __nix_profile_paths (string split ' ' -- $NIX_PROFILES)[-1..1]
|
||||
set -l __extra_completionsdir \
|
||||
$__nix_profile_paths/etc/fish/completions \
|
||||
$__nix_profile_paths/share/fish/vendor_completions.d
|
||||
set -l __extra_functionsdir \
|
||||
$__nix_profile_paths/etc/fish/functions \
|
||||
$__nix_profile_paths/share/fish/vendor_functions.d
|
||||
set -l __extra_confdir \
|
||||
$__nix_profile_paths/etc/fish/conf.d \
|
||||
$__nix_profile_paths/share/fish/vendor_conf.d \
|
||||
|
||||
### Configure fish_function_path ###
|
||||
# Remove any of our extra paths that may already exist.
|
||||
# Record the equivalent __extra_confdir path for any function path that exists.
|
||||
set -l existing_conf_paths
|
||||
for path in $__extra_functionsdir
|
||||
if set -l idx (contains --index -- $path $fish_function_path)
|
||||
set -e fish_function_path[$idx]
|
||||
set -a existing_conf_paths $__extra_confdir[(contains --index -- $path $__extra_functionsdir)]
|
||||
end
|
||||
end
|
||||
# Insert the paths before $__fish_data_dir.
|
||||
if set -l idx (contains --index -- $__fish_data_dir/functions $fish_function_path)
|
||||
# Fish has no way to simply insert into the middle of an array.
|
||||
set -l new_path $fish_function_path[1..$idx]
|
||||
set -e new_path[$idx]
|
||||
set -a new_path $__extra_functionsdir
|
||||
set fish_function_path $new_path $fish_function_path[$idx..-1]
|
||||
else
|
||||
set -a fish_function_path $__extra_functionsdir
|
||||
end
|
||||
|
||||
### Configure fish_complete_path ###
|
||||
# Remove any of our extra paths that may already exist.
|
||||
for path in $__extra_completionsdir
|
||||
if set -l idx (contains --index -- $path $fish_complete_path)
|
||||
set -e fish_complete_path[$idx]
|
||||
end
|
||||
end
|
||||
# Insert the paths before $__fish_data_dir.
|
||||
if set -l idx (contains --index -- $__fish_data_dir/completions $fish_complete_path)
|
||||
set -l new_path $fish_complete_path[1..$idx]
|
||||
set -e new_path[$idx]
|
||||
set -a new_path $__extra_completionsdir
|
||||
set fish_complete_path $new_path $fish_complete_path[$idx..-1]
|
||||
else
|
||||
set -a fish_complete_path $__extra_completionsdir
|
||||
end
|
||||
|
||||
### Source conf directories ###
|
||||
# The built-in directories were already sourced during shell initialization.
|
||||
# Any __extra_confdir that came from $__fish_data_dir/__fish_build_paths.fish was also sourced.
|
||||
# As explained above, we're using the presence of pre-existing paths in $fish_function_path as a
|
||||
# signal that the corresponding conf dir has also already been sourced.
|
||||
# In order to simulate this, we'll run through the same algorithm as found in
|
||||
# $__fish_data_dir/config.fish except we'll avoid sourcing the file if it comes from an
|
||||
# already-sourced location.
|
||||
# Caveats:
|
||||
# * Files will be sourced in a different order than we'd ideally do (because we're coming in
|
||||
# after the fact to source them).
|
||||
# * If there are existing extra conf paths, files in them may have been sourced that should have
|
||||
# been suppressed by paths we're inserting in front.
|
||||
# * Similarly any files in $__fish_data_dir/vendor_conf.d that should have been suppressed won't
|
||||
# have been.
|
||||
set -l sourcelist
|
||||
for file in $__fish_config_dir/conf.d/*.fish $__fish_sysconf_dir/conf.d/*.fish
|
||||
# We know these paths were sourced already. Just record them.
|
||||
set -l basename (string replace -r '^.*/' '' -- $file)
|
||||
contains -- $basename $sourcelist
|
||||
or set -a sourcelist $basename
|
||||
end
|
||||
for root in $__extra_confdir
|
||||
for file in $root/*.fish
|
||||
set -l basename (string replace -r '^.*/' '' -- $file)
|
||||
contains -- $basename $sourcelist
|
||||
and continue
|
||||
set -a sourcelist $basename
|
||||
contains -- $root $existing_conf_paths
|
||||
and continue # this is a pre-existing path, it will have been sourced already
|
||||
[ -f $file -a -r $file ]
|
||||
and source $file
|
||||
end
|
||||
end
|
||||
end
|
3
fish/.config/fish/functions/add_to_path.fish
Normal file
3
fish/.config/fish/functions/add_to_path.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
function add_to_path --description 'Persistently prepends paths to your PATH'
|
||||
set --universal fish_user_paths $fish_user_paths $argv
|
||||
end
|
24
fish/.config/fish/functions/cdl.fish
Normal file
24
fish/.config/fish/functions/cdl.fish
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Copyright © 2019 Marcel Kapfer <opensource@mmk2410.org>
|
||||
# MIT License
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
function cdl --wraps cd --description "Switch directory and show content"
|
||||
cd $argv
|
||||
l
|
||||
end
|
27
fish/.config/fish/functions/diff.fish
Normal file
27
fish/.config/fish/functions/diff.fish
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Copyright © 2019 Marcel Kapfer <opensource@mmk2410.org>
|
||||
# MIT License
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
function diff --wraps diff --description "Use colordiff instead of diff, if available"
|
||||
if type -q colordiff
|
||||
/usr/bin/colordiff $argv
|
||||
else
|
||||
/usr/bin/diff $argv
|
||||
end
|
||||
end
|
27
fish/.config/fish/functions/sbcl.fish
Normal file
27
fish/.config/fish/functions/sbcl.fish
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Copyright © 2019 Marcel Kapfer <opensource@mmk2410.org>
|
||||
# MIT License
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
function sbcl --wraps sbcl --description "Wrap SBCL with rlwrap (readline support)"
|
||||
if type -q rlwrap
|
||||
rlwrap sbcl $argv
|
||||
else
|
||||
sbcl $argv
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue