1
0
Fork 0
mirror of https://github.com/SeriousBug/dotfiles synced 2024-11-01 03:27:26 -05:00

add work specific changes

This commit is contained in:
Kaan Barmore-Genç 2022-07-23 13:34:25 -04:00
parent 7a970cf19b
commit 6919b66f03
11 changed files with 136 additions and 104 deletions

View file

@ -1,5 +1,7 @@
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"

View file

@ -1,17 +1,17 @@
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
set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist
test ! -d $nvm_data && command mkdir -p $nvm_data
echo "Downloading the Node distribution index..." 2>/dev/null
_nvm_index_update $nvm_mirror $nvm_data/.index
_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
set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist
end
function _nvm_uninstall --on-event nvm_uninstall
@ -24,5 +24,5 @@ function _nvm_uninstall --on-event nvm_uninstall
end
if status is-interactive && set --query nvm_default_version && ! set --query nvm_current_version
nvm use $nvm_default_version >/dev/null
nvm use --silent $nvm_default_version
end

View file

@ -4,23 +4,6 @@ end
# set up direnv
direnv hook fish | source
# set current desktop, needed for desktop sharing with Wayland
set -gx XDG_CURRENT_DESKTOP sway
# make Qt apps use the theme set by qt5ct
set -gx QT_QPA_PLATFORMTHEME qt5ct
# load desktop files from flatpak
set -l xdg_data_home $XDG_DATA_HOME ~/.local/share
set -gx --path XDG_DATA_DIRS $xdg_data_home[1]/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
# Unlock login keyring
if test -n "$DESKTOP_SESSION"
set -x (gnome-keyring-daemon --start | string split "=")
end
for flatpakdir in ~/.local/share/flatpak/exports/bin /var/lib/flatpak/exports/bin
if test -d $flatpakdir
contains $flatpakdir $PATH; or set -a PATH $flatpakdir
end
end
# Set Mac keyboard shortcuts
bind \u0192 forward-word
bind \u222B backward-word

View file

@ -9,8 +9,8 @@ SETUVAR --export MOZ_ENABLE_WAYLAND:1
SETUVAR --export TSC_WATCHFILE:UseFsEventsWithFallbackDynamicPolling
SETUVAR --export XDG_CURRENT_DESKTOP:sway
SETUVAR __fish_initialized:3400
SETUVAR _fisher_jorgebucaran_2F_fisher_files:/home/kaan/\x2econfig/fish/functions/fisher\x2efish\x1e/home/kaan/\x2econfig/fish/completions/fisher\x2efish
SETUVAR _fisher_jorgebucaran_2F_nvm_2E_fish_files:/home/kaan/\x2econfig/fish/functions/_nvm_index_update\x2efish\x1e/home/kaan/\x2econfig/fish/functions/_nvm_list\x2efish\x1e/home/kaan/\x2econfig/fish/functions/_nvm_version_activate\x2efish\x1e/home/kaan/\x2econfig/fish/functions/_nvm_version_deactivate\x2efish\x1e/home/kaan/\x2econfig/fish/functions/nvm\x2efish\x1e/home/kaan/\x2econfig/fish/conf\x2ed/nvm\x2efish\x1e/home/kaan/\x2econfig/fish/completions/nvm\x2efish
SETUVAR _fisher_jorgebucaran_2F_fisher_files:/Users/kaan/\x2econfig/fish/functions/fisher\x2efish\x1e/Users/kaan/\x2econfig/fish/completions/fisher\x2efish
SETUVAR _fisher_jorgebucaran_2F_nvm_2E_fish_files:/Users/kaan/\x2econfig/fish/functions/_nvm_index_update\x2efish\x1e/Users/kaan/\x2econfig/fish/functions/_nvm_list\x2efish\x1e/Users/kaan/\x2econfig/fish/functions/_nvm_version_activate\x2efish\x1e/Users/kaan/\x2econfig/fish/functions/_nvm_version_deactivate\x2efish\x1e/Users/kaan/\x2econfig/fish/functions/nvm\x2efish\x1e/Users/kaan/\x2econfig/fish/conf\x2ed/nvm\x2efish\x1e/Users/kaan/\x2econfig/fish/completions/nvm\x2efish
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1ejorgebucaran/nvm\x2efish
SETUVAR fish_color_autosuggestion:555\x1ebrblack
SETUVAR fish_color_cancel:\x2dr
@ -40,6 +40,7 @@ SETUVAR fish_pager_color_description:B3A06D\x1eyellow
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
SETUVAR fish_pager_color_selected_background:\x2dr
SETUVAR fish_user_paths:/home/kaan/\x2ecargo/bin\x1e/home/kaan/Android/Sdk/platform\x2dtools\x1e/home/kaan/Android/Sdk/tools/bin\x1e/home/kaan/Android/Sdk/tools\x1e/home/kaan/Android/Sdk/emulator\x1e/home/kaan/\x2elocal/bin
SETUVAR nvm_data:/home/kaan/\x2elocal/share/nvm
SETUVAR fish_user_paths:/Users/kaan/\x2ecargo/bin\x1e/home/kaan/\x2ecargo/bin\x1e/home/kaan/Android/Sdk/platform\x2dtools\x1e/home/kaan/Android/Sdk/tools/bin\x1e/home/kaan/Android/Sdk/tools\x1e/home/kaan/Android/Sdk/emulator\x1e/home/kaan/\x2elocal/bin
SETUVAR nvm_data:/Users/kaan/\x2elocal/share/nvm
SETUVAR nvm_default_version:lts
SETUVAR nvm_mirror:https\x3a//nodejs\x2eorg/dist

View file

@ -1,7 +1,11 @@
function _nvm_index_update --argument-names mirror index
if not command curl --location --silent $mirror/index.tab >$index.temp
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: \"$mirror\"" >&2
echo "nvm: Can't update index, host unavailable: \"$nvm_mirror\"" >&2
return 1
end

View file

@ -1,4 +1,4 @@
function _nvm_version_activate --argument-names v
set --global --export nvm_current_version $v
set --prepend PATH $nvm_data/$v/bin
function _nvm_version_activate --argument-names ver
set --global --export nvm_current_version $ver
set --prepend PATH $nvm_data/$ver/bin
end

View file

@ -1,5 +1,5 @@
function _nvm_version_deactivate --argument-names v
test "$nvm_current_version" = "$v" && set --erase nvm_current_version
set --local index (contains --index -- $nvm_data/$v/bin $PATH) &&
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

View file

@ -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.3.1
set --local fisher_version 4.3.5
set --local fish_plugins $__fish_config_dir/fish_plugins
switch "$cmd"
@ -16,7 +16,7 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
echo " -v or --version Print version"
echo " -h or --help Print this help message"
echo "Variables:"
echo " \$fisher_path Plugin installation path. Default: ~/.config/fish"
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
@ -29,13 +29,15 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
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 test ! -e $fish_plugins
else if ! set --query file_plugins
echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
end
set arg_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins)
set arg_plugins $file_plugins
end
for plugin in $arg_plugins
@ -70,6 +72,8 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
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
@ -78,23 +82,29 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
command mkdir -p $source/{completions,conf.d,functions}
fish --command "
$fish_path --command "
if test -e $plugin
command cp -Rf $plugin/* $source
else
set temp (command mktemp -d)
set name (string split \@ $plugin) || set name[2] HEAD
set url https://api.github.com/repos/\$name[1]/tarball/\$name[2]
set header 'Accept: application/vnd.github.v3+json'
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 -H \$header \$url | tar -xzC \$temp -f - 2>/dev/null
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
@ -125,6 +135,7 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
emit {$name}_uninstall
end
printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var
set --erase _fisher_plugins[$index]
end
command rm -rf $$plugin_files_var
@ -134,7 +145,6 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
complete --erase --command $name
end
set --erase _fisher_plugins[$index]
set --erase $plugin_files_var
end
end
@ -183,10 +193,22 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
command rm -rf $source_plugins
set --query _fisher_plugins[1] || set --erase _fisher_plugins
set --query _fisher_plugins &&
printf "%s\n" $_fisher_plugins >$fish_plugins ||
if set --query _fisher_plugins[1]
set --local commit_plugins
for plugin in $file_plugins
contains -- $plugin $_fisher_plugins && set --append commit_plugins $plugin
end
for plugin in $_fisher_plugins
contains -- $plugin $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 ", " (

View file

@ -1,19 +1,35 @@
function nvm --argument-names cmd v --description "Node version manager"
if test -z "$v" && contains -- "$cmd" install use
for file in .nvmrc .node-version
set file (_nvm_find_up $PWD $file) && read v <$file && break
function nvm --description "Node version manager"
for silent in --silent -s
if set --local index (contains --index -- $silent $argv)
set --erase argv[$index] && break
end
if test -z "$v"
set --erase silent
end
set --local cmd $argv[1]
set --local ver $argv[2]
if set --query silent && ! set --query cmd[1]
echo "nvm: Version number not specified (see nvm -h for usage)" >&2
return 1
end
if ! set --query ver[1] && contains -- "$cmd" install use
for file in .nvmrc .node-version
set file (_nvm_find_up $PWD $file) && read ver <$file && break
end
if ! set --query ver[1]
echo "nvm: Invalid version or missing \".nvmrc\" file" >&2
return 1
end
end
set --local their_version $v
set --local their_version $ver
switch "$cmd"
case -v --version
echo "nvm, version 2.2.7"
echo "nvm, version 2.2.11"
case "" -h --help
echo "Usage: nvm install <version> Download and activate the specified Node version"
echo " nvm install Install version from nearest .nvmrc file"
@ -25,23 +41,25 @@ function nvm --argument-names cmd v --description "Node version manager"
echo " nvm current Print the currently-active version"
echo " nvm uninstall <version> Uninstall a version"
echo "Options:"
echo " -s or --silent Suppress standard output"
echo " -v or --version Print version"
echo " -h or --help Print this help message"
echo "Variables:"
echo " nvm_arch Override architecture, e.g. x64-musl"
echo " nvm_mirror Set the Node download mirror"
echo " nvm_mirror Use a mirror of the Node binaries"
echo " nvm_default_version Set the default version for new shells"
echo " nvm_default_packages Install a list of packages every time you install a Node version"
case install
_nvm_index_update $nvm_mirror $nvm_data/.index || return
_nvm_index_update
string match --entire --regex -- (_nvm_version_match $v) <$nvm_data/.index | read v alias
string match --entire --regex -- (_nvm_version_match $ver) <$nvm_data/.index | read ver alias
if ! set --query v[1]
if ! set --query ver[1]
echo "nvm: Invalid version number or alias: \"$their_version\"" >&2
return 1
end
if test ! -e $nvm_data/$v
if test ! -e $nvm_data/$ver
set --local os (command uname -s | string lower)
set --local ext tar.gz
set --local arch (command uname -m)
@ -66,7 +84,7 @@ function nvm --argument-names cmd v --description "Node version manager"
case x86_64
set arch x64
case arm64
string match --regex --quiet "v(?<major>\d+)" $v
string match --regex --quiet "v(?<major>\d+)" $ver
if test "$os" = darwin -a $major -lt 16
set arch x64
end
@ -80,101 +98,105 @@ function nvm --argument-names cmd v --description "Node version manager"
set --query nvm_arch && set arch $nvm_arch
set --local dir "node-$v-$os-$arch"
set --local url $nvm_mirror/$v/$dir.$ext
set --local dir "node-$ver-$os-$arch"
set --local url $nvm_mirror/$ver/$dir.$ext
command mkdir -p $nvm_data/$v
command mkdir -p $nvm_data/$ver
echo -e "Installing Node \x1b[1m$v\x1b[22m $alias"
if ! set --query silent
echo -e "Installing Node \x1b[1m$ver\x1b[22m $alias"
echo -e "Fetching \x1b[4m$url\x1b[24m\x1b[7m"
end
if ! command curl --progress-bar --location $url \
| command tar --extract --gzip --directory $nvm_data/$v 2>/dev/null
command rm -rf $nvm_data/$v
if ! command curl $silent --progress-bar --location $url |
command tar --extract --gzip --directory $nvm_data/$ver 2>/dev/null
command rm -rf $nvm_data/$ver
echo -e "\033[F\33[2K\x1b[0mnvm: Invalid mirror or host unavailable: \"$url\"" >&2
return 1
end
echo -en "\033[F\33[2K\x1b[0m"
set --query silent || echo -en "\033[F\33[2K\x1b[0m"
if test "$os" = win
command mv $nvm_data/$v/$dir $nvm_data/$v/bin
command mv $nvm_data/$ver/$dir $nvm_data/$ver/bin
else
command mv $nvm_data/$v/$dir/* $nvm_data/$v
command rm -rf $nvm_data/$v/$dir
command mv $nvm_data/$ver/$dir/* $nvm_data/$ver
command rm -rf $nvm_data/$ver/$dir
end
end
if test $v != "$nvm_current_version"
if test $ver != "$nvm_current_version"
set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version
_nvm_version_activate $v
_nvm_version_activate $ver
set --query nvm_default_packages[1] && npm install --global $silent $nvm_default_packages
end
printf "Now using Node %s (npm %s) %s\n" (_nvm_node_info)
set --query silent || printf "Now using Node %s (npm %s) %s\n" (_nvm_node_info)
case use
test $v = default && set v $nvm_default_version
_nvm_list | string match --entire --regex -- (_nvm_version_match $v) | read v __
test $ver = default && set ver $nvm_default_version
_nvm_list | string match --entire --regex -- (_nvm_version_match $ver) | read ver __
if ! set --query v[1]
if ! set --query ver[1]
echo "nvm: Can't use Node \"$their_version\", version must be installed first" >&2
return 1
end
if test $v != "$nvm_current_version"
if test $ver != "$nvm_current_version"
set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version
test $v != system && _nvm_version_activate $v
test $ver != system && _nvm_version_activate $ver
end
printf "Now using Node %s (npm %s) %s\n" (_nvm_node_info)
set --query silent || printf "Now using Node %s (npm %s) %s\n" (_nvm_node_info)
case uninstall
if test -z "$v"
if test -z "$ver"
echo "nvm: Not enough arguments for command: \"$cmd\"" >&2
return 1
end
test $v = default && test ! -z "$nvm_default_version" && set v $nvm_default_version
test $ver = default && test ! -z "$nvm_default_version" && set ver $nvm_default_version
_nvm_list | string match --entire --regex -- (_nvm_version_match $v) | read v __
_nvm_list | string match --entire --regex -- (_nvm_version_match $ver) | read ver __
if ! set -q v[1]
if ! set -q ver[1]
echo "nvm: Node version not installed or invalid: \"$their_version\"" >&2
return 1
end
printf "Uninstalling Node %s %s\n" $v (string replace ~ \~ "$nvm_data/$v/bin/node")
set --query silent || printf "Uninstalling Node %s %s\n" $ver (string replace ~ \~ "$nvm_data/$ver/bin/node")
_nvm_version_deactivate $v
_nvm_version_deactivate $ver
command rm -rf $nvm_data/$v
command rm -rf $nvm_data/$ver
case current
_nvm_current
case ls list
_nvm_list | _nvm_list_format (_nvm_current) $argv[2]
case lsr {ls,list}-remote
_nvm_index_update $nvm_mirror $nvm_data/.index || return
_nvm_index_update || return
_nvm_list | command awk '
FILENAME == "-" && (is_local[$1] = FNR == NR) { next } {
print $0 (is_local[$1] ? " ✓" : "")
}
' - $nvm_data/.index | _nvm_list_format (_nvm_current) $argv[2]
case \*
echo "nvm: Unknown command or option: \"$cmd\" (see nvm -h)" >&2
echo "nvm: Unknown command or option: \"$cmd\" (see nvm -h for usage)" >&2
return 1
end
end
function _nvm_find_up --argument-names path file
test -e "$path/$file" && echo $path/$file || begin
test "$path" != / || return
_nvm_find_up (command dirname $path) $file
test ! -z "$path" || return
_nvm_find_up (string replace --regex -- '/[^/]*$' "" $path) $file
end
end
function _nvm_version_match --argument-names v
string replace --regex -- '^v?(\d+|\d+\.\d+)$' 'v$1.' $v |
function _nvm_version_match --argument-names ver
string replace --regex -- '^v?(\d+|\d+\.\d+)$' 'v$1.' $ver |
string replace --filter --regex -- '^v?(\d+)' 'v$1' |
string escape --style=regex ||
string lower '\b'$v'(?:/\w+)?$'
string lower '\b'$ver'(?:/\w+)?$'
end
function _nvm_list_format --argument-names current regex

View file

@ -1,13 +1,13 @@
[user]
email = kaan@bgenc.net
name = Kaan Genc
signingkey = A797CF95E35B9AF65CEF27C55E48BE32646A796F
signingkey = F5DEC5268AA501F35FBD5978B2E280771CD62FCF
name = Kaan Barmore-Genc
[init]
defaultBranch = main
[pull]
rebase = true
[commit]
gpgSign = false
gpgSign = true
[tag]
gpgsign = true
[pager]
@ -24,5 +24,3 @@
ff = no
[alias]
stat = status
[core]
editor = code --wait

View file

@ -24,7 +24,7 @@ bold_italic_font auto
#: italic_font Operator Mono Book Italic
#: bold_italic_font Operator Mono Medium Italic
font_size 11.0
font_size 13.0
#: Font size (in pts)