Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from zstg/main
Browse files Browse the repository at this point in the history
Lots of minor changes (fish and maneki)
  • Loading branch information
zstg authored Apr 28, 2024
2 parents 9a220d8 + 3caac37 commit f883cc7
Show file tree
Hide file tree
Showing 43 changed files with 2,298 additions and 43 deletions.
2 changes: 1 addition & 1 deletion airootfs/etc/calamares
Submodule calamares updated 0 files
2 changes: 1 addition & 1 deletion airootfs/etc/skel/.aliases
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
alias ls='eza --color=always'
alias rg='rg -i --sort-path'
alias rg='rg -i --sort path'
alias grep='grep --color=auto'
alias neofetch='neofetch --ascii_distro janus'
alias fetch-arch="sudo brl fetch arch"
Expand Down
94 changes: 94 additions & 0 deletions airootfs/etc/skel/.config/fish/config.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
if status is-interactive
# vim:fileencoding=utf-8:foldmethod=marker
# Commands to run in interactive sessions can go here
source (/usr/bin/starship init fish --print-full-init | psub)
# set -gx fish_key_bindings fish_vi_key_bindings
if [ "$IS_VTERM" != "1" ];
fish_vi_key_bindings
else
fish_default_key_bindings
end
source ~/.dotfiles/shells/.profile
source ~/.dotfiles/shells/aliases
set -x MANROFFOPT "-c"
set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
set fish_greeting
echo > ~/.local/share/fish/fish_history
alias clh='echo > ~/.local/share/fish/fish_history && exec fish'
abbr -a pacman sudo pacman
abbr -a s sudo
abbr -a md mkdir -p
function fish_user_key_bindings
bind --preset -M insert \el forward-char
bind --preset -M insert \eh backward-char
bind --preset -M insert \ew forward-word
bind --preset -M insert \eb backward-word
bind --preset -M insert \cH backward-kill-word
bind --preset -M insert \e\[3\;5~ kill-word
bind --preset -M insert \ca beginning-of-line
bind --preset -M insert \ce end-of-line
bind --preset -M insert \cc 'echo; commandline | cat; commandline ""; commandline -f repaint'
end
function __conda_add_prompt # kill the right prompt __conda_add_prompt
end
source ~/.dotfiles/shells/fish/git.fish
tokyonight-dark # function to display in tokyonight-dark colours
end

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
if test -f /home/stig/.miniconda/bin/conda
eval /home/stig/.miniconda/bin/conda "shell.fish" "hook" $argv | source
else
if test -f "/home/stig/.miniconda/etc/fish/conf.d/conda.fish"
. "/home/stig/.miniconda/etc/fish/conf.d/conda.fish"
else
set -x PATH "/home/stig/.miniconda/bin" $PATH
end
end
# <<< conda initialize <<<

# Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang
function __history_previous_command
switch (commandline -t)
case "!"
commandline -t $history[1]; commandline -f repaint
case "*"
commandline -i !
end
end

function __history_previous_command_arguments
switch (commandline -t)
case "!"
commandline -t ""
commandline -f history-token-search-backward
case "*"
commandline -i '$'
end
end

if [ "$fish_key_bindings" = fish_vi_key_bindings ];
bind -Minsert ! __history_previous_command
bind -Minsert '$' __history_previous_command_arguments
else
bind ! __history_previous_command
bind '$' __history_previous_command_arguments
end

# Fish command history
function history
builtin history --show-time='%F %T '
end

function copy
set count (count $argv | tr -d \n)
if test "$count" = 2; and test -d "$argv[1]"
set from (echo $argv[1] | trim-right /)
set to (echo $argv[2])
command cp -r $from $to
else
command cp $argv
end
end

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function convert_aliases_to_abbreviations
# Define the path to the aliases file
set aliases_file ~/.dotfiles/shells/aliases
# Read each line from the aliases file
while read -l line
# Extract the alias name and command
set alias_name (echo $line | sed -n 's/^alias \([^=]*\)=.*/\1/p')
set alias_command (echo $line | sed -n 's/^alias [^=]*=\(.*\)/\1/p')

# Check if both name and command are extracted
if test -n "$alias_name" -a -n "$alias_command"
# Create an abbreviation for the alias
abbr -a $alias_name $alias_command
end
end < $aliases_file
end
1 change: 1 addition & 0 deletions airootfs/etc/skel/.config/fish/fish_plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jethrokuan/fzf
52 changes: 52 additions & 0 deletions airootfs/etc/skel/.config/fish/fish_variables
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR FZF_DEFAULT_OPTS:\x2d\x2dheight\x2040\x25
SETUVAR FZF_DISABLE_KEYBINDINGS:0
SETUVAR FZF_LEGACY_KEYBINDINGS:1
SETUVAR FZF_PREVIEW_DIR_CMD:ls
SETUVAR FZF_PREVIEW_FILE_CMD:head\x20\x2dn\x2010
SETUVAR FZF_TMUX_HEIGHT:40\x25
SETUVAR __fish_initialized:3400
SETUVAR _fisher_jethrokuan_2F_fzf_files:/home/DELL/\x2econfig/fish/functions/__fzf_cd\x2efish\x1e/home/DELL/\x2econfig/fish/functions/__fzf_complete\x2efish\x1e/home/DELL/\x2econfig/fish/functions/__fzf_complete_preview\x2efish\x1e/home/DELL/\x2econfig/fish/functions/__fzf_find_file\x2efish\x1e/home/DELL/\x2econfig/fish/functions/__fzf_get_dir\x2efish\x1e/home/DELL/\x2econfig/fish/functions/__fzf_open\x2efish\x1e/home/DELL/\x2econfig/fish/functions/__fzf_parse_commandline\x2efish\x1e/home/DELL/\x2econfig/fish/functions/__fzf_reverse_isearch\x2efish\x1e/home/DELL/\x2econfig/fish/functions/__fzfcmd\x2efish\x1e/home/DELL/\x2econfig/fish/conf\x2ed/fzf\x2efish
SETUVAR _fisher_plugins:jethrokuan/fzf
SETUVAR fish_color_autosuggestion:707A8C
SETUVAR fish_color_cancel:\x2d\x2dreverse
SETUVAR fish_color_command:5CCFE6
SETUVAR fish_color_comment:5C6773
SETUVAR fish_color_cwd:73D0FF
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:F29E74
SETUVAR fish_color_error:FF3333
SETUVAR fish_color_escape:95E6CB
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal
SETUVAR fish_color_host_remote:\x1d
SETUVAR fish_color_keyword:\x1d
SETUVAR fish_color_match:F28779
SETUVAR fish_color_normal:CBCCC6
SETUVAR fish_color_operator:FFCC66
SETUVAR fish_color_option:\x1d
SETUVAR fish_color_param:CBCCC6
SETUVAR fish_color_quote:BAE67E
SETUVAR fish_color_redirection:D4BFFF
SETUVAR fish_color_search_match:\x2d\x2dbackground\x3dFFCC66
SETUVAR fish_color_selection:\x2d\x2dbackground\x3dFFCC66
SETUVAR fish_color_status:red
SETUVAR fish_color_user:brgreen
SETUVAR fish_color_valid_path:\x2d\x2dunderline
SETUVAR fish_greeting:\x1d
SETUVAR fish_key_bindings:fish_vi_key_bindings
SETUVAR fish_pager_color_background:\x1d
SETUVAR fish_pager_color_completion:normal
SETUVAR fish_pager_color_description:B3A06D
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
SETUVAR fish_pager_color_secondary_background:\x1d
SETUVAR fish_pager_color_secondary_completion:\x1d
SETUVAR fish_pager_color_secondary_description:\x1d
SETUVAR fish_pager_color_secondary_prefix:\x1d
SETUVAR fish_pager_color_selected_background:\x2d\x2dbackground\x3dFFCC66
SETUVAR fish_pager_color_selected_completion:\x1d
SETUVAR fish_pager_color_selected_description:\x1d
SETUVAR fish_pager_color_selected_prefix:\x1d
SETUVAR fish_user_paths:/home/stig/\x2elocal/share/cargo/bin
211 changes: 211 additions & 0 deletions airootfs/etc/skel/.config/fish/fisher.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
function fisher --argument-names cmd --description "A plugin manager for Fish"
set --query fisher_path || set --local fisher_path $__fish_config_dir
set --local fisher_version 4.3.1
set --local fish_plugins $__fish_config_dir/fish_plugins

switch "$cmd"
case -v --version
echo "fisher, version $fisher_version"
case "" -h --help
echo "Usage: fisher install <plugins...> Install plugins"
echo " fisher remove <plugins...> Remove installed plugins"
echo " fisher update <plugins...> Update installed plugins"
echo " fisher update Update all installed plugins"
echo " fisher list [<regex>] List installed plugins matching regex"
echo "Options:"
echo " -v or --version Print version"
echo " -h or --help Print this help message"
echo "Variables:"
echo " \$fisher_path Plugin installation path. Default: ~/.config/fish"
case ls list
string match --entire --regex -- "$argv[2]" $_fisher_plugins
case install update remove
isatty || read --local --null --array stdin && set --append argv $stdin

set --local install_plugins
set --local update_plugins
set --local remove_plugins
set --local arg_plugins $argv[2..-1]
set --local old_plugins $_fisher_plugins
set --local new_plugins

if ! set --query argv[2]
if test "$cmd" != update
echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1
else if test ! -e $fish_plugins
echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
end
set arg_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins)
end

for plugin in $arg_plugins
test -e "$plugin" && set plugin (realpath $plugin)
contains -- "$plugin" $new_plugins || set --append new_plugins $plugin
end

if set --query argv[2]
for plugin in $new_plugins
if contains -- "$plugin" $old_plugins
test "$cmd" = remove &&
set --append remove_plugins $plugin ||
set --append update_plugins $plugin
else if test "$cmd" = install
set --append install_plugins $plugin
else
echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1
end
end
else
for plugin in $new_plugins
contains -- "$plugin" $old_plugins &&
set --append update_plugins $plugin ||
set --append install_plugins $plugin
end

for plugin in $old_plugins
contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin
end
end

set --local pid_list
set --local source_plugins
set --local fetch_plugins $update_plugins $install_plugins
echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal)

for plugin in $fetch_plugins
set --local source (command mktemp -d)
set --append source_plugins $source

command mkdir -p $source/{completions,conf.d,functions}

fish --command "
if test -e $plugin
command cp -Rf $plugin/* $source
else
set temp (command mktemp -d)
set name (string split \@ $plugin) || set name[2] HEAD
set url https://codeload.github.com/\$name[1]/tar.gz/\$name[2]
echo Fetching (set_color --underline)\$url(set_color normal)
if curl --silent \$url | tar -xzC \$temp -f - 2>/dev/null
command cp -Rf \$temp/*/* $source
else
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
command rm -rf $source
end
command rm -rf \$temp
end
set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files
" &

set --append pid_list (jobs --last --pid)
end

wait $pid_list 2>/dev/null

for plugin in $fetch_plugins
if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source
if set --local index (contains --index -- "$plugin" $install_plugins)
set --erase install_plugins[$index]
else
set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)]
end
end
end

for plugin in $update_plugins $remove_plugins
if set --local index (contains --index -- "$plugin" $_fisher_plugins)
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files

if contains -- "$plugin" $remove_plugins
for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var)
emit {$name}_uninstall
end
printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var
end

command rm -rf $$plugin_files_var
functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var)

for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var)
complete --erase --command $name
end

set --erase _fisher_plugins[$index]
set --erase $plugin_files_var
end
end

if set --query update_plugins[1] || set --query install_plugins[1]
command mkdir -p $fisher_path/{functions,conf.d,completions}
end

for plugin in $update_plugins $install_plugins
set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)]
set --local files $source/{functions,conf.d,completions}/*

if set --local index (contains --index -- $plugin $install_plugins)
set --local user_files $fisher_path/{functions,conf.d,completions}/*
set --local conflict_files

for file in (string replace -- $source/ $fisher_path/ $files)
contains -- $file $user_files && set --append conflict_files $file
end

if set --query conflict_files[1] && set --erase install_plugins[$index]
echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2
continue
end
end

for file in (string replace -- $source/ "" $files)
command cp -Rf $source/$file $fisher_path/$file
end

set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files)

contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin
contains -- $plugin $install_plugins && set --local event install || set --local event update

printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var

for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var)
source $file
if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file)
emit {$name}_$event
end
end
end

command rm -rf $source_plugins

set --query _fisher_plugins[1] || set --erase _fisher_plugins
set --query _fisher_plugins &&
printf "%s\n" $_fisher_plugins >$fish_plugins ||
command rm -f $fish_plugins

set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins)
test "$total" != "0 0 0" && echo (string join ", " (
test $total[1] = 0 || echo "Installed $total[1]") (
test $total[2] = 0 || echo "Updated $total[2]") (
test $total[3] = 0 || echo "Removed $total[3]")
) plugin/s
case \*
echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1
end
end

## Migrations ##
function _fisher_fish_postexec --on-event fish_postexec
if functions --query _fisher_list
fisher update >/dev/null 2>/dev/null
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
test -e $XDG_DATA_HOME/fisher && command rm -rf $XDG_DATA_HOME/fisher
functions --erase _fisher_list _fisher_plugin_parse
set --erase fisher_data
end
functions --erase _fisher_fish_postexec
end
Loading

0 comments on commit f883cc7

Please sign in to comment.