mirror of
https://github.com/kogakure/dotfiles.git
synced 2026-02-03 12:15:29 +00:00
feat: add Dotbot
This commit is contained in:
10
.gitignore
vendored
10
.gitignore
vendored
@@ -5,10 +5,10 @@ automatic_backups
|
||||
homebrew/*.lock.json
|
||||
|
||||
# Tmux Plugin Manager
|
||||
.config/tmux/plugins/
|
||||
config/tmux/plugins/
|
||||
|
||||
# Fish
|
||||
.config/fish/completions
|
||||
.config/fish/conf.d
|
||||
.config/fish/fish_variables
|
||||
.config/fish/functions/*
|
||||
config/fish/completions
|
||||
config/fish/conf.d
|
||||
config/fish/fish_variables
|
||||
config/fish/functions/*
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
.git
|
||||
.gitignore
|
||||
.gitmodules
|
||||
.DS_Store
|
||||
|
||||
install.sh
|
||||
README.md
|
||||
|
||||
bin
|
||||
homebrew
|
||||
private
|
||||
@@ -17,7 +17,7 @@ xcode-select --install
|
||||
## Install Initial Software
|
||||
|
||||
```sh
|
||||
brew install stow
|
||||
brew install dotbot
|
||||
brew install --cask proton-pass
|
||||
brew install --cask secretive
|
||||
```
|
||||
@@ -42,11 +42,11 @@ sudo scutil --set HostName <hostname>
|
||||
git clone git@github.com:kogakure/dotfiles.git ~/.dotfiles
|
||||
```
|
||||
|
||||
## Install Script
|
||||
## Setup the Mac
|
||||
|
||||
Log in with your Apple ID to be able to install app store apps. Run the install script to setup the computer:
|
||||
|
||||
```sh
|
||||
cd ~/.dotfiles
|
||||
./install.sh
|
||||
./setup.sh
|
||||
```
|
||||
|
||||
140
config/fish/functions/__bass.py
Normal file
140
config/fish/functions/__bass.py
Normal file
@@ -0,0 +1,140 @@
|
||||
"""
|
||||
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
|
||||
if name.startswith('%'):
|
||||
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)
|
||||
49
config/fish/functions/__fzf_cd.fish
Normal file
49
config/fish/functions/__fzf_cd.fish
Normal file
@@ -0,0 +1,49 @@
|
||||
function __fzf_cd -d "Change directory"
|
||||
set -l commandline (__fzf_parse_commandline)
|
||||
set -l dir $commandline[1]
|
||||
set -l fzf_query $commandline[2]
|
||||
|
||||
if not type -q argparse
|
||||
# Fallback for fish shell version < 2.7
|
||||
function argparse
|
||||
functions -e argparse # deletes itself
|
||||
end
|
||||
if contains -- --hidden $argv; or contains -- -h $argv
|
||||
set _flag_hidden "yes"
|
||||
end
|
||||
end
|
||||
|
||||
# Fish shell version >= v2.7, use argparse
|
||||
set -l options "h/hidden"
|
||||
argparse $options -- $argv
|
||||
|
||||
set -l COMMAND
|
||||
|
||||
set -q FZF_CD_COMMAND
|
||||
or set -l FZF_CD_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@^\./@@'"
|
||||
|
||||
set -q FZF_CD_WITH_HIDDEN_COMMAND
|
||||
or set -l FZF_CD_WITH_HIDDEN_COMMAND "
|
||||
command find -L \$dir \
|
||||
\\( -path '*/\\.git*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \
|
||||
-o -type d -print 2> /dev/null | sed 1d | cut -b3-"
|
||||
|
||||
if set -q _flag_hidden
|
||||
set COMMAND $FZF_CD_WITH_HIDDEN_COMMAND
|
||||
else
|
||||
set COMMAND $FZF_CD_COMMAND
|
||||
end
|
||||
|
||||
eval "$COMMAND | "(__fzfcmd)" +m $FZF_DEFAULT_OPTS $FZF_CD_OPTS --query \"$fzf_query\"" | read -l select
|
||||
|
||||
if not test -z "$select"
|
||||
builtin cd "$select"
|
||||
|
||||
# Remove last token from commandline.
|
||||
commandline -t ""
|
||||
end
|
||||
|
||||
commandline -f repaint
|
||||
end
|
||||
168
config/fish/functions/__fzf_complete.fish
Normal file
168
config/fish/functions/__fzf_complete.fish
Normal file
@@ -0,0 +1,168 @@
|
||||
##
|
||||
# Use fzf as fish completion widget.
|
||||
#
|
||||
#
|
||||
# When FZF_COMPLETE variable is set, fzf is used as completion
|
||||
# widget for the fish shell by binding the TAB key.
|
||||
#
|
||||
# FZF_COMPLETE can have some special numeric values:
|
||||
#
|
||||
# `set FZF_COMPLETE 0` basic widget accepts with TAB key
|
||||
# `set FZF_COMPLETE 1` extends 0 with candidate preview window
|
||||
# `set FZF_COMPLETE 2` same as 1 but TAB walks on candidates
|
||||
# `set FZF_COMPLETE 3` multi TAB selection, RETURN accepts selected ones.
|
||||
#
|
||||
# Any other value of FZF_COMPLETE is given directly as options to fzf.
|
||||
#
|
||||
# If you prefer to set more advanced options, take a look at the
|
||||
# `__fzf_complete_opts` function and override that in your environment.
|
||||
|
||||
|
||||
# modified from https://github.com/junegunn/fzf/wiki/Examples-(fish)#completion
|
||||
function __fzf_complete -d 'fzf completion and print selection back to commandline'
|
||||
# As of 2.6, fish's "complete" function does not understand
|
||||
# subcommands. Instead, we use the same hack as __fish_complete_subcommand and
|
||||
# extract the subcommand manually.
|
||||
set -l cmd (commandline -co) (commandline -ct)
|
||||
|
||||
switch $cmd[1]
|
||||
case env sudo
|
||||
for i in (seq 2 (count $cmd))
|
||||
switch $cmd[$i]
|
||||
case '-*'
|
||||
case '*=*'
|
||||
case '*'
|
||||
set cmd $cmd[$i..-1]
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set -l cmd_lastw $cmd[-1]
|
||||
set cmd (string join -- ' ' $cmd)
|
||||
|
||||
set -l initial_query ''
|
||||
test -n "$cmd_lastw"; and set initial_query --query="$cmd_lastw"
|
||||
|
||||
set -l complist (complete -C$cmd)
|
||||
set -l result
|
||||
|
||||
# do nothing if there is nothing to select from
|
||||
test -z "$complist"; and return
|
||||
|
||||
set -l compwc (echo $complist | wc -w)
|
||||
if test $compwc -eq 1
|
||||
# if there is only one option dont open fzf
|
||||
set result "$complist"
|
||||
else
|
||||
|
||||
set -l query
|
||||
string join -- \n $complist \
|
||||
| eval (__fzfcmd) (string escape --no-quoted -- $initial_query) --print-query (__fzf_complete_opts) \
|
||||
| cut -f1 \
|
||||
| while read -l r
|
||||
# first line is the user entered query
|
||||
if test -z "$query"
|
||||
set query $r
|
||||
# rest of lines are selected candidates
|
||||
else
|
||||
set result $result $r
|
||||
end
|
||||
end
|
||||
|
||||
# exit if user canceled
|
||||
if test -z "$query" ;and test -z "$result"
|
||||
commandline -f repaint
|
||||
return
|
||||
end
|
||||
|
||||
# if user accepted but no candidate matches, use the input as result
|
||||
if test -z "$result"
|
||||
set result $query
|
||||
end
|
||||
end
|
||||
|
||||
set prefix (string sub -s 1 -l 1 -- (commandline -t))
|
||||
for i in (seq (count $result))
|
||||
set -l r $result[$i]
|
||||
switch $prefix
|
||||
case "'"
|
||||
commandline -t -- (string escape -- $r)
|
||||
case '"'
|
||||
if string match '*"*' -- $r >/dev/null
|
||||
commandline -t -- (string escape -- $r)
|
||||
else
|
||||
commandline -t -- '"'$r'"'
|
||||
end
|
||||
case '~'
|
||||
commandline -t -- (string sub -s 2 (string escape -n -- $r))
|
||||
case '*'
|
||||
commandline -t -- $r
|
||||
end
|
||||
[ $i -lt (count $result) ]; and commandline -i ' '
|
||||
end
|
||||
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
function __fzf_complete_opts_common
|
||||
if set -q FZF_DEFAULT_OPTS
|
||||
echo $FZF_DEFAULT_OPTS
|
||||
end
|
||||
echo --cycle --reverse --inline-info
|
||||
end
|
||||
|
||||
function __fzf_complete_opts_tab_accepts
|
||||
echo --bind tab:accept,btab:cancel
|
||||
end
|
||||
|
||||
function __fzf_complete_opts_tab_walks
|
||||
echo --bind tab:down,btab:up
|
||||
end
|
||||
|
||||
function __fzf_complete_opts_preview
|
||||
set -l file (status -f)
|
||||
echo --with-nth=1 --preview-window=right:wrap --preview="fish\ '$file'\ __fzf_complete_preview\ '{1}'\ '{2..}'"
|
||||
end
|
||||
|
||||
test "$argv[1]" = "__fzf_complete_preview"; and __fzf_complete_preview $argv[2..3]
|
||||
|
||||
function __fzf_complete_opts_0 -d 'basic single selection with tab accept'
|
||||
__fzf_complete_opts_common
|
||||
echo --no-multi
|
||||
__fzf_complete_opts_tab_accepts
|
||||
end
|
||||
|
||||
function __fzf_complete_opts_1 -d 'single selection with preview and tab accept'
|
||||
__fzf_complete_opts_0
|
||||
__fzf_complete_opts_preview
|
||||
end
|
||||
|
||||
function __fzf_complete_opts_2 -d 'single selection with preview and tab walks'
|
||||
__fzf_complete_opts_1
|
||||
__fzf_complete_opts_tab_walks
|
||||
end
|
||||
|
||||
function __fzf_complete_opts_3 -d 'multi selection with preview'
|
||||
__fzf_complete_opts_common
|
||||
echo --multi
|
||||
__fzf_complete_opts_preview
|
||||
end
|
||||
|
||||
function __fzf_complete_opts -d 'fzf options for fish tab completion'
|
||||
switch $FZF_COMPLETE
|
||||
case 0
|
||||
__fzf_complete_opts_0
|
||||
case 1
|
||||
__fzf_complete_opts_1
|
||||
case 2
|
||||
__fzf_complete_opts_2
|
||||
case 3
|
||||
__fzf_complete_opts_3
|
||||
case '*'
|
||||
echo $FZF_COMPLETE
|
||||
end
|
||||
if set -q FZF_COMPLETE_OPTS
|
||||
echo $FZF_COMPLETE_OPTS
|
||||
end
|
||||
end
|
||||
31
config/fish/functions/__fzf_complete_preview.fish
Normal file
31
config/fish/functions/__fzf_complete_preview.fish
Normal file
@@ -0,0 +1,31 @@
|
||||
function __fzf_complete_preview -d 'generate preview for completion widget.
|
||||
argv[1] is the currently selected candidate in fzf
|
||||
argv[2] is a string containing the rest of the output produced by `complete -Ccmd`
|
||||
'
|
||||
|
||||
if test "$argv[2]" = "Redefine variable"
|
||||
# show environment variables current value
|
||||
set -l evar (echo $argv[1] | cut -d= -f1)
|
||||
echo $argv[1]$$evar
|
||||
else
|
||||
echo $argv[1]
|
||||
end
|
||||
|
||||
set -l path (string replace "~" $HOME -- $argv[1])
|
||||
|
||||
# list directories on preview
|
||||
if test -d "$path"
|
||||
eval $FZF_PREVIEW_DIR_CMD (string escape $path)
|
||||
end
|
||||
|
||||
# show ten lines of non-binary files preview
|
||||
if test -f "$path"; and grep -qI . "$path"
|
||||
eval $FZF_PREVIEW_FILE_CMD (string escape $path)
|
||||
end
|
||||
|
||||
# if fish knows about it, let it show info
|
||||
type -q "$path" 2>/dev/null; and type -a "$path"
|
||||
|
||||
# show aditional data
|
||||
echo $argv[2]
|
||||
end
|
||||
29
config/fish/functions/__fzf_find_file.fish
Normal file
29
config/fish/functions/__fzf_find_file.fish
Normal file
@@ -0,0 +1,29 @@
|
||||
function __fzf_find_file -d "List files and folders"
|
||||
set -l commandline (__fzf_parse_commandline)
|
||||
set -l dir $commandline[1]
|
||||
set -l fzf_query $commandline[2]
|
||||
|
||||
set -q FZF_FIND_FILE_COMMAND
|
||||
or set -l FZF_FIND_FILE_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@^\./@@'"
|
||||
|
||||
begin
|
||||
eval "$FZF_FIND_FILE_COMMAND | "(__fzfcmd) "-m $FZF_DEFAULT_OPTS $FZF_FIND_FILE_OPTS --query \"$fzf_query\"" | while read -l s; set results $results $s; end
|
||||
end
|
||||
|
||||
if test -z "$results"
|
||||
commandline -f repaint
|
||||
return
|
||||
else
|
||||
commandline -t ""
|
||||
end
|
||||
|
||||
for result in $results
|
||||
commandline -it -- (string escape $result)
|
||||
commandline -it -- " "
|
||||
end
|
||||
commandline -f repaint
|
||||
end
|
||||
17
config/fish/functions/__fzf_get_dir.fish
Normal file
17
config/fish/functions/__fzf_get_dir.fish
Normal file
@@ -0,0 +1,17 @@
|
||||
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 test (string length $dir) -gt 1
|
||||
set dir (string replace -r '/*$' '' $dir)
|
||||
end
|
||||
|
||||
# Iteratively check if dir exists and strip tail end of path
|
||||
while test ! -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
|
||||
63
config/fish/functions/__fzf_open.fish
Normal file
63
config/fish/functions/__fzf_open.fish
Normal file
@@ -0,0 +1,63 @@
|
||||
function __fzf_open -d "Open files and directories."
|
||||
function __fzf_open_get_open_cmd -d "Find appropriate open command."
|
||||
if type -q xdg-open
|
||||
echo "xdg-open"
|
||||
else if type -q open
|
||||
echo "open"
|
||||
end
|
||||
end
|
||||
|
||||
set -l commandline (__fzf_parse_commandline)
|
||||
set -l dir $commandline[1]
|
||||
set -l fzf_query $commandline[2]
|
||||
|
||||
if not type -q argparse
|
||||
set created_argparse
|
||||
function argparse
|
||||
functions -e argparse # deletes itself
|
||||
end
|
||||
if contains -- --editor $argv; or contains -- -e $argv
|
||||
set _flag_editor "yes"
|
||||
end
|
||||
if contains -- --preview $argv; or contains -- -p $argv
|
||||
set _flag_preview "yes"
|
||||
end
|
||||
end
|
||||
|
||||
set -l options "e/editor" "p/preview=?"
|
||||
argparse $options -- $argv
|
||||
|
||||
set -l preview_cmd
|
||||
if set -q FZF_ENABLE_OPEN_PREVIEW
|
||||
set preview_cmd "--preview-window=right:wrap --preview='fish -c \"__fzf_complete_preview {}\"'"
|
||||
end
|
||||
|
||||
set -q FZF_OPEN_COMMAND
|
||||
or set -l FZF_OPEN_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@^\./@@'"
|
||||
|
||||
set -l select (eval "$FZF_OPEN_COMMAND | "(__fzfcmd) $preview_cmd "-m $FZF_DEFAULT_OPTS $FZF_OPEN_OPTS --query \"$fzf_query\"" | string escape)
|
||||
|
||||
# set how to open
|
||||
set -l open_cmd
|
||||
if set -q _flag_editor
|
||||
set open_cmd "$EDITOR"
|
||||
else
|
||||
set open_cmd (__fzf_open_get_open_cmd)
|
||||
if test -z "$open_cmd"
|
||||
echo "Couldn't find appropriate open command to use. Do you have 'xdg-open' or 'open' installed?"; and return 1
|
||||
end
|
||||
end
|
||||
|
||||
set -l open_status 0
|
||||
if not test -z "$select"
|
||||
commandline "$open_cmd $select"; and commandline -f execute
|
||||
set open_status $status
|
||||
end
|
||||
|
||||
commandline -f repaint
|
||||
return $open_status
|
||||
end
|
||||
23
config/fish/functions/__fzf_parse_commandline.fish
Normal file
23
config/fish/functions/__fzf_parse_commandline.fish
Normal file
@@ -0,0 +1,23 @@
|
||||
function __fzf_parse_commandline -d 'Parse the current command line token and return split of existing filepath and rest of token'
|
||||
# eval is used to do shell expansion on paths
|
||||
set -l commandline (eval "printf '%s' "(commandline -t))
|
||||
|
||||
if test -z $commandline
|
||||
# Default to current directory with no --query
|
||||
set dir '.'
|
||||
set fzf_query ''
|
||||
else
|
||||
set dir (__fzf_get_dir $commandline)
|
||||
|
||||
if test "$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
|
||||
end
|
||||
6
config/fish/functions/__fzf_reverse_isearch.fish
Normal file
6
config/fish/functions/__fzf_reverse_isearch.fish
Normal file
@@ -0,0 +1,6 @@
|
||||
function __fzf_reverse_isearch
|
||||
history merge
|
||||
history -z | eval (__fzfcmd) --read0 --print0 --tiebreak=index --toggle-sort=ctrl-r $FZF_DEFAULT_OPTS $FZF_REVERSE_ISEARCH_OPTS -q '(commandline)' | read -lz result
|
||||
and commandline -- $result
|
||||
commandline -f repaint
|
||||
end
|
||||
9
config/fish/functions/__fzfcmd.fish
Normal file
9
config/fish/functions/__fzfcmd.fish
Normal file
@@ -0,0 +1,9 @@
|
||||
function __fzfcmd
|
||||
set -q FZF_TMUX; or set FZF_TMUX 0
|
||||
set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40%
|
||||
if test $FZF_TMUX -eq 1
|
||||
echo "fzf-tmux -d$FZF_TMUX_HEIGHT"
|
||||
else
|
||||
echo "fzf"
|
||||
end
|
||||
end
|
||||
174
config/fish/functions/__z.fish
Normal file
174
config/fish/functions/__z.fish
Normal file
@@ -0,0 +1,174 @@
|
||||
function __z -d "Jump to a recent directory."
|
||||
function __print_help -d "Print z help."
|
||||
printf "Usage: $Z_CMD [-celrth] string1 string2...\n\n"
|
||||
printf " -c --clean Removes directories that no longer exist from $Z_DATA\n"
|
||||
printf " -d --dir Opens matching directory using system file manager.\n"
|
||||
printf " -e --echo Prints best match, no cd\n"
|
||||
printf " -l --list List matches and scores, no cd\n"
|
||||
printf " -p --purge Delete all entries from $Z_DATA\n"
|
||||
printf " -r --rank Search by rank\n"
|
||||
printf " -t --recent Search by recency\n"
|
||||
printf " -x --delete Removes the current directory from $Z_DATA\n"
|
||||
printf " -h --help Print this help\n\n"
|
||||
end
|
||||
function __z_legacy_escape_regex
|
||||
# taken from escape_string_pcre2 in fish
|
||||
# used to provide compatibility with fish 2
|
||||
for c in (string split '' $argv)
|
||||
if contains $c (string split '' '.^$*+()?[{}\\|-]')
|
||||
printf \\
|
||||
end
|
||||
printf '%s' $c
|
||||
end
|
||||
end
|
||||
|
||||
set -l options h/help c/clean e/echo l/list p/purge r/rank t/recent d/directory x/delete
|
||||
|
||||
argparse $options -- $argv
|
||||
|
||||
if set -q _flag_help
|
||||
__print_help
|
||||
return 0
|
||||
else if set -q _flag_clean
|
||||
__z_clean
|
||||
printf "%s cleaned!\n" $Z_DATA
|
||||
return 0
|
||||
else if set -q _flag_purge
|
||||
echo >$Z_DATA
|
||||
printf "%s purged!\n" $Z_DATA
|
||||
return 0
|
||||
else if set -q _flag_delete
|
||||
sed -i -e "\:^$PWD|.*:d" $Z_DATA
|
||||
return 0
|
||||
end
|
||||
|
||||
set -l typ
|
||||
|
||||
if set -q _flag_rank
|
||||
set typ rank
|
||||
else if set -q _flag_recent
|
||||
set typ recent
|
||||
end
|
||||
|
||||
set -l z_script '
|
||||
function frecent(rank, time) {
|
||||
dx = t-time
|
||||
if( dx < 3600 ) return rank*4
|
||||
if( dx < 86400 ) return rank*2
|
||||
if( dx < 604800 ) return rank/2
|
||||
return rank/4
|
||||
}
|
||||
|
||||
function output(matches, best_match, common) {
|
||||
# list or return the desired directory
|
||||
if( list ) {
|
||||
cmd = "sort -nr"
|
||||
for( x in matches ) {
|
||||
if( matches[x] ) {
|
||||
printf "%-10s %s\n", matches[x], x | cmd
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if( common ) best_match = common
|
||||
print best_match
|
||||
}
|
||||
}
|
||||
|
||||
function common(matches) {
|
||||
# find the common root of a list of matches, if it exists
|
||||
for( x in matches ) {
|
||||
if( matches[x] && (!short || length(x) < length(short)) ) {
|
||||
short = x
|
||||
}
|
||||
}
|
||||
if( short == "/" ) return
|
||||
for( x in matches ) if( matches[x] && index(x, short) != 1 ) {
|
||||
return
|
||||
}
|
||||
return short
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
hi_rank = ihi_rank = -9999999999
|
||||
}
|
||||
{
|
||||
if( typ == "rank" ) {
|
||||
rank = $2
|
||||
} else if( typ == "recent" ) {
|
||||
rank = $3 - t
|
||||
} else rank = frecent($2, $3)
|
||||
if( $1 ~ q ) {
|
||||
matches[$1] = rank
|
||||
} else if( tolower($1) ~ tolower(q) ) imatches[$1] = rank
|
||||
if( matches[$1] && matches[$1] > hi_rank ) {
|
||||
best_match = $1
|
||||
hi_rank = matches[$1]
|
||||
} else if( imatches[$1] && imatches[$1] > ihi_rank ) {
|
||||
ibest_match = $1
|
||||
ihi_rank = imatches[$1]
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
# prefer case sensitive
|
||||
if( best_match ) {
|
||||
output(matches, best_match, common(matches))
|
||||
} else if( ibest_match ) {
|
||||
output(imatches, ibest_match, common(imatches))
|
||||
}
|
||||
}
|
||||
'
|
||||
|
||||
set -l qs
|
||||
for arg in $argv
|
||||
set -l escaped $arg
|
||||
if string escape --style=regex '' >/dev/null 2>&1 # use builtin escape if available
|
||||
set escaped (string escape --style=regex $escaped)
|
||||
else
|
||||
set escaped (__z_legacy_escape_regex $escaped)
|
||||
end
|
||||
# Need to escape twice, see https://www.math.utah.edu/docs/info/gawk_5.html#SEC32
|
||||
set escaped (string replace --all \\ \\\\ $escaped)
|
||||
set qs $qs $escaped
|
||||
end
|
||||
set -l q (string join '.*' $qs)
|
||||
|
||||
if set -q _flag_list
|
||||
# Handle list separately as it can print common path information to stderr
|
||||
# which cannot be captured from a subcommand.
|
||||
command awk -v t=(date +%s) -v list="list" -v typ="$typ" -v q="$q" -F "|" $z_script "$Z_DATA"
|
||||
return
|
||||
end
|
||||
|
||||
set target (command awk -v t=(date +%s) -v typ="$typ" -v q="$q" -F "|" $z_script "$Z_DATA")
|
||||
|
||||
if test "$status" -gt 0
|
||||
return
|
||||
end
|
||||
|
||||
if test -z "$target"
|
||||
printf "'%s' did not match any results\n" "$argv"
|
||||
return 1
|
||||
end
|
||||
|
||||
if set -q _flag_echo
|
||||
printf "%s\n" "$target"
|
||||
else if set -q _flag_directory
|
||||
if test -n "$ZO_METHOD"
|
||||
type -q "$ZO_METHOD"; and "$ZO_METHOD" "$target"; and return $status
|
||||
echo "Cannot open with ZO_METHOD set to $ZO_METHOD"; and return 1
|
||||
else if test "$OS" = Windows_NT
|
||||
# Be careful, in msys2, explorer always return 1
|
||||
type -q explorer; and explorer "$target"
|
||||
return 0
|
||||
echo "Cannot open file explorer"
|
||||
return 1
|
||||
else
|
||||
type -q xdg-open; and xdg-open "$target"; and return $status
|
||||
type -q open; and open "$target"; and return $status
|
||||
echo "Not sure how to open file manager"; and return 1
|
||||
end
|
||||
else
|
||||
pushd "$target"
|
||||
end
|
||||
end
|
||||
49
config/fish/functions/__z_add.fish
Normal file
49
config/fish/functions/__z_add.fish
Normal file
@@ -0,0 +1,49 @@
|
||||
function __z_add -d "Add PATH to .z file"
|
||||
test -n "$fish_private_mode"; and return 0
|
||||
|
||||
for i in $Z_EXCLUDE
|
||||
if string match -r $i $PWD >/dev/null
|
||||
return 0 #Path excluded
|
||||
end
|
||||
end
|
||||
|
||||
set -l tmpfile (mktemp $Z_DATA.XXXXXX)
|
||||
|
||||
if test -f $tmpfile
|
||||
set -l path (string replace --all \\ \\\\ $PWD)
|
||||
command awk -v path=$path -v now=(date +%s) -F "|" '
|
||||
BEGIN {
|
||||
rank[path] = 1
|
||||
time[path] = now
|
||||
}
|
||||
$2 >= 1 {
|
||||
if( $1 == path ) {
|
||||
rank[$1] = $2 + 1
|
||||
time[$1] = now
|
||||
}
|
||||
else {
|
||||
rank[$1] = $2
|
||||
time[$1] = $3
|
||||
}
|
||||
count += $2
|
||||
}
|
||||
END {
|
||||
if( count > 1000 ) {
|
||||
for( i in rank ) print i "|" 0.9*rank[i] "|" time[i] # aging
|
||||
}
|
||||
else for( i in rank ) print i "|" rank[i] "|" time[i]
|
||||
}
|
||||
' $Z_DATA 2>/dev/null >$tmpfile
|
||||
|
||||
if test ! -z "$Z_OWNER"
|
||||
chown $Z_OWNER:(id -ng $Z_OWNER) $tmpfile
|
||||
end
|
||||
#
|
||||
# Don't use redirection here as it can lead to a race condition where $Z_DATA is clobbered.
|
||||
# Note: There is a still a possible race condition where an old version of $Z_DATA is
|
||||
# read by one instance of Fish before another instance of Fish writes its copy.
|
||||
#
|
||||
command mv $tmpfile $Z_DATA
|
||||
or command rm $tmpfile
|
||||
end
|
||||
end
|
||||
11
config/fish/functions/__z_clean.fish
Normal file
11
config/fish/functions/__z_clean.fish
Normal file
@@ -0,0 +1,11 @@
|
||||
function __z_clean -d "Clean up .z file to remove paths no longer valid"
|
||||
set -l tmpfile (mktemp $Z_DATA.XXXXXX)
|
||||
|
||||
if test -f $tmpfile
|
||||
while read line
|
||||
set -l path (string split '|' $line)[1]
|
||||
test -d $path; and echo $line
|
||||
end <$Z_DATA >$tmpfile
|
||||
command mv -f $tmpfile $Z_DATA
|
||||
end
|
||||
end
|
||||
13
config/fish/functions/__z_complete.fish
Normal file
13
config/fish/functions/__z_complete.fish
Normal file
@@ -0,0 +1,13 @@
|
||||
function __z_complete -d "add completions"
|
||||
complete -c $Z_CMD -a "(__z -l | string replace -r '^\\S*\\s*' '')" -f -k
|
||||
complete -c $ZO_CMD -a "(__z -l | string replace -r '^\\S*\\s*' '')" -f -k
|
||||
|
||||
complete -c $Z_CMD -s c -l clean -d "Cleans out $Z_DATA"
|
||||
complete -c $Z_CMD -s e -l echo -d "Prints best match, no cd"
|
||||
complete -c $Z_CMD -s l -l list -d "List matches, no cd"
|
||||
complete -c $Z_CMD -s p -l purge -d "Purges $Z_DATA"
|
||||
complete -c $Z_CMD -s r -l rank -d "Searches by rank, cd"
|
||||
complete -c $Z_CMD -s t -l recent -d "Searches by recency, cd"
|
||||
complete -c $Z_CMD -s h -l help -d "Print help"
|
||||
complete -c $Z_CMD -s x -l delete -d "Removes the current directory from $Z_DATA"
|
||||
end
|
||||
9
config/fish/functions/_autopair_backspace.fish
Normal file
9
config/fish/functions/_autopair_backspace.fish
Normal file
@@ -0,0 +1,9 @@
|
||||
function _autopair_backspace
|
||||
set --local index (commandline --cursor)
|
||||
set --local buffer (commandline)
|
||||
|
||||
test $index -ge 1 &&
|
||||
contains -- (string sub --start=$index --length=2 -- "$buffer") $autopair_pairs &&
|
||||
commandline --function delete-char
|
||||
commandline --function backward-delete-char
|
||||
end
|
||||
13
config/fish/functions/_autopair_insert_left.fish
Normal file
13
config/fish/functions/_autopair_insert_left.fish
Normal file
@@ -0,0 +1,13 @@
|
||||
function _autopair_insert_left --argument-names left right
|
||||
set --local buffer (commandline)
|
||||
set --local before (commandline --cut-at-cursor)
|
||||
|
||||
commandline --insert -- $left
|
||||
|
||||
switch "$buffer"
|
||||
case "$before"{," "\*,$autopair_right\*}
|
||||
set --local index (commandline --cursor)
|
||||
commandline --insert -- $right
|
||||
commandline --cursor $index
|
||||
end
|
||||
end
|
||||
11
config/fish/functions/_autopair_insert_right.fish
Normal file
11
config/fish/functions/_autopair_insert_right.fish
Normal file
@@ -0,0 +1,11 @@
|
||||
function _autopair_insert_right --argument-names key
|
||||
set --local buffer (commandline)
|
||||
set --local before (commandline --cut-at-cursor)
|
||||
|
||||
switch "$buffer"
|
||||
case "$before$key"\*
|
||||
commandline --cursor (math (commandline --cursor) + 1)
|
||||
case \*
|
||||
commandline --insert -- $key
|
||||
end
|
||||
end
|
||||
20
config/fish/functions/_autopair_insert_same.fish
Normal file
20
config/fish/functions/_autopair_insert_same.fish
Normal file
@@ -0,0 +1,20 @@
|
||||
function _autopair_insert_same --argument-names key
|
||||
set --local buffer (commandline)
|
||||
set --local index (commandline --cursor)
|
||||
set --local next (string sub --start=(math $index + 1) --length=1 -- "$buffer")
|
||||
|
||||
if test (math (count (string match --all --regex -- "$key" "$buffer")) % 2) = 0
|
||||
test $key = $next && commandline --cursor (math $index + 1) && return
|
||||
|
||||
commandline --insert -- $key
|
||||
|
||||
if test $index -lt 1 ||
|
||||
contains -- (string sub --start=$index --length=1 -- "$buffer") "" " " $autopair_left &&
|
||||
contains -- $next "" " " $autopair_right
|
||||
commandline --insert -- $key
|
||||
commandline --cursor (math $index + 1)
|
||||
end
|
||||
else
|
||||
commandline --insert -- $key
|
||||
end
|
||||
end
|
||||
7
config/fish/functions/_autopair_tab.fish
Normal file
7
config/fish/functions/_autopair_tab.fish
Normal file
@@ -0,0 +1,7 @@
|
||||
function _autopair_tab
|
||||
commandline --paging-mode && down-or-search && return
|
||||
|
||||
string match --quiet --regex -- '\$[^\s]*"$' (commandline --current-token) &&
|
||||
commandline --function end-of-line --function backward-delete-char
|
||||
commandline --function complete
|
||||
end
|
||||
29
config/fish/functions/bass.fish
Normal file
29
config/fish/functions/bass.fish
Normal file
@@ -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] <bash-command>"
|
||||
end
|
||||
240
config/fish/functions/fisher.fish
Normal file
240
config/fish/functions/fisher.fish
Normal file
@@ -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.4
|
||||
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 <plugins...> Install plugins"
|
||||
echo " fisher remove <plugins...> Remove installed plugins"
|
||||
echo " fisher update <plugins...> Update installed plugins"
|
||||
echo " fisher update Update all installed plugins"
|
||||
echo " fisher list [<regex>] 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 command curl -q --silent -L \$url | command 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
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"ChatGPT.nvim": { "branch": "main", "commit": "f081338f07216a46d3915ce46c1fcb083bcb5016" },
|
||||
"CopilotChat.nvim": { "branch": "canary", "commit": "4a5e07185b37d3132e5541d8fa42aa874b774476" },
|
||||
"CopilotChat.nvim": { "branch": "canary", "commit": "cfdf371cec954fccf5410315884e110d214d38fa" },
|
||||
"LazyVim": { "branch": "main", "commit": "12818a6cb499456f4903c5d8e68af43753ebc869" },
|
||||
"SchemaStore.nvim": { "branch": "main", "commit": "a86e7a0ecaf09fdb0b58ca09f34cd1e2b2b1fd75" },
|
||||
"SchemaStore.nvim": { "branch": "main", "commit": "6ba091a30616aadeda531c7f27dfad263303f55d" },
|
||||
"aerial.nvim": { "branch": "master", "commit": "e75a3df2c20b3a98c786f5e61587d74a7a6b61d6" },
|
||||
"auto-save.nvim": { "branch": "main", "commit": "979b6c82f60cfa80f4cf437d77446d0ded0addf0" },
|
||||
"baleia.nvim": { "branch": "main", "commit": "1b25eac3ac03659c3d3af75c7455e179e5f197f7" },
|
||||
@@ -10,7 +10,7 @@
|
||||
"base16-vim": { "branch": "master", "commit": "3be3cd82cd31acfcab9a41bad853d9c68d30478d" },
|
||||
"blamer.nvim": { "branch": "master", "commit": "e0d43c11697300eb68f00d69df8b87deb0bf52dc" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "0b2fd861eee7595015b6561dade52fb060be10c4" },
|
||||
"catppuccin": { "branch": "main", "commit": "e1268d1c0351aa5a42ea00a680ce84de2ba080fc" },
|
||||
"catppuccin": { "branch": "main", "commit": "548b2a25415bb60e05c536b7658aa8ffbfeb3e45" },
|
||||
"chafa.nvim": { "branch": "main", "commit": "792c8f4f0e86b5e27c3602be4614f886f3a12a5a" },
|
||||
"cheatsheet.nvim": { "branch": "master", "commit": "9716f9aaa94dd1fd6ce59b5aae0e5f25e2a463ef" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
@@ -20,7 +20,7 @@
|
||||
"codeium.nvim": { "branch": "main", "commit": "f6a2ef32a9e923cb0104a19d3e426b0e40e49505" },
|
||||
"codewindow.nvim": { "branch": "master", "commit": "dd7017617962943eb1d152fc58940f11c6775a4a" },
|
||||
"committia.vim": { "branch": "master", "commit": "a187b8633694027ab5ef8a834527d33093282f95" },
|
||||
"conform.nvim": { "branch": "master", "commit": "25d48271e3d4404ba017cb92a37d3a681c1ad149" },
|
||||
"conform.nvim": { "branch": "master", "commit": "0f4f299dfea09d2adfd7a1da05149a0844ac8eee" },
|
||||
"copilot-cmp": { "branch": "master", "commit": "b6e5286b3d74b04256d0a7e3bd2908eabec34b44" },
|
||||
"copilot.lua": { "branch": "master", "commit": "86537b286f18783f8b67bccd78a4ef4345679625" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" },
|
||||
@@ -33,18 +33,18 @@
|
||||
"flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" },
|
||||
"fm-nvim": { "branch": "master", "commit": "8e6a77049330e7c797eb9e63affd75eb796fe75e" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
|
||||
"fzf": { "branch": "master", "commit": "4e85f72f0ee237bef7a1617e0cf8c811a4091d72" },
|
||||
"fzf-lua": { "branch": "main", "commit": "73bdec9ac5da578376bdc5a705ea80a19baa4942" },
|
||||
"fzf": { "branch": "master", "commit": "c423c496a15b96cfc3c3fbd09135bcdc0c8e6b6e" },
|
||||
"fzf-lua": { "branch": "main", "commit": "2c4f76ac810de3b1ef91f06371ebc3cff55b1b3c" },
|
||||
"fzf.vim": { "branch": "master", "commit": "6f28c8c7bb551161a0315a76488522204f39c1f4" },
|
||||
"gen.nvim": { "branch": "main", "commit": "07fb74cf1bc533791e2c7cfca7bd3f45a3b597f9" },
|
||||
"gen.nvim": { "branch": "main", "commit": "5c153aae3e3f2c39fe424b992127aa43cf1a0293" },
|
||||
"gh.nvim": { "branch": "main", "commit": "ebbaac254ef7dd6f85b439825fbce82d0dc84515" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "58bd9e98d8e3c5a1c98af312e85247ee1afd3ed2" },
|
||||
"grug-far.nvim": { "branch": "main", "commit": "3e491ca05c50f87d02543adb010aed9dfb1e12c1" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "562dc47189ad3c8696dbf460d38603a74d544849" },
|
||||
"grug-far.nvim": { "branch": "main", "commit": "22f1571d2c60883b3fbf05e90f04cabde056fe3e" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
|
||||
"harpoon-lualine": { "branch": "master", "commit": "d1b873c19b701fd80d60a67d086dbb3bcc4eb00e" },
|
||||
"highlight-undo.nvim": { "branch": "main", "commit": "1ea1c79372d7d93c88fd97543880927b7635e3d2" },
|
||||
"inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "3fe94b8034dd5241cb882bb73847303b58857ecf" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "dddb5d21811c319eb6e51a993d8fb44b193aae3f" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" },
|
||||
"lazygit.nvim": { "branch": "main", "commit": "dc56df433bfbf107fee0139e187eb9750878fa84" },
|
||||
@@ -59,7 +59,7 @@
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "62360f061d45177dda8afc1b0fd1327328540301" },
|
||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"mini.ai": { "branch": "main", "commit": "45587078f323eaf41b9f701bbc04f8d1ab008979" },
|
||||
"mini.ai": { "branch": "main", "commit": "a9b992b13d22a8db8df6beac25afa59a10b5584d" },
|
||||
"mini.animate": { "branch": "main", "commit": "320fb35460238c436407cd779f63abad98e84870" },
|
||||
"mini.icons": { "branch": "main", "commit": "fe63fe080e76d80713557e5f0c65bc15b14b152d" },
|
||||
"mini.pairs": { "branch": "main", "commit": "927d19cbdd0e752ab1c7eed87072e71d2cd6ff51" },
|
||||
@@ -67,34 +67,34 @@
|
||||
"neo-tree.nvim": { "branch": "main", "commit": "206241e451c12f78969ff5ae53af45616ffc9b72" },
|
||||
"neogit": { "branch": "master", "commit": "2b74a777b963dfdeeabfabf84d5ba611666adab4" },
|
||||
"neotest": { "branch": "master", "commit": "32ff2ac21135a372a42b38ae131e531e64833bd3" },
|
||||
"neotest-golang": { "branch": "main", "commit": "f71d2494726c529c5d5c43813b24b3dd91ade981" },
|
||||
"neotest-golang": { "branch": "main", "commit": "58a174e5526b0edd2cf0829a6cf98efe3d49f209" },
|
||||
"neotest-jest": { "branch": "main", "commit": "514fd4eae7da15fd409133086bb8e029b65ac43f" },
|
||||
"neotest-rspec": { "branch": "main", "commit": "53fc108a06ae43d7f873d42ee5189c2301e33623" },
|
||||
"neotest-vitest": { "branch": "main", "commit": "353364aa05b94b09409cbef21b79c97c5564e2ce" },
|
||||
"night-owl.nvim": { "branch": "main", "commit": "131641a516085c5b3cacc8022581902e9f2f14af" },
|
||||
"night-owl.nvim": { "branch": "main", "commit": "87486a7157d49bc9ed43aab89432672deaf03110" },
|
||||
"noctis.nvim": { "branch": "main", "commit": "0b9336e39c686a7e58de06e4dd38c2bd862a7b33" },
|
||||
"noice.nvim": { "branch": "main", "commit": "448bb9c524a7601035449210838e374a30153172" },
|
||||
"nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "194ec600488f7c7229668d0e80bd197f3a2b84ff" },
|
||||
"nvim-cursorline": { "branch": "main", "commit": "804f0023692653b2b2368462d67d2a87056947f9" },
|
||||
"nvim-dap": { "branch": "master", "commit": "dcc85d12d6e2c18c5fa0f9a304d9f5e767e1401a" },
|
||||
"nvim-dap-go": { "branch": "main", "commit": "5030d53097fed7b75524a04048d8dbf417fa0140" },
|
||||
"nvim-dap": { "branch": "master", "commit": "9b81479813c5b1e79d2c7e2df6dc99aa1580bc19" },
|
||||
"nvim-dap-go": { "branch": "main", "commit": "5511788255c92bdd845f8d9690f88e2e0f0ff9f2" },
|
||||
"nvim-dap-ruby": { "branch": "main", "commit": "4176405d186a93ebec38a6344df124b1689cfcfd" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "484995d573c0f0563f6a66ebdd6c67b649489615" },
|
||||
"nvim-lint": { "branch": "master", "commit": "efc6fc83f0772283e064c53a8f9fb5645bde0bc0" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "81a19de18990208b678be084597613e2dbe66912" },
|
||||
"nvim-lint": { "branch": "master", "commit": "906cd0012be2acbf98de87a3c25154abe7da0478" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "652386deae739e38fa1bcf2f06e3e7de9b3436ba" },
|
||||
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
|
||||
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
|
||||
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
|
||||
"nvim-silicon": { "branch": "main", "commit": "feb882f04c992b797daa118101a239fb3bedfc04" },
|
||||
"nvim-snippets": { "branch": "main", "commit": "56b4052f71220144689caaa2e5b66222ba5661eb" },
|
||||
"nvim-transparent": { "branch": "main", "commit": "fd35a46f4b7c1b244249266bdcb2da3814f01724" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "1aad04ecde5ebf8f2b3eea5c6f39d38b251757f5" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "33a17515b79ddb10d750320fa994098bdc3e93ef" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "3d1f5e7df8d9981ec0bcf4aa635c0cc0a7ee89d9" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ca93cb2c34b67ab22d01976fc90bc95627a3317f" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "76f6b1d7c3f254567dc583124318e52305e3b111" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "7dcb8fea3e7b3ccdb50f2c3ae7c248cdf6fe1ae1" },
|
||||
"nvim-various-textobjs": { "branch": "main", "commit": "52343c70e2487095cafd4a5000d0465a2b992b03" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" },
|
||||
"oatmeal.nvim": { "branch": "master", "commit": "c8cdd0a182cf77f88ea5fa4703229ddb3f47c1f7" },
|
||||
@@ -128,7 +128,7 @@
|
||||
"telescope.nvim": { "branch": "master", "commit": "3b1600d0fd5172ad9fae00987362ca0ef3d8895d" },
|
||||
"tmux-awesome-manager.nvim": { "branch": "master", "commit": "f266ba588249965a16df77bca3f8e9a241156d37" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "8f45f353dc3649cb9b44cecda96827ea88128584" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "8ed0f52006d3207ec6c94de7db62da840937ef2a" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "137d06fb103952a0fb567882bb8527e2f92d327d" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "b0e7c7382a7e8f6456f2a95655983993ffda745e" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" },
|
||||
"ts-comments.nvim": { "branch": "main", "commit": "98d7d4dec0af1312d38e288f800bbf6ff562b6ab" },
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user