Skip to content

Commit

Permalink
lots of updates :)
Browse files Browse the repository at this point in the history
  • Loading branch information
echoriiku committed Nov 24, 2022
1 parent 025e610 commit ad6530d
Show file tree
Hide file tree
Showing 43 changed files with 409 additions and 64 deletions.
2 changes: 2 additions & 0 deletions dot_config/alacritty/alacritty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ font:
normal:
family: CartographCF Nerd Font
style: Regular
env:
TERM: xterm-256color

# Cursor settings #
cursor:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ complete fzf_configure_bindings --long directory --description "Change the key b
complete fzf_configure_bindings --long git_log --description "Change the key binding for searching git log"
complete fzf_configure_bindings --long git_status --description "Change the key binding for searching git status"
complete fzf_configure_bindings --long history --description "Change the key binding for searching history"
complete fzf_configure_bindings --long processes --description "Change the key binding for searching processes"
complete fzf_configure_bindings --long variables --description "Change the key binding for searching variables"
File renamed without changes.
21 changes: 21 additions & 0 deletions dot_config/fish/completions/nvm.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
complete --command nvm --exclusive
complete --command nvm --exclusive --long version --description "Print version"
complete --command nvm --exclusive --long help --description "Print help"
complete --command nvm --long silent --description "Suppress standard output"

complete --command nvm --exclusive --condition __fish_use_subcommand --arguments install --description "Download and activate the specified Node version"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments use --description "Activate a version in the current shell"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list --description "List installed versions"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list-remote --description "List versions available to install matching optional regex"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments current --description "Print the currently-active version"
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from install" --arguments "(
test -e $nvm_data && string split ' ' <$nvm_data/.index
)"
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from use" --arguments "(_nvm_list | string split ' ')"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments uninstall --description "Uninstall a version"
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from uninstall" --arguments "(
_nvm_list | string split ' ' | string replace system ''
)"
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from use uninstall" --arguments "(
set --query nvm_default_version && echo default
)"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions dot_config/fish/conf.d/nvm.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
function _nvm_install --on-event nvm_install
set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
set --universal nvm_data $XDG_DATA_HOME/nvm

test ! -d $nvm_data && command mkdir -p $nvm_data
echo "Downloading the Node distribution index..." 2>/dev/null
_nvm_index_update
end

function _nvm_update --on-event nvm_update
set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
set --universal nvm_data $XDG_DATA_HOME/nvm
end

function _nvm_uninstall --on-event nvm_uninstall
command rm -rf $nvm_data

set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version

set --names | string replace --filter --regex -- "^nvm" "set --erase nvm" | source
functions --erase (functions --all | string match --entire --regex -- "^_nvm_")
end

if status is-interactive && set --query nvm_default_version && ! set --query nvm_current_version
nvm use --silent $nvm_default_version
end
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ end
abbr -a upd 'sudo dnf update --refresh && flatpak update && cargo install-update -a'

alias wezterm='flatpak run org.wezfurlong.wezterm'
alias nv='nvim'

#autostart fetch script
# cutefetch $(printf '\t-k\n-b\n-p' | shuf -n 1) $(shuf -i 1-13 -n 1)
macchina
# macchina
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
jorgebucaran/fisher
patrickf1/fzf.fish
jomik/fish-gruvbox
jorgebucaran/nvm.fish
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ SETUVAR _fish_abbr_zj:zellij
SETUVAR _fish_abbr_zl:zellij
SETUVAR _fisher_jomik_2F_fish_2D_gruvbox_files:\x7e/\x2econfig/fish/functions/theme_gruvbox\x2efish
SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish
SETUVAR _fisher_jorgebucaran_2F_nvm_2E_fish_files:\x7e/\x2econfig/fish/functions/_nvm_index_update\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_list\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_version_activate\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_version_deactivate\x2efish\x1e\x7e/\x2econfig/fish/functions/nvm\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/nvm\x2efish\x1e\x7e/\x2econfig/fish/completions/nvm\x2efish
SETUVAR _fisher_patrickf1_2F_fzf_2E_fish_files:\x7e/\x2econfig/fish/functions/_fzf_configure_bindings_help\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_extract_var_info\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_changed_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_diff_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_file_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_directory\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_log\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_status\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_history\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_processes\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_variables\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_wrapper\x2efish\x1e\x7e/\x2econfig/fish/functions/fzf_configure_bindings\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/fzf\x2efish\x1e\x7e/\x2econfig/fish/completions/fzf_configure_bindings\x2efish
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1epatrickf1/fzf\x2efish\x1ejomik/fish\x2dgruvbox
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1epatrickf1/fzf\x2efish\x1ejomik/fish\x2dgruvbox\x1ejorgebucaran/nvm\x2efish
SETUVAR _fisher_upgraded_to_4_4:\x1d
SETUVAR fish_color_autosuggestion:\x1d
SETUVAR fish_color_cancel:\x1d
Expand Down Expand Up @@ -82,3 +83,5 @@ 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/riiku/\x2enimble/bin\x1e/home/riiku/\x2enim/bin\x1e/home/riiku/\x2espicetify\x1e/home/riiku/\x2edeno/bin\x1e/home/riiku/\x2ecargo/bin\x1e/home/riiku/\x2elocal/bin
SETUVAR nvm_data:/home/riiku/\x2elocal/share/nvm
SETUVAR nvm_mirror:https\x3a//nodejs\x2eorg/dist
43 changes: 43 additions & 0 deletions dot_config/fish/functions/_fzf_configure_bindings_help.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
function _fzf_configure_bindings_help --description "Prints the help message for fzf_configure_bindings."
echo "\
USAGE:
fzf_configure_bindings [--COMMAND=[KEY_SEQUENCE]...]
DESCRIPTION
fzf_configure_bindings installs key bindings for fzf.fish's commands and erases any bindings it
previously installed. It installs bindings for both default and insert modes. fzf.fish executes
it without options on fish startup to install the out-of-the-box key bindings.
By default, commands are bound to a mnemonic key sequence, shown below. Each command's binding
can be configured using a namesake corresponding option:
COMMAND | DEFAULT KEY SEQUENCE | CORRESPONDING OPTION
Search Directory | Ctrl+Alt+F (F for file) | --directory
Search Git Log | Ctrl+Alt+L (L for log) | --git_log
Search Git Status | Ctrl+Alt+S (S for status) | --git_status
Search History | Ctrl+R (R for reverse) | --history
Search Processes | Ctrl+Alt+P (P for process) | --processes
Search Variables | Ctrl+V (V for variable) | --variables
Override a command's binding by specifying its corresponding option with the desired key
sequence. Disable a command's binding by specifying its corresponding option with no value.
Because fzf_configure_bindings erases bindings it previously installed, it can be cleanly
executed multiple times. Once the desired fzf_configure_bindings command has been found, add it
to your config.fish in order to persist the customized bindings.
In terms of validation, fzf_configure_bindings fails if passed unknown options. It expects an
equals sign between an option's name and value. However, it does not validate key sequences.
Pass -h or --help to print this help message and exit.
EXAMPLES
Default bindings but bind Search Directory to Ctrl+F and Search Variables to Ctrl+Alt+V
\$ fzf_configure_bindings --directory=\cf --variables=\e\cv
Default bindings but disable Search History
\$ fzf_configure_bindings --history=
An agglomeration of different options
\$ fzf_configure_bindings --git_status=\cg --history=\ch --variables= --processes=
SEE Also
To learn more about fish key bindings, see bind(1) and fish_key_reader(1).
"
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# arg should be a line from git status --short, e.g.
# MM functions/_fzf_preview_changed_file.fish
# D README.md
# R LICENSE.md -> LICENSE
# R LICENSE -> "New License"
function _fzf_preview_changed_file --argument-names path_status --description "Show the git diff of the given file."
# remove quotes because they'll be interpreted literally by git diff
# no need to requote when referencing $path because fish does not perform word splitting
Expand All @@ -12,8 +12,8 @@ function _fzf_preview_changed_file --argument-names path_status --description "S
# https://git-scm.com/docs/git-status/2.35.0#_short_format
set -l index_status (string sub --length 1 $path_status)
set -l working_tree_status (string sub --start 2 --length 1 $path_status)
# no-prefix because the file is always being compared to itself so is unecessary
set diff_opts --color=always --no-prefix

set diff_opts --color=always

if test $index_status = '?'
_fzf_report_diff_type Untracked
Expand All @@ -27,7 +27,18 @@ function _fzf_preview_changed_file --argument-names path_status --description "S
else
if test $index_status != ' '
_fzf_report_diff_type Staged
git diff --staged $diff_opts -- $path

# renames are only detected in the index, never working tree, so only need to test for it here
# https://stackoverflow.com/questions/73954214
if test $index_status = R
# diff the post-rename path with the original path, otherwise the diff will show the entire file as being added
set orig_and_new_path (string split --max 1 -- ' -> ' $path)
git diff --staged $diff_opts -- $orig_and_new_path[1] $orig_and_new_path[2]
# path currently has the form of "original -> current", so we need to correct it before it's used below
set path $orig_and_new_path[2]
else
git diff --staged $diff_opts -- $path
end
end

if test $working_tree_status != ' '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ function _fzf_search_directory --description "Search the current directory. Repl
# --string-cwd-prefix prevents fd >= 8.3.0 from prepending ./ to relative paths
set fd_opts --color=always --strip-cwd-prefix $fzf_fd_opts

set fzf_arguments --multi --ansi $fzf_dir_opts
# $fzf_dir_opts is the deprecated version of $fzf_directory_opts
set fzf_arguments --multi --ansi $fzf_dir_opts $fzf_directory_opts
set token (commandline --current-token)
# expand any variables or leading tilde (~) in the token
set expanded_token (eval echo -- $token)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ function _fzf_search_variables --argument-names set_show_output set_names_output
--preview-window="wrap" \
--multi \
--query=$cleaned_curr_token \
$fzf_shell_vars_opts
# $fzf_shell_vars_opts is the deprecated version of $fzf_variables_opts
$fzf_shell_vars_opts $fzf_variables_opts
)

if test $status -eq 0
Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions dot_config/fish/functions/_nvm_index_update.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function _nvm_index_update
test ! -d $nvm_data && command mkdir -p $nvm_data

set --local index $nvm_data/.index

if not command curl --location --silent $nvm_mirror/index.tab >$index.temp
command rm -f $index.temp
echo "nvm: Can't update index, host unavailable: \"$nvm_mirror\"" >&2
return 1
end

command awk -v OFS=\t '
/v0.9.12/ { exit } # Unsupported
NR > 1 {
print $1 (NR == 2 ? " latest" : $10 != "-" ? " lts/" tolower($10) : "")
}
' $index.temp >$index

command rm -f $index.temp
end
11 changes: 11 additions & 0 deletions dot_config/fish/functions/_nvm_list.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function _nvm_list
set --local versions $nvm_data/*
set --query versions[1] &&
string match --entire --regex -- (string match --regex -- "v\d.+" $versions |
string escape --style=regex |
string join "|"
) <$nvm_data/.index

command --all node |
string match --quiet --invert --regex -- "^$nvm_data" && echo system
end
4 changes: 4 additions & 0 deletions dot_config/fish/functions/_nvm_version_activate.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function _nvm_version_activate --argument-names ver
set --global --export nvm_current_version $ver
set --prepend PATH $nvm_data/$ver/bin
end
5 changes: 5 additions & 0 deletions dot_config/fish/functions/_nvm_version_deactivate.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function _nvm_version_deactivate --argument-names ver
test "$nvm_current_version" = "$ver" && set --erase nvm_current_version
set --local index (contains --index -- $nvm_data/$ver/bin $PATH) &&
set --erase PATH[$index]
end
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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.2
set --local fisher_version 4.4.3
set --local fish_plugins $__fish_config_dir/fish_plugins

switch "$cmd"
Expand Down Expand Up @@ -173,7 +173,7 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
end

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

set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function fzf_configure_bindings --description "Installs the default key bindings
# no need to install bindings if not in interactive mode or running tests
status is-interactive || test "$CI" = true; or return

set options_spec h/help 'directory=?' 'git_log=?' 'git_status=?' 'history=?' 'variables=?' 'processes=?'
set options_spec h/help 'directory=?' 'git_log=?' 'git_status=?' 'history=?' 'processes=?' 'variables=?'
argparse --max-args=0 --ignore-unknown $options_spec -- $argv 2>/dev/null
if test $status -ne 0
echo "Invalid option or a positional argument was provided." >&2
Expand All @@ -15,14 +15,14 @@ function fzf_configure_bindings --description "Installs the default key bindings
return
else
# Initialize with default key sequences and then override or disable them based on flags
# index 1 = directory, 2 = git_log, 3 = git_status, 4 = history, 5 = variables, 6 = processes
set key_sequences \e\cf \e\cl \e\cs \cr \cv \e\cp # \c = control, \e = escape
# index 1 = directory, 2 = git_log, 3 = git_status, 4 = history, 5 = processes, 6 = variables
set key_sequences \e\cf \e\cl \e\cs \cr \e\cp \cv # \c = control, \e = escape
set --query _flag_directory && set key_sequences[1] "$_flag_directory"
set --query _flag_git_log && set key_sequences[2] "$_flag_git_log"
set --query _flag_git_status && set key_sequences[3] "$_flag_git_status"
set --query _flag_history && set key_sequences[4] "$_flag_history"
set --query _flag_variables && set key_sequences[5] "$_flag_variables"
set --query _flag_processes && set key_sequences[6] "$_flag_processes"
set --query _flag_processes && set key_sequences[5] "$_flag_processes"
set --query _flag_variables && set key_sequences[6] "$_flag_variables"

# If fzf bindings already exists, uninstall it first for a clean slate
if functions --query _fzf_uninstall_bindings
Expand All @@ -34,8 +34,8 @@ function fzf_configure_bindings --description "Installs the default key bindings
test -n $key_sequences[2] && bind --mode $mode $key_sequences[2] _fzf_search_git_log
test -n $key_sequences[3] && bind --mode $mode $key_sequences[3] _fzf_search_git_status
test -n $key_sequences[4] && bind --mode $mode $key_sequences[4] _fzf_search_history
test -n $key_sequences[5] && bind --mode $mode $key_sequences[5] "$_fzf_search_vars_command"
test -n $key_sequences[6] && bind --mode $mode $key_sequences[6] _fzf_search_processes
test -n $key_sequences[5] && bind --mode $mode $key_sequences[5] _fzf_search_processes
test -n $key_sequences[6] && bind --mode $mode $key_sequences[6] "$_fzf_search_vars_command"
end

function _fzf_uninstall_bindings --inherit-variable key_sequences
Expand Down
Loading

0 comments on commit ad6530d

Please sign in to comment.