mirror of
https://github.com/The-Repo-Club/DotFiles.git
synced 2024-11-25 00:38:20 -05:00
Added Fish
This commit is contained in:
parent
740cec820e
commit
65e4e73426
163
.config/fish/completions/bun.fish
Normal file
163
.config/fish/completions/bun.fish
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
# This is terribly complicated
|
||||||
|
# It's because:
|
||||||
|
# 1. bun run has to have dynamic completions
|
||||||
|
# 2. there are global options
|
||||||
|
# 3. bun {install add remove} gets special options
|
||||||
|
# 4. I don't know how to write fish completions well
|
||||||
|
# Contributions very welcome!!
|
||||||
|
|
||||||
|
function __fish__get_bun_bins
|
||||||
|
string split ' ' (bun getcompletes b)
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish__get_bun_scripts
|
||||||
|
set -lx SHELL bash
|
||||||
|
set -lx MAX_DESCRIPTION_LEN 40
|
||||||
|
string trim (string split '\n' (string split '\t' (bun getcompletes z)))
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish__get_bun_packages
|
||||||
|
if test (commandline -ct) != ""
|
||||||
|
set -lx SHELL fish
|
||||||
|
string split ' ' (bun getcompletes a (commandline -ct))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __history_completions
|
||||||
|
set -l tokens (commandline --current-process --tokenize)
|
||||||
|
history --prefix (commandline) | string replace -r \^$tokens[1]\\s\* "" | string replace -r \^$tokens[2]\\s\* "" | string split ' '
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish__get_bun_bun_js_files
|
||||||
|
string split ' ' (bun getcompletes j)
|
||||||
|
end
|
||||||
|
|
||||||
|
function bun_fish_is_nth_token --description 'Test if current token is on Nth place' --argument-names n
|
||||||
|
set -l tokens (commandline -poc)
|
||||||
|
set -l tokens (string replace -r --filter '^([^-].*)' '$1' -- $tokens)
|
||||||
|
test (count $tokens) -eq "$n"
|
||||||
|
end
|
||||||
|
|
||||||
|
function __bun_command_count --argument-names n
|
||||||
|
set -l cmds (commandline -poc)
|
||||||
|
|
||||||
|
test (count cmds) -eq "$n"
|
||||||
|
end
|
||||||
|
|
||||||
|
function __bun_last_cmd --argument-names n
|
||||||
|
set -l cmds (commandline -poc)
|
||||||
|
|
||||||
|
test "(cmds[-1])" = "$n"
|
||||||
|
end
|
||||||
|
|
||||||
|
set -l bun_install_boolean_flags yarn production optional development no-save dry-run force no-cache silent verbose global
|
||||||
|
set -l bun_install_boolean_flags_descriptions "Write a yarn.lock file (yarn v1)" "Don't install devDependencies" "Add dependency to optionalDependencies" "Add dependency to devDependencies" "Don't install devDependencies" "Don't install anything" "Always request the latest versions from the registry & reinstall all dependenices" "Ignore manifest cache entirely" "Don't output anything" "Excessively verbose logging" "Use global folder"
|
||||||
|
|
||||||
|
set -l bun_builtin_cmds dev create help bun upgrade discord run install remove add init link unlink pm x
|
||||||
|
set -l bun_builtin_cmds_without_run dev create help bun upgrade discord install remove add init pm x
|
||||||
|
set -l bun_builtin_cmds_without_bun dev create help upgrade run discord install remove add init pm x
|
||||||
|
set -l bun_builtin_cmds_without_create dev help bun upgrade discord run install remove add init pm x
|
||||||
|
set -l bun_builtin_cmds_without_install create dev help bun upgrade discord run remove add init pm x
|
||||||
|
set -l bun_builtin_cmds_without_remove create dev help bun upgrade discord run install add init pm x
|
||||||
|
set -l bun_builtin_cmds_without_add create dev help bun upgrade discord run remove install init pm x
|
||||||
|
set -l bun_builtin_cmds_without_pm create dev help bun upgrade discord run init pm x
|
||||||
|
|
||||||
|
# clear
|
||||||
|
complete -e -c bun
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a '(__fish__get_bun_scripts)' -d 'script'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from run" -a '(__fish__get_bun_bins)' -d 'package bin'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from run" -a '(__fish__get_bun_scripts)' -d 'script'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from run" -a '(__fish__get_bun_bun_js_files)' -d 'Bun.js'
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __fish_use_subcommand" -a 'run' -f -d 'Run a script or bin'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s 'u' -l 'origin' -r -d 'Server URL. Rewrites import paths'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s 'p' -l 'port' -r -d 'Port number to start server from'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s 'd' -l 'define' -r -d 'Substitute K:V while parsing, e.g. --define process.env.NODE_ENV:\"development\"'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s 'e' -l 'external' -r -d 'Exclude module from transpilation (can use * wildcards). ex: -e react'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -l 'use' -r -d 'Use a framework (ex: next)'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -l 'hot' -r -d 'Enable hot reloading in Bun\'s JavaScript runtime'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __fish_use_subcommand" -a 'dev' -d 'Start dev server'
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a 'create' -f -d 'Create a new project from a template'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_create next react; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from create;" -a 'next' -d 'new Next.js project'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_create next react; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from create;" -a 'react' -d 'new React project'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a 'upgrade' -d 'Upgrade bun to the latest version' -x
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a '--help' -d 'See all commands and flags' -x
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -l "version" -s "v" -a '--version' -d 'Bun\'s version' -x
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a 'discord' -d 'Open bun\'s Discord server' -x
|
||||||
|
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_bun; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); __fish_use_subcommand" -a 'bun' -d 'Generate a new bundle'
|
||||||
|
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_bun; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from bun" -F -d 'Bundle this'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_create; and not __fish_seen_subcommand_from (__fish__get_bun_bins); and not __fish_seen_subcommand_from (__fish__get_bun_scripts); and __fish_seen_subcommand_from react; or __fish_seen_subcommand_from next" -F -d "Create in directory"
|
||||||
|
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a 'init' -F -d 'Start an empty Bun project'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a 'install' -f -d 'Install packages from package.json'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a 'add' -F -d 'Add a package to package.json'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a 'remove' -F -d 'Remove a package from package.json'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand add remove" -F
|
||||||
|
|
||||||
|
|
||||||
|
for i in (seq (count $bun_install_boolean_flags))
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from install add remove;" -l "$bun_install_boolean_flags[$i]" -d "$bun_install_boolean_flags_descriptions[$i]"
|
||||||
|
end
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from install add remove;" -l 'cwd' -d 'Change working directory'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from install add remove;" -l 'cache-dir' -d 'Choose a cache directory (default: $HOME/.bun/install/cache)'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from add;" -d 'Popular' -a '(__fish__get_bun_packages)'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from add;" -d 'History' -a '(__history_completions)'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "__fish_seen_subcommand_from pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) cache;" -a 'bin ls cache hash hash-print hash-string' -f
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "__fish_seen_subcommand_from pm; and __fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts);" -a 'rm' -f
|
||||||
|
|
||||||
|
complete -c bun -n "not __fish_seen_subcommand_from $bun_builtin_cmds (__fish__get_bun_bins) (__fish__get_bun_scripts)" -a "$bun_builtin_cmds" -f
|
18
.config/fish/conf.d/00_profile.fish
Normal file
18
.config/fish/conf.d/00_profile.fish
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#-*-coding:utf-8 -*-
|
||||||
|
xset b off
|
||||||
|
if [ "$XDG_SESSION_TYPE" = x11 ]
|
||||||
|
setxkbmap -layout gb
|
||||||
|
setxkbmap -option caps:super
|
||||||
|
end
|
||||||
|
|
||||||
|
set -gx LC_ALL "en_GB.UTF-8"
|
||||||
|
set -gx ANDROID_HOME /home/wayne/Android/Sdk
|
||||||
|
set -gx PAGER more
|
||||||
|
set -gx AUR_PAGER more
|
||||||
|
set -gx EDITOR vim
|
||||||
|
#QT and GTK Variables
|
||||||
|
set -gx QT_QPA_PLATFORMTHEME qt5ct
|
||||||
|
set -gx QT_AUTO_SCREEN_SCALE_FACTOR 0
|
||||||
|
set -gx TDESKTOP_USE_GTK_FILE_DIALOG 1
|
||||||
|
|
||||||
|
set -gx GOPATH $HOME/.cache/go
|
5
.config/fish/conf.d/01_greeting.fish
Normal file
5
.config/fish/conf.d/01_greeting.fish
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# greeting for fish shell
|
||||||
|
|
||||||
|
function fish_greeting
|
||||||
|
# shellfetch
|
||||||
|
end
|
4
.config/fish/conf.d/01_keybinds.fish
Normal file
4
.config/fish/conf.d/01_keybinds.fish
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Keybinding
|
||||||
|
bind \ec __history_previous_command
|
||||||
|
bind \e\e __sudope
|
||||||
|
|
9
.config/fish/conf.d/02_cd-paths.fish
Normal file
9
.config/fish/conf.d/02_cd-paths.fish
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
set CDPATH "$HOME/.config:$CDPATH"
|
||||||
|
|
||||||
|
# Adds `~/.local/bin` to $CDPATH
|
||||||
|
# set CDPATH so it includes user's private bin if it exists
|
||||||
|
if test -d "$HOME/.local/bin"
|
||||||
|
set CDPATH "$HOME/.local/bin:$CDPATH"
|
||||||
|
end
|
||||||
|
|
||||||
|
set CDPATH $(printf %s "$CDPATH" | awk -vRS=: '!a[$0]++' | paste -s -d:)
|
83
.config/fish/conf.d/02_paths.fish
Normal file
83
.config/fish/conf.d/02_paths.fish
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
set PATH "$HOME/.local/bin:$PATH"
|
||||||
|
|
||||||
|
|
||||||
|
# Adds `/opt/flutter/bin` to $PATH
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if test -d "/opt/flutter/bin"
|
||||||
|
set PATH "/opt/flutter/bin:$PATH"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Adds `ANDROID_HOME/tools` to $PATH
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if test -d "$ANDROID_HOME/tools"
|
||||||
|
set PATH "$ANDROID_HOME/tools:$PATH"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Adds `ANDROID_HOME/tools/bin` to $PATH
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if test -d "$ANDROID_HOME/tools/bin"
|
||||||
|
set PATH "$ANDROID_HOME/tools/bin:$PATH"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Adds `ANDROID_HOME/platform-tools` to $PATH
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if test -d "$ANDROID_HOME/platform-tools"
|
||||||
|
set PATH "$ANDROID_HOME/platform-tools:$PATH"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Adds `~/.config/composer/vendor/bin` to $PATH
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if test -d "$HOME/.config/composer/vendor/bin"
|
||||||
|
set PATH "$HOME/.config/composer/vendor/bin:$PATH"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Adds `~/.local/share/gem/ruby/3.0.0/bin` to $PATH
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if test -d "$HOME/.local/share/gem/ruby/3.0.0/bin"
|
||||||
|
set GEM_HOME "$HOME/.local/share/gem/ruby/3.0.0"
|
||||||
|
set PATH "$HOME/.local/share/gem/ruby/3.0.0/bin:$PATH"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Adds `~/.cargo/bin` to $PATH
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if test -d "$HOME/.cargo/bin"
|
||||||
|
set PATH "$HOME/.cargo/bin:$PATH"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Adds `~/.local/bin/flexiflow_bar` to $PATH
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if test -d "$HOME/.local/bin/flexiflow_bar"
|
||||||
|
set PATH "$HOME/.local/bin/flexiflow_bar:$PATH"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Adds `~/.local/bin/rofi` to $PATH
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if test -d "$HOME/.local/bin/rofi"
|
||||||
|
set PATH "$HOME/.local/bin/rofi:$PATH"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Adds `~/.local/bin/fzf` to $PATH
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if test -d "$HOME/.local/bin/fzf"
|
||||||
|
set PATH "$HOME/.local/bin/fzf:$PATH"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Adds `~/.local/bin/lemonbar` to $PATH
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if test -d "$HOME/.local/bin/lemonbar"
|
||||||
|
set PATH "$HOME/.local/bin/lemonbar:$PATH"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Adds `~/.local/bin/discord_bot` to $PATH
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if test -d "$HOME/.local/bin/discord_bot"
|
||||||
|
set PATH "$HOME/.local/bin/discord_bot:$PATH"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Adds `~/.local/bin/clipmenu` to $PATH
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if test -d "$HOME/.local/bin/clipmenu"
|
||||||
|
set PATH "$HOME/.local/bin/clipmenu:$PATH"
|
||||||
|
end
|
||||||
|
|
||||||
|
set PATH $(printf %s "$PATH" | awk -vRS=: '!a[$0]++' | paste -s -d:)
|
50
.config/fish/conf.d/08_minimal-mistakes.fish
Normal file
50
.config/fish/conf.d/08_minimal-mistakes.fish
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# Dracula Color Palette
|
||||||
|
set -l foreground e5e9f0
|
||||||
|
set -l selection 434c5e
|
||||||
|
set -l comment 81a1c1
|
||||||
|
set -l red ff5959
|
||||||
|
set -l orange ff9c59
|
||||||
|
set -l yellow ffff59
|
||||||
|
set -l green 59ff59
|
||||||
|
set -l purple 9059ff
|
||||||
|
set -l cyan 59fff9
|
||||||
|
set -l pink ff59f9
|
||||||
|
|
||||||
|
# Syntax Highlighting Colors
|
||||||
|
set -gx fish_color_normal $foreground
|
||||||
|
set -gx fish_color_command $cyan
|
||||||
|
set -gx fish_color_keyword $pink
|
||||||
|
set -gx fish_color_quote $yellow
|
||||||
|
set -gx fish_color_redirection $foreground
|
||||||
|
set -gx fish_color_end $orange
|
||||||
|
set -gx fish_color_error $red
|
||||||
|
set -gx fish_color_param $purple
|
||||||
|
set -gx fish_color_comment $comment
|
||||||
|
set -gx fish_color_selection --background=$selection
|
||||||
|
set -gx fish_color_search_match --background=$selection
|
||||||
|
set -gx fish_color_operator $green
|
||||||
|
set -gx fish_color_escape $pink
|
||||||
|
set -gx fish_color_autosuggestion $comment
|
||||||
|
set -gx fish_color_cancel $red --reverse
|
||||||
|
set -gx fish_color_option $orange
|
||||||
|
|
||||||
|
# Default Prompt Colors
|
||||||
|
set -gx fish_color_cwd $green
|
||||||
|
set -gx fish_color_host $purple
|
||||||
|
set -gx fish_color_host_remote $purple
|
||||||
|
set -gx fish_color_user $cyan
|
||||||
|
|
||||||
|
# Completion Pager Colors
|
||||||
|
set -gx fish_pager_color_progress $comment
|
||||||
|
set -gx fish_pager_color_background
|
||||||
|
set -gx fish_pager_color_prefix $cyan
|
||||||
|
set -gx fish_pager_color_completion $foreground
|
||||||
|
set -gx fish_pager_color_description $comment
|
||||||
|
set -gx fish_pager_color_selected_background --background=$selection
|
||||||
|
set -gx fish_pager_color_selected_prefix $cyan
|
||||||
|
set -gx fish_pager_color_selected_completion $foreground
|
||||||
|
set -gx fish_pager_color_selected_description $comment
|
||||||
|
set -gx fish_pager_color_secondary_background
|
||||||
|
set -gx fish_pager_color_secondary_prefix $cyan
|
||||||
|
set -gx fish_pager_color_secondary_completion $foreground
|
||||||
|
set -gx fish_pager_color_secondary_description $comment
|
35
.config/fish/conf.d/09_sudo_prompt.fish
Normal file
35
.config/fish/conf.d/09_sudo_prompt.fish
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Description
|
||||||
|
# -----------
|
||||||
|
#
|
||||||
|
# sudo prompt in color
|
||||||
|
#
|
||||||
|
function sudo
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Setup colors
|
||||||
|
#Bold Colors
|
||||||
|
set -l bnormal (set_color -o normal)
|
||||||
|
set -l bblack (set_color -o brblack)
|
||||||
|
set -l bred (set_color -o brred)
|
||||||
|
set -l bgreen (set_color -o brgreen)
|
||||||
|
set -l byellow (set_color -o bryellow)
|
||||||
|
set -l bblue (set_color -o brblue)
|
||||||
|
set -l bmagenta (set_color -o brmagenta)
|
||||||
|
set -l bcyan (set_color -o brcyan)
|
||||||
|
set -l bwhite (set_color -o brwhite)
|
||||||
|
|
||||||
|
#Normal Colors
|
||||||
|
set -l normal (set_color normal)
|
||||||
|
set -l black (set_color black)
|
||||||
|
set -l red (set_color red)
|
||||||
|
set -l green (set_color green)
|
||||||
|
set -l yellow (set_color yellow)
|
||||||
|
set -l blue (set_color blue)
|
||||||
|
set -l magenta (set_color magenta)
|
||||||
|
set -l cyan (set_color cyan)
|
||||||
|
set -l white (set_color white)
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
command sudo -p "$red$yellow [sudo]$green password for %u: $normal" $argv
|
||||||
|
end
|
9
.config/fish/config.fish
Normal file
9
.config/fish/config.fish
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export MICRO_TRUECOLOR=1
|
||||||
|
|
||||||
|
for plugins in "$HOME/.config/fish/plugins/"*
|
||||||
|
source $plugins
|
||||||
|
end
|
||||||
|
|
||||||
|
for functions in "$HOME/.config/fish/functions/"*
|
||||||
|
source $functions
|
||||||
|
end
|
8
.config/fish/fish_variables
Normal file
8
.config/fish/fish_variables
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# This file contains fish universal variable definitions.
|
||||||
|
# VERSION: 3.0
|
||||||
|
SETUVAR __fish_initialized:3400
|
||||||
|
SETUVAR fish_color_cwd_root:red
|
||||||
|
SETUVAR fish_color_history_current:\x2d\x2dbold
|
||||||
|
SETUVAR fish_color_status:red
|
||||||
|
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||||
|
SETUVAR fish_key_bindings:fish_default_key_bindings
|
60
.config/fish/functions/99_commands.fish
Normal file
60
.config/fish/functions/99_commands.fish
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# Unlock user from passwords
|
||||||
|
function ulock --description 'alias ulock="faillock --reset"'
|
||||||
|
command faillock --reset
|
||||||
|
end
|
||||||
|
|
||||||
|
# Check ports for current user
|
||||||
|
function ports --description 'alias ports="sudo netstat -tulanp"'
|
||||||
|
command sudo netstat -tulanp
|
||||||
|
end
|
||||||
|
|
||||||
|
# Set permissions for user
|
||||||
|
function setperm
|
||||||
|
command sudo chown $USER:$USER $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
# Stow commands
|
||||||
|
function stowadd
|
||||||
|
command stow -St ~ $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function stowremove
|
||||||
|
command stow -Dt ~ $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
# Clear command
|
||||||
|
function clear
|
||||||
|
command reset && shellfetch
|
||||||
|
end
|
||||||
|
|
||||||
|
# free
|
||||||
|
function free
|
||||||
|
command free -mt
|
||||||
|
end
|
||||||
|
|
||||||
|
# continue download
|
||||||
|
function wget
|
||||||
|
command wget -c $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
# grub update
|
||||||
|
function update-grub
|
||||||
|
command sudo grub-mkconfig -o /boot/grub/grub.cfg
|
||||||
|
end
|
||||||
|
|
||||||
|
# add new fonts
|
||||||
|
function update-fc
|
||||||
|
command fc-cache -fv
|
||||||
|
end
|
||||||
|
|
||||||
|
function clear-qtile
|
||||||
|
echo "No errors found." >~/.local/share/qtile/qtile.log
|
||||||
|
end
|
||||||
|
|
||||||
|
function reload
|
||||||
|
source ~/.config/fish/config.fish
|
||||||
|
end
|
||||||
|
|
||||||
|
function dotfiles
|
||||||
|
command git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $argv
|
||||||
|
end
|
28
.config/fish/functions/99_exa.fish
Normal file
28
.config/fish/functions/99_exa.fish
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#list comamnds
|
||||||
|
function l
|
||||||
|
exa $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function ls
|
||||||
|
exa $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function la
|
||||||
|
ls -a
|
||||||
|
end
|
||||||
|
|
||||||
|
function ll
|
||||||
|
ls -l
|
||||||
|
end
|
||||||
|
|
||||||
|
function lla
|
||||||
|
ls -la
|
||||||
|
end
|
||||||
|
|
||||||
|
function lt
|
||||||
|
ls --tree
|
||||||
|
end
|
||||||
|
|
||||||
|
function lg
|
||||||
|
ls -a | grep -E $argv
|
||||||
|
end
|
110
.config/fish/functions/99_git.fish
Normal file
110
.config/fish/functions/99_git.fish
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
#github commands
|
||||||
|
function g
|
||||||
|
git $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gadd
|
||||||
|
git add $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gbranch
|
||||||
|
git branch $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gcommit
|
||||||
|
git commit -S -v $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gcommitmsg
|
||||||
|
git commit -S -m $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gclone
|
||||||
|
git clone $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gclean
|
||||||
|
git clean -id $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gdiff
|
||||||
|
git diff $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gfetch
|
||||||
|
git fetch $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function ghelp
|
||||||
|
git help $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gpull
|
||||||
|
git pull $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gmerge
|
||||||
|
git merge $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gpush
|
||||||
|
git push $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gremote
|
||||||
|
git remote $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function grebase
|
||||||
|
git rebase $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function grevert
|
||||||
|
git revert $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function greset
|
||||||
|
git reset $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function grm
|
||||||
|
git rm $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gremote
|
||||||
|
git remote remove $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function grestore
|
||||||
|
git restore $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function greset
|
||||||
|
git reset -- $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gbackup
|
||||||
|
git reset --soft HEAD~1
|
||||||
|
end
|
||||||
|
|
||||||
|
function gcleanup
|
||||||
|
git fetch --prune --prune-tags origin
|
||||||
|
git remote prune origin
|
||||||
|
git pull
|
||||||
|
end
|
||||||
|
|
||||||
|
function gshow
|
||||||
|
git show $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gstatus
|
||||||
|
git status $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gstash
|
||||||
|
git stash $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function gall
|
||||||
|
gpull && gadd . && gcommit -s && gpush
|
||||||
|
end
|
48
.config/fish/functions/99_pacman.fish
Normal file
48
.config/fish/functions/99_pacman.fish
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
# pacman functions
|
||||||
|
function pacman
|
||||||
|
set yellow "\033[0;33m"
|
||||||
|
set end "\033[0m"
|
||||||
|
|
||||||
|
set num 1
|
||||||
|
while test -f /var/lib/pacman/db.lck
|
||||||
|
if test $num -eq 1
|
||||||
|
printf "$yellow->$end %s\n" "/var/lib/pacman/db.lck is present."
|
||||||
|
printf "$yellow->$end %s\n" "There may be another Pacman instance running. Waiting..."
|
||||||
|
set num 2
|
||||||
|
end
|
||||||
|
sleep 2 &
|
||||||
|
wait $last_pid
|
||||||
|
end
|
||||||
|
|
||||||
|
if [ "$argv" = -c ]
|
||||||
|
if pacman -Qttdq
|
||||||
|
command sudo pacman --color auto -Qttdq | command sudo pacman --color auto -Rns -
|
||||||
|
end
|
||||||
|
else if [ "$argv" = --upall ]
|
||||||
|
sudo pikaur -Syu
|
||||||
|
auracle update -C ~/.cache/pkgs/
|
||||||
|
else if [ "$argv" = --pacsync ]
|
||||||
|
pacsync
|
||||||
|
else
|
||||||
|
command sudo pacman --color auto $argv
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Update all packages
|
||||||
|
function upall
|
||||||
|
pacman --upall
|
||||||
|
end
|
||||||
|
|
||||||
|
#check aur and arch packages
|
||||||
|
function checkarch
|
||||||
|
command sudo pacman -Qqen >~/package_list.txt
|
||||||
|
end
|
||||||
|
|
||||||
|
function checkaur
|
||||||
|
command sudo pacman -Qqem >~/package_list_aur.txt
|
||||||
|
end
|
||||||
|
|
||||||
|
# Pacman unlock
|
||||||
|
function unlock
|
||||||
|
sudo rm /var/lib/pacman/db.lck
|
||||||
|
end
|
49
.config/fish/functions/99_repos.fish
Normal file
49
.config/fish/functions/99_repos.fish
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# arch repo commands
|
||||||
|
|
||||||
|
function updaterepo
|
||||||
|
while true
|
||||||
|
read -l -P "Are you sure you want to update arch repo? [y/N] " confirm
|
||||||
|
|
||||||
|
switch $confirm
|
||||||
|
case Y y
|
||||||
|
cd /run/media/wayne/Backup/.gitlabs/ArchLinux.Repo.063240.xyz/scripts/
|
||||||
|
python mkindex.py --header "arch.linuxrepos.org" ../x86_64 >../x86_64/index.html
|
||||||
|
cd /run/media/wayne/Backup/.gitlabs/ArchLinux.Repo.063240.xyz/
|
||||||
|
./x86_64/updaterepo.sh $argv
|
||||||
|
cd $dirprev[1]
|
||||||
|
echoResponce "Arch repo has been updated."
|
||||||
|
return
|
||||||
|
case "" N n
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function updatereadme
|
||||||
|
while true
|
||||||
|
read -l -P "Are you sure you want to update arch readme? [y/N] " confirm
|
||||||
|
|
||||||
|
switch $confirm
|
||||||
|
case Y y
|
||||||
|
cd /run/media/wayne/Backup/.gitlabs/ArchLinux.Repo.063240.xyz/scripts/
|
||||||
|
python updatereadme.py
|
||||||
|
cd $dirprev[1]
|
||||||
|
cd /run/media/wayne/Backup/.gitlabs/ArchLinux.Repo.063240.xyz/x86_64/
|
||||||
|
python updatereadme.py
|
||||||
|
cd $dirprev[1]
|
||||||
|
echoResponce "Arch readme has been updated."
|
||||||
|
return
|
||||||
|
case "" N n
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function echoResponce
|
||||||
|
set_color 0F0
|
||||||
|
echo -n "✔ "
|
||||||
|
set_color FF0
|
||||||
|
echo -n " $argv "
|
||||||
|
set_color 0F0
|
||||||
|
echo -e " ✔"
|
||||||
|
end
|
16
.config/fish/functions/99_rsync.fish
Normal file
16
.config/fish/functions/99_rsync.fish
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#rsync commands
|
||||||
|
function rsync-move
|
||||||
|
rsync -avz --progress -h --remove-source-files $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function rsync-synchronize
|
||||||
|
rsync -avzu --delete --progress -h $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function rsync-update
|
||||||
|
rsync -avzu --progress -h $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function rsync-copy
|
||||||
|
rsync -avz --progress -h $argv
|
||||||
|
end
|
5
.config/fish/functions/99_ssh.fish
Normal file
5
.config/fish/functions/99_ssh.fish
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# ssh commands
|
||||||
|
|
||||||
|
function chris
|
||||||
|
ssh linknsync@213.246.150.150
|
||||||
|
end
|
20
.config/fish/functions/99_youtube.fish
Normal file
20
.config/fish/functions/99_youtube.fish
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#youtube-dl commands
|
||||||
|
function yta-aac
|
||||||
|
youtube-dl --extract-audio --audio-format aac $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function yta-best
|
||||||
|
youtube-dl --extract-audio --audio-format best $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function yta-m4a
|
||||||
|
youtube-dl --extract-audio --audio-format m4a $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function yta-mp3
|
||||||
|
youtube-dl --extract-audio --audio-format mp3 $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function yta-wav
|
||||||
|
youtube-dl --extract-audio --audio-format wav $argv
|
||||||
|
end
|
285
.config/fish/plugins/__fish_command_not_found.fish
Normal file
285
.config/fish/plugins/__fish_command_not_found.fish
Normal file
@ -0,0 +1,285 @@
|
|||||||
|
# If an old handler already exists, defer to that.
|
||||||
|
# Print to stderr
|
||||||
|
function _cnf_print
|
||||||
|
echo -e 1>&2 $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
set _cnf_action
|
||||||
|
set _cnf_askfirst false
|
||||||
|
set _cnf_force_su false
|
||||||
|
set _cnf_noprompt false
|
||||||
|
set _cnf_noupdate false
|
||||||
|
set _cnf_verbose true
|
||||||
|
|
||||||
|
set _cnf_actions install info "list files" "list files (paged)"
|
||||||
|
|
||||||
|
# Parse options
|
||||||
|
for opt in $argv
|
||||||
|
switch "$opt"
|
||||||
|
case askfirst
|
||||||
|
set _cnf_askfirst true
|
||||||
|
case noprompt
|
||||||
|
set _cnf_noprompt true
|
||||||
|
case noupdate
|
||||||
|
set _cnf_noupdate true
|
||||||
|
case su
|
||||||
|
set _cnf_force_su true
|
||||||
|
case quiet
|
||||||
|
set _cnf_verbose false
|
||||||
|
case install
|
||||||
|
set _cnf_action "$_cnf_actions[1]"
|
||||||
|
case info
|
||||||
|
set _cnf_action "$_cnf_actions[2]"
|
||||||
|
case list_files
|
||||||
|
set _cnf_action "$_cnf_actions[3]"
|
||||||
|
case list_files_paged
|
||||||
|
set _cnf_action "$_cnf_actions[4]"
|
||||||
|
case '*'
|
||||||
|
_cnf_print "fish: unknown option: $opt"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function _cnf_pacman_db_path
|
||||||
|
set db_path (sed -n '/^DBPath[[:space:]]*=/{s/^[^=]*=[[:space:]]*\(.*[^[:space:]]\)[[:space:]]*/\1/p;q}' /etc/pacman.conf)
|
||||||
|
if test -z "$db_path"
|
||||||
|
set db_path /var/lib/pacman
|
||||||
|
end
|
||||||
|
echo "$db_path/sync"
|
||||||
|
end
|
||||||
|
|
||||||
|
function _cnf_asroot
|
||||||
|
if test (id -u) -ne 0
|
||||||
|
if $_cnf_force_su
|
||||||
|
su -c "$argv"
|
||||||
|
else
|
||||||
|
sudo $argv
|
||||||
|
end
|
||||||
|
else
|
||||||
|
$argv
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function _cnf_prompt_yn --argument-name prompt
|
||||||
|
read --prompt="echo \"fish: $prompt [Y/n] \"" result
|
||||||
|
or kill -s INT $fish_pid
|
||||||
|
switch "$result"
|
||||||
|
case 'y*' 'Y*' ''
|
||||||
|
return 0
|
||||||
|
case '*'
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if $_cnf_noupdate
|
||||||
|
function _cnf_need_to_update_files
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
function _cnf_need_to_update_files
|
||||||
|
set dir "$argv[1]"
|
||||||
|
set db_path (_cnf_pacman_db_path)
|
||||||
|
if test (find "$db_path" -type f -maxdepth 2 -name "*.db" 2>/dev/null | wc -l) -eq 0
|
||||||
|
if _cnf_prompt_yn "No pacman db files in '$db_path', refresh?"
|
||||||
|
_cnf_asroot pacman -Sy >&2
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if test (find "$dir" -type f -maxdepth 2 -name "*.files" 2>/dev/null | wc -l) -eq 0
|
||||||
|
set old_files all
|
||||||
|
else
|
||||||
|
set newest_files (/usr/bin/ls -t "$dir"/*.files | head -n 1)
|
||||||
|
set newest_pacman_db (/usr/bin/ls -t "$db_path"/*.db | head -n 1)
|
||||||
|
set old_files (find "$newest_pacman_db" -newer "$newest_files")
|
||||||
|
end
|
||||||
|
if test -n "$old_files"
|
||||||
|
_cnf_prompt_yn "$dir/*.files are out of date, update?"
|
||||||
|
return $status
|
||||||
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function _cnf_command_packages
|
||||||
|
set cmd "$argv[1]"
|
||||||
|
if type pkgfile >/dev/null 2>/dev/null
|
||||||
|
set cache (pkgfile --help | sed -n 's/.*--cachedir.*default:[[:space:]]*\(.*\))$/\1/p')
|
||||||
|
if test -z "$cache"
|
||||||
|
set cache /var/cache/pkgfile
|
||||||
|
end
|
||||||
|
|
||||||
|
if _cnf_need_to_update_files "$cache"
|
||||||
|
_cnf_asroot pkgfile --update >&2
|
||||||
|
end
|
||||||
|
pkgfile --binaries -- "$cmd" 2>/dev/null
|
||||||
|
else
|
||||||
|
set pacman_version (pacman -Q pacman 2>/dev/null | awk -F'[ -]' '{print $2}')
|
||||||
|
set args -Fq
|
||||||
|
if test (vercmp "$pacman_version" "5.2.0") -lt 0
|
||||||
|
set args "$args"o
|
||||||
|
end
|
||||||
|
set db_path (_cnf_pacman_db_path)
|
||||||
|
if _cnf_need_to_update_files "$db_path"
|
||||||
|
_cnf_asroot pacman -Fy >&2
|
||||||
|
end
|
||||||
|
pacman $args "/usr/bin/$cmd" 2>/dev/null
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function _cnf_package_files
|
||||||
|
set package "$argv[1]"
|
||||||
|
if type pkgfile >/dev/null 2>/dev/null
|
||||||
|
pkgfile --list "$package" | sed 's/[^[:space:]]*[[:space:]]*//'
|
||||||
|
else
|
||||||
|
pacman -Flq "$package"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Don't show pre-search warning if 'quiet' option is not set
|
||||||
|
if $_cnf_verbose
|
||||||
|
function _cnf_pre_search_warn
|
||||||
|
set cmd "$argv[1]"
|
||||||
|
_cnf_print "fish: \"$cmd\" is not found locally, searching in repositories..."
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
else
|
||||||
|
function _cnf_pre_search_warn
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if $_cnf_askfirst
|
||||||
|
# When askfirst is given, override default verbose behavior
|
||||||
|
function _cnf_pre_search_warn
|
||||||
|
set cmd "$argv[1]"
|
||||||
|
_cnf_prompt_yn "\"$cmd\" is not found locally, search in repositories?"
|
||||||
|
return $status
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function _cnf_cmd_not_found
|
||||||
|
set cmd "$argv[1]"
|
||||||
|
_cnf_print "fish: command not found: \"$cmd\""
|
||||||
|
return 127
|
||||||
|
end
|
||||||
|
|
||||||
|
# Without installation prompt
|
||||||
|
if $_cnf_noprompt
|
||||||
|
function fish_command_not_found
|
||||||
|
set cmd "$argv[1]"
|
||||||
|
_cnf_pre_search_warn "$cmd" || return 127
|
||||||
|
set packages (_cnf_command_packages "$cmd")
|
||||||
|
switch (count $packages)
|
||||||
|
case 0
|
||||||
|
_cnf_cmd_not_found "$cmd"
|
||||||
|
case 1
|
||||||
|
_cnf_print "fish: \"$cmd\" may be found in package \"$packages\""
|
||||||
|
case '*'
|
||||||
|
_cnf_print "fish: \"$cmd\" may be found in the following packages:"
|
||||||
|
for package in $packages
|
||||||
|
_cnf_print "\t$package"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# With installation prompt (default)
|
||||||
|
function _cnf_check_fzf
|
||||||
|
if ! which fzf >/dev/null 2>/dev/null
|
||||||
|
if _cnf_prompt_yn "Gathering input requires 'fzf', install it?"
|
||||||
|
_cnf_asroot pacman -S fzf
|
||||||
|
end
|
||||||
|
if ! which fzf >/dev/null 2>/dev/null
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function fish_command_not_found
|
||||||
|
set cmd "$argv[1]"
|
||||||
|
set scroll_header "Shift up or down to scroll the preview"
|
||||||
|
_cnf_pre_search_warn "$cmd" || return 127
|
||||||
|
set packages (_cnf_command_packages "$cmd")
|
||||||
|
switch (count $packages)
|
||||||
|
case 0
|
||||||
|
_cnf_cmd_not_found "$cmd"
|
||||||
|
case 1
|
||||||
|
function _cnf_prompt_install
|
||||||
|
set packages "$argv[1]"
|
||||||
|
if _cnf_prompt_yn "Would you like to install '$packages'?"
|
||||||
|
_cnf_asroot pacman -S "$packages"
|
||||||
|
else
|
||||||
|
return 127
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
set action
|
||||||
|
if test -z "$_cnf_action"
|
||||||
|
set may_be_found "\"$cmd\" may be found in package \"$packages\""
|
||||||
|
_cnf_print "fish: $may_be_found"
|
||||||
|
if _cnf_check_fzf
|
||||||
|
set package_files (_cnf_package_files "$packages" | string collect)
|
||||||
|
set package_info (pacman -Si "$packages" | string collect)
|
||||||
|
set action (printf "%s\n" $_cnf_actions | \
|
||||||
|
fzf --preview "echo {} | grep -q '^list' && echo '$package_files' \
|
||||||
|
|| echo '$package_info'" \
|
||||||
|
--prompt "Action (\"esc\" to abort):" \
|
||||||
|
--header "$may_be_found
|
||||||
|
$scroll_header")
|
||||||
|
else
|
||||||
|
return 127
|
||||||
|
end
|
||||||
|
else
|
||||||
|
set action "$_cnf_action"
|
||||||
|
end
|
||||||
|
|
||||||
|
switch "$action"
|
||||||
|
case install
|
||||||
|
_cnf_asroot pacman -S "$packages"
|
||||||
|
case info
|
||||||
|
pacman -Si "$packages"
|
||||||
|
_cnf_prompt_install "$packages"
|
||||||
|
case 'list files'
|
||||||
|
_cnf_package_files "$packages"
|
||||||
|
_cnf_prompt_install "$packages"
|
||||||
|
case 'list files (paged)'
|
||||||
|
test -z "$pager" && set --local pager less
|
||||||
|
_cnf_package_files "$packages" | "$pager"
|
||||||
|
_cnf_prompt_install "$packages"
|
||||||
|
case '*'
|
||||||
|
return 127
|
||||||
|
end
|
||||||
|
case '*'
|
||||||
|
set package
|
||||||
|
_cnf_print "fish: \"$cmd\" may be found in the following packages:"
|
||||||
|
for package in $packages
|
||||||
|
_cnf_print "\t$package"
|
||||||
|
end
|
||||||
|
if _cnf_check_fzf
|
||||||
|
set package (printf "%s\n" $packages | \
|
||||||
|
fzf --bind="tab:preview(type pkgfile >/dev/null 2>/dev/null && \
|
||||||
|
pkgfile --list {} | sed 's/[^[:space:]]*[[:space:]]*//' || \
|
||||||
|
pacman -Flq {})" \
|
||||||
|
--preview "pacman -Si {}" \
|
||||||
|
--header "Press \"tab\" to view files
|
||||||
|
$scroll_header" \
|
||||||
|
--prompt "Select a package to install (\"esc\" to abort):")
|
||||||
|
else
|
||||||
|
return 127
|
||||||
|
end
|
||||||
|
if test -n "$package"
|
||||||
|
_cnf_asroot pacman -S "$package"
|
||||||
|
else
|
||||||
|
return 127
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish_command_not_found_handler \
|
||||||
|
--on-event fish_command_not_found
|
||||||
|
fish_command_not_found "$argv"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Clean up environment
|
||||||
|
set -e opt _cnf_askfirst _cnf_noprompt _cnf_noupdate _cnf_verbose
|
57
.config/fish/plugins/__fish_prompt.fish
Normal file
57
.config/fish/plugins/__fish_prompt.fish
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
function fish_prompt
|
||||||
|
# Setup colors
|
||||||
|
#Bold Colors
|
||||||
|
set -l bnormal (set_color -o normal)
|
||||||
|
set -l bblack (set_color -o brblack)
|
||||||
|
set -l bred (set_color -o brred)
|
||||||
|
set -l bgreen (set_color -o brgreen)
|
||||||
|
set -l byellow (set_color -o bryellow)
|
||||||
|
set -l bblue (set_color -o brblue)
|
||||||
|
set -l bmagenta (set_color -o brmagenta)
|
||||||
|
set -l bcyan (set_color -o brcyan)
|
||||||
|
set -l bwhite (set_color -o brwhite)
|
||||||
|
|
||||||
|
#Normal Colors
|
||||||
|
set -l normal (set_color normal)
|
||||||
|
set -l black (set_color black)
|
||||||
|
set -l red (set_color red)
|
||||||
|
set -l green (set_color green)
|
||||||
|
set -l yellow (set_color yellow)
|
||||||
|
set -l blue (set_color blue)
|
||||||
|
set -l magenta (set_color magenta)
|
||||||
|
set -l cyan (set_color cyan)
|
||||||
|
set -l white (set_color white)
|
||||||
|
|
||||||
|
set -g fish_prompt_pwd_dir_length 3
|
||||||
|
# Cache exit status
|
||||||
|
set -l last_status $status
|
||||||
|
|
||||||
|
# Just calculate these once, to save a few cycles when displaying the prompt
|
||||||
|
if not set -q __fish_prompt_hostname
|
||||||
|
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
|
||||||
|
end
|
||||||
|
if not set -q __fish_prompt_char
|
||||||
|
switch (id -u)
|
||||||
|
case 0
|
||||||
|
set -g __fish_prompt_char \u276f\u276f
|
||||||
|
case '*'
|
||||||
|
set -g __fish_prompt_char $bgreen''$bmagenta''$bred''$byellow''$bblue''$bcyan''
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Configure __fish_git_prompt
|
||||||
|
set -g __fish_git_prompt_show_informative_status true
|
||||||
|
set -g __fish_git_prompt_showcolorhints true
|
||||||
|
|
||||||
|
# Color prompt char red for non-zero exit status
|
||||||
|
set -l pcolor $bpurple
|
||||||
|
if [ $last_status -ne 0 ]
|
||||||
|
set pcolor $bred
|
||||||
|
end
|
||||||
|
|
||||||
|
# Top
|
||||||
|
echo -n $bred"["$byellow"$USER"$bgreen"@"$bblue"$__fish_prompt_hostname"$bnormal $bred(prompt_pwd)"]" $normal(fish_vcs_prompt)
|
||||||
|
|
||||||
|
# Bottom
|
||||||
|
echo -e "\n$__fish_prompt_char $normal"
|
||||||
|
end
|
4
.config/fish/plugins/__history_previous_command.fish
Normal file
4
.config/fish/plugins/__history_previous_command.fish
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
function __history_previous_command
|
||||||
|
commandline -t $history[1]
|
||||||
|
commandline -f repaint
|
||||||
|
end
|
54
.config/fish/plugins/__sudope.fish
Normal file
54
.config/fish/plugins/__sudope.fish
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
function __sudope -d "Quickly toggle sudo prefix"
|
||||||
|
|
||||||
|
# Save the current command line and cursor position.
|
||||||
|
set -l command_buffer (commandline)
|
||||||
|
set -l cursor_position (commandline -C)
|
||||||
|
|
||||||
|
# If the command line is empty, pull the last command from history.
|
||||||
|
if test -z "$command_buffer"
|
||||||
|
set command_buffer $history[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Parse the command line (first line only).
|
||||||
|
set -l command_parts (string match -ir '^(\s*)(sudo(\s+|$))?(.*)' $command_buffer[1])
|
||||||
|
|
||||||
|
# Handle multiline commands with extra care.
|
||||||
|
set -l command_lines_count (count $command_buffer)
|
||||||
|
test $command_lines_count -gt 1
|
||||||
|
and set -l command_rest $command_buffer[2..$command_lines_count]
|
||||||
|
|
||||||
|
switch (count $command_parts)
|
||||||
|
case 3
|
||||||
|
# No "sudo".
|
||||||
|
|
||||||
|
# Add "sudo" to the beginning of the command, after any leading whitespace (if present).
|
||||||
|
commandline -r (string join \n (string join '' $command_parts[2] 'sudo ' $command_parts[3]) $command_rest)
|
||||||
|
|
||||||
|
# Push the cursor position ahead if necessary (+5 for 'sudo ').
|
||||||
|
test $cursor_position -ge (string length -- "$command_parts[2]")
|
||||||
|
and set cursor_position (math $cursor_position+5)
|
||||||
|
|
||||||
|
# Place the cursor where it was (or where it should be).
|
||||||
|
commandline -C $cursor_position
|
||||||
|
|
||||||
|
case 5
|
||||||
|
# "sudo" is present in the beginning of the command.
|
||||||
|
|
||||||
|
# Remove "sudo", leave any leading whitespace (if present).
|
||||||
|
commandline -r (string join \n (string join '' $command_parts[2 5]) $command_rest)
|
||||||
|
|
||||||
|
# Push the cursor position back if appropriate ('sudo' and whitespace).
|
||||||
|
set -l lead_length (string length -- "$command_parts[2]")
|
||||||
|
set -l sudo_length (string length -- "$command_parts[3]")
|
||||||
|
if test $cursor_position -ge (math $lead_length+$sudo_length)
|
||||||
|
# The cursor was after "sudo".
|
||||||
|
set cursor_position (math $cursor_position-$sudo_length)
|
||||||
|
else if test $cursor_position -ge $lead_length
|
||||||
|
# The cursor was somewhere on "sudo".
|
||||||
|
set cursor_position $lead_length
|
||||||
|
end
|
||||||
|
|
||||||
|
# Place the cursor where it was (or where it should be).
|
||||||
|
commandline -C -- $cursor_position
|
||||||
|
end
|
||||||
|
end
|
4
.config/fish/plugins/__sync_history.fish
Normal file
4
.config/fish/plugins/__sync_history.fish
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
function sync_history --on-event fish_preexec
|
||||||
|
history --save
|
||||||
|
history --merge
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user