mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-01 22:47:48 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9cb400dd3f | |||
| fce649619a | |||
| 8b0148e468 | |||
| 9cb27eb9dc | |||
| f1ed88a98e | |||
| ec35f1cb1e | |||
| dab8504cfd | |||
| 0f9a76e36f | |||
|
|
97244d5287 | ||
| 50ea9bea89 | |||
| 688469ad8b | |||
|
|
af32914d71 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -45,3 +45,4 @@ config/fish/completions/asdf.fish
|
|||||||
config/vim/.netrwhist
|
config/vim/.netrwhist
|
||||||
config/vim/extra/*
|
config/vim/extra/*
|
||||||
config/gh/hosts.yml
|
config/gh/hosts.yml
|
||||||
|
dependency-check-report.html
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ repos:
|
|||||||
- id: actionlint
|
- id: actionlint
|
||||||
|
|
||||||
- repo: https://github.com/renovatebot/pre-commit-hooks
|
- repo: https://github.com/renovatebot/pre-commit-hooks
|
||||||
rev: 39.212.0
|
rev: 39.222.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: renovate-config-validator
|
- id: renovate-config-validator
|
||||||
|
|
||||||
|
|||||||
235
config/fish/completions/docker.fish
Executable file
235
config/fish/completions/docker.fish
Executable file
@@ -0,0 +1,235 @@
|
|||||||
|
# fish completion for docker -*- shell-script -*-
|
||||||
|
|
||||||
|
function __docker_debug
|
||||||
|
set -l file "$BASH_COMP_DEBUG_FILE"
|
||||||
|
if test -n "$file"
|
||||||
|
echo "$argv" >> $file
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __docker_perform_completion
|
||||||
|
__docker_debug "Starting __docker_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))
|
||||||
|
|
||||||
|
__docker_debug "args: $args"
|
||||||
|
__docker_debug "last arg: $lastArg"
|
||||||
|
|
||||||
|
# Disable ActiveHelp which is not supported for fish shell
|
||||||
|
set -l requestComp "DOCKER_ACTIVE_HELP=0 $args[1] __complete $args[2..-1] $lastArg"
|
||||||
|
|
||||||
|
__docker_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., <program> -n=<TAB>)
|
||||||
|
# completions must be prefixed with the flag
|
||||||
|
set -l flagPrefix (string match -r -- '-.*=' "$lastArg")
|
||||||
|
|
||||||
|
__docker_debug "Comps: $comps"
|
||||||
|
__docker_debug "DirectiveLine: $directiveLine"
|
||||||
|
__docker_debug "flagPrefix: $flagPrefix"
|
||||||
|
|
||||||
|
for comp in $comps
|
||||||
|
printf "%s%s\n" "$flagPrefix" "$comp"
|
||||||
|
end
|
||||||
|
|
||||||
|
printf "%s\n" "$directiveLine"
|
||||||
|
end
|
||||||
|
|
||||||
|
# this function limits calls to __docker_perform_completion, by caching the result behind $__docker_perform_completion_once_result
|
||||||
|
function __docker_perform_completion_once
|
||||||
|
__docker_debug "Starting __docker_perform_completion_once"
|
||||||
|
|
||||||
|
if test -n "$__docker_perform_completion_once_result"
|
||||||
|
__docker_debug "Seems like a valid result already exists, skipping __docker_perform_completion"
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
set --global __docker_perform_completion_once_result (__docker_perform_completion)
|
||||||
|
if test -z "$__docker_perform_completion_once_result"
|
||||||
|
__docker_debug "No completions, probably due to a failure"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
__docker_debug "Performed completions and set __docker_perform_completion_once_result"
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# this function is used to clear the $__docker_perform_completion_once_result variable after completions are run
|
||||||
|
function __docker_clear_perform_completion_once_result
|
||||||
|
__docker_debug ""
|
||||||
|
__docker_debug "========= clearing previously set __docker_perform_completion_once_result variable =========="
|
||||||
|
set --erase __docker_perform_completion_once_result
|
||||||
|
__docker_debug "Successfully erased the variable __docker_perform_completion_once_result"
|
||||||
|
end
|
||||||
|
|
||||||
|
function __docker_requires_order_preservation
|
||||||
|
__docker_debug ""
|
||||||
|
__docker_debug "========= checking if order preservation is required =========="
|
||||||
|
|
||||||
|
__docker_perform_completion_once
|
||||||
|
if test -z "$__docker_perform_completion_once_result"
|
||||||
|
__docker_debug "Error determining if order preservation is required"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
set -l directive (string sub --start 2 $__docker_perform_completion_once_result[-1])
|
||||||
|
__docker_debug "Directive is: $directive"
|
||||||
|
|
||||||
|
set -l shellCompDirectiveKeepOrder 32
|
||||||
|
set -l keeporder (math (math --scale 0 $directive / $shellCompDirectiveKeepOrder) % 2)
|
||||||
|
__docker_debug "Keeporder is: $keeporder"
|
||||||
|
|
||||||
|
if test $keeporder -ne 0
|
||||||
|
__docker_debug "This does require order preservation"
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
__docker_debug "This doesn't require order preservation"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# This function does two things:
|
||||||
|
# - Obtain the completions and store them in the global __docker_comp_results
|
||||||
|
# - Return false if file completion should be performed
|
||||||
|
function __docker_prepare_completions
|
||||||
|
__docker_debug ""
|
||||||
|
__docker_debug "========= starting completion logic =========="
|
||||||
|
|
||||||
|
# Start fresh
|
||||||
|
set --erase __docker_comp_results
|
||||||
|
|
||||||
|
__docker_perform_completion_once
|
||||||
|
__docker_debug "Completion results: $__docker_perform_completion_once_result"
|
||||||
|
|
||||||
|
if test -z "$__docker_perform_completion_once_result"
|
||||||
|
__docker_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 $__docker_perform_completion_once_result[-1])
|
||||||
|
set --global __docker_comp_results $__docker_perform_completion_once_result[1..-2]
|
||||||
|
|
||||||
|
__docker_debug "Completions are: $__docker_comp_results"
|
||||||
|
__docker_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
|
||||||
|
__docker_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
|
||||||
|
__docker_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)
|
||||||
|
|
||||||
|
__docker_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)
|
||||||
|
__docker_debug "prefix: $prefix"
|
||||||
|
|
||||||
|
set -l completions (string match -r -- "^$prefix.*" $__docker_comp_results)
|
||||||
|
set --global __docker_comp_results $completions
|
||||||
|
__docker_debug "Filtered completions are: $__docker_comp_results"
|
||||||
|
|
||||||
|
# Important not to quote the variable for count to work
|
||||||
|
set -l numComps (count $__docker_comp_results)
|
||||||
|
__docker_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 $__docker_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.
|
||||||
|
__docker_debug "Adding second completion to perform nospace directive"
|
||||||
|
set --global __docker_comp_results $split[1] $split[1].
|
||||||
|
__docker_debug "Completions are now: $__docker_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
|
||||||
|
__docker_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 "docker"
|
||||||
|
# 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 "docker " > /dev/null 2>&1
|
||||||
|
end
|
||||||
|
|
||||||
|
# Remove any pre-existing completions for the program since we will be handling all of them.
|
||||||
|
complete -c docker -e
|
||||||
|
|
||||||
|
# this will get called after the two calls below and clear the $__docker_perform_completion_once_result global
|
||||||
|
complete -c docker -n '__docker_clear_perform_completion_once_result'
|
||||||
|
# The call to __docker_prepare_completions will setup __docker_comp_results
|
||||||
|
# which provides the program's completion choices.
|
||||||
|
# If this doesn't require order preservation, we don't use the -k flag
|
||||||
|
complete -c docker -n 'not __docker_requires_order_preservation && __docker_prepare_completions' -f -a '$__docker_comp_results'
|
||||||
|
# otherwise we use the -k flag
|
||||||
|
complete -k -c docker -n '__docker_requires_order_preservation && __docker_prepare_completions' -f -a '$__docker_comp_results'
|
||||||
63
config/fish/completions/nvm.fish
Normal file
63
config/fish/completions/nvm.fish
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
# NVM (https://github.com/creationix/nvm) completions for Fish shell
|
||||||
|
# Inspired on (https://github.com/derekstavis/plugin-nvm)
|
||||||
|
|
||||||
|
function __nvm_complete_ls_remote
|
||||||
|
if not test "$__nvm_ls_remote"
|
||||||
|
set -g __nvm_ls_remote (nvm ls-remote | grep -Po '(?:iojs-)?v[0-9]+\.[0-9]+\.[0-9]+')
|
||||||
|
end
|
||||||
|
|
||||||
|
printf "%s\n" $__nvm_ls_remote
|
||||||
|
end
|
||||||
|
|
||||||
|
function __nvm_complete_ls
|
||||||
|
if not test "$__nvm_ls"
|
||||||
|
set -g __nvm_ls (nvm ls | grep -Po '[[:space:]].\K(v[0-9]+\.[0-9]+\.[0-9]+)')
|
||||||
|
end
|
||||||
|
|
||||||
|
printf "%s\n" $__nvm_ls
|
||||||
|
end
|
||||||
|
|
||||||
|
#Install
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'install' -d 'Download and install a <version>. Uses .nvmrc if available'
|
||||||
|
complete -f -c nvm -n "__fish_seen_subcommand_from install" -a "(__nvm_complete_ls_remote)"
|
||||||
|
complete -f -c nvm -n "__fish_seen_subcommand_from install" -l reinstall-packages-from= -d 'When installing, reinstall packages installed in <node|iojs|node version number>'
|
||||||
|
complete -f -c nvm -n "__fish_seen_subcommand_from install" -s s -d 'From source'
|
||||||
|
|
||||||
|
#Use
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'use' -d 'Modify PATH to use <version>. Uses .nvmrc if available'
|
||||||
|
complete -f -c nvm -n "__fish_seen_subcommand_from use" -a "(__nvm_complete_ls)"
|
||||||
|
complete -f -c nvm -n "__fish_seen_subcommand_from use" -l silent
|
||||||
|
|
||||||
|
#Exec
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'exec' -d 'Run <command> on <version>. Uses .nvmrc if available'
|
||||||
|
complete -f -c nvm -n "__fish_seen_subcommand_from exec" -a "(__nvm_complete_ls)"
|
||||||
|
complete -f -c nvm -n "__fish_seen_subcommand_from exec" -l silent
|
||||||
|
|
||||||
|
#Run
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'run' -d 'Run <command> on <version>. Uses .nvmrc if available'
|
||||||
|
complete -f -c nvm -n "__fish_seen_subcommand_from run" -a "(__nvm_complete_ls)"
|
||||||
|
complete -f -c nvm -n "__fish_seen_subcommand_from run" -l silent
|
||||||
|
|
||||||
|
|
||||||
|
#Uninstall
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'uninstall' -d 'Uninstall a version'
|
||||||
|
complete -f -c nvm -n "__fish_seen_subcommand_from uninstall" -a "(__nvm_complete_ls)"
|
||||||
|
|
||||||
|
#Which
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'which' -d 'Display path to installed node version. Uses .nvmrc if available'
|
||||||
|
complete -f -c nvm -n "__fish_seen_subcommand_from which" -a "(__nvm_complete_ls)"
|
||||||
|
|
||||||
|
#Reinstall-Packages
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'reinstall-packages' -d 'Reinstall global `npm` packages contained in <version> to current version'
|
||||||
|
complete -f -c nvm -n "__fish_seen_subcommand_from reinstall-packages" -a "(__nvm_complete_ls)"
|
||||||
|
|
||||||
|
#Completions
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'current' -d 'Display currently activated version'
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'ls' -d 'List installed versions'
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'ls-remote' -d 'List remote versions available for install'
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'version' -d 'Resolve the given description to a single local <version>'
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'version-remote' -d 'Resolve the given description to a single remote <version>'
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'deactivate' -d 'Undo effects of `nvm` on current shell'
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'alias' -d 'Show all aliases beginning with <pattern> or set an alias named <name> pointing to <version>'
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'unalias' -d 'Deletes the alias named <name>'
|
||||||
|
complete -f -c nvm -n '__fish_use_subcommand' -a 'unload' -d 'Unload `nvm` from shell'
|
||||||
@@ -121,9 +121,6 @@ set -q OP_CACHE; or set -x OP_CACHE "$XDG_STATE_HOME/1password"
|
|||||||
set -q WORKON_HOME; or set -x WORKON_HOME "$XDG_DATA_HOME/virtualenvs"
|
set -q WORKON_HOME; or set -x WORKON_HOME "$XDG_DATA_HOME/virtualenvs"
|
||||||
set -q PYENV_ROOT; or set -x PYENV_ROOT "$XDG_DATA_HOME/pyenv"
|
set -q PYENV_ROOT; or set -x PYENV_ROOT "$XDG_DATA_HOME/pyenv"
|
||||||
fish_add_path "$PYENV_ROOT/bin"
|
fish_add_path "$PYENV_ROOT/bin"
|
||||||
if x-have pyenv; and not functions -q pyenv
|
|
||||||
status --is-interactive; and source (pyenv init - | psub)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Poetry configuration
|
# Poetry configuration
|
||||||
set -q POETRY_HOME; or set -x POETRY_HOME "$XDG_DATA_HOME/poetry"
|
set -q POETRY_HOME; or set -x POETRY_HOME "$XDG_DATA_HOME/poetry"
|
||||||
|
|||||||
@@ -6,3 +6,5 @@ jgusta/paths
|
|||||||
danhper/fish-ssh-agent
|
danhper/fish-ssh-agent
|
||||||
halostatue/fish-brew@v3
|
halostatue/fish-brew@v3
|
||||||
edc/bass
|
edc/bass
|
||||||
|
jorgebucaran/nvm.fish
|
||||||
|
fabioantunes/fish-nvm
|
||||||
|
|||||||
70
config/fish/functions/__nvm_run.fish
Normal file
70
config/fish/functions/__nvm_run.fish
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
function __nvm_run
|
||||||
|
set count (count $argv)
|
||||||
|
|
||||||
|
if test "$count" -le 0
|
||||||
|
echo 'No params'
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if test (uname -s) = 'Darwin'; and string match -q "*versions/node/*/bin" $PATH
|
||||||
|
set -l nvm_node_path (string match "*versions/node/*/bin" $PATH)
|
||||||
|
set -l nvm_index (contains -i -- $nvm_node_path $PATH)
|
||||||
|
if test $nvm_index -gt 1
|
||||||
|
set -gx PATH $nvm_node_path (string match -v $nvm_node_path $PATH)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function run_command
|
||||||
|
set stack (status stack-trace | grep called | cut -d " " -f 7)
|
||||||
|
set count (count $argv)
|
||||||
|
|
||||||
|
if type -fq $argv[1]; and test "$stack[1]" != (type -fP $argv[1])
|
||||||
|
set count (count $argv)
|
||||||
|
if test "$count" -ge 2
|
||||||
|
set args $argv[2..-1]
|
||||||
|
|
||||||
|
# https://stackoverflow.com/questions/45237675/proxying-arguments-from-one-function-to-a-command/45238056#45238056
|
||||||
|
eval (string escape -- (type -fP $argv[1]) $args)
|
||||||
|
else
|
||||||
|
eval (string escape -- (type -fP $argv[1]))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
echo (set_color -o)"Fish nvm:"(set_color normal) "'$argv[1]' is currently not installed, try running npm i -g $argv[1]"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function can_run_command
|
||||||
|
if type -P $argv[1] > /dev/null 2>&1; or type -P node > /dev/null 2>&1
|
||||||
|
return
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function run_default
|
||||||
|
nvm use default > /dev/null
|
||||||
|
set -gx NVM_HAS_RUN 1
|
||||||
|
if can_run_command $argv[1]
|
||||||
|
run_command $argv
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not test -n "$NVM_HAS_RUN"
|
||||||
|
if test -f .nvmrc;
|
||||||
|
set nvm_output (nvm use)
|
||||||
|
set nvm_status $status
|
||||||
|
if test $nvm_status -gt 0
|
||||||
|
echo $nvm_output
|
||||||
|
end
|
||||||
|
if test $nvm_status -eq 0; and can_run_command $argv[1]
|
||||||
|
set -gx NVM_HAS_RUN 1
|
||||||
|
run_command $argv
|
||||||
|
end
|
||||||
|
else
|
||||||
|
run_default $argv
|
||||||
|
end
|
||||||
|
else
|
||||||
|
run_command $argv
|
||||||
|
end
|
||||||
|
end
|
||||||
3
config/fish/functions/node.fish
Normal file
3
config/fish/functions/node.fish
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
function node -d "Server-side JavaScript runtime" -w node
|
||||||
|
__nvm_run "node" $argv
|
||||||
|
end
|
||||||
3
config/fish/functions/npm.fish
Normal file
3
config/fish/functions/npm.fish
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
function npm -d "node package manager" -w npm
|
||||||
|
__nvm_run "npm" $argv
|
||||||
|
end
|
||||||
3
config/fish/functions/npx.fish
Normal file
3
config/fish/functions/npx.fish
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
function npx -d "execute npm package binaries" -w npx
|
||||||
|
__nvm_run "npx" $argv
|
||||||
|
end
|
||||||
24
config/fish/functions/nvm.fish
Normal file
24
config/fish/functions/nvm.fish
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
function nvm
|
||||||
|
if not type -q bass
|
||||||
|
echo 'Bass is not installed please install it running fisher edc/bass'
|
||||||
|
return
|
||||||
|
end
|
||||||
|
set -q NVM_DIR; or set -gx NVM_DIR ~/.nvm
|
||||||
|
set -q nvm_prefix; or set -gx nvm_prefix $NVM_DIR
|
||||||
|
|
||||||
|
bass source $nvm_prefix/nvm.sh --no-use ';' nvm $argv
|
||||||
|
|
||||||
|
set bstatus $status
|
||||||
|
|
||||||
|
if test $bstatus -gt 0
|
||||||
|
return $bstatus
|
||||||
|
end
|
||||||
|
|
||||||
|
if test (count $argv) -lt 1
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
if test $argv[1] = "use"; or test $argv[1] = "install"
|
||||||
|
set -gx NVM_HAS_RUN 1
|
||||||
|
end
|
||||||
|
end
|
||||||
49
config/fish/functions/nvm_alias_command.fish
Normal file
49
config/fish/functions/nvm_alias_command.fish
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
function nvm_alias_command -d "Create an alias command"
|
||||||
|
function __nvm_alias_output
|
||||||
|
if test -z "$nvm_alias_output"
|
||||||
|
echo "/usr/local/bin"
|
||||||
|
else
|
||||||
|
echo (string replace -r '/$' '' $nvm_alias_output)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __create_alias_command
|
||||||
|
if test -e "$argv[1]"
|
||||||
|
set_color yellow
|
||||||
|
echo "Ignored: $argv[1] (already exists)"
|
||||||
|
set_color normal
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
set -l template "__nvm_run \"COMMAND\" \$argv"
|
||||||
|
printf "#!/usr/bin/env fish\n%s\n" (string replace COMMAND $argv[2] $template) > $argv[1]
|
||||||
|
if test $status -eq 0
|
||||||
|
printf "\U2705 %s alias command was created at %s\n" $argv[2] $argv[1]
|
||||||
|
return (chmod +x $argv[1])
|
||||||
|
else
|
||||||
|
printf "\U274C failed creating %s alias command at %s\n" $argv[2] $argv[1]
|
||||||
|
printf "Probably a permissions problem, try running sudo fish, and then nvm_alias_command\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
set -l outputPath (__nvm_alias_output)
|
||||||
|
mkdir -p $outputPath
|
||||||
|
|
||||||
|
if test $status -ge 1
|
||||||
|
printf "\U274C failed creating dir $outputPath."
|
||||||
|
printf "Probably a permissions problem, try running sudo fish, and then nvm_alias_command\n"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if test (count $argv) -le 0
|
||||||
|
set -l aliases node npm npx yarn
|
||||||
|
|
||||||
|
for alias in $aliases
|
||||||
|
__create_alias_command "$outputPath/$alias" $alias
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for arg in $argv
|
||||||
|
__create_alias_command "$outputPath/$arg" $arg
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
28
config/fish/functions/nvm_alias_function.fish
Normal file
28
config/fish/functions/nvm_alias_function.fish
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
function nvm_alias_function -d "Create an alias function"
|
||||||
|
function __create_alias_function
|
||||||
|
if test -e "$argv[1]"
|
||||||
|
set_color yellow
|
||||||
|
echo "Ignored: $argv[1] (already exists)"
|
||||||
|
set_color normal
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
set -l line1 "function COMMAND -w COMMAND"
|
||||||
|
set -l line2 "__nvm_run \"COMMAND\" \$argv"
|
||||||
|
echo (string replace -a COMMAND $argv[2] $line1) > $argv[1]
|
||||||
|
echo (string replace COMMAND $argv[2] $line2) >> $argv[1]
|
||||||
|
echo "end" >> $argv[1]
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if test (count $argv) -le 0
|
||||||
|
set_color yellow
|
||||||
|
echo "Please specify package(s) name(s)"
|
||||||
|
set_color normal
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
for arg in $argv
|
||||||
|
__create_alias_function "$fish_function_path[1]/$arg.fish" $argv
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
3
config/fish/functions/yarn.fish
Normal file
3
config/fish/functions/yarn.fish
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
function yarn -d "yarn package manager" -w yarn
|
||||||
|
__nvm_run "yarn" $argv
|
||||||
|
end
|
||||||
@@ -107,6 +107,10 @@ brew "choose-rust"
|
|||||||
brew "cmake"
|
brew "cmake"
|
||||||
# Get a file from an HTTP, HTTPS or FTP server
|
# Get a file from an HTTP, HTTPS or FTP server
|
||||||
brew "curl"
|
brew "curl"
|
||||||
|
# OpenType text shaping engine
|
||||||
|
brew "harfbuzz"
|
||||||
|
# OWASP dependency-check
|
||||||
|
brew "dependency-check"
|
||||||
# Lightweight DNS forwarder and DHCP server
|
# Lightweight DNS forwarder and DHCP server
|
||||||
brew "dnsmasq"
|
brew "dnsmasq"
|
||||||
# .NET Core
|
# .NET Core
|
||||||
@@ -121,8 +125,6 @@ brew "figlet"
|
|||||||
brew "fish"
|
brew "fish"
|
||||||
# Lock file during command
|
# Lock file during command
|
||||||
brew "flock"
|
brew "flock"
|
||||||
# Fast and simple Node.js version manager
|
|
||||||
brew "fnm"
|
|
||||||
# Libraries to talk to Microsoft SQL Server and Sybase databases
|
# Libraries to talk to Microsoft SQL Server and Sybase databases
|
||||||
brew "freetds"
|
brew "freetds"
|
||||||
# Monitor a directory for changes and run a shell command
|
# Monitor a directory for changes and run a shell command
|
||||||
@@ -135,8 +137,6 @@ brew "gd"
|
|||||||
brew "gdu"
|
brew "gdu"
|
||||||
# GitHub command-line tool
|
# GitHub command-line tool
|
||||||
brew "gh"
|
brew "gh"
|
||||||
# OpenType text shaping engine
|
|
||||||
brew "harfbuzz"
|
|
||||||
# Secure hashing function
|
# Secure hashing function
|
||||||
brew "libb2"
|
brew "libb2"
|
||||||
# Framework for layout and rendering of i18n text
|
# Framework for layout and rendering of i18n text
|
||||||
@@ -193,6 +193,8 @@ brew "jq"
|
|||||||
brew "json-c"
|
brew "json-c"
|
||||||
# Network authentication protocol
|
# Network authentication protocol
|
||||||
brew "krb5"
|
brew "krb5"
|
||||||
|
# Style and grammar checker
|
||||||
|
brew "languagetool"
|
||||||
# Tool to detect/remediate misconfig and security risks of GitHub/GitLab assets
|
# Tool to detect/remediate misconfig and security risks of GitHub/GitLab assets
|
||||||
brew "legitify"
|
brew "legitify"
|
||||||
# BSD-style licensed readline alternative
|
# BSD-style licensed readline alternative
|
||||||
@@ -230,7 +232,9 @@ brew "openldap"
|
|||||||
# ISO-C API and CLI for generating UUIDs
|
# ISO-C API and CLI for generating UUIDs
|
||||||
brew "ossp-uuid"
|
brew "ossp-uuid"
|
||||||
# General-purpose scripting language
|
# General-purpose scripting language
|
||||||
brew "php@8.2", link: true
|
brew "php"
|
||||||
|
# General-purpose scripting language
|
||||||
|
brew "php@8.2"
|
||||||
# General-purpose scripting language
|
# General-purpose scripting language
|
||||||
brew "php@8.3"
|
brew "php@8.3"
|
||||||
# Pins GitHub Actions to full hashes and versions
|
# Pins GitHub Actions to full hashes and versions
|
||||||
@@ -336,6 +340,8 @@ cask "jetbrains-toolbox"
|
|||||||
cask "keybase"
|
cask "keybase"
|
||||||
# Kubernetes IDE
|
# Kubernetes IDE
|
||||||
cask "lens"
|
cask "lens"
|
||||||
|
# Neovim Client
|
||||||
|
cask "neovide"
|
||||||
# Reverse proxy, secure introspectable tunnels to localhost
|
# Reverse proxy, secure introspectable tunnels to localhost
|
||||||
cask "ngrok"
|
cask "ngrok"
|
||||||
# Simple application that will prevent iTunes or Apple Music from launching
|
# Simple application that will prevent iTunes or Apple Music from launching
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ g.loaded_java_provider = 0 -- Disable java provider
|
|||||||
-- Most of the good defaults are provided by `mini.basics`
|
-- Most of the good defaults are provided by `mini.basics`
|
||||||
-- See: lua/plugins/mini.lua
|
-- See: lua/plugins/mini.lua
|
||||||
o.confirm = true -- Confirm before closing unsaved buffers
|
o.confirm = true -- Confirm before closing unsaved buffers
|
||||||
|
o.dictionary = '/usr/share/dict/words' -- Add system dictionary
|
||||||
o.ignorecase = true -- Ignore case in search patterns
|
o.ignorecase = true -- Ignore case in search patterns
|
||||||
o.inccommand = 'split' -- Preview substitutions live, as you type!
|
o.inccommand = 'split' -- Preview substitutions live, as you type!
|
||||||
o.list = true -- Show invisible characters
|
o.list = true -- Show invisible characters
|
||||||
@@ -37,7 +38,7 @@ o.scrolloff = 8 -- Show context around cursor
|
|||||||
o.sidescrolloff = 8 -- Show context around cursor
|
o.sidescrolloff = 8 -- Show context around cursor
|
||||||
o.signcolumn = 'yes' -- Keep signcolumn on by default
|
o.signcolumn = 'yes' -- Keep signcolumn on by default
|
||||||
o.spell = true -- Enable spell checking
|
o.spell = true -- Enable spell checking
|
||||||
o.spelllang = 'en_us' -- Set the spell checking language
|
o.spelllang = 'fi,en_us' -- Set the spell checking language
|
||||||
o.splitbelow = true -- split to the bottom
|
o.splitbelow = true -- split to the bottom
|
||||||
o.splitright = true -- vsplit to the right
|
o.splitright = true -- vsplit to the right
|
||||||
o.termguicolors = true -- Enable GUI colors
|
o.termguicolors = true -- Enable GUI colors
|
||||||
|
|||||||
@@ -5,8 +5,13 @@ return {
|
|||||||
'folke/snacks.nvim',
|
'folke/snacks.nvim',
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
lazy = false,
|
lazy = false,
|
||||||
|
---@diagnostic disable-next-line: undefined-doc-name
|
||||||
|
---@type snacks.Config
|
||||||
opts = {
|
opts = {
|
||||||
bigfile = { enabled = true },
|
bigfile = { enabled = true },
|
||||||
|
input = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
gitbrowse = { enabled = true },
|
gitbrowse = { enabled = true },
|
||||||
quickfile = { enabled = true },
|
quickfile = { enabled = true },
|
||||||
statuscolumn = {
|
statuscolumn = {
|
||||||
|
|||||||
@@ -108,17 +108,25 @@ local lsp_servers = {
|
|||||||
-- These are automatically configured by WhoIsSethDaniel/mason-tool-installer.nvim
|
-- These are automatically configured by WhoIsSethDaniel/mason-tool-installer.nvim
|
||||||
local mason_tools = {
|
local mason_tools = {
|
||||||
'actionlint',
|
'actionlint',
|
||||||
|
'ast-grep',
|
||||||
|
'black',
|
||||||
'editorconfig-checker',
|
'editorconfig-checker',
|
||||||
'goimports',
|
'goimports',
|
||||||
|
'golangci-lint',
|
||||||
|
'golines',
|
||||||
|
'gopls',
|
||||||
'gotests',
|
'gotests',
|
||||||
|
'isort',
|
||||||
'phpcbf',
|
'phpcbf',
|
||||||
'phpmd',
|
'phpmd',
|
||||||
'phpstan',
|
'phpstan',
|
||||||
'pint',
|
'pint',
|
||||||
'prettierd',
|
'prettierd',
|
||||||
|
'revive',
|
||||||
'semgrep',
|
'semgrep',
|
||||||
'shellcheck',
|
'shellcheck',
|
||||||
'shfmt',
|
'shfmt',
|
||||||
|
'sonarlint-language-server',
|
||||||
'staticcheck',
|
'staticcheck',
|
||||||
'stylua',
|
'stylua',
|
||||||
'trivy',
|
'trivy',
|
||||||
@@ -323,7 +331,7 @@ return {
|
|||||||
|
|
||||||
-- Disable autoformat for files in a certain paths
|
-- Disable autoformat for files in a certain paths
|
||||||
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
||||||
if bufname:match '/node_modules|vendor/' then return end
|
if bufname:match '/dist|node_modules|vendor/' then return end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
timeout_ms = 500,
|
timeout_ms = 500,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ return {
|
|||||||
'document_symbols',
|
'document_symbols',
|
||||||
},
|
},
|
||||||
source_selector = {
|
source_selector = {
|
||||||
winbar = true,
|
winbar = false,
|
||||||
statusline = false,
|
statusline = false,
|
||||||
separator = { left = '', right = '' },
|
separator = { left = '', right = '' },
|
||||||
show_separator_on_edge = true,
|
show_separator_on_edge = true,
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
return {
|
return {
|
||||||
-- https://github.com/preservim/vim-colors-pencil
|
-- https://github.com/rmehri01/onenord.nvim
|
||||||
{
|
{
|
||||||
'preservim/vim-colors-pencil',
|
'rmehri01/onenord.nvim',
|
||||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||||
config = function()
|
opts = {
|
||||||
vim.cmd 'colorscheme pencil'
|
borders = true,
|
||||||
vim.api.nvim_set_option_value('pencil_terminal_italics', 1, {})
|
fade_nc = true,
|
||||||
end,
|
disable = {
|
||||||
|
float_background = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Automatic dark mode
|
-- Automatic dark mode
|
||||||
|
|||||||
@@ -372,8 +372,10 @@ function! plug#end()
|
|||||||
|
|
||||||
for [cmd, names] in items(lod.cmd)
|
for [cmd, names] in items(lod.cmd)
|
||||||
execute printf(
|
execute printf(
|
||||||
\ 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, %s)',
|
\ has('patch-7.4.1898')
|
||||||
\ cmd, string(cmd), string(names))
|
\ ? 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, <q-mods> ,%s)'
|
||||||
|
\ : 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, %s)'
|
||||||
|
\ , cmd, string(cmd), string(names))
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
for [map, names] in items(lod.map)
|
for [map, names] in items(lod.map)
|
||||||
@@ -651,11 +653,19 @@ function! s:lod_ft(pat, names)
|
|||||||
call s:doautocmd('filetypeindent', 'FileType')
|
call s:doautocmd('filetypeindent', 'FileType')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:lod_cmd(cmd, bang, l1, l2, args, names)
|
if has('patch-7.4.1898')
|
||||||
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
function! s:lod_cmd(cmd, bang, l1, l2, args, mods, names)
|
||||||
call s:dobufread(a:names)
|
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||||
execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
|
call s:dobufread(a:names)
|
||||||
endfunction
|
execute printf('%s %s%s%s %s', a:mods, (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
function! s:lod_cmd(cmd, bang, l1, l2, args, names)
|
||||||
|
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||||
|
call s:dobufread(a:names)
|
||||||
|
execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
function! s:lod_map(map, names, with_prefix, prefix)
|
function! s:lod_map(map, names, with_prefix, prefix)
|
||||||
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||||
@@ -1075,12 +1085,16 @@ function! s:hash_match(a, b)
|
|||||||
return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0
|
return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:disable_credential_helper()
|
||||||
|
return s:git_version_requirement(2) && get(g:, 'plug_disable_credential_helper', 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:checkout(spec)
|
function! s:checkout(spec)
|
||||||
let sha = a:spec.commit
|
let sha = a:spec.commit
|
||||||
let output = s:git_revision(a:spec.dir)
|
let output = s:git_revision(a:spec.dir)
|
||||||
let error = 0
|
let error = 0
|
||||||
if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
|
if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
|
||||||
let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
|
let credential_helper = s:disable_credential_helper() ? '-c credential.helper= ' : ''
|
||||||
let output = s:system(
|
let output = s:system(
|
||||||
\ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
|
\ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
|
||||||
let error = v:shell_error
|
let error = v:shell_error
|
||||||
@@ -1589,7 +1603,7 @@ while 1 " Without TCO, Vim stack is bound to explode
|
|||||||
let [error, _] = s:git_validate(spec, 0)
|
let [error, _] = s:git_validate(spec, 0)
|
||||||
if empty(error)
|
if empty(error)
|
||||||
if pull
|
if pull
|
||||||
let cmd = s:git_version_requirement(2) ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
|
let cmd = s:disable_credential_helper() ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
|
||||||
if has_tag && !empty(globpath(spec.dir, '.git/shallow'))
|
if has_tag && !empty(globpath(spec.dir, '.git/shallow'))
|
||||||
call extend(cmd, ['--depth', '99999999'])
|
call extend(cmd, ['--depth', '99999999'])
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,9 +1,18 @@
|
|||||||
local wezterm = require 'wezterm'
|
local wezterm = require 'wezterm'
|
||||||
local config = wezterm.config_builder()
|
local config = wezterm.config_builder()
|
||||||
|
|
||||||
|
config.set_environment_variables = {
|
||||||
|
COLORTERM = 'truecolor',
|
||||||
|
}
|
||||||
|
|
||||||
-- Font and font size
|
-- Font and font size
|
||||||
config.font_size = 14.0
|
config.font_size = 14.0
|
||||||
config.font = wezterm.font_with_fallback {
|
config.font = wezterm.font_with_fallback {
|
||||||
|
{
|
||||||
|
family = 'Operator Mono',
|
||||||
|
weight = 'Book',
|
||||||
|
},
|
||||||
|
'Operator Mono',
|
||||||
'JetBrainsMonoNL NFM Light',
|
'JetBrainsMonoNL NFM Light',
|
||||||
'JetBrains Mono',
|
'JetBrains Mono',
|
||||||
'Symbols Nerd Font Mono',
|
'Symbols Nerd Font Mono',
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/ivuorinen/dotfiles#readme",
|
"homepage": "https://github.com/ivuorinen/dotfiles#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ivuorinen/base-configs": "^2.0.0"
|
"@ivuorinen/base-configs": "^2.0.0",
|
||||||
|
"bundle-audit": "^0.1.0"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@1.22.22"
|
"packageManager": "yarn@1.22.22"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user