commit 755ddf5f2f49cabc2c9314f54248754b67a7c5a9 Author: Segcolt <9hmbzr275@mozmail.com> Date: Wed Sep 18 21:32:11 2024 -0300 My fish config diff --git a/completions/fisher.fish b/completions/fisher.fish new file mode 100644 index 0000000..6d23ce4 --- /dev/null +++ b/completions/fisher.fish @@ -0,0 +1,7 @@ +complete --command fisher --exclusive --long help --description "Print help" +complete --command fisher --exclusive --long version --description "Print version" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments install --description "Install plugins" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments update --description "Update installed plugins" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments remove --description "Remove installed plugins" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments list --description "List installed plugins matching regex" +complete --command fisher --exclusive --condition "__fish_seen_subcommand_from update remove" --arguments "(fisher list)" diff --git a/completions/navidrome.fish b/completions/navidrome.fish new file mode 100644 index 0000000..56fdba2 --- /dev/null +++ b/completions/navidrome.fish @@ -0,0 +1,177 @@ +# fish completion for navidrome -*- shell-script -*- + +function __navidrome_debug + set -l file "$BASH_COMP_DEBUG_FILE" + if test -n "$file" + echo "$argv" >> $file + end +end + +function __navidrome_perform_completion + __navidrome_debug "Starting __navidrome_perform_completion" + + # Extract all args except the last one + set -l args (commandline -opc) + # Extract the last arg and escape it in case it is a space + set -l lastArg (string escape -- (commandline -ct)) + + __navidrome_debug "args: $args" + __navidrome_debug "last arg: $lastArg" + + # Disable ActiveHelp which is not supported for fish shell + set -l requestComp "NAVIDROME_ACTIVE_HELP=0 $args[1] __complete $args[2..-1] $lastArg" + + __navidrome_debug "Calling $requestComp" + set -l results (eval $requestComp 2> /dev/null) + + # Some programs may output extra empty lines after the directive. + # Let's ignore them or else it will break completion. + # Ref: https://github.com/spf13/cobra/issues/1279 + for line in $results[-1..1] + if test (string trim -- $line) = "" + # Found an empty line, remove it + set results $results[1..-2] + else + # Found non-empty line, we have our proper output + break + end + end + + set -l comps $results[1..-2] + set -l directiveLine $results[-1] + + # For Fish, when completing a flag with an = (e.g., -n=) + # completions must be prefixed with the flag + set -l flagPrefix (string match -r -- '-.*=' "$lastArg") + + __navidrome_debug "Comps: $comps" + __navidrome_debug "DirectiveLine: $directiveLine" + __navidrome_debug "flagPrefix: $flagPrefix" + + for comp in $comps + printf "%s%s\n" "$flagPrefix" "$comp" + end + + printf "%s\n" "$directiveLine" +end + +# This function does two things: +# - Obtain the completions and store them in the global __navidrome_comp_results +# - Return false if file completion should be performed +function __navidrome_prepare_completions + __navidrome_debug "" + __navidrome_debug "========= starting completion logic ==========" + + # Start fresh + set --erase __navidrome_comp_results + + set -l results (__navidrome_perform_completion) + __navidrome_debug "Completion results: $results" + + if test -z "$results" + __navidrome_debug "No completion, probably due to a failure" + # Might as well do file completion, in case it helps + return 1 + end + + set -l directive (string sub --start 2 $results[-1]) + set --global __navidrome_comp_results $results[1..-2] + + __navidrome_debug "Completions are: $__navidrome_comp_results" + __navidrome_debug "Directive is: $directive" + + set -l shellCompDirectiveError 1 + set -l shellCompDirectiveNoSpace 2 + set -l shellCompDirectiveNoFileComp 4 + set -l shellCompDirectiveFilterFileExt 8 + set -l shellCompDirectiveFilterDirs 16 + + if test -z "$directive" + set directive 0 + end + + set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2) + if test $compErr -eq 1 + __navidrome_debug "Received error directive: aborting." + # Might as well do file completion, in case it helps + return 1 + end + + set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2) + set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2) + if test $filefilter -eq 1; or test $dirfilter -eq 1 + __navidrome_debug "File extension filtering or directory filtering not supported" + # Do full file completion instead + return 1 + end + + set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2) + set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2) + + __navidrome_debug "nospace: $nospace, nofiles: $nofiles" + + # If we want to prevent a space, or if file completion is NOT disabled, + # we need to count the number of valid completions. + # To do so, we will filter on prefix as the completions we have received + # may not already be filtered so as to allow fish to match on different + # criteria than the prefix. + if test $nospace -ne 0; or test $nofiles -eq 0 + set -l prefix (commandline -t | string escape --style=regex) + __navidrome_debug "prefix: $prefix" + + set -l completions (string match -r -- "^$prefix.*" $__navidrome_comp_results) + set --global __navidrome_comp_results $completions + __navidrome_debug "Filtered completions are: $__navidrome_comp_results" + + # Important not to quote the variable for count to work + set -l numComps (count $__navidrome_comp_results) + __navidrome_debug "numComps: $numComps" + + if test $numComps -eq 1; and test $nospace -ne 0 + # We must first split on \t to get rid of the descriptions to be + # able to check what the actual completion will be. + # We don't need descriptions anyway since there is only a single + # real completion which the shell will expand immediately. + set -l split (string split --max 1 \t $__navidrome_comp_results[1]) + + # Fish won't add a space if the completion ends with any + # of the following characters: @=/:., + set -l lastChar (string sub -s -1 -- $split) + if not string match -r -q "[@=/:.,]" -- "$lastChar" + # In other cases, to support the "nospace" directive we trick the shell + # by outputting an extra, longer completion. + __navidrome_debug "Adding second completion to perform nospace directive" + set --global __navidrome_comp_results $split[1] $split[1]. + __navidrome_debug "Completions are now: $__navidrome_comp_results" + end + end + + if test $numComps -eq 0; and test $nofiles -eq 0 + # To be consistent with bash and zsh, we only trigger file + # completion when there are no other completions + __navidrome_debug "Requesting file completion" + return 1 + end + end + + return 0 +end + +# Since Fish completions are only loaded once the user triggers them, we trigger them ourselves +# so we can properly delete any completions provided by another script. +# Only do this if the program can be found, or else fish may print some errors; besides, +# the existing completions will only be loaded if the program can be found. +if type -q "navidrome" + # The space after the program name is essential to trigger completion for the program + # and not completion of the program name itself. + # Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish. + complete --do-complete "navidrome " > /dev/null 2>&1 +end + +# Remove any pre-existing completions for the program since we will be handling all of them. +complete -c navidrome -e + +# The call to __navidrome_prepare_completions will setup __navidrome_comp_results +# which provides the program's completion choices. +complete -c navidrome -n '__navidrome_prepare_completions' -f -a '$__navidrome_comp_results' + diff --git a/completions/please.fish b/completions/please.fish new file mode 100644 index 0000000..81aed39 --- /dev/null +++ b/completions/please.fish @@ -0,0 +1 @@ +complete --command please --no-files --arguments "(env _PLEASE_COMPLETE=complete_fish _TYPER_COMPLETE_FISH_ACTION=get-args _TYPER_COMPLETE_ARGS=(commandline -cp) please)" --condition "env _PLEASE_COMPLETE=complete_fish _TYPER_COMPLETE_FISH_ACTION=is-args _TYPER_COMPLETE_ARGS=(commandline -cp) please" diff --git a/config.fish b/config.fish new file mode 100755 index 0000000..288d4b1 --- /dev/null +++ b/config.fish @@ -0,0 +1,54 @@ +bass source /etc/profile +source $HOME/.config/fish/config.fish2 + +fish_add_path $HOME/.local/bin + +if status is-interactive + # Commands to run in interactive sessions can go here + set fish_cursor_default block + set -Ux SHELL /bin/fish + + set -Ux FZF_DEFAULT_OPTS "\ + --color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 \ + --color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \ + --color=marker:#f5e0dc,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8" + + fzf_key_bindings + fish_hybrid_key_bindings + + sh -c ' + if [ ! -f "/run/user/$EUID/fish.please.lock" ]; then + please + touch "/run/user/$EUID/fish.please.lock" + else + fortune -o | ponysay -b round + fi + ' + + starship init fish | source +end +set fish_greeting + +function bind_bang + switch (commandline -t)[-1] + case "!" + commandline -t -- $history[1] + commandline -f repaint + case "*" + commandline -i ! + end +end + +function bind_dollar + switch (commandline -t)[-1] + case "!" + commandline -f backward-delete-char history-token-search-backward + case "*" + commandline -i '$' + end +end + +function fish_user_key_bindings + bind ! bind_bang + bind '$' bind_dollar +end diff --git a/config.fish2 b/config.fish2 new file mode 100644 index 0000000..31b6197 --- /dev/null +++ b/config.fish2 @@ -0,0 +1,247 @@ +# Main file for fish command completions. This file contains various +# common helper functions for the command completions. All actual +# completions are located in the completions subdirectory. +# +# Set default field separators +# +set -g IFS \n\ \t +set -qg __fish_added_user_paths +or set -g __fish_added_user_paths + +# +# Create the default command_not_found handler +# +function __fish_default_command_not_found_handler + printf (_ "fish: Unknown command: %s\n") (string escape -- $argv[1]) >&2 +end + + +if not status --is-interactive + # Hook up the default as the command_not_found handler + # if we are not interactive to avoid custom handlers. + function fish_command_not_found --on-event fish_command_not_found + __fish_default_command_not_found_handler $argv + end +end + +# +# Set default search paths for completions and shellscript functions +# unless they already exist +# + +# __fish_data_dir, __fish_sysconf_dir, __fish_help_dir, __fish_bin_dir +# are expected to have been set up by read_init from fish.cpp + +# Grab extra directories (as specified by the build process, usually for +# third-party packages to ship completions &c. +set -l __extra_completionsdir +set -l __extra_functionsdir +set -l __extra_confdir +if test -f $__fish_data_dir/__fish_build_paths.fish + source $__fish_data_dir/__fish_build_paths.fish +end + +# Compute the directories for vendor configuration. We want to include +# all of XDG_DATA_DIRS, as well as the __extra_* dirs defined above. +set -l xdg_data_dirs +if set -q XDG_DATA_DIRS + set --path xdg_data_dirs $XDG_DATA_DIRS + set xdg_data_dirs (string replace -r '([^/])/$' '$1' -- $xdg_data_dirs)/fish +else + set xdg_data_dirs $__fish_data_dir +end + +set -l vendor_completionsdirs +set -l vendor_functionsdirs +set -l vendor_confdirs +# Don't load vendor directories when running unit tests +if not set -q FISH_UNIT_TESTS_RUNNING + set vendor_completionsdirs $__fish_user_data_dir/vendor_completions.d $xdg_data_dirs/vendor_completions.d + set vendor_functionsdirs $__fish_user_data_dir/vendor_functions.d $xdg_data_dirs/vendor_functions.d + set vendor_confdirs $__fish_user_data_dir/vendor_conf.d $xdg_data_dirs/vendor_conf.d + + # Ensure that extra directories are always included. + if not contains -- $__extra_completionsdir $vendor_completionsdirs + set -a vendor_completionsdirs $__extra_completionsdir + end + if not contains -- $__extra_functionsdir $vendor_functionsdirs + set -a vendor_functionsdirs $__extra_functionsdir + end + if not contains -- $__extra_confdir $vendor_confdirs + set -a vendor_confdirs $__extra_confdir + end +end + +# Set up function and completion paths. Make sure that the fish +# default functions/completions are included in the respective path. + +if not set -q fish_function_path + set fish_function_path $__fish_config_dir/functions $__fish_sysconf_dir/functions $vendor_functionsdirs $__fish_data_dir/functions +else if not contains -- $__fish_data_dir/functions $fish_function_path + set -a fish_function_path $__fish_data_dir/functions +end + +if not set -q fish_complete_path + set fish_complete_path $__fish_config_dir/completions $__fish_sysconf_dir/completions $vendor_completionsdirs $__fish_data_dir/completions $__fish_user_data_dir/generated_completions +else if not contains -- $__fish_data_dir/completions $fish_complete_path + set -a fish_complete_path $__fish_data_dir/completions +end + +# Add a handler for when fish_user_path changes, so we can apply the same changes to PATH +function __fish_reconstruct_path -d "Update PATH when fish_user_paths changes" --on-variable fish_user_paths + # Deduplicate $fish_user_paths + # This should help with people appending to it in config.fish + set -l new_user_path + for path in (string split : -- $fish_user_paths) + if not contains -- $path $new_user_path + set -a new_user_path $path + end + end + + if test (count $new_user_path) -lt (count $fish_user_paths) + # This will end up calling us again, so we return + set fish_user_paths $new_user_path + return + end + + set -l local_path $PATH + + for x in $__fish_added_user_paths + set -l idx (contains --index -- $x $local_path) + and set -e local_path[$idx] + end + + set -g __fish_added_user_paths + if set -q fish_user_paths + # Explicitly split on ":" because $fish_user_paths might not be a path variable, + # but $PATH definitely is. + for x in (string split ":" -- $fish_user_paths[-1..1]) + if set -l idx (contains --index -- $x $local_path) + set -e local_path[$idx] + else + set -ga __fish_added_user_paths $x + end + set -p local_path $x + end + end + + set -xg PATH $local_path +end + +# +# Launch debugger on SIGTRAP +# +function fish_sigtrap_handler --on-signal TRAP --no-scope-shadowing --description "TRAP handler: debug prompt" + breakpoint +end + +# +# When a prompt is first displayed, make sure that interactive +# mode-specific initializations have been performed. +# This handler removes itself after it is first called. +# +function __fish_on_interactive --on-event fish_prompt + __fish_config_interactive + functions -e __fish_on_interactive +end + +# Set the locale if it isn't explicitly set. Allowing the lack of locale env vars to imply the +# C/POSIX locale causes too many problems. Do this before reading the snippets because they might be +# in UTF-8 (with non-ASCII characters). +__fish_set_locale + +# +# Some things should only be done for login terminals +# This used to be in etc/config.fish - keep it here to keep the semantics +# +if status --is-login + if command -sq /usr/libexec/path_helper + # Adapt construct_path from the macOS /usr/libexec/path_helper + # executable for fish; see + # https://opensource.apple.com/source/shell_cmds/shell_cmds-203/path_helper/path_helper.c.auto.html . + function __fish_macos_set_env -d "set an environment variable like path_helper does (macOS only)" + set -l result + + # Populate path according to config files + for path_file in $argv[2] $argv[3]/* + if test -f $path_file + while read -l entry + if not contains -- $entry $result + test -n "$entry" + and set -a result $entry + end + end <$path_file + end + end + + # Merge in any existing path elements + for existing_entry in $$argv[1] + if not contains -- $existing_entry $result + set -a result $existing_entry + end + end + + set -xg $argv[1] $result + end + + __fish_macos_set_env PATH /etc/paths '/etc/paths.d' + if test -n "$MANPATH" + __fish_macos_set_env MANPATH /etc/manpaths '/etc/manpaths.d' + end + functions -e __fish_macos_set_env + end + + # + # Put linux consoles in unicode mode. + # + if test "$TERM" = linux + and string match -qir '\.UTF' -- $LANG + and command -sq unicode_start + unicode_start + end +end + +# Invoke this here to apply the current value of fish_user_path after +# PATH is possibly set above. +__fish_reconstruct_path + +# Allow %n job expansion to be used with fg/bg/wait +# `jobs` is the only one that natively supports job expansion +function __fish_expand_pid_args + for arg in $argv + if string match -qr '^%\d+$' -- $arg + if not jobs -p $arg + return 1 + end + else + printf "%s\n" $arg + end + end +end + +for jobbltn in bg wait disown + function $jobbltn -V jobbltn + builtin $jobbltn (__fish_expand_pid_args $argv) + end +end +function fg + builtin fg (__fish_expand_pid_args $argv)[-1] +end + +function kill + command kill (__fish_expand_pid_args $argv) +end + +# As last part of initialization, source the conf directories. +# Implement precedence (User > Admin > Extra (e.g. vendors) > Fish) by basically doing "basename". +set -l sourcelist +for file in $__fish_config_dir/conf.d/*.fish $__fish_sysconf_dir/conf.d/*.fish $vendor_confdirs/*.fish + set -l basename (string replace -r '^.*/' '' -- $file) + contains -- $basename $sourcelist + and continue + set sourcelist $sourcelist $basename + # Also skip non-files or unreadable files. + # This allows one to use e.g. symlinks to /dev/null to "mask" something (like in systemd). + test -f $file -a -r $file + and source $file +end diff --git a/fish_plugins b/fish_plugins new file mode 100644 index 0000000..594dfc0 --- /dev/null +++ b/fish_plugins @@ -0,0 +1 @@ +jorgebucaran/fisher diff --git a/fish_variables b/fish_variables new file mode 100644 index 0000000..4678f73 --- /dev/null +++ b/fish_variables @@ -0,0 +1,62 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR BACKUP:/home/allann/Documentos/backup +SETUVAR --export FZF_DEFAULT_OPTS:\x20\x20\x20\x20\x20\x20\x20\x20\x2d\x2dcolor\x3dbg\x2b\x3a\x23313244\x2cbg\x3a\x231e1e2e\x2cspinner\x3a\x23f5e0dc\x2chl\x3a\x23f38ba8\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2d\x2dcolor\x3dfg\x3a\x23cdd6f4\x2cheader\x3a\x23f38ba8\x2cinfo\x3a\x23cba6f7\x2cpointer\x3a\x23f5e0dc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2d\x2dcolor\x3dmarker\x3a\x23f5e0dc\x2cfg\x2b\x3a\x23cdd6f4\x2cprompt\x3a\x23cba6f7\x2chl\x2b\x3a\x23f38ba8 +SETUVAR GPGKEY:3A7EF236ECD99667F3564FAEDAF2CB5910EEA5BF +SETUVAR GST_DEBUG_DUMP_DOT_DIR:/tmp/tmp\x2eTJkDp7Jo3E +SETUVAR --export MOUNT:/run/media/allann +SETUVAR --export SHELL:/bin/fish +SETUVAR __fish_initialized:3400 +SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish +SETUVAR _fisher_plugins:jorgebucaran/fisher +SETUVAR _fisher_upgraded_to_4_4:\x1d +SETUVAR --export clementine:/home/allann/Documentos/Clementine_Playlists +SETUVAR env:/home/allann/Documentos/workspace/env/python\x2denv +SETUVAR fish_color_autosuggestion:6c7086 +SETUVAR fish_color_cancel:f38ba8 +SETUVAR fish_color_command:89b4fa +SETUVAR fish_color_comment:red +SETUVAR fish_color_cwd:f9e2af +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:fab387 +SETUVAR fish_color_error:f38ba8 +SETUVAR fish_color_escape:f2cdcd +SETUVAR fish_color_gray:6c7086 +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:89b4fa +SETUVAR fish_color_host_remote:\x1d +SETUVAR fish_color_keyword:f38ba8 +SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue +SETUVAR fish_color_normal:cdd6f4 +SETUVAR fish_color_operator:f5c2e7 +SETUVAR fish_color_option:\x1d +SETUVAR fish_color_param:f2cdcd +SETUVAR fish_color_quote:a6e3a1 +SETUVAR fish_color_redirection:f5c2e7 +SETUVAR fish_color_search_match:\x2d\x2dbackground\x3d313244 +SETUVAR fish_color_selection:\x2d\x2dbackground\x3d313244 +SETUVAR fish_color_status:red +SETUVAR fish_color_user:94e2d5 +SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_key_bindings:fish_hybrid_key_bindings +SETUVAR fish_pager_color_background:\x1d +SETUVAR fish_pager_color_completion:cdd6f4 +SETUVAR fish_pager_color_description:6c7086 +SETUVAR fish_pager_color_prefix:f5c2e7 +SETUVAR fish_pager_color_progress:6c7086 +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\x2dreverse +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/allann/\x2elocal/bin +SETUVAR grabber:/home/allann/Imagens/Grabber +SETUVAR pictures:/home/allann/Imagens/Pictures +SETUVAR --export projects:/home/allann/Documentos/workspace/Projects +SETUVAR --export wiki:/home/allann/Documentos/Wiki +SETUVAR --export workspace:/home/allann/Documentos/workspace +SETUVAR yimmy_solarized:true +SETUVAR ytdlp:/home/allann/V\u00eddeos/yt\x2ddlp diff --git a/functions/__bass.py b/functions/__bass.py new file mode 100755 index 0000000..3fe17fc --- /dev/null +++ b/functions/__bass.py @@ -0,0 +1,138 @@ +""" +To be used with a companion fish function like this: + + function refish + set -l _x (python /tmp/bass.py source ~/.nvm/nvim.sh ';' nvm use iojs); source $_x; and rm -f $_x + end + +""" + +from __future__ import print_function + +import json +import os +import signal +import subprocess +import sys +import traceback + + +BASH = 'bash' + +FISH_READONLY = [ + 'PWD', 'SHLVL', 'history', 'pipestatus', 'status', 'version', + 'FISH_VERSION', 'fish_pid', 'hostname', '_', 'fish_private_mode' +] + +IGNORED = [ + 'PS1', 'XPC_SERVICE_NAME' +] + +def ignored(name): + if name == 'PWD': # this is read only, but has special handling + return False + # ignore other read only variables + if name in FISH_READONLY: + return True + if name in IGNORED or name.startswith("BASH_FUNC"): + return True + return False + +def escape(string): + # use json.dumps to reliably escape quotes and backslashes + return json.dumps(string).replace(r'$', r'\$') + +def escape_identifier(word): + return escape(word.replace('?', '\\?')) + +def comment(string): + return '\n'.join(['# ' + line for line in string.split('\n')]) + +def gen_script(): + # Use the following instead of /usr/bin/env to read environment so we can + # deal with multi-line environment variables (and other odd cases). + env_reader = "%s -c 'import os,json; print(json.dumps({k:v for k,v in os.environ.items()}))'" % (sys.executable) + args = [BASH, '-c', env_reader] + output = subprocess.check_output(args, universal_newlines=True) + old_env = output.strip() + + pipe_r, pipe_w = os.pipe() + if sys.version_info >= (3, 4): + os.set_inheritable(pipe_w, True) + command = 'eval $1 && ({}; alias) >&{}'.format( + env_reader, + pipe_w + ) + args = [BASH, '-c', command, 'bass', ' '.join(sys.argv[1:])] + p = subprocess.Popen(args, universal_newlines=True, close_fds=False) + os.close(pipe_w) + with os.fdopen(pipe_r) as f: + new_env = f.readline() + alias_str = f.read() + if p.wait() != 0: + raise subprocess.CalledProcessError( + returncode=p.returncode, + cmd=' '.join(sys.argv[1:]), + output=new_env + alias_str + ) + new_env = new_env.strip() + + old_env = json.loads(old_env) + new_env = json.loads(new_env) + + script_lines = [] + + for k, v in new_env.items(): + if ignored(k): + continue + v1 = old_env.get(k) + if not v1: + script_lines.append(comment('adding %s=%s' % (k, v))) + elif v1 != v: + script_lines.append(comment('updating %s=%s -> %s' % (k, v1, v))) + # process special variables + if k == 'PWD': + script_lines.append('cd %s' % escape(v)) + continue + else: + continue + if k == 'PATH': + value = ' '.join([escape(directory) + for directory in v.split(':')]) + else: + value = escape(v) + script_lines.append('set -g -x %s %s' % (k, value)) + + for var in set(old_env.keys()) - set(new_env.keys()): + script_lines.append(comment('removing %s' % var)) + script_lines.append('set -e %s' % var) + + script = '\n'.join(script_lines) + + alias_lines = [] + for line in alias_str.splitlines(): + _, rest = line.split(None, 1) + k, v = rest.split("=", 1) + alias_lines.append("alias " + escape_identifier(k) + "=" + v) + alias = '\n'.join(alias_lines) + + return script + '\n' + alias + +script_file = os.fdopen(3, 'w') + +if not sys.argv[1:]: + print('__bass_usage', file=script_file, end='') + sys.exit(0) + +try: + script = gen_script() +except subprocess.CalledProcessError as e: + sys.exit(e.returncode) +except Exception: + print('Bass internal error!', file=sys.stderr) + raise # traceback will output to stderr +except KeyboardInterrupt: + signal.signal(signal.SIGINT, signal.SIG_DFL) + os.kill(os.getpid(), signal.SIGINT) +else: + script_file.write(script) diff --git a/functions/adb-input.fish b/functions/adb-input.fish new file mode 100644 index 0000000..1c9bd8d --- /dev/null +++ b/functions/adb-input.fish @@ -0,0 +1,3 @@ +function adb-input + adb shell input text "$(echo $argv | sed 's/ /\\\ /g')" && adb shell input keyevent 66; +end diff --git a/functions/adbsync.fish b/functions/adbsync.fish new file mode 100644 index 0000000..e7985bc --- /dev/null +++ b/functions/adbsync.fish @@ -0,0 +1,3 @@ +function adbsync --wraps=adbsync.py --wraps='adbsync.py --show-progress' --wraps='adbsync.py --show-progress --adb-flag a' --description 'alias adbsync adbsync.py --show-progress --adb-flag a' + adbsync.py --show-progress --adb-flag a $argv; +end diff --git a/functions/android-lolisnatcher.fish b/functions/android-lolisnatcher.fish new file mode 100644 index 0000000..51b5fe2 --- /dev/null +++ b/functions/android-lolisnatcher.fish @@ -0,0 +1,3 @@ +function android-lolisnatcher --wraps='ssh 192.168.15.122 -p 8022 lolisnatcher || ssh 192.168.15.122 -p 8022' --wraps='ssh 192.168.15.122 -p 8022 lolisnatcher || ssh 192.168.15.133 -p 8022' --wraps='ssh 192.168.15.122 -p 8022 lolisnatcher || ssh 192.168.15.133 -p 8022 lolisnatcher' --wraps='ssh 192.168.15.122 -p 8022 lolisnatcher 2>/dev/null || ssh 192.168.15.133 -p 8022 lolisnatcher' --wraps='ssh 192.168.15.122 -p 8022 lolisnatcher 2>/dev/null || ssh 192.168.15.133 -p 8022 lolisnatcher || echo ERRO' --wraps='ssh 192.168.15.122 -p 8022 lolisnatcher 2>/dev/null || ssh 192.168.15.133 -p 8022 lolisnatcher 2>/dev/null || echo ERRO' --wraps='adb shell am start -n com.termux/.HomeActivity && ssh 192.168.15.122 -p 8022 lolisnatcher 2>/dev/null || ssh 192.168.15.133 -p 8022 lolisnatcher 2>/dev/null || echo ERRO' --description 'alias android-lolisnatcher adb shell am start -n com.termux/.HomeActivity && ssh 192.168.15.122 -p 8022 lolisnatcher 2>/dev/null || ssh 192.168.15.133 -p 8022 lolisnatcher 2>/dev/null || echo ERRO' + adb shell am start -n com.termux/.HomeActivity && ssh 192.168.15.122 -p 8022 lolisnatcher 2>/dev/null || ssh 192.168.15.133 -p 8022 lolisnatcher 2>/dev/null || echo ERRO $argv; +end diff --git a/functions/android-update.fish b/functions/android-update.fish new file mode 100644 index 0000000..a3a34ed --- /dev/null +++ b/functions/android-update.fish @@ -0,0 +1,3 @@ +function android-update --wraps=/home/allann/Documentos/scripts/update-images-android.sh --description 'alias android-update /home/allann/Documentos/scripts/update-images-android.sh' + /home/allann/Documentos/scripts/update-images-android.sh $argv; +end diff --git a/functions/asciitable.fish b/functions/asciitable.fish new file mode 100644 index 0000000..8939670 --- /dev/null +++ b/functions/asciitable.fish @@ -0,0 +1,3 @@ +function asciitable --wraps='icat ~/Imagens/asciifull.gif' --description 'alias asciitable icat ~/Imagens/asciifull.gif' + icat ~/Imagens/asciifull.gif $argv; +end diff --git a/functions/asm.fish b/functions/asm.fish new file mode 100644 index 0000000..73b5b9e --- /dev/null +++ b/functions/asm.fish @@ -0,0 +1,3 @@ +function asm --wraps='~/Documentos/scripts/gnu-asm.sh' --description 'alias asm ~/Documentos/scripts/gnu-asm.sh' + ~/Documentos/scripts/gnu-asm.sh $argv; +end diff --git a/functions/bass.fish b/functions/bass.fish new file mode 100755 index 0000000..2b3af16 --- /dev/null +++ b/functions/bass.fish @@ -0,0 +1,29 @@ +function bass + set -l bash_args $argv + set -l bass_debug + if test "$bash_args[1]_" = '-d_' + set bass_debug true + set -e bash_args[1] + end + + set -l script_file (mktemp) + if command -v python3 >/dev/null 2>&1 + command python3 -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file + else + command python -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file + end + set -l bass_status $status + if test $bass_status -ne 0 + return $bass_status + end + + if test -n "$bass_debug" + cat $script_file + end + source $script_file + command rm $script_file +end + +function __bass_usage + echo "Usage: bass [-d] " +end diff --git a/functions/beet-tag.fish b/functions/beet-tag.fish new file mode 100644 index 0000000..be65496 --- /dev/null +++ b/functions/beet-tag.fish @@ -0,0 +1,3 @@ +function beet-tag --wraps='beet import -C' --description 'alias beet-tag beet import -C' + beet import -C $argv; +end diff --git a/functions/betterdiscord.fish b/functions/betterdiscord.fish new file mode 100644 index 0000000..700c370 --- /dev/null +++ b/functions/betterdiscord.fish @@ -0,0 +1,3 @@ +function betterdiscord --wraps=betterdiscordctl --description 'alias betterdiscord betterdiscordctl' + betterdiscordctl $argv; +end diff --git a/functions/bluepower.fish b/functions/bluepower.fish new file mode 100644 index 0000000..ee0db73 --- /dev/null +++ b/functions/bluepower.fish @@ -0,0 +1,3 @@ +function bluepower --wraps='upower -d | grep -m1 percentage' --description 'alias bluepower upower -d | grep -m1 percentage' + upower -d | grep -m1 percentage $argv; +end diff --git a/functions/cd-doc.fish b/functions/cd-doc.fish new file mode 100644 index 0000000..e661eae --- /dev/null +++ b/functions/cd-doc.fish @@ -0,0 +1,3 @@ +function cd-doc --wraps='cd ~/Documentos' --description 'alias cd-doc cd ~/Documentos' + cd ~/Documentos $argv; +end diff --git a/functions/cd-dow.fish b/functions/cd-dow.fish new file mode 100644 index 0000000..769f851 --- /dev/null +++ b/functions/cd-dow.fish @@ -0,0 +1,3 @@ +function cd-dow --wraps='cd ~/Downloads' --description 'alias cd-dow cd ~/Downloads' + cd ~/Downloads $argv; +end diff --git a/functions/cd-git.fish b/functions/cd-git.fish new file mode 100644 index 0000000..e7b8afe --- /dev/null +++ b/functions/cd-git.fish @@ -0,0 +1,3 @@ +function cd-git --wraps='cd ~/git' --description 'alias cd-git cd ~/git' + cd ~/git $argv; +end diff --git a/functions/cd-img.fish b/functions/cd-img.fish new file mode 100644 index 0000000..35d41fd --- /dev/null +++ b/functions/cd-img.fish @@ -0,0 +1,3 @@ +function cd-img --wraps=cd\ \~/Imagens\n --wraps='cd ~/Imagens' --description 'alias cd-img cd ~/Imagens' + cd ~/Imagens $argv; +end diff --git a/functions/cd-pic.fish b/functions/cd-pic.fish new file mode 100644 index 0000000..91a8dc5 --- /dev/null +++ b/functions/cd-pic.fish @@ -0,0 +1,3 @@ +function cd-pic --wraps='cd ~/Imagens/Pictures' --description 'alias cd-pic cd ~/Imagens/Pictures' + cd ~/Imagens/Pictures $argv; +end diff --git a/functions/cd-script.fish b/functions/cd-script.fish new file mode 100644 index 0000000..62b5011 --- /dev/null +++ b/functions/cd-script.fish @@ -0,0 +1,3 @@ +function cd-script --wraps='cd ~/Documentos/scripts' --description 'alias cd-script cd ~/Documentos/scripts' + cd ~/Documentos/scripts $argv; +end diff --git a/functions/cd-work.fish b/functions/cd-work.fish new file mode 100644 index 0000000..bfc3940 --- /dev/null +++ b/functions/cd-work.fish @@ -0,0 +1,3 @@ +function cd-work --wraps='cd ~/Documentos/workspace' --description 'alias cd-work cd ~/Documentos/workspace' + cd ~/Documentos/workspace $argv; +end diff --git a/functions/cdb.fish b/functions/cdb.fish new file mode 100644 index 0000000..3a2f1d3 --- /dev/null +++ b/functions/cdb.fish @@ -0,0 +1,3 @@ +function cdb --wraps='cd ..' --description 'alias cdb cd ..' + cd .. $argv; +end diff --git a/functions/cdb2.fish b/functions/cdb2.fish new file mode 100644 index 0000000..b692a0a --- /dev/null +++ b/functions/cdb2.fish @@ -0,0 +1,3 @@ +function cdb2 --wraps='cd ../..' --description 'alias cdb2 cd ../..' + cd ../.. $argv; +end diff --git a/functions/cdb3.fish b/functions/cdb3.fish new file mode 100644 index 0000000..e3ee9b3 --- /dev/null +++ b/functions/cdb3.fish @@ -0,0 +1,3 @@ +function cdb3 --wraps='cd ../../..' --description 'alias cdb3 cd ../../..' + cd ../../.. $argv; +end diff --git a/functions/check-dpms.fish b/functions/check-dpms.fish new file mode 100644 index 0000000..6b0e361 --- /dev/null +++ b/functions/check-dpms.fish @@ -0,0 +1,3 @@ +function check-dpms --wraps='kreadconfig5 --file kwinrc --group Compositing --key Enabled' --wraps='~/Documentos/scripts/check-dpms.sh' --description 'alias check-dpms ~/Documentos/scripts/check-dpms.sh' + ~/Documentos/scripts/check-dpms.sh $argv; +end diff --git a/functions/check-port.fish b/functions/check-port.fish new file mode 100644 index 0000000..8e7057e --- /dev/null +++ b/functions/check-port.fish @@ -0,0 +1,3 @@ +function check-port --wraps='sudo netstat -pln | grep' --description 'alias check-port sudo netstat -pln | grep' + sudo netstat -pln | grep $argv; +end diff --git a/functions/clean-music.fish b/functions/clean-music.fish new file mode 100644 index 0000000..0748f18 --- /dev/null +++ b/functions/clean-music.fish @@ -0,0 +1,10 @@ +function clean-music + for mood in $(find ~/Músicas -name "*.mood") + set path (dirname "$mood") + set file (basename (string split -m1 -r '.' "$mood") | cut -c2-) + if test -z (find "$path" -name "$(bash -c "printf \"%q\" \"$file\"").*" -print -quit) + rm -v "$mood" + end + end + find ~/Músicas -type d -empty -print -delete +end diff --git a/functions/clean-portage.fish b/functions/clean-portage.fish new file mode 100644 index 0000000..821fdb9 --- /dev/null +++ b/functions/clean-portage.fish @@ -0,0 +1,3 @@ +function clean-portage --wraps='sudo rm -rv /var/tmp/portage*' --wraps='sudo rm -rv /var/tmp/portage/*' --description 'alias clean-portage sudo rm -rv /var/tmp/portage/*' + sudo rm -rv /var/tmp/portage/* $argv; +end diff --git a/functions/clean-upscaly.fish b/functions/clean-upscaly.fish new file mode 100644 index 0000000..6c2194a --- /dev/null +++ b/functions/clean-upscaly.fish @@ -0,0 +1,3 @@ +function clean-upscaly --wraps='rm ~/.temp/upscaly/*' --wraps='rm -rf ~/.temp/upscaly/*' --description 'alias clean-upscaly rm -rf ~/.temp/upscaly/*' + rm -rf ~/.temp/upscaly/* $argv; +end diff --git a/functions/dispatch-conf.fish b/functions/dispatch-conf.fish new file mode 100644 index 0000000..b6de19f --- /dev/null +++ b/functions/dispatch-conf.fish @@ -0,0 +1,3 @@ +function dispatch-conf --wraps='su- c "dispatch-conf"' --wraps='su :-c "dispatch-conf"' --wraps='su -c "dispatch-conf"' --description 'alias dispatch-conf su -c "dispatch-conf"' + su -c "dispatch-conf" $argv; +end diff --git a/functions/dracut.fish b/functions/dracut.fish new file mode 100644 index 0000000..e25291a --- /dev/null +++ b/functions/dracut.fish @@ -0,0 +1,3 @@ +function dracut --wraps='sudo bash -c "dracut --kver=$(readlink /usr/src/linux | sed s/linux-//) && mv -v /boot/*png /boot/$(/usr/src/linux | sed s/linux/vmlinuz).png"' --wraps='sudo bash -c "dracut --kver=$(readlink /usr/src/linux | sed s/linux-//) && mv -v /boot/*png /boot/$(readlink /usr/src/linux | sed s/linux/vmlinuz).png"' --wraps='sudo bash -c "dracut --kver=$(readlink /usr/src/linux | sed s/linux-//) && mv -v /boot/*png /boot/$(readlink /usr/src/linux | sed s/linux/vmlinuz/).png"' --description 'alias dracut sudo bash -c "dracut --kver=$(readlink /usr/src/linux | sed s/linux-//) && mv -v /boot/*png /boot/$(readlink /usr/src/linux | sed s/linux/vmlinuz/).png"' + sudo bash -c "dracut --kver=$(readlink /usr/src/linux | sed s/linux-//) && mv -v /boot/*png /boot/$(readlink /usr/src/linux | sed s/linux/vmlinuz/).png" $argv; +end diff --git a/functions/easyeffects.fish b/functions/easyeffects.fish new file mode 100644 index 0000000..1ec02a1 --- /dev/null +++ b/functions/easyeffects.fish @@ -0,0 +1,3 @@ +function easyeffects --wraps='killall easyeffects && easyeffects --gapplication-service &>/dev/null &; disown' --wraps='killall easyeffects; easyeffects --gapplication-service &>/dev/null &; disown' --wraps=killall\ easyeffects\;\ \\easyeffects\ --gapplication-service\ \&\>/dev/null\ \&\;\ disown --wraps='killall easyeffects; command easyeffects --gapplication-service &>/dev/null &; disown' --wraps='killall easyeffects &> /dev/null; command easyeffects --gapplication-service &>/dev/null &; disown' --description 'alias easyeffects killall easyeffects &> /dev/null; command easyeffects --gapplication-service &>/dev/null &; disown' + killall easyeffects &> /dev/null; command easyeffects --gapplication-service &>/dev/null &; disown $argv; +end diff --git a/functions/extasciitable.fish b/functions/extasciitable.fish new file mode 100644 index 0000000..9798b06 --- /dev/null +++ b/functions/extasciitable.fish @@ -0,0 +1,3 @@ +function extasciitable --wraps='kitty +kitten icat ~/Imagens/extasciifull.gif' --description 'alias extasciitable kitty +kitten icat ~/Imagens/extasciifull.gif' + kitty +kitten icat ~/Imagens/extasciifull.gif $argv; +end diff --git a/functions/filebrowser.fish b/functions/filebrowser.fish new file mode 100644 index 0000000..5349736 --- /dev/null +++ b/functions/filebrowser.fish @@ -0,0 +1,4 @@ +function filebrowser --description 'alias filebrowser filebrowser -r ~/.local/share/cloud -d ~/.config/filebrowser/filebrowser.db -c ~/.config/filebrowser/filebowser.yaml -p 3327' + command filebrowser -r ~/.local/share/cloud -d ~/.config/filebrowser/filebrowser.db -c ~/.config/filebrowser/filebowser.yaml -p 3327 $argv + +end diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish new file mode 100644 index 0000000..086bd25 --- /dev/null +++ b/functions/fish_prompt.fish @@ -0,0 +1,16 @@ +function fish_prompt + if test -n "$SSH_TTY" + echo -n (set_color brred)"$USER"(set_color white)'@'(set_color yellow)(prompt_hostname)' ' + end + + set_color -o + + echo -n (set_color red)''(set_color green)''(set_color yellow)' ' + if fish_is_root_user + echo -n (set_color red)'# ' + else + echo -n (set_color yellow)' ' + end + echo -n (set_color bryellow)$(prompt_pwd)' ' + set_color normal +end diff --git a/functions/fish_right_prompt.fish b/functions/fish_right_prompt.fish new file mode 100644 index 0000000..18708f8 --- /dev/null +++ b/functions/fish_right_prompt.fish @@ -0,0 +1,161 @@ +function fish_right_prompt + set -l cmd_status $status + if test $cmd_status -ne 0 + echo -n (set_color red)" [$cmd_status]" + end + + if not command -sq git + set_color normal + return + end + + # Get the git directory for later use. + # Return if not inside a Git repository work tree. + if not set -l git_dir (command git rev-parse --git-dir 2>/dev/null) + set_color normal + return + end + + # Get the current action ("merge", "rebase", etc.) + # and if there's one get the current commit hash too. + set -l commit '' + if set -l action (fish_print_git_action "$git_dir") + set commit (command git rev-parse HEAD 2> /dev/null | string sub -l 7) + end + + # Get either the branch name or a branch descriptor. + set -l branch_detached 0 + if not set -l branch (command git symbolic-ref --short HEAD 2>/dev/null) + set branch_detached 1 + set branch (command git describe --contains --all HEAD 2>/dev/null) + end + + # Get the commit difference counts between local and remote. + command git rev-list --count --left-right 'HEAD...@{upstream}' 2>/dev/null \ + | read -d \t -l status_ahead status_behind + if test $status -ne 0 + set status_ahead 0 + set status_behind 0 + end + + # Get the stash status. + # (git stash list) is very slow. => Avoid using it. + set -l status_stashed 0 + if test -f "$git_dir/refs/stash" + set status_stashed 1 + else if test -r "$git_dir/commondir" + read -l commondir <"$git_dir/commondir" + if test -f "$commondir/refs/stash" + set status_stashed 1 + end + end + + # git-status' porcelain v1 format starts with 2 letters on each line: + # The first letter (X) denotes the index state. + # The second letter (Y) denotes the working directory state. + # + # The following table presents the possible combinations: + # * The underscore character denotes whitespace. + # * The cell values stand for the following file states: + # a: added + # d: deleted + # m: modified + # r: renamed + # u: unmerged + # t: untracked + # * Cells with more than one letter signify that both states + # are simultaneously the case. This is possible since the git index + # and working directory operate independently of each other. + # * Cells which are empty are unhandled by this code. + # * T (= type change) is undocumented. + # See Git v1.7.8.2 release notes for more information. + # + # \ Y→ + # X \ + # ↓ | A | C | D | M | R | T | U | X | B | ? | _ + # ----+----+----+----+----+----+----+----+----+----+----+---- + # A | u | | ad | am | r | am | u | | | | a + # C | | | ad | am | r | am | u | | | | a + # D | | | u | am | r | am | u | | | | a + # M | | | ad | am | r | am | u | | | | a + # R | r | r | rd | rm | r | rm | ur | r | r | r | r + # T | | | ad | am | r | am | u | | | | a + # U | u | u | u | um | ur | um | u | u | u | u | u + # X | | | | m | r | m | u | | | | + # B | | | | m | r | m | u | | | | + # ? | | | | m | r | m | u | | | t | + # _ | | | d | m | r | m | u | | | | + set -l porcelain_status (command git status --porcelain | string sub -l2) + + set -l status_added 0 + if string match -qr '[ACDMT][ MT]|[ACMT]D' $porcelain_status + set status_added 1 + end + set -l status_deleted 0 + if string match -qr '[ ACMRT]D' $porcelain_status + set status_deleted 1 + end + set -l status_modified 0 + if string match -qr '[MT]$' $porcelain_status + set status_modified 1 + end + set -l status_renamed 0 + if string match -qe R $porcelain_status + set status_renamed 1 + end + set -l status_unmerged 0 + if string match -qr 'AA|DD|U' $porcelain_status + set status_unmerged 1 + end + set -l status_untracked 0 + if string match -qe '\?\?' $porcelain_status + set status_untracked 1 + end + + set_color -o + + if test -n "$branch" + if test $branch_detached -ne 0 + set_color brmagenta + else + set_color green + end + echo -n " $branch" + end + if test -n "$commit" + echo -n ' '(set_color yellow)"$commit" + end + if test -n "$action" + set_color normal + echo -n (set_color white)':'(set_color -o brred)"$action" + end + if test $status_ahead -ne 0 + echo -n ' '(set_color brmagenta)'⬆' + end + if test $status_behind -ne 0 + echo -n ' '(set_color brmagenta)'⬇' + end + if test $status_stashed -ne 0 + echo -n ' '(set_color cyan)'✭' + end + if test $status_added -ne 0 + echo -n ' '(set_color green)'✚' + end + if test $status_deleted -ne 0 + echo -n ' '(set_color red)'✖' + end + if test $status_modified -ne 0 + echo -n ' '(set_color blue)'✱' + end + if test $status_renamed -ne 0 + echo -n ' '(set_color magenta)'➜' + end + if test $status_unmerged -ne 0 + echo -n ' '(set_color yellow)'═' + end + if test $status_untracked -ne 0 + echo -n ' '(set_color white)'◼' + end + + set_color normal +end diff --git a/functions/fish_user_key_bindings.fish b/functions/fish_user_key_bindings.fish new file mode 100644 index 0000000..b33870e --- /dev/null +++ b/functions/fish_user_key_bindings.fish @@ -0,0 +1,176 @@ +# ____ ____ +# / __/___ / __/ +# / /_/_ / / /_ +# / __/ / /_/ __/ +# /_/ /___/_/ key-bindings.fish +# +# - $FZF_TMUX_OPTS +# - $FZF_CTRL_T_COMMAND +# - $FZF_CTRL_T_OPTS +# - $FZF_CTRL_R_OPTS +# - $FZF_ALT_C_COMMAND +# - $FZF_ALT_C_OPTS + +# Key bindings +# ------------ +function fzf_key_bindings + + # Store current token in $dir as root for the 'find' command + function fzf-file-widget -d "List files and folders" + set -l commandline (__fzf_parse_commandline) + set -l dir $commandline[1] + set -l fzf_query $commandline[2] + set -l prefix $commandline[3] + + # "-path \$dir'*/\\.*'" matches hidden files/folders inside $dir but not + # $dir itself, even if hidden. + test -n "$FZF_CTRL_T_COMMAND"; or set -l FZF_CTRL_T_COMMAND " + command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \ + -o -type f -print \ + -o -type d -print \ + -o -type l -print 2> /dev/null | sed 's@^\./@@'" + + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% + begin + set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS" + eval "$FZF_CTRL_T_COMMAND | "(__fzfcmd)' -m --query "'$fzf_query'"' | while read -l r; set result $result $r; end + end + if [ -z "$result" ] + commandline -f repaint + return + else + # Remove last token from commandline. + commandline -t "" + end + for i in $result + commandline -it -- $prefix + commandline -it -- (string escape $i) + commandline -it -- ' ' + end + commandline -f repaint + end + + function fzf-history-widget -d "Show command history" + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% + begin + set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT $FZF_DEFAULT_OPTS --scheme=history --bind=ctrl-r:toggle-sort,ctrl-z:ignore $FZF_CTRL_R_OPTS +m" + + set -l FISH_MAJOR (echo $version | cut -f1 -d.) + set -l FISH_MINOR (echo $version | cut -f2 -d.) + + # history's -z flag is needed for multi-line support. + # history's -z flag was added in fish 2.4.0, so don't use it for versions + # before 2.4.0. + if [ "$FISH_MAJOR" -gt 2 -o \( "$FISH_MAJOR" -eq 2 -a "$FISH_MINOR" -ge 4 \) ]; + history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result + and commandline -- $result + else + history | eval (__fzfcmd) -q '(commandline)' | read -l result + and commandline -- $result + end + end + commandline -f repaint + end + + function fzf-cd-widget -d "Change directory" + set -l commandline (__fzf_parse_commandline) + set -l dir $commandline[1] + set -l fzf_query $commandline[2] + set -l prefix $commandline[3] + + test -n "$FZF_ALT_C_COMMAND"; or set -l FZF_ALT_C_COMMAND " + command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \ + -o -type d -print 2> /dev/null | sed 's@^\./@@'" + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% + begin + set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" + eval "$FZF_ALT_C_COMMAND | "(__fzfcmd)' +m --query "'$fzf_query'"' | read -l result + + if [ -n "$result" ] + cd -- $result + + # Remove last token from commandline. + commandline -t "" + commandline -it -- $prefix + end + end + + commandline -f repaint + end + + function __fzfcmd + test -n "$FZF_TMUX"; or set FZF_TMUX 0 + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% + if [ -n "$FZF_TMUX_OPTS" ] + echo "fzf-tmux $FZF_TMUX_OPTS -- " + else if [ $FZF_TMUX -eq 1 ] + echo "fzf-tmux -d$FZF_TMUX_HEIGHT -- " + else + echo "fzf" + end + end + + bind \ct fzf-file-widget + bind \cr fzf-history-widget + bind \ec fzf-cd-widget + + if bind -M insert > /dev/null 2>&1 + bind -M insert \ct fzf-file-widget + bind -M insert \cr fzf-history-widget + bind -M insert \ec fzf-cd-widget + end + + function __fzf_parse_commandline -d 'Parse the current command line token and return split of existing filepath, fzf query, and optional -option= prefix' + set -l commandline (commandline -t) + + # strip -option= from token if present + set -l prefix (string match -r -- '^-[^\s=]+=' $commandline) + set commandline (string replace -- "$prefix" '' $commandline) + + # eval is used to do shell expansion on paths + eval set commandline $commandline + + if [ -z $commandline ] + # Default to current directory with no --query + set dir '.' + set fzf_query '' + else + set dir (__fzf_get_dir $commandline) + + if [ "$dir" = "." -a (string sub -l 1 -- $commandline) != '.' ] + # if $dir is "." but commandline is not a relative path, this means no file path found + set fzf_query $commandline + else + # Also remove trailing slash after dir, to "split" input properly + set fzf_query (string replace -r "^$dir/?" -- '' "$commandline") + end + end + + echo $dir + echo $fzf_query + echo $prefix + end + + function __fzf_get_dir -d 'Find the longest existing filepath from input string' + set dir $argv + + # Strip all trailing slashes. Ignore if $dir is root dir (/) + if [ (string length -- $dir) -gt 1 ] + set dir (string replace -r '/*$' -- '' $dir) + end + + # Iteratively check if dir exists and strip tail end of path + while [ ! -d "$dir" ] + # If path is absolute, this can keep going until ends up at / + # If path is relative, this can keep going until entire input is consumed, dirname returns "." + set dir (dirname -- "$dir") + end + + echo $dir + end + +end + +function fish_user_key_bindings + fzf_key_bindings +end diff --git a/functions/fisher.fish b/functions/fisher.fish new file mode 100644 index 0000000..1aec671 --- /dev/null +++ b/functions/fisher.fish @@ -0,0 +1,240 @@ +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.4.3 + 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 Install plugins" + echo " fisher remove Remove installed plugins" + echo " fisher update Update installed plugins" + echo " fisher update Update all installed plugins" + echo " fisher list [] List installed plugins matching regex" + echo "Options:" + echo " -v, --version Print version" + echo " -h, --help Print this help message" + echo "Variables:" + echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~ + 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 + + test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins) + + if ! set --query argv[2] + if test "$cmd" != update + echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1 + else if ! set --query file_plugins + echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1 + end + set arg_plugins $file_plugins + end + + for plugin in $arg_plugins + set plugin (test -e "$plugin" && realpath $plugin || string lower -- $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 + set --local fish_path (status fish-path) + + 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,themes,functions} + + $fish_path --command " + if test -e $plugin + command cp -Rf $plugin/* $source + else + set temp (command mktemp -d) + set repo (string split -- \@ $plugin) || set repo[2] HEAD + + if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1]) + set name (string split -- / \$path)[-1] + set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz + else + set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2] + end + + echo Fetching (set_color --underline)\$url(set_color normal) + + if curl --silent -L \$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 | string replace -- \~ ~ + set --erase _fisher_plugins[$index] + end + + command rm -rf (string replace -- \~ ~ $$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 $plugin_files_var + end + end + + if set --query update_plugins[1] || set --query install_plugins[1] + command mkdir -p $fisher_path/{functions,themes,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,themes,conf.d,completions}/* + + if set --local index (contains --index -- $plugin $install_plugins) + set --local user_files $fisher_path/{functions,themes,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 -RLf $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 | string replace -- ~ \~) + + 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 | string replace -- \~ ~ + + for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~) + 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 + + if set --query _fisher_plugins[1] + set --local commit_plugins + + for plugin in $file_plugins + contains -- (string lower -- $plugin) (string lower -- $_fisher_plugins) && set --append commit_plugins $plugin + end + + for plugin in $_fisher_plugins + contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin + end + + printf "%s\n" $commit_plugins >$fish_plugins + else + set --erase _fisher_plugins + command rm -f $fish_plugins + end + + 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 + +if ! set --query _fisher_upgraded_to_4_4 + set --universal _fisher_upgraded_to_4_4 + if functions --query _fisher_list + set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share + command rm -rf $XDG_DATA_HOME/fisher + functions --erase _fisher_{list,plugin_parse} + fisher update >/dev/null 2>/dev/null + else + for var in (set --names | string match --entire --regex '^_fisher_.+_files$') + set $var (string replace -- ~ \~ $$var) + end + functions --erase _fisher_fish_postexec + end +end diff --git a/functions/function-erase.fish b/functions/function-erase.fish new file mode 100644 index 0000000..c65eccb --- /dev/null +++ b/functions/function-erase.fish @@ -0,0 +1,3 @@ +function function-erase + functions --erase "$argv[1]"; funcsave "$argv[1]"; +end diff --git a/functions/fzf_key_bindings.fish b/functions/fzf_key_bindings.fish new file mode 100755 index 0000000..743c7c1 --- /dev/null +++ b/functions/fzf_key_bindings.fish @@ -0,0 +1,172 @@ +# ____ ____ +# / __/___ / __/ +# / /_/_ / / /_ +# / __/ / /_/ __/ +# /_/ /___/_/ key-bindings.fish +# +# - $FZF_TMUX_OPTS +# - $FZF_CTRL_T_COMMAND +# - $FZF_CTRL_T_OPTS +# - $FZF_CTRL_R_OPTS +# - $FZF_ALT_C_COMMAND +# - $FZF_ALT_C_OPTS + +# Key bindings +# ------------ +function fzf_key_bindings + + # Store current token in $dir as root for the 'find' command + function fzf-file-widget -d "List files and folders" + set -l commandline (__fzf_parse_commandline) + set -l dir $commandline[1] + set -l fzf_query $commandline[2] + set -l prefix $commandline[3] + + # "-path \$dir'*/\\.*'" matches hidden files/folders inside $dir but not + # $dir itself, even if hidden. + test -n "$FZF_CTRL_T_COMMAND"; or set -l FZF_CTRL_T_COMMAND " + command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \ + -o -type f -print \ + -o -type d -print \ + -o -type l -print 2> /dev/null | sed 's@^\./@@'" + + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% + begin + set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS" + eval "$FZF_CTRL_T_COMMAND | "(__fzfcmd)' -m --query "'$fzf_query'"' | while read -l r; set result $result $r; end + end + if [ -z "$result" ] + commandline -f repaint + return + else + # Remove last token from commandline. + commandline -t "" + end + for i in $result + commandline -it -- $prefix + commandline -it -- (string escape $i) + commandline -it -- ' ' + end + commandline -f repaint + end + + function fzf-history-widget -d "Show command history" + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% + begin + set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT $FZF_DEFAULT_OPTS --scheme=history --bind=ctrl-r:toggle-sort,ctrl-z:ignore $FZF_CTRL_R_OPTS +m" + + set -l FISH_MAJOR (echo $version | cut -f1 -d.) + set -l FISH_MINOR (echo $version | cut -f2 -d.) + + # history's -z flag is needed for multi-line support. + # history's -z flag was added in fish 2.4.0, so don't use it for versions + # before 2.4.0. + if [ "$FISH_MAJOR" -gt 2 -o \( "$FISH_MAJOR" -eq 2 -a "$FISH_MINOR" -ge 4 \) ]; + history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result + and commandline -- $result + else + history | eval (__fzfcmd) -q '(commandline)' | read -l result + and commandline -- $result + end + end + commandline -f repaint + end + + function fzf-cd-widget -d "Change directory" + set -l commandline (__fzf_parse_commandline) + set -l dir $commandline[1] + set -l fzf_query $commandline[2] + set -l prefix $commandline[3] + + test -n "$FZF_ALT_C_COMMAND"; or set -l FZF_ALT_C_COMMAND " + command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \ + -o -type d -print 2> /dev/null | sed 's@^\./@@'" + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% + begin + set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" + eval "$FZF_ALT_C_COMMAND | "(__fzfcmd)' +m --query "'$fzf_query'"' | read -l result + + if [ -n "$result" ] + cd -- $result + + # Remove last token from commandline. + commandline -t "" + commandline -it -- $prefix + end + end + + commandline -f repaint + end + + function __fzfcmd + test -n "$FZF_TMUX"; or set FZF_TMUX 0 + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% + if [ -n "$FZF_TMUX_OPTS" ] + echo "fzf-tmux $FZF_TMUX_OPTS -- " + else if [ $FZF_TMUX -eq 1 ] + echo "fzf-tmux -d$FZF_TMUX_HEIGHT -- " + else + echo "fzf" + end + end + + bind \ct fzf-file-widget + bind \cr fzf-history-widget + bind \ec fzf-cd-widget + + if bind -M insert > /dev/null 2>&1 + bind -M insert \ct fzf-file-widget + bind -M insert \cr fzf-history-widget + bind -M insert \ec fzf-cd-widget + end + + function __fzf_parse_commandline -d 'Parse the current command line token and return split of existing filepath, fzf query, and optional -option= prefix' + set -l commandline (commandline -t) + + # strip -option= from token if present + set -l prefix (string match -r -- '^-[^\s=]+=' $commandline) + set commandline (string replace -- "$prefix" '' $commandline) + + # eval is used to do shell expansion on paths + eval set commandline $commandline + + if [ -z $commandline ] + # Default to current directory with no --query + set dir '.' + set fzf_query '' + else + set dir (__fzf_get_dir $commandline) + + if [ "$dir" = "." -a (string sub -l 1 -- $commandline) != '.' ] + # if $dir is "." but commandline is not a relative path, this means no file path found + set fzf_query $commandline + else + # Also remove trailing slash after dir, to "split" input properly + set fzf_query (string replace -r "^$dir/?" -- '' "$commandline") + end + end + + echo $dir + echo $fzf_query + echo $prefix + end + + function __fzf_get_dir -d 'Find the longest existing filepath from input string' + set dir $argv + + # Strip all trailing slashes. Ignore if $dir is root dir (/) + if [ (string length -- $dir) -gt 1 ] + set dir (string replace -r '/*$' -- '' $dir) + end + + # Iteratively check if dir exists and strip tail end of path + while [ ! -d "$dir" ] + # If path is absolute, this can keep going until ends up at / + # If path is relative, this can keep going until entire input is consumed, dirname returns "." + set dir (dirname -- "$dir") + end + + echo $dir + end + +end diff --git a/functions/gcc.fish b/functions/gcc.fish new file mode 100644 index 0000000..5d5f9e8 --- /dev/null +++ b/functions/gcc.fish @@ -0,0 +1,3 @@ +function gcc --description 'alias gcc gcc -Wall -Wextra -Werror -Wshadow -fno-common -O2 -pipe -flto -std=gnu2x' + command gcc -Wall -Wextra -Werror -Wshadow -fno-common -O2 -pipe -flto -std=gnu2x $argv; +end diff --git a/functions/gccasm.fish b/functions/gccasm.fish new file mode 100644 index 0000000..9efa3e3 --- /dev/null +++ b/functions/gccasm.fish @@ -0,0 +1,3 @@ +function gccasm --wraps='gcc -S -fverbose-asm' --wraps='gcc -fverbose-asm' --wraps='gcc -fverbose-asm -S' --description 'alias gccasm gcc -fverbose-asm -S' + gcc -fverbose-asm -S $argv; +end diff --git a/functions/git-clementine.fish b/functions/git-clementine.fish new file mode 100644 index 0000000..bffb9d6 --- /dev/null +++ b/functions/git-clementine.fish @@ -0,0 +1,3 @@ +function git-clementine --wraps='git -C $clementine' --description 'alias git-clementine git -C $clementine' + git -C $clementine $argv; +end diff --git a/functions/git-scripts.fish b/functions/git-scripts.fish new file mode 100644 index 0000000..8715654 --- /dev/null +++ b/functions/git-scripts.fish @@ -0,0 +1,3 @@ +function git-scripts --wraps='git -C ~/Documentos/scripts' --description 'alias git-scripts git -C ~/Documentos/scripts' + git -C ~/Documentos/scripts $argv; +end diff --git a/functions/gvim-cheat.fish b/functions/gvim-cheat.fish new file mode 100644 index 0000000..2c042fe --- /dev/null +++ b/functions/gvim-cheat.fish @@ -0,0 +1,3 @@ +function gvim-cheat --wraps='icat ~/Documentos/Manuals/vi-vim-cheat-sheet.gif' --description 'alias gvim-cheat icat ~/Documentos/Manuals/vi-vim-cheat-sheet.gif' + icat ~/Documentos/Manuals/vi-vim-cheat-sheet.gif $argv; +end diff --git a/functions/halt.fish b/functions/halt.fish new file mode 100644 index 0000000..cf59984 --- /dev/null +++ b/functions/halt.fish @@ -0,0 +1,4 @@ +function halt --wraps='sudo poweroff' --description 'alias halt sudo poweroff' + sudo poweroff $argv + +end diff --git a/functions/hextobi.fish b/functions/hextobi.fish new file mode 100644 index 0000000..7ce3986 --- /dev/null +++ b/functions/hextobi.fish @@ -0,0 +1,3 @@ +function hextobi --wraps='kitty +kitten icat ~/Imagens/binary_to_hex_tablepng.png' --wraps='kitty +kitten icat ~/Imagens/binary_to_hex_table.png' --description 'alias hextobi kitty +kitten icat ~/Imagens/binary_to_hex_table.png' + kitty +kitten icat ~/Imagens/binary_to_hex_table.png $argv; +end diff --git a/functions/icat.fish b/functions/icat.fish new file mode 100644 index 0000000..3b49f26 --- /dev/null +++ b/functions/icat.fish @@ -0,0 +1,3 @@ +function icat --description 'alias icat kitty +kitten icat' + kitty +kitten icat $argv; +end diff --git a/functions/info.fish b/functions/info.fish new file mode 100644 index 0000000..500f212 --- /dev/null +++ b/functions/info.fish @@ -0,0 +1,3 @@ +function info + vim -R -c "silent Info $argv" -c "lua vim.opt.showtabline=0" -c "map :InfoNext" -c "map h :InfoPrev" -c "map :Menu" -c "map w :InfoUp" -c "map l K" +only; +end diff --git a/functions/journal.fish b/functions/journal.fish new file mode 100644 index 0000000..1c4d395 --- /dev/null +++ b/functions/journal.fish @@ -0,0 +1,13 @@ +function journal + if test -z $wiki + echo "Por favor, define a variável \$wiki com o caminho da wiki." + exit 5 + end + set -x NVIM_APPNAME nvim.bak + set NVIM "$wiki/journal/nvim.appimage" + if test -e "$wiki/journal/$(date +%Y/%m/%d).md" + $NVIM +'execute "normal :WikiJournal\Go\\!!date +\\\\%R\I# \o\"' +"norm G\$" -c 'startinsert'; + else + $NVIM +'execute "normal :WikiJournal\!!date +\\\\%R\I# \o\"' +"norm G\$" -c 'startinsert' + end +end diff --git a/functions/kdeup.fish b/functions/kdeup.fish new file mode 100644 index 0000000..745f8fc --- /dev/null +++ b/functions/kdeup.fish @@ -0,0 +1,3 @@ +function kdeup --wraps='killall clementine; kill 2707; clementine &>/dev/null &; caffeine &>/dev/null &; disown' --wraps='killall clementine; kill $(pidof caffeine-ng); clementine &>/dev/null &; caffeine &>/dev/null &; disown' --description 'alias kdeup killall clementine; kill $(pidof caffeine-ng); clementine &>/dev/null &; caffeine &>/dev/null &; disown' + killall clementine; kill $(pidof caffeine-ng); clementine &>/dev/null &; caffeine &>/dev/null &; disown $argv; +end diff --git a/functions/kernel-config.fish b/functions/kernel-config.fish new file mode 100644 index 0000000..b2575f7 --- /dev/null +++ b/functions/kernel-config.fish @@ -0,0 +1,3 @@ +function kernel-config --wraps=bash\ -c\ \'zcat\ /proc/config.gz\ \>\ /usr/src/linux/.config\' --wraps=sudo\ bash\ -c\ \'zcat\ /proc/config.gz\ \>\ /usr/src/linux/.config\' --wraps=sudo\ bash\ -c\ \'zcat\ /proc/config.gz\ \>\ /usr/src/linux/.config\;\ make\ olddefconfig\' --wraps=sudo\ bash\ -c\ \'zcat\ /proc/config.gz\ \>\ /usr/src/linux/.config\;\ \(cd\ /usr/src/linux\;\ make\ olddefconfig\)\' --wraps='sudo bash -c "zcat /proc/config.gz > /usr/src/linux/.config; (cd /usr/src/linux; make olddefconfig)"' --description 'alias kernel-config sudo bash -c "zcat /proc/config.gz > /usr/src/linux/.config; (cd /usr/src/linux; make olddefconfig)"' + sudo bash -c "zcat /proc/config.gz > /usr/src/linux/.config; (cd /usr/src/linux; make olddefconfig)" $argv; +end diff --git a/functions/kexec-reboot.fish b/functions/kexec-reboot.fish new file mode 100644 index 0000000..3ab680a --- /dev/null +++ b/functions/kexec-reboot.fish @@ -0,0 +1,3 @@ +function kexec-reboot --wraps='sudo rc-service kexec start; reboot' --description 'alias kexec-reboot sudo rc-service kexec start; reboot' + sudo rc-service kexec start; reboot $argv; +end diff --git a/functions/kwin-toggle.fish b/functions/kwin-toggle.fish new file mode 100644 index 0000000..e354cc7 --- /dev/null +++ b/functions/kwin-toggle.fish @@ -0,0 +1,3 @@ +function kwin-toggle --wraps=Documentos/scripts/kwin-toggle-compositioning.sh --wraps='~Documentos/scripts/kwin-toggle-compositioning.sh' --wraps='~/Documentos/scripts/kwin-toggle-compositioning.sh' --description 'alias kwin-toggle ~/Documentos/scripts/kwin-toggle-compositioning.sh' + ~/Documentos/scripts/kwin-toggle-compositioning.sh $argv; +end diff --git a/functions/lazygit-cheat.fish b/functions/lazygit-cheat.fish new file mode 100644 index 0000000..020d692 --- /dev/null +++ b/functions/lazygit-cheat.fish @@ -0,0 +1,3 @@ +function lazygit-cheat --wraps='glow -p ~/Documentos/Manuals/lazygit-bindings.md' --wraps='glow -p ~/Documentos/Manuals/lazygit-keybindings.md' --description 'alias lazygit-cheat glow -p ~/Documentos/Manuals/lazygit-keybindings.md' + glow -p ~/Documentos/Manuals/lazygit-keybindings.md $argv; +end diff --git a/functions/linux_make.fish b/functions/linux_make.fish new file mode 100644 index 0000000..821612d --- /dev/null +++ b/functions/linux_make.fish @@ -0,0 +1,3 @@ +function linux_make --wraps='sudo make; sudo make modules; sudo make install; sudo make modules_install' --wraps='sudo make; sudo make modules; sudo make install; sudo make modules_install; sudo dracut --force' --description 'alias linux_make sudo make; sudo make modules; sudo make install; sudo make modules_install; sudo dracut --force' + sudo make; sudo make modules; sudo make install; sudo make modules_install; sudo dracut --force $argv; +end diff --git a/functions/log.fish b/functions/log.fish new file mode 100644 index 0000000..d41fb5a --- /dev/null +++ b/functions/log.fish @@ -0,0 +1,3 @@ +function log --wraps='less /var/log/messages' --wraps='sudo less /var/log/messages' --description 'alias log sudo less /var/log/messages' + sudo less /var/log/messages $argv; +end diff --git a/functions/lsa-png.fish b/functions/lsa-png.fish new file mode 100644 index 0000000..80de8a1 --- /dev/null +++ b/functions/lsa-png.fish @@ -0,0 +1,3 @@ +function lsa-png --wraps='ls -a | grep .png' --description 'alias lsa-png ls -a | grep .png' + ls -a | grep .png $argv; +end diff --git a/functions/lsa.fish b/functions/lsa.fish new file mode 100644 index 0000000..978438f --- /dev/null +++ b/functions/lsa.fish @@ -0,0 +1,3 @@ +function lsa --wraps='ls -a' --description 'alias lsa ls -a' + ls -a $argv; +end diff --git a/functions/make-kernel-less.fish b/functions/make-kernel-less.fish new file mode 100644 index 0000000..ff0acc7 --- /dev/null +++ b/functions/make-kernel-less.fish @@ -0,0 +1,4 @@ +function make-kernel-less --wraps='cd /usr/src/linux; sudo bash -c "make ARCH=x86_64 -j2 && make ARCH=x86_64 -j2 modules && make install && make modules_install"; cd -' --description 'alias make-kernel-less cd /usr/src/linux; sudo bash -c "make ARCH=x86_64 -j2 && make ARCH=x86_64 -j2 modules && make install && make modules_install"; cd -' + cd /usr/src/linux; sudo bash -c "make ARCH=x86_64 -j2 && make ARCH=x86_64 -j2 modules && make install && make modules_install"; cd - $argv + +end diff --git a/functions/make-kernel.fish b/functions/make-kernel.fish new file mode 100644 index 0000000..d9e3f5b --- /dev/null +++ b/functions/make-kernel.fish @@ -0,0 +1,3 @@ +function make-kernel --wraps='cd /usr/src/linux; sudo bash -c "make ARCH=x86_64 -j4 && make ARCH=x86_64 -j4 modules && make install && make modules_install"; cd -' --description 'alias make-kernel cd /usr/src/linux; sudo bash -c "make ARCH=x86_64 -j4 && make ARCH=x86_64 -j4 modules && make install && make modules_install"; cd -' + cd /usr/src/linux; sudo bash -c "make ARCH=x86_64 -j4 && make ARCH=x86_64 -j4 modules && make install && make modules_install"; cd - $argv; +end diff --git a/functions/menuconfig.fish b/functions/menuconfig.fish new file mode 100644 index 0000000..12083d3 --- /dev/null +++ b/functions/menuconfig.fish @@ -0,0 +1,3 @@ +function menuconfig --wraps='cd /usr/src/linux; sudo bash -c "make -j$(nproc) menuconfig"; cd -' --description 'alias menuconfig cd /usr/src/linux; sudo bash -c "make -j$(nproc) menuconfig"; cd -' + cd /usr/src/linux; sudo bash -c "make -j$(nproc) menuconfig"; cd - $argv; +end diff --git a/functions/mpvfzf.fish b/functions/mpvfzf.fish new file mode 100644 index 0000000..ce9c3f3 --- /dev/null +++ b/functions/mpvfzf.fish @@ -0,0 +1,3 @@ +function mpvfzf --wraps=mpvyt\\\\\\\ ls\\\\\\\ \\\\\\\~/Vídeos/yt-dlp\\\\\\\ \\\\\\\|\\\\\\\ fzf\\\\\\\ --reverse\\\\\\\ --prompt\\\\\\\ \\\\\\\'Play\\\\\\\ video:\\\\\\\ \\\\\\\'\\\\\\\ --bind\\\\\\\ \\\\\\\'enter:execute\\\\\\\(mpv\\\\\\\ /home/allann/Vídeos/yt-dlp/\\\\\\\{\\\\\\\}\\\\\\\)\\\\\\\' --wraps=mpvyt\ ls\ \~/Vídeos/yt-dlp\ \|\ fzf\ --reverse\ --prompt\ \'Play\ video:\ \'\ --bind\ \'enter:execute\(mpv\ /home/allann/Vídeos/yt-dlp/\{\}\)\' --wraps=ls\ \~/Vídeos/yt-dlp\ \|\ fzf\ --reverse\ --prompt\ \'Play\ video:\ \'\ --bind\ \'enter:execute\(mpv\ /home/allann/Vídeos/yt-dlp/\{\}\)\' --wraps=ls\ \~/Vídeos/yt-dlp\ \|\ fzf\ --reverse\ --prompt\ \'Play\ video:\ \'\ --bind\ \'enter:execute\(mpv\ \"/home/allann/Vídeos/yt-dlp/\{\}\"\ --x11-name=mpv-yt-dlp\)\' --wraps=ls\ \~/Vídeos/yt-dlp\ \|\ fzf\ --reverse\ --prompt\ \'Play\ video:\ \'\ --bind\ \'enter:execute\(mpv\ /home/allann/Vídeos/yt-dlp/\{\}\ --x11-name=mpv-yt-dlp\)\' --wraps=ls\ -I\ \'\*.json\'\ \~/Vídeos/yt-dlp\ \|\ fzf\ --reverse\ --prompt\ \'Play\ video:\ \'\ --bind\ \'enter:execute\(mpv\ /home/allann/Vídeos/yt-dlp/\{\}\ --x11-name=mpv-yt-dlp\)\' --wraps='ls -I "*.json" ~/Vídeos/yt-dlp | fzf --reverse --prompt "Play video: " --bind "enter:execute(mpv /home/allann/Vídeos/yt-dlp/{} --x11-name=mpv-yt-dlp)"' --wraps='find ~/Vídeos -type f -not -name "*.json" | fzf --reverse --prompt "Play video: " --bind "enter:execute(mpv /home/allann/Vídeos/yt-dlp/{} --x11-name=mpv-yt-dlp)"' --wraps='cd ~/Vídeos/yt-dlp; find . -type f -not -name "*.json" | fzf --reverse --prompt "Play video: " --bind "enter:execute(mpv /home/allann/Vídeos/yt-dlp/{} --x11-name=mpv-yt-dlp)"; cd -' --wraps='cd ~/Vídeos/yt-dlp; find . -type f -not -name "*.json" -mindepth 1 | fzf --reverse --prompt "Play video: " --bind "enter:execute(mpv /home/allann/Vídeos/yt-dlp/{} --x11-name=mpv-yt-dlp)"; cd -' --wraps='cd ~/Vídeos/yt-dlp; find . -mindepth 1 -type f -not -name "*.json" | fzf --reverse --prompt "Play video: " --bind "enter:execute(mpv /home/allann/Vídeos/yt-dlp/{} --x11-name=mpv-yt-dlp)"; cd -' --wraps='cd ~/Vídeos/yt-dlp; find . ! -path . -type f -not -name "*.json" | fzf --reverse --prompt "Play video: " --bind "enter:execute(mpv /home/allann/Vídeos/yt-dlp/{} --x11-name=mpv-yt-dlp)"; cd -' --wraps='cd ~/Vídeos/yt-dlp; find * -type f -not -name "*.json" | fzf --reverse --prompt "Play video: " --bind "enter:execute(mpv /home/allann/Vídeos/yt-dlp/{} --x11-name=mpv-yt-dlp)"; cd -' --description 'alias mpvfzf cd ~/Vídeos/yt-dlp; find * -type f -not -name "*.json" | fzf --reverse --prompt "Play video: " --bind "enter:execute(mpv /home/allann/Vídeos/yt-dlp/{} --x11-name=mpv-yt-dlp)"; cd -' + cd ~/Vídeos/yt-dlp; find * -type f -not -name "*.json" | fzf --reverse --prompt "Play video: " --bind "enter:execute(mpv /home/allann/Vídeos/yt-dlp/{} --wayland-app-id=mpv-yt-dlp)"; cd - $argv; +end diff --git a/functions/mv.fish b/functions/mv.fish new file mode 100644 index 0000000..2425d6e --- /dev/null +++ b/functions/mv.fish @@ -0,0 +1,3 @@ +function mv --description 'alias mv mv -i' + command mv -i $argv; +end diff --git a/functions/navidrome.fish b/functions/navidrome.fish new file mode 100644 index 0000000..7f85a6e --- /dev/null +++ b/functions/navidrome.fish @@ -0,0 +1,5 @@ +function navidrome + touch /var/tmp/navidrome.running + ND_CONFIGFILE="$HOME/.config/navidrome/navidrome.toml" command navidrome $argv; + rm /var/tmp/navidrome.running +end diff --git a/functions/nconfig.fish b/functions/nconfig.fish new file mode 100644 index 0000000..72d5085 --- /dev/null +++ b/functions/nconfig.fish @@ -0,0 +1,3 @@ +function nconfig --wraps='cd /usr/src/linux; sudo bash -c "make nconfig"; cd -' --wraps='cd /usr/src/linux; sudo bash -c "make -j$(nproc) nconfig"; cd -' --description 'alias nconfig cd /usr/src/linux; sudo bash -c "make -j$(nproc) nconfig"; cd -' + cd /usr/src/linux; sudo bash -c "make -j$(nproc) nconfig"; cd - $argv; +end diff --git a/functions/pacman-autoremove.fish b/functions/pacman-autoremove.fish new file mode 100644 index 0000000..49b3ef8 --- /dev/null +++ b/functions/pacman-autoremove.fish @@ -0,0 +1,3 @@ +function pacman-autoremove --wraps='pacman -Qdtq | pacman -Rs -' --wraps='sudo pacman -Qdtq | pacman -Rs -' --wraps='sudo pacman -Qdtq | sudo pacman -Rs -' --wraps='sudo pacman -Qdtq | sudo pacman -Rs - ' --wraps='sudo pacman -Rcns ' --wraps='sudo pacman -Qdtq | sudo pacman -Rs' --description 'alias pacman-autoremove sudo pacman -Qdtq | sudo pacman -Rs -' + sudo pacman -Qdtq | sudo pacman -Rs - $argv; +end diff --git a/functions/padoru.fish b/functions/padoru.fish new file mode 100644 index 0000000..da58d63 --- /dev/null +++ b/functions/padoru.fish @@ -0,0 +1,3 @@ +function padoru --wraps=paru --description 'alias padoru paru' + paru $argv; +end diff --git a/functions/please.fish b/functions/please.fish new file mode 100644 index 0000000..22de2ca --- /dev/null +++ b/functions/please.fish @@ -0,0 +1,3 @@ +function please --wraps='PLEASE_DIR="/home/allann/Documentos/workspace/env/python-env/bin" /python /please' --wraps='PLEASE_DIR="$HOME/Documentos/workspace/env/python-env/bin" $PLEASE_DIR/python $PLEASE_DIR/please' --description 'alias please PLEASE_DIR="$HOME/Documentos/workspace/env/python-env/bin" $PLEASE_DIR/python $PLEASE_DIR/please' + PLEASE_DIR="$HOME/Documentos/workspace/env/python-env/bin" $PLEASE_DIR/python $PLEASE_DIR/please $argv; +end diff --git a/functions/poweroff.fish b/functions/poweroff.fish new file mode 100644 index 0000000..cc41669 --- /dev/null +++ b/functions/poweroff.fish @@ -0,0 +1,4 @@ +function poweroff --description 'alias poweroff sudo poweroff' + sudo poweroff $argv + +end diff --git a/functions/ps-grep.fish b/functions/ps-grep.fish new file mode 100644 index 0000000..0762e74 --- /dev/null +++ b/functions/ps-grep.fish @@ -0,0 +1,3 @@ +function ps-grep --wraps='function PS_GREP; ps aux | grep "$argv" | grep -v grep; end; PS_GREP' --wraps='ps aux | grep -v grep | grep' --description 'alias ps-grep ps aux | grep -v grep | grep' + ps aux | grep -v grep | grep $argv; +end diff --git a/functions/r2-cheat.fish b/functions/r2-cheat.fish new file mode 100644 index 0000000..1def0de --- /dev/null +++ b/functions/r2-cheat.fish @@ -0,0 +1,3 @@ +function r2-cheat --wraps='~/Documentos/Manual/radare2-cheatsheet.md' --wraps='less ~/Documentos/Manual/radare2-cheatsheet.md' --wraps='less ~/Documentos/Manuals/radare2-cheatsheet.md' --wraps='vim -R ~/Documentos/Manuals/radare2-cheatsheet.md' --wraps='glow -p ~/Documentos/Manuals/radare2-cheatsheet.md' --description 'alias r2-cheat glow -p ~/Documentos/Manuals/radare2-cheatsheet.md' + glow -p ~/Documentos/Manuals/radare2-cheatsheet.md $argv; +end diff --git a/functions/r2.fish b/functions/r2.fish new file mode 100644 index 0000000..1d88ea7 --- /dev/null +++ b/functions/r2.fish @@ -0,0 +1,3 @@ +function r2 --description 'alias r2 r2 -e bin.cache=true' + command r2 -e bin.cache=true $argv; +end diff --git a/functions/reboot.fish b/functions/reboot.fish new file mode 100644 index 0000000..2b4251c --- /dev/null +++ b/functions/reboot.fish @@ -0,0 +1,3 @@ +function reboot --description 'alias reboot sudo reboot' + sudo reboot $argv; +end diff --git a/functions/registers.fish b/functions/registers.fish new file mode 100644 index 0000000..001ebf2 --- /dev/null +++ b/functions/registers.fish @@ -0,0 +1,3 @@ +function registers --wraps='kitty +kitten icat ~/Imagens/registers-use.png' --description 'alias registers kitty +kitten icat ~/Imagens/registers-use.png' + kitty +kitten icat ~/Imagens/registers-use.png $argv; +end diff --git a/functions/rename.fish b/functions/rename.fish new file mode 100644 index 0000000..d28dae7 --- /dev/null +++ b/functions/rename.fish @@ -0,0 +1,3 @@ +function rename --wraps='~/Documentos/scripts/rename.sh' --description 'alias rename gio rename' + gio rename $argv; +end diff --git a/functions/restart-pipewire.fish b/functions/restart-pipewire.fish new file mode 100644 index 0000000..894aef7 --- /dev/null +++ b/functions/restart-pipewire.fish @@ -0,0 +1,3 @@ +function restart-pipewire --wraps='systemctl --user restart pipewire pipewire-pulse wireplumber && killall easyeffects && easyeffects --gapplication-service &>/dev/null & && disown' --wraps='systemctl --user restart pipewire pipewire-pulse wireplumber && killall easyeffects && sleep 10 && easyeffects --gapplication-service &>/dev/null & && disown' --wraps='killall pipewire; gentoo-pipewire-launcher &> /dev/null &; disown; sleep 10; killall easyeffects; easyeffects --gapplication-service &>/dev/null &; disown' --description 'alias restart-pipewire killall pipewire; gentoo-pipewire-launcher &> /dev/null &; disown; sleep 10; killall easyeffects; easyeffects --gapplication-service &>/dev/null &; disown' + killall pipewire; gentoo-pipewire-launcher &> /dev/null &; disown; sleep 10; killall easyeffects; easyeffects --gapplication-service &>/dev/null &; disown $argv; +end diff --git a/functions/restart-plasmashell.fish b/functions/restart-plasmashell.fish new file mode 100644 index 0000000..73b2add --- /dev/null +++ b/functions/restart-plasmashell.fish @@ -0,0 +1,3 @@ +function restart-plasmashell --wraps='killall plasmashell; plasmashell > /dev/null 2>&1 & disown' --description 'alias restart-plasmashell killall plasmashell; plasmashell > /dev/null 2>&1 & disown' + killall plasmashell; plasmashell > /dev/null 2>&1 & disown $argv; +end diff --git a/functions/rm.fish b/functions/rm.fish new file mode 100644 index 0000000..343c390 --- /dev/null +++ b/functions/rm.fish @@ -0,0 +1,3 @@ +function rm --description 'alias rm rm -v' + command rm -v $argv; +end diff --git a/functions/router-reboot.fish b/functions/router-reboot.fish new file mode 100644 index 0000000..08a8842 --- /dev/null +++ b/functions/router-reboot.fish @@ -0,0 +1,3 @@ +function router-reboot --wraps='ssh -l root 192.168.15.2 reboot' --wraps='ssh -l root 192.168.15.2 reboot &>/dev/null' --wraps='ssh -l root 192.168.15.2 reboot &>/dev/null && echo' --wraps='ssh -l root 192.168.15.2 reboot &>/dev/null; true' --wraps='ssh -l root 192.168.15.2 reboot &>/dev/null &; true' --description 'alias router-reboot ssh -l root 192.168.15.2 reboot &>/dev/null &; true' + ssh -l root 192.168.15.2 reboot &>/dev/null &; true $argv; +end diff --git a/functions/rsnet.fish b/functions/rsnet.fish new file mode 100644 index 0000000..b3235ce --- /dev/null +++ b/functions/rsnet.fish @@ -0,0 +1,3 @@ +function rsnet --wraps='sudo rc-service NetworkManager stop; sudo rc-service iwd stop; sleep 2; sudo rc-service iwd start; sudo rc-service NetworkManager start' --description 'alias rsnet sudo rc-service NetworkManager stop; sudo rc-service iwd stop; sleep 2; sudo rc-service iwd start; sudo rc-service NetworkManager start' + sudo rc-service NetworkManager stop; sudo rc-service iwd stop; sleep 2; sudo rc-service iwd start; sudo rc-service NetworkManager start $argv; +end diff --git a/functions/rsync-adb.fish b/functions/rsync-adb.fish new file mode 100644 index 0000000..d3a6db4 --- /dev/null +++ b/functions/rsync-adb.fish @@ -0,0 +1,3 @@ +function rsync-adb --wraps='rsync -auv --progress --inplace --no-perms --omit-dir-times' --description 'alias rsync-adb rsync -auv --progress --inplace --no-perms --omit-dir-times' + rsync -auv --progress --inplace --no-perms --omit-dir-times $argv; +end diff --git a/functions/rsync.fish b/functions/rsync.fish new file mode 100644 index 0000000..71a4191 --- /dev/null +++ b/functions/rsync.fish @@ -0,0 +1,3 @@ +function rsync --description 'alias rsync rsync -a --progress' + command rsync -a --progress $argv; +end diff --git a/functions/scans.fish b/functions/scans.fish new file mode 100644 index 0000000..ef6f304 --- /dev/null +++ b/functions/scans.fish @@ -0,0 +1,3 @@ +function scans --wraps='qimgv ~/Imagens/scans' --description 'alias scans qimgv ~/Imagens/scans' + qimgv ~/Imagens/scans $argv; +end diff --git a/functions/shutdown.fish b/functions/shutdown.fish new file mode 100644 index 0000000..e8f1e15 --- /dev/null +++ b/functions/shutdown.fish @@ -0,0 +1,3 @@ +function shutdown --wraps='sudo shutdown now' --description 'alias shutdown sudo shutdown now' + sudo shutdown now $argv; +end diff --git a/functions/speedtest.fish b/functions/speedtest.fish new file mode 100644 index 0000000..5c7d5fe --- /dev/null +++ b/functions/speedtest.fish @@ -0,0 +1,4 @@ +function speedtest --wraps=SpeedTest --description 'alias speedtest SpeedTest' + SpeedTest $argv + +end diff --git a/functions/su.fish b/functions/su.fish new file mode 100644 index 0000000..a9f271f --- /dev/null +++ b/functions/su.fish @@ -0,0 +1,3 @@ +function su + command su --shell=/usr/bin/fish $argv +end diff --git a/functions/swap.fish b/functions/swap.fish new file mode 100644 index 0000000..8430201 --- /dev/null +++ b/functions/swap.fish @@ -0,0 +1,3 @@ +function swap --wraps=sudo\ bash\ -c\ \'swapoff\ -a\;\ swapon\ -a\' --wraps='sudo bash -c "swapoff -a; swapon -a"' --wraps='sudo swapoff /dev/sda2; sudo swapon /dev/sda2 -o sw,pri=-2,noatime' --wraps=sudo\ bash\ -c\ \'swapoff\ /dev/sda2\;\ swapon\ /dev/sda2\ -o\ sw,pri=-2,noatime\' --description alias\ swap\ sudo\ bash\ -c\ \'swapoff\ /dev/sda2\;\ swapon\ /dev/sda2\ -o\ sw,pri=-2,noatime\' + sudo bash -c 'swapoff /dev/sda2; swapon /dev/sda2 -o sw,pri=-2,noatime' $argv; +end diff --git a/functions/toggle-dpms.fish b/functions/toggle-dpms.fish new file mode 100644 index 0000000..7f94136 --- /dev/null +++ b/functions/toggle-dpms.fish @@ -0,0 +1,3 @@ +function toggle-dpms --wraps='~/Documentos/scripts/toggle-dpms.sh' --wraps='~/Documentos/scripts/toggle-dpms.sh &>/dev/null & disown' --description 'alias toggle-dpms ~/Documentos/scripts/toggle-dpms.sh &>/dev/null & disown' + ~/Documentos/scripts/toggle-dpms.sh &>/dev/null & disown $argv; +end diff --git a/functions/toggle-firefox.fish b/functions/toggle-firefox.fish new file mode 100644 index 0000000..4bde4bb --- /dev/null +++ b/functions/toggle-firefox.fish @@ -0,0 +1,3 @@ +function toggle-firefox --wraps='~/Documentos/scripts/toggle-firefox.sh' --description 'alias toggle-firefox ~/Documentos/scripts/toggle-firefox.sh' + ~/Documentos/scripts/toggle-firefox.sh $argv; +end diff --git a/functions/trash.fish b/functions/trash.fish new file mode 100644 index 0000000..1a30506 --- /dev/null +++ b/functions/trash.fish @@ -0,0 +1,3 @@ +function trash --description 'alias trash gio trash' + gio trash $argv; +end diff --git a/functions/upscale-batch.fish b/functions/upscale-batch.fish new file mode 100644 index 0000000..d25a7c8 --- /dev/null +++ b/functions/upscale-batch.fish @@ -0,0 +1,3 @@ +function upscale-batch --wraps='~/Documentos/scripts/upscaly-batch.sh' --description 'alias upscale-batch ~/Documentos/scripts/upscaly-batch.sh' + ~/Documentos/scripts/upscaly-batch.sh $argv; +end diff --git a/functions/vim-cheat.fish b/functions/vim-cheat.fish new file mode 100644 index 0000000..a79719a --- /dev/null +++ b/functions/vim-cheat.fish @@ -0,0 +1,3 @@ +function vim-cheat --wraps='cat ~/Documentos/workspace/anotações/Vim-cheatsheet' --wraps=cat\ \~/Documentos/workspace/anotações/Vim-cheatsheet\;\ echo\ \'\' --wraps='cat ~/Documentos/workspace/anotações/Vim-cheatsheet; echo ""' --wraps='glow ~/Documentos/workspace/anotações/Vim-cheatsheet' --wraps='glow -p ~/Documentos/workspace/anotações/Vim-cheatsheet' --description 'alias vim-cheat glow -p ~/Documentos/workspace/anotações/Vim-cheatsheet' + glow -p ~/Documentos/workspace/anotações/Vim-cheatsheet $argv; +end diff --git a/functions/vim-tor.fish b/functions/vim-tor.fish new file mode 100644 index 0000000..f6a55a9 --- /dev/null +++ b/functions/vim-tor.fish @@ -0,0 +1,3 @@ +function vim-tor --wraps='vim Documentos/workspace/anotações/onion-sites.onion' --wraps='vim ~/Documentos/workspace/anotações/onion-sites.onion' --description 'alias vim-tor vim ~/Documentos/workspace/anotações/onion-sites.onion' + vim ~/Documentos/workspace/anotações/onion-sites.onion $argv; +end diff --git a/functions/vim.fish b/functions/vim.fish new file mode 100644 index 0000000..f9e4cf4 --- /dev/null +++ b/functions/vim.fish @@ -0,0 +1,3 @@ +function vim --wraps=nvim --description 'alias vim nvim' + nvim $argv; +end diff --git a/functions/vivo.fish b/functions/vivo.fish new file mode 100644 index 0000000..624fb82 --- /dev/null +++ b/functions/vivo.fish @@ -0,0 +1,3 @@ +function vivo --wraps='sshpass -f ~/Documentos/backup/vivo_pass ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa -l support 192.168.15.1' --description 'alias vivo sshpass -f ~/Documentos/backup/vivo_pass ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa -l support 192.168.15.1' + sshpass -f ~/Documentos/backup/vivo_pass ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa -l support 192.168.15.1 $argv; +end diff --git a/functions/wiki.fish b/functions/wiki.fish new file mode 100644 index 0000000..ed496ad --- /dev/null +++ b/functions/wiki.fish @@ -0,0 +1,3 @@ +function wiki --wraps='vim ~/Documentos/Wiki/index.md' --wraps='nvim +WikiIndex' --description 'alias wiki nvim +WikiIndex' + nvim +WikiIndex $argv; +end diff --git a/functions/write-input.fish b/functions/write-input.fish new file mode 100644 index 0000000..befbb1f --- /dev/null +++ b/functions/write-input.fish @@ -0,0 +1,4 @@ +function write-input --wraps='xclip -selection cliboard -o > input' --description 'alias write-input xclip -selection cliboard -o > input' + xclip -selection cliboard -o > input $argv + +end diff --git a/functions/xconfig.fish b/functions/xconfig.fish new file mode 100644 index 0000000..203cc8c --- /dev/null +++ b/functions/xconfig.fish @@ -0,0 +1,3 @@ +function xconfig --wraps='cd /usr/src/linux; sudo bash -c "make xconfig"; cd -' --wraps='cd /usr/src/linux; sudo bash -c "make -j$(nproc) xconfig"; cd -' --description 'alias xconfig cd /usr/src/linux; sudo bash -c "make -j$(nproc) xconfig"; cd -' + cd /usr/src/linux; sudo bash -c "make -j$(nproc) xconfig"; cd - $argv; +end diff --git a/functions/yt.fish b/functions/yt.fish new file mode 100644 index 0000000..bc11273 --- /dev/null +++ b/functions/yt.fish @@ -0,0 +1,3 @@ +function yt --wraps=ytfzf --description 'alias yt ytfzf' + ytfzf $argv; +end diff --git a/functions/ytmd.fish b/functions/ytmd.fish new file mode 100644 index 0000000..a400843 --- /dev/null +++ b/functions/ytmd.fish @@ -0,0 +1,3 @@ +function ytmd --wraps='ty-dlp -x --embed-thumbnail' --wraps='yt-dlp -x --embed-thumbnail' --wraps='~/Documentos/scripts/ytmd.sh' --description 'alias ytmd ~/Documentos/scripts/ytmd.sh' + ~/Documentos/scripts/ytmd.sh $argv; +end diff --git a/functions/zram.fish b/functions/zram.fish new file mode 100644 index 0000000..7516fb9 --- /dev/null +++ b/functions/zram.fish @@ -0,0 +1,3 @@ +function zram --wraps='sudo rc-service zram-init restart' --wraps='sudo rc-service zram-init restart; sudo swap' --wraps='sudo rc-service zram-init restart; swap' --description 'alias zram sudo rc-service zram-init restart; swap' + sudo rc-service zram-init restart; swap $argv; +end diff --git a/themes/Catppuccin Mocha.theme b/themes/Catppuccin Mocha.theme new file mode 100644 index 0000000..9bea4af --- /dev/null +++ b/themes/Catppuccin Mocha.theme @@ -0,0 +1,26 @@ +# name: 'Catppuccin mocha' +# url: 'https://github.com/catppuccin/fish' +# preferred_background: 1e1e2e + +fish_color_normal cdd6f4 +fish_color_command 89b4fa +fish_color_param f2cdcd +fish_color_keyword f38ba8 +fish_color_quote a6e3a1 +fish_color_redirection f5c2e7 +fish_color_end fab387 +fish_color_error f38ba8 +fish_color_gray 6c7086 +fish_color_selection --background=313244 +fish_color_search_match --background=313244 +fish_color_operator f5c2e7 +fish_color_escape f2cdcd +fish_color_autosuggestion 6c7086 +fish_color_cancel f38ba8 +fish_color_cwd f9e2af +fish_color_user 94e2d5 +fish_color_host 89b4fa +fish_pager_color_progress 6c7086 +fish_pager_color_prefix f5c2e7 +fish_pager_color_completion cdd6f4 +fish_pager_color_description 6c7086