Move tasks into new general role
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
###
|
||||
# Loader for Oh My Fish! packages
|
||||
# Loads all packages stored in ~/.config/fish/pkgs/
|
||||
#
|
||||
# Inspired by https://github.com/jorgebucaran/fisher
|
||||
###
|
||||
|
||||
set -q pkgs_path; or set -g pkgs_path ~/.config/fish/pkgs
|
||||
|
||||
# also search for functions/completions/binaries/manpages within packages
|
||||
set fish_function_path $fish_function_path[1] $pkgs_path/.functions $pkgs_path/*/functions $fish_function_path[2..-1]
|
||||
set fish_complete_path $fish_complete_path[1] $pkgs_path/*/completions $fish_complete_path[2..-1]
|
||||
set -x PATH $pkgs_path/*/bin $PATH
|
||||
set -x MANPATH $pkgs_path/*/man $MANPATH
|
||||
|
||||
# load package key bindings when needed
|
||||
if functions -q fish_user_key_bindings
|
||||
functions -c fish_user_key_bindings fish_user_key_bindings_copy
|
||||
end
|
||||
function fish_user_key_bindings
|
||||
for file in $pkgs_path/*/key_bindings.fish
|
||||
builtin source $file 2>&1 > /dev/null
|
||||
end
|
||||
if functions -q fish_user_key_bindings_copy
|
||||
fish_user_key_bindings_copy
|
||||
end
|
||||
end
|
||||
|
||||
# load custom config from packages
|
||||
for file in $pkgs_path/*/conf.d/*.fish $pkgs_path/*/init.fish
|
||||
builtin source $file 2> /dev/null
|
||||
end
|
||||
|
||||
# ensure that the prompt is loaded (doesn't autoload for some reason)
|
||||
if test -f $pkgs_path/.functions/fish_prompt.fish
|
||||
builtin source $pkgs_path/.functions/fish_prompt.fish 2> /dev/null
|
||||
end
|
||||
|
||||
# collect all functions on the top-level of packages into $pkgs_path/.functions
|
||||
# (run by Ansible after packages have been updated)
|
||||
function _pkgs_collect_functions
|
||||
# clear the functions directory as we rebuild it from scratch
|
||||
if test -d $pkgs_path/.functions
|
||||
command rm -rf $pkgs_path/.functions
|
||||
end
|
||||
command mkdir -p $pkgs_path/.functions
|
||||
|
||||
# consider all fish files in the top-level of each package
|
||||
for src in $pkgs_path/*/*.fish
|
||||
set -l package (command basename (command dirname $src))
|
||||
set -l filename (command basename $src)
|
||||
|
||||
# we don't care about uninstall.fish;
|
||||
# init.fish and key_bindings.fish are dynamically handled on runtime above
|
||||
if not contains $filename {init,key_bindings,uninstall}.fish
|
||||
# create a relative symlink
|
||||
command ln -sf ../$package/$filename $pkgs_path/.functions/$filename
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,46 @@
|
||||
# Environment variables
|
||||
# ---------------------
|
||||
|
||||
set -x PATH $HOME/bin \
|
||||
$HOME/.composer/vendor/bin \
|
||||
$HOME/.local/bin \
|
||||
$HOME/.linuxbrew/bin \
|
||||
$PATH
|
||||
|
||||
set -x MANPATH $HOME/.linuxbrew/share/man \
|
||||
$MANPATH
|
||||
|
||||
# language
|
||||
set -x LANG de_DE.UTF-8
|
||||
|
||||
# editor
|
||||
set -x VISUAL "$HOME/.config/fish/pkgs/rmate/rmate -p 64364 -w" # Visual Studio Code (wait mode)
|
||||
set -x EDITOR 'nano -w' # nano as fallback editor
|
||||
|
||||
set -x XDG_CONFIG_HOME $HOME/.config
|
||||
|
||||
# Aliases
|
||||
# -------
|
||||
|
||||
# Edit file remotely with VS Code
|
||||
alias code="$HOME/.config/fish/pkgs/rmate/rmate -p 64364"
|
||||
|
||||
# Short ls command
|
||||
alias l='ls -la'
|
||||
|
||||
# General Settings
|
||||
# ----------------
|
||||
|
||||
# enforce 24-bit color mode
|
||||
# (the requried env var is not transmitted via SSH)
|
||||
set -x COLORTERM truecolor
|
||||
set -g fish_term24bit 1
|
||||
|
||||
# settings for the bobthefish theme
|
||||
set -g fish_prompt_pwd_dir_length 0
|
||||
set -g theme_color_scheme solarized-dark
|
||||
set -g theme_date_format '+%a %d.%m.%y %H:%M:%S'
|
||||
set -g theme_display_git_master_branch yes
|
||||
set -g theme_show_exit_status yes
|
||||
set -g theme_title_use_abbreviated_path no
|
||||
set -x VIRTUAL_ENV_DISABLE_PROMPT 1
|
||||
@@ -0,0 +1,3 @@
|
||||
function fish_greeting
|
||||
welcome
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
###
|
||||
# Looks up the IPv4 address of the given hostname and tries to find the reverse record of that IP
|
||||
#
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# $domain string Hostname to look up
|
||||
# Returns:
|
||||
# None
|
||||
###
|
||||
function nsreverse
|
||||
# lookup IP
|
||||
set ip (dig "$argv[1]" A +short); or return 1
|
||||
|
||||
# lookup reverse record
|
||||
set reverse (dig -x "$ip" +short); or return 1
|
||||
|
||||
# output
|
||||
echo -e "\033[1mIPv4: \033[0;34m $ip\033[0m"
|
||||
echo -e "\033[1mReverse lookup:\033[0;34m $reverse\033[0m"
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
###
|
||||
# Looks up the IPv6 address of the given hostname and tries to find the reverse record of that IP
|
||||
#
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# $domain string Hostname to look up
|
||||
# Returns:
|
||||
# None
|
||||
###
|
||||
function nsreverse6
|
||||
# lookup IP
|
||||
set ip (dig "$argv[1]" AAAA +short); or return 1
|
||||
|
||||
# lookup reverse record
|
||||
set reverse (dig -x "$ip" +short); or return 1
|
||||
|
||||
# output
|
||||
echo -e "\033[1mIPv6: \033[0;34m $ip\033[0m"
|
||||
echo -e "\033[1mReverse lookup:\033[0;34m $reverse\033[0m"
|
||||
end
|
||||
Reference in New Issue
Block a user