Remove fish functions, commpletions, and d.conf except for custom prompt.
This commit is contained in:
parent
34eafb22c6
commit
c6d2c29248
|
|
@ -1 +0,0 @@
|
|||
fisher complete
|
||||
|
|
@ -1,142 +0,0 @@
|
|||
function __fish_poetry_b179e9296ef2e34b_complete_no_subcommand
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i about add build cache check config debug env export help init install lock new publish remove run search self shell show update version
|
||||
return 1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
# global options
|
||||
complete -c poetry -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -l ansi -d 'Force ANSI output'
|
||||
complete -c poetry -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -l help -d 'Display this help message'
|
||||
complete -c poetry -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -l no-ansi -d 'Disable ANSI output'
|
||||
complete -c poetry -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -l no-interaction -d 'Do not ask any interactive question'
|
||||
complete -c poetry -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -l quiet -d 'Do not output any message'
|
||||
complete -c poetry -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -l verbose -d 'Increase the verbosity of messages: "-v" for normal output, "-vv" for more verbose output and "-vvv" for debug'
|
||||
complete -c poetry -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -l version -d 'Display this application version'
|
||||
|
||||
# commands
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a about -d 'Shows information about Poetry.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a add -d 'Adds a new dependency to pyproject.toml.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a build -d 'Builds a package, as a tarball and a wheel by default.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a cache -d 'Interact with Poetry\'s cache'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a check -d 'Checks the validity of the pyproject.toml file.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a config -d 'Manages configuration settings.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a debug -d 'Debug various elements of Poetry.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a env -d 'Interact with Poetry\'s project environments.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a export -d 'Exports the lock file to alternative formats.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a help -d 'Display the manual of a command'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a init -d 'Creates a basic pyproject.toml file in the current directory.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a install -d 'Installs the project dependencies.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a lock -d 'Locks the project dependencies.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a new -d 'Creates a new Python project at <path>.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a publish -d 'Publishes a package to a remote repository.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a remove -d 'Removes a package from the project dependencies.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a run -d 'Runs a command in the appropriate environment.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a search -d 'Searches for packages on remote repositories.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a self -d 'Interact with Poetry directly.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a shell -d 'Spawns a shell within the virtual environment.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a show -d 'Shows information about packages.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a update -d 'Update the dependencies as according to the pyproject.toml file.'
|
||||
complete -c poetry -f -n '__fish_poetry_b179e9296ef2e34b_complete_no_subcommand' -a version -d 'Shows the version of the project or bumps it when a valid bump rule is provided.'
|
||||
|
||||
# command options
|
||||
|
||||
# about
|
||||
|
||||
# add
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l allow-prereleases -d 'Accept prereleases.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l dev -d 'Add as a development dependency.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l extras -d 'Extras to activate for the dependency.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l lock -d 'Do not perform operations (only update the lockfile).'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l optional -d 'Add as an optional dependency.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l platform -d 'Platforms for which the dependency must be installed.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l python -d 'Python version for which the dependency must be installed.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l source -d 'Name of the source to use to install the package.'
|
||||
|
||||
# build
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from build' -l format -d 'Limit the format to either sdist or wheel.'
|
||||
|
||||
# cache
|
||||
|
||||
# check
|
||||
|
||||
# config
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from config' -l list -d 'List configuration settings.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from config' -l local -d 'Set/Get from the project\'s local configuration.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from config' -l unset -d 'Unset configuration setting.'
|
||||
|
||||
# debug
|
||||
|
||||
# env
|
||||
|
||||
# export
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l dev -d 'Include development dependencies.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l extras -d 'Extra sets of dependencies to include.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l format -d 'Format to export to. Currently, only requirements.txt is supported.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l output -d 'The name of the output file.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l with-credentials -d 'Include credentials for extra indices.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l without-hashes -d 'Exclude hashes from the exported file.'
|
||||
|
||||
# help
|
||||
|
||||
# init
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from init' -l author -d 'Author name of the package.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from init' -l dependency -d 'Package to require, with an optional version constraint, e.g. requests:^2.10.0 or requests=2.11.1.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from init' -l description -d 'Description of the package.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from init' -l dev-dependency -d 'Package to require for development, with an optional version constraint, e.g. requests:^2.10.0 or requests=2.11.1.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from init' -l license -d 'License of the package.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from init' -l name -d 'Name of the package.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from init' -l python -d 'Compatible Python versions.'
|
||||
|
||||
# install
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l extras -d 'Extra sets of dependencies to install.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l no-dev -d 'Do not install the development dependencies.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l no-root -d 'Do not install the root package (the current project).'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l remove-untracked -d 'Removes packages not present in the lock file.'
|
||||
|
||||
# lock
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from lock' -l no-update -d 'Do not update locked versions, only refresh lock file.'
|
||||
|
||||
# new
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from new' -l name -d 'Set the resulting package name.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from new' -l src -d 'Use the src layout for the project.'
|
||||
|
||||
# publish
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l build -d 'Build the package before publishing.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l cert -d 'Certificate authority to access the repository.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l client-cert -d 'Client certificate to access the repository.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l dry-run -d 'Perform all actions except upload the package.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l password -d 'The password to access the repository.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l repository -d 'The repository to publish the package to.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l username -d 'The username to access the repository.'
|
||||
|
||||
# remove
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from remove' -l dev -d 'Remove a package from the development dependencies.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from remove' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
|
||||
|
||||
# run
|
||||
|
||||
# search
|
||||
|
||||
# self
|
||||
|
||||
# shell
|
||||
|
||||
# show
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l all -d 'Show all packages (even those not compatible with current system).'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l latest -d 'Show the latest version.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l no-dev -d 'Do not list the development dependencies.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l outdated -d 'Show the latest version but only for packages that are outdated.'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l tree -d 'List the dependencies as a tree.'
|
||||
|
||||
# update
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from update' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from update' -l lock -d 'Do not perform operations (only update the lockfile).'
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from update' -l no-dev -d 'Do not update the development dependencies.'
|
||||
|
||||
# version
|
||||
complete -c poetry -A -n '__fish_seen_subcommand_from version' -l short -d 'Output the version number only'
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
function ..; cd ..; end
|
||||
function ...; cd ../..; end
|
||||
function ....; cd ../../..; end
|
||||
function .....; cd ../../../..; end
|
||||
|
||||
function d; __fastdir_dirhist -l -n; end
|
||||
abbr -- - 'cd -'
|
||||
|
||||
function 1; __fastdir_cd_num 1; end
|
||||
function 2; __fastdir_cd_num 2; end
|
||||
function 3; __fastdir_cd_num 3; end
|
||||
function 4; __fastdir_cd_num 4; end
|
||||
function 5; __fastdir_cd_num 5; end
|
||||
function 6; __fastdir_cd_num 6; end
|
||||
function 7; __fastdir_cd_num 7; end
|
||||
function 8; __fastdir_cd_num 8; end
|
||||
function 9; __fastdir_cd_num 9; end
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
# From https://github.com/patrickf3139/fzf.fish/blob/main/conf.d/fzf.fish
|
||||
# Set up the default, mnemonic key bindings unless the user has chosen to customize them
|
||||
if not set --query fzf_fish_custom_keybindings
|
||||
# \cf is Ctrl+f
|
||||
bind \cj '__fzf_search_current_dir'
|
||||
#bind \cr '__fzf_search_history'
|
||||
bind \cv '__fzf_search_shell_variables'
|
||||
# The following two key binding use Alt as an additional modifier key to avoid conflicts
|
||||
bind \e\cl '__fzf_search_git_log'
|
||||
bind \e\cs '__fzf_search_git_status'
|
||||
|
||||
# set up the same key bindings for insert mode if using fish_vi_key_bindings
|
||||
if [ "$fish_key_bindings" = 'fish_vi_key_bindings' ]
|
||||
bind --mode insert \cf '__fzf_search_current_dir'
|
||||
bind --mode insert \cr '__fzf_search_history'
|
||||
bind --mode insert \cv '__fzf_search_shell_variables'
|
||||
bind --mode insert \e\cl '__fzf_search_git_log'
|
||||
bind --mode insert \e\cs '__fzf_search_git_status'
|
||||
end
|
||||
end
|
||||
|
||||
# If FZF_DEFAULT_OPTS is not set, then set some sane defaults. This also affects fzf outside of this plugin.
|
||||
# See https://github.com/junegunn/fzf#environment-variables
|
||||
if not set --query FZF_DEFAULT_OPTS
|
||||
# cycle makes scrolling easier
|
||||
# reverse layout is more familiar as it mimicks the layout of git log, history, and env
|
||||
# border makes clear where the fzf window ends
|
||||
# height 75% allows you to view what you were doing and stay in context of your work
|
||||
# preview-window wrap wraps long lines in the preview window
|
||||
set --export FZF_DEFAULT_OPTS '--cycle --layout=reverse --border --height 75% --preview-window=wrap'
|
||||
end
|
||||
|
||||
|
||||
# Forgit configuration
|
||||
set FORGIT_FZF_DEFAULT_OPTS "
|
||||
$FZF_DEFAULT_OPTS
|
||||
--ansi
|
||||
--height='80%'
|
||||
--bind='alt-k:preview-up,alt-p:preview-up'
|
||||
--bind='alt-j:preview-down,alt-n:preview-down'
|
||||
--bind='ctrl-r:toggle-all'
|
||||
--bind='ctrl-s:toggle-sort'
|
||||
--bind='?:toggle-preview'
|
||||
--bind='alt-w:toggle-preview-wrap'
|
||||
--preview-window='right:60%'
|
||||
+1
|
||||
$FORGIT_FZF_DEFAULT_OPTS
|
||||
"
|
||||
|
||||
# register aliases
|
||||
if test -z "$FORGIT_NO_ALIASES"
|
||||
if test -n "$forgit_add"
|
||||
alias $forgit_add 'forgit::add'
|
||||
else
|
||||
alias ga 'forgit::add'
|
||||
end
|
||||
|
||||
if test -n "$forgit_reset_head"
|
||||
alias $forgit_reset_head 'forgit::reset::head'
|
||||
else
|
||||
alias grh 'forgit::reset::head'
|
||||
end
|
||||
|
||||
if test -n "$forgit_log"
|
||||
alias $forgit_log 'forgit::log'
|
||||
else
|
||||
alias glo 'forgit::log'
|
||||
end
|
||||
|
||||
if test -n "$forgit_diff"
|
||||
alias $forgit_diff 'forgit::diff'
|
||||
else
|
||||
alias gd 'forgit::diff'
|
||||
end
|
||||
|
||||
if test -n "$forgit_ignore"
|
||||
alias $forgit_ignore 'forgit::ignore'
|
||||
else
|
||||
alias gi 'forgit::ignore'
|
||||
end
|
||||
|
||||
if test -n "$forgit_restore"
|
||||
alias $forgit_restore 'forgit::checkout_file'
|
||||
else
|
||||
alias gcf 'forgit::checkout_file'
|
||||
end
|
||||
|
||||
if test -n "$forgit_clean"
|
||||
alias $forgit_clean 'forgit::clean'
|
||||
else
|
||||
alias gclean 'forgit::clean'
|
||||
end
|
||||
|
||||
if test -n "$forgit_stash_show"
|
||||
alias $forgit_stash_show 'forgit::stash::show'
|
||||
else
|
||||
alias gss 'forgit::stash::show'
|
||||
end
|
||||
|
||||
if test -n "$forgit_cherry_pick"
|
||||
alias $forgit_cherry_pick 'forgit::cherry::pick'
|
||||
else
|
||||
alias gcp 'forgit::cherry::pick'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-github/conf.d/github.fish
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# Path to Oh My Fish install.
|
||||
set -q XDG_DATA_HOME
|
||||
and set -gx OMF_PATH "$XDG_DATA_HOME/omf"
|
||||
or set -gx OMF_PATH "$HOME/.local/share/omf"
|
||||
|
||||
# Load Oh My Fish configuration.
|
||||
source $OMF_PATH/init.fish
|
||||
|
|
@ -6,56 +6,7 @@
|
|||
# powerful commandline tools. It's interactive computing for effective
|
||||
# workflow.
|
||||
#-------------------------------------------------------------------------------
|
||||
# Abbreviations
|
||||
#abbr python python3
|
||||
#abbr vim nvim
|
||||
#abbr cat bat
|
||||
abbr pd prevd
|
||||
#abbr l ls -a
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Key Bindings
|
||||
bind \ee '$EDITOR ~/.config/fish/config.fish' # Edit config.fish with alt-e
|
||||
bind \er 'exec fish' # Reload fish config with alt-r
|
||||
bind \cg delete-char # Replace readline <C-d> with <C-g> because <C-d> also exits shells.
|
||||
bind \ea beginning-of-line # Replace <C-a> with <Alt-a> because <C-a> is used as tmux leader key.
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# FZF -> Fuzzy find everything!
|
||||
set PATH $PATH ~/.local/share/nvim/plugged/fzf/bin # Fzf is installed through vim plug
|
||||
set FZF_TMUX 1 # Use tmux pane by default
|
||||
set FZF_DEFAULT_OPTS '-m' # Multi-select by default
|
||||
if type rg &> /dev/null # Use Ripgrep (Faster than Grep)
|
||||
set FZF_DEFAULT_COMMAND 'rg --files --hidden --follow --glob "!.git/" --glob "!plugged/"'
|
||||
set FZF_CTRL_T_COMMAND 'rg --files --hidden --follow --glob "!.git/" --glob "!plugged/" $dir'
|
||||
end
|
||||
# Alt-c for directory history
|
||||
if type d &> /dev/null # Use <M-c> to fuzzy search directory history
|
||||
set FZF_CTRL_J_COMMAND "__fastdir_dirhist -l -n | awk -v OFS='%s' '{print \$2}' | awk '!x[\$0]++' | fzf-tmux "
|
||||
end
|
||||
# Alt-c for autojump database
|
||||
set FZF_CTRL_O_COMMAND "bat ~/.local/share/autojump/autojump.txt | sort -nr | fzf-tmux +s | awk -F '\t' '{printf \$2}'"
|
||||
set FZF_PREVIEW_FILE_CMD "bat"
|
||||
set FZF_PREVIEW_DIR_CMD "tree"
|
||||
|
||||
bind \cj eval $FZF_CTRL_J_COMMAND
|
||||
bind \co eval $FZF_CTRL_O_COMMAND
|
||||
|
||||
command -v blsd > /dev/null && export FZF_ALT_C_COMMAND='blsd'
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Autojump -> Faster filesystem navigation
|
||||
if test -f ~/.autojump/share/autojump/autojump.fish
|
||||
. ~/.autojump/share/autojump/autojump.fish
|
||||
end
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# See fishfile for installed plugins through fisherman
|
||||
abbr gc git commit -m
|
||||
abbr gp git push origin master
|
||||
abbr python python
|
||||
|
||||
set -gx GOPATH $HOME/go; set -gx GOROOT $HOME/.go; set -gx PATH $GOPATH/bin $PATH; # g-install: do NOT edit, see https://github.com/stefanmaric/g
|
||||
#abbr cat batcat
|
||||
abbr pip pip3
|
||||
bind \cd delete
|
||||
source ~/.config/fish/config/abbr.fish
|
||||
source ~/.config/fish/config/keys.fish
|
||||
source ~/.config/fish/config/plugins.fish
|
||||
source ~/.config/fish/config/programs.fish
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
# Abbreviations
|
||||
|
||||
# Git
|
||||
abbr gc git commit -m
|
||||
abbr gp git push origin master
|
||||
abbr gs git status
|
||||
|
||||
# Navigation
|
||||
abbr pd prevd
|
||||
|
||||
# Programs
|
||||
#abbr vim nvim
|
||||
#abbr cat bat
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# Key Bindings
|
||||
|
||||
# Edit config.fish with alt-e
|
||||
bind \ee '$EDITOR ~/.config/fish/config.fish'
|
||||
|
||||
# Reload fish config with alt-r
|
||||
bind \er 'exec fish'
|
||||
|
||||
# Replace readline <C-d> with <C-g> because <C-d> also exits shells.
|
||||
# Note: Consider alternatives
|
||||
bind \cg delete-char
|
||||
|
||||
# What does this do relative to the above?
|
||||
bind \cd delete
|
||||
|
||||
# Replace <C-a> with <Alt-a> because <C-a> is used as tmux leader key.
|
||||
# Note: Consider alternatives
|
||||
bind \ea beginning-of-line
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
# jichu4n/fish-command-timer
|
||||
set fish_command_timer_time_format '%b %d %I:%M%p'
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
#-------------------------------------------------------------------------------
|
||||
# Autojump -> Faster filesystem navigation
|
||||
if test -f ~/.autojump/share/autojump/autojump.fish
|
||||
. ~/.autojump/share/autojump/autojump.fish
|
||||
end
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# FZF -> Fuzzy find everything!
|
||||
|
||||
# Fzf is installed through vim plug
|
||||
set PATH $PATH ~/.local/share/nvim/plugged/fzf/bin
|
||||
|
||||
# Use tmux pane by default
|
||||
set FZF_TMUX 1
|
||||
|
||||
# Multi-select by default
|
||||
set FZF_DEFAULT_OPTS '-m'
|
||||
|
||||
# Use Ripgrep (Faster than Grep)
|
||||
if type rg &> /dev/null
|
||||
set FZF_DEFAULT_COMMAND 'rg --files --hidden --follow --glob "!.git/" --glob "!plugged/"'
|
||||
set FZF_CTRL_T_COMMAND 'rg --files --hidden --follow --glob "!.git/" --glob "!plugged/" $dir'
|
||||
end
|
||||
|
||||
if type d &> /dev/null
|
||||
set FZF_CTRL_J_COMMAND "__fastdir_dirhist -l -n | awk -v OFS='%s' '{print \$2}' | awk '!x[\$0]++' | fzf-tmux "
|
||||
bind \cj eval $FZF_CTRL_J_COMMAND
|
||||
end
|
||||
|
||||
# Ctrl-o for preview file using bat
|
||||
if type bat &> /dev/null
|
||||
set FZF_PREVIEW_FILE_CMD "bat"
|
||||
set FZF_CTRL_O_COMMAND "bat ~/.local/share/autojump/autojump.txt | sort -nr | fzf-tmux +s | awk -F '\t' '{printf \$2}'"
|
||||
bind \co eval $FZF_CTRL_O_COMMAND
|
||||
end
|
||||
|
||||
# Preview directories using tree
|
||||
if type tree &> /dev/null
|
||||
set FZF_PREVIEW_DIR_CMD "tree"
|
||||
end
|
||||
|
||||
# Alt-c for directory history using blsd
|
||||
command -v blsd > /dev/null && export FZF_ALT_C_COMMAND='blsd'
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# GO
|
||||
set -gx GOPATH $HOME/go; set -gx GOROOT $HOME/.go; set -gx PATH $GOPATH/bin $PATH; # g-install: do NOT edit, see https://github.com/stefanmaric/g
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-utils/EditDailyLog.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-utils/LogDirectory.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-utils/OpenLogDirectory.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-utils/RunBackup.fish
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
"""
|
||||
To be used with a companion fish function like this:
|
||||
|
||||
function refish
|
||||
set -l _x (python /tmp/bass.py source ~/.nvm/nvim.sh ';' nvm use iojs); source $_x; and rm -f $_x
|
||||
end
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import json
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
|
||||
BASH = 'bash'
|
||||
|
||||
FISH_READONLY = [
|
||||
'PWD', 'SHLVL', 'history', 'pipestatus', 'status', 'version',
|
||||
'FISH_VERSION', 'fish_pid', 'hostname', '_', 'fish_private_mode'
|
||||
]
|
||||
|
||||
IGNORED = [
|
||||
'PS1', 'XPC_SERVICE_NAME'
|
||||
]
|
||||
|
||||
def ignored(name):
|
||||
if name == 'PWD': # this is read only, but has special handling
|
||||
return False
|
||||
# ignore other read only variables
|
||||
if name in FISH_READONLY:
|
||||
return True
|
||||
if name in IGNORED or name.startswith("BASH_FUNC"):
|
||||
return True
|
||||
return False
|
||||
|
||||
def escape(string):
|
||||
# use json.dumps to reliably escape quotes and backslashes
|
||||
return json.dumps(string).replace(r'$', r'\$')
|
||||
|
||||
def escape_identifier(word):
|
||||
return escape(word.replace('?', '\\?'))
|
||||
|
||||
def comment(string):
|
||||
return '\n'.join(['# ' + line for line in string.split('\n')])
|
||||
|
||||
def gen_script():
|
||||
# Use the following instead of /usr/bin/env to read environment so we can
|
||||
# deal with multi-line environment variables (and other odd cases).
|
||||
env_reader = "%s -c 'import os,json; print(json.dumps({k:v for k,v in os.environ.items()}))'" % (sys.executable)
|
||||
args = [BASH, '-c', env_reader]
|
||||
output = subprocess.check_output(args, universal_newlines=True)
|
||||
old_env = output.strip()
|
||||
|
||||
pipe_r, pipe_w = os.pipe()
|
||||
if sys.version_info >= (3, 4):
|
||||
os.set_inheritable(pipe_w, True)
|
||||
command = 'eval $1 && ({}; alias) >&{}'.format(
|
||||
env_reader,
|
||||
pipe_w
|
||||
)
|
||||
args = [BASH, '-c', command, 'bass', ' '.join(sys.argv[1:])]
|
||||
p = subprocess.Popen(args, universal_newlines=True, close_fds=False)
|
||||
os.close(pipe_w)
|
||||
with os.fdopen(pipe_r) as f:
|
||||
new_env = f.readline()
|
||||
alias_str = f.read()
|
||||
if p.wait() != 0:
|
||||
raise subprocess.CalledProcessError(
|
||||
returncode=p.returncode,
|
||||
cmd=' '.join(sys.argv[1:]),
|
||||
output=new_env + alias_str
|
||||
)
|
||||
new_env = new_env.strip()
|
||||
|
||||
old_env = json.loads(old_env)
|
||||
new_env = json.loads(new_env)
|
||||
|
||||
script_lines = []
|
||||
|
||||
for k, v in new_env.items():
|
||||
if ignored(k):
|
||||
continue
|
||||
v1 = old_env.get(k)
|
||||
if not v1:
|
||||
script_lines.append(comment('adding %s=%s' % (k, v)))
|
||||
elif v1 != v:
|
||||
script_lines.append(comment('updating %s=%s -> %s' % (k, v1, v)))
|
||||
# process special variables
|
||||
if k == 'PWD':
|
||||
script_lines.append('cd %s' % escape(v))
|
||||
continue
|
||||
else:
|
||||
continue
|
||||
if k == 'PATH':
|
||||
value = ' '.join([escape(directory)
|
||||
for directory in v.split(':')])
|
||||
else:
|
||||
value = escape(v)
|
||||
script_lines.append('set -g -x %s %s' % (k, value))
|
||||
|
||||
for var in set(old_env.keys()) - set(new_env.keys()):
|
||||
script_lines.append(comment('removing %s' % var))
|
||||
script_lines.append('set -e %s' % var)
|
||||
|
||||
script = '\n'.join(script_lines)
|
||||
|
||||
alias_lines = []
|
||||
for line in alias_str.splitlines():
|
||||
_, rest = line.split(None, 1)
|
||||
k, v = rest.split("=", 1)
|
||||
alias_lines.append("alias " + escape_identifier(k) + "=" + v)
|
||||
alias = '\n'.join(alias_lines)
|
||||
|
||||
return script + '\n' + alias
|
||||
|
||||
script_file = os.fdopen(3, 'w')
|
||||
|
||||
if not sys.argv[1:]:
|
||||
print('__bass_usage', file=script_file, end='')
|
||||
sys.exit(0)
|
||||
|
||||
try:
|
||||
script = gen_script()
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.exit(e.returncode)
|
||||
except Exception:
|
||||
print('Bass internal error!', file=sys.stderr)
|
||||
raise # traceback will output to stderr
|
||||
except KeyboardInterrupt:
|
||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||
os.kill(os.getpid(), signal.SIGINT)
|
||||
else:
|
||||
script_file.write(script)
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
function __fastdir_cd_num
|
||||
if not count $argv > /dev/null
|
||||
echo "need directory name"
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l current_dir_num (math (count $dirprev) + 1)
|
||||
set -l dir_diff (math $argv[1] - $current_dir_num)
|
||||
|
||||
if test $dir_diff -gt 0
|
||||
if test $dir_diff -gt (count $dirnext)
|
||||
set dir_diff (count $dirnext)
|
||||
end
|
||||
return (nextd $dir_diff)
|
||||
else if test $dir_diff -lt 0
|
||||
set dir_diff (math 0 - $dir_diff)
|
||||
if test $dir_diff -gt (count $dirprev)
|
||||
set dir_diff (count $dirprev)
|
||||
end
|
||||
return (prevd $dir_diff)
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
function __fastdir_dirhist --description "Print the current directory history (the back- and fwd- lists)"
|
||||
if count $argv > /dev/null
|
||||
switch $argv[1]
|
||||
case -h --h --he --hel --help
|
||||
__fish_print_help dirh
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
# Avoid set comment
|
||||
set -l current (command pwd)
|
||||
set -l separator " "
|
||||
set -l line_len (math (count $dirprev) + (echo $dirprev $current $dirnext | wc -m) )
|
||||
set -l line_num false
|
||||
if test $line_len -gt $COLUMNS
|
||||
# Print one entry per line if history is long
|
||||
set separator "\n"
|
||||
end
|
||||
|
||||
if count $argv > /dev/null
|
||||
for i in (seq (count $argv))
|
||||
switch $argv[$i]
|
||||
case '-l' --l --lo --lon --long
|
||||
set separator "\n"
|
||||
continue
|
||||
case '-n' --n --nu --num --numb --numbe --number
|
||||
set line_num true
|
||||
continue
|
||||
case '-*'
|
||||
printf (_ "%s: Unknown option %s\n" ) nextd $argv[$i]
|
||||
return 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set -l current_line 0
|
||||
|
||||
# BSD seq 0 outputs '1 0' instead of nothing
|
||||
if count $dirprev > /dev/null
|
||||
for i in (seq (count $dirprev))
|
||||
if test $line_num = true
|
||||
echo -n "$i "
|
||||
end
|
||||
echo -n -e $dirprev[$i]$separator
|
||||
set current_line $i
|
||||
end
|
||||
end
|
||||
|
||||
set_color $fish_color_history_current
|
||||
if test $line_num = true
|
||||
set current_line (math $current_line + 1)
|
||||
echo -n "$current_line "
|
||||
end
|
||||
echo -n -e $current$separator
|
||||
set_color normal
|
||||
|
||||
# BSD seq 0 outputs '1 0' instead of nothing
|
||||
if count $dirnext > /dev/null
|
||||
for i in (seq (echo (count $dirnext)) -1 1)
|
||||
if test $line_num = true
|
||||
set -l line (math (count $dirnext) - $i + $current_line + 1)
|
||||
echo -n "$line "
|
||||
end
|
||||
echo -n -e $dirnext[$i]$separator
|
||||
end
|
||||
end
|
||||
|
||||
if test $separator != "\n"
|
||||
echo
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
function __fish_prog_needs_command
|
||||
set -l cmd (commandline -opc)
|
||||
if test (count $cmd) -eq 1
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function __fish_prog_using_command
|
||||
set -l cmd (commandline -opc)
|
||||
if test (count $cmd) -gt 1
|
||||
if test $argv[1] = $cmd[2]
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-fzf/__fzf_display_value_or_error.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-fzf/__fzf_preview_file.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-fzf/__fzf_report_file_type.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-fzf/__fzf_search_current_dir.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-fzf/__fzf_search_git_log.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-fzf/__fzf_search_git_status.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-fzf/__fzf_search_history.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-fzf/__fzf_search_shell_variables.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-github/__github_add_org.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-github/__github_get_org_repos.fish
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# Defined in /tmp/fish.hymHqS/_virtualfish.fish @ line 2
|
||||
function _virtualfish
|
||||
if set -q VIRTUAL_ENV
|
||||
echo -n -s (set_color black) "(" (basename "$VIRTUAL_ENV") "🐍)" (set_color normal) " "
|
||||
end
|
||||
end
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
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
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-utils/create_daily_log.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-fzf/d.fish
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
function delete
|
||||
commandline -f delete-char
|
||||
end
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-github/fcd.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-github/fclone.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-github/fhub.fish
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
function fish_prompt --description 'Write out the prompt'
|
||||
# Just calculate this once, to save a few cycles when displaying the prompt
|
||||
if not set -q __fish_prompt_hostname
|
||||
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
|
||||
end
|
||||
|
||||
set -l color_cwd
|
||||
set -l suffix
|
||||
switch $USER
|
||||
case root toor
|
||||
if set -q fish_color_cwd_root
|
||||
set color_cwd $fish_color_cwd_root
|
||||
else
|
||||
set color_cwd $fish_color_cwd
|
||||
end
|
||||
set suffix '#'
|
||||
case '*'
|
||||
set color_cwd $fish_color_cwd
|
||||
set suffix '>'
|
||||
end
|
||||
|
||||
echo -n -s "$USER" @ "$__fish_prompt_hostname" ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix "
|
||||
end
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
function fish_user_key_bindings
|
||||
fzf_key_bindings
|
||||
end
|
||||
|
|
@ -1,436 +0,0 @@
|
|||
set -g fisher_version 3.3.2
|
||||
|
||||
function fisher -a cmd -d "fish plugin manager"
|
||||
set -q XDG_CACHE_HOME; or set XDG_CACHE_HOME ~/.cache
|
||||
set -q XDG_CONFIG_HOME; or set XDG_CONFIG_HOME ~/.config
|
||||
set -q XDG_DATA_HOME; or set XDG_DATA_HOME ~/.local/share
|
||||
|
||||
set -g fish_config $XDG_CONFIG_HOME/fish
|
||||
set -g fisher_cache $XDG_CACHE_HOME/fisher
|
||||
set -g fisher_data $XDG_DATA_HOME/fisher
|
||||
|
||||
set -q fisher_path; or set -g fisher_path $fish_config
|
||||
set -g fishfile $fish_config/fishfile
|
||||
|
||||
for path in {$fish_config,$fisher_path}/{functions,completions,conf.d} $fisher_cache
|
||||
if test ! -d $path
|
||||
command mkdir -p $path
|
||||
end
|
||||
end
|
||||
|
||||
if test ! -e $fisher_path/completions/fisher.fish
|
||||
echo "fisher complete" >$fisher_path/completions/fisher.fish
|
||||
_fisher_complete
|
||||
end
|
||||
|
||||
if test -e $fisher_path/conf.d/fisher.fish
|
||||
switch "$version"
|
||||
case \*-\*
|
||||
command rm -f $fisher_path/conf.d/fisher.fish
|
||||
case 2\*
|
||||
case \*
|
||||
command rm -f $fisher_path/conf.d/fisher.fish
|
||||
end
|
||||
else
|
||||
switch "$version"
|
||||
case \*-\*
|
||||
case 2\*
|
||||
echo "fisher copy-user-key-bindings" >$fisher_path/conf.d/fisher.fish
|
||||
end
|
||||
end
|
||||
|
||||
# 2019-10-22: temp code, migrates fishfile from old path back to $fish_config
|
||||
if test -e "$fisher_path/fishfile"; and test ! -e "$fishfile"
|
||||
command mv -f "$fisher_path/fishfile" "$fishfile"
|
||||
end
|
||||
|
||||
# 2020-06-23: temp code, migrates fisher data from XDG_CONFIG_HOME to XDG_DATA_HOME
|
||||
set -l fisher_config $XDG_CONFIG_HOME/fisher
|
||||
if test -d $fisher_config
|
||||
echo "migrating local data from $fisher_config to $fisher_data"
|
||||
command rm -rf $fisher_data
|
||||
command mv -f $fisher_config $fisher_data
|
||||
end
|
||||
|
||||
switch "$cmd"
|
||||
case {,self-}complete
|
||||
_fisher_complete
|
||||
case copy-user-key-bindings
|
||||
_fisher_copy_user_key_bindings
|
||||
case ls
|
||||
set -e argv[1]
|
||||
if test -s "$fishfile"
|
||||
set -l file (_fisher_fmt <$fishfile | _fisher_parse -R | command sed "s|@.*||")
|
||||
_fisher_ls | _fisher_fmt | command awk -v FILE="$file" "
|
||||
BEGIN { for (n = split(FILE, f); ++i <= n;) file[f[i]] } \$0 in file && /$argv[1]/
|
||||
" | command sed "s|^$HOME|~|"
|
||||
end
|
||||
case self-update
|
||||
_fisher_self_update (status -f)
|
||||
case self-uninstall
|
||||
_fisher_self_uninstall
|
||||
case {,-}-v{ersion,}
|
||||
echo "fisher version $fisher_version" (status -f | command sed "s|^$HOME|~|")
|
||||
case {,-}-h{elp,}
|
||||
_fisher_help
|
||||
case ""
|
||||
_fisher_commit --
|
||||
case add rm
|
||||
if not isatty
|
||||
while read -l arg
|
||||
set argv $argv $arg
|
||||
end
|
||||
end
|
||||
|
||||
if test (count $argv) = 1
|
||||
echo "fisher: invalid number of arguments" >&2
|
||||
_fisher_help >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
_fisher_commit $argv
|
||||
case \*
|
||||
echo "fisher: unknown flag or command \"$cmd\"" >&2
|
||||
_fisher_help >&2
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_complete
|
||||
complete -ec fisher
|
||||
complete -xc fisher -n __fish_use_subcommand -a add -d "Add plugins"
|
||||
complete -xc fisher -n __fish_use_subcommand -a rm -d "Remove plugins"
|
||||
complete -xc fisher -n __fish_use_subcommand -a ls -d "List installed plugins matching REGEX"
|
||||
complete -xc fisher -n __fish_use_subcommand -a --help -d "Show usage help"
|
||||
complete -xc fisher -n __fish_use_subcommand -a --version -d "$fisher_version"
|
||||
complete -xc fisher -n __fish_use_subcommand -a self-update -d "Update to the latest version"
|
||||
for pkg in (fisher ls)
|
||||
complete -xc fisher -n "__fish_seen_subcommand_from rm" -a $pkg
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_copy_user_key_bindings
|
||||
if functions -q fish_user_key_bindings
|
||||
functions -c fish_user_key_bindings fish_user_key_bindings_copy
|
||||
end
|
||||
function fish_user_key_bindings
|
||||
for file in $fisher_path/conf.d/*_key_bindings.fish
|
||||
source $file >/dev/null 2>/dev/null
|
||||
end
|
||||
if functions -q fish_user_key_bindings_copy
|
||||
fish_user_key_bindings_copy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_ls
|
||||
for pkg in $fisher_data/*/*/*
|
||||
command readlink $pkg; or echo $pkg
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_fmt
|
||||
command sed "s|^[[:space:]]*||;s|^$fisher_data/||;s|^~|$HOME|;s|^\.\/*|$PWD/|;s|^https*:/*||;s|^github\.com/||;s|/*\$||"
|
||||
end
|
||||
|
||||
function _fisher_help
|
||||
echo "usage: fisher add <plugin...> Add plugin/s"
|
||||
echo " fisher rm <plugin...> Remove plugin/s"
|
||||
echo " fisher Update all plugins"
|
||||
echo " fisher ls [<regex>] List installed plugins matching <regex>"
|
||||
echo " fisher --help Show this help"
|
||||
echo " fisher --version Show the current version"
|
||||
echo " fisher self-update Update to the latest version"
|
||||
echo " fisher self-uninstall Uninstall from your system"
|
||||
echo "examples:"
|
||||
echo " fisher add jorgebucaran/z rafaelrinaldi/pure"
|
||||
echo " fisher add gitlab.com/foo/bar@v2"
|
||||
echo " fisher add ~/path/to/local/pkg"
|
||||
echo " fisher add <file"
|
||||
echo " fisher rm rafaelrinaldi/pure"
|
||||
echo " fisher ls | fisher rm"
|
||||
end
|
||||
|
||||
function _fisher_self_update -a file
|
||||
set -l url "https://raw.githubusercontent.com/jorgebucaran/fisher/main/fisher.fish"
|
||||
echo "fetching $url" >&2
|
||||
command curl -s "$url?nocache" >$file.
|
||||
|
||||
set -l next_version (command awk '$4 ~ /^[0-9]+\.[0-9]+\.[0-9]+$/ { print v=$4 } { exit !v }' <$file.)
|
||||
switch "$next_version"
|
||||
case "" $fisher_version
|
||||
command rm -f $file.
|
||||
if test -z "$next_version"
|
||||
echo "fisher: cannot update fisher -- are you offline?" >&2
|
||||
return 1
|
||||
end
|
||||
echo "fisher is already up-to-date" >&2
|
||||
case \*
|
||||
echo "linking $file" | command sed "s|$HOME|~|" >&2
|
||||
command mv -f $file. $file
|
||||
source $file
|
||||
echo "updated to fisher $fisher_version -- hooray!" >&2
|
||||
_fisher_complete
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_self_uninstall
|
||||
for pkg in (_fisher_ls)
|
||||
_fisher_rm $pkg
|
||||
end
|
||||
|
||||
for file in $fisher_cache $fisher_data $fisher_path/{functions,completions,conf.d}/fisher.fish $fishfile
|
||||
echo "removing $file"
|
||||
command rm -Rf $file 2>/dev/null
|
||||
end | command sed "s|$HOME|~|" >&2
|
||||
|
||||
for name in (set -n | command awk '/^fisher_/')
|
||||
set -e "$name"
|
||||
end
|
||||
|
||||
functions -e (functions -a | command awk '/^_fisher/') fisher
|
||||
complete -c fisher --erase
|
||||
end
|
||||
|
||||
function _fisher_commit -a cmd
|
||||
set -e argv[1]
|
||||
set -l elapsed (_fisher_now)
|
||||
|
||||
if test ! -e "$fishfile"
|
||||
command touch $fishfile
|
||||
echo "created new fishfile in $fishfile" | command sed "s|$HOME|~|" >&2
|
||||
end
|
||||
|
||||
set -l old_pkgs (_fisher_ls | _fisher_fmt)
|
||||
for pkg in (_fisher_ls)
|
||||
_fisher_rm $pkg
|
||||
end
|
||||
command rm -Rf $fisher_data
|
||||
command mkdir -p $fisher_data
|
||||
|
||||
set -l next_pkgs (_fisher_fmt <$fishfile | _fisher_parse -R $cmd (printf "%s\n" $argv | _fisher_fmt))
|
||||
set -l actual_pkgs (_fisher_fetch $next_pkgs)
|
||||
set -l updated_pkgs
|
||||
for pkg in $old_pkgs
|
||||
if contains -- $pkg $actual_pkgs
|
||||
set updated_pkgs $updated_pkgs $pkg
|
||||
end
|
||||
end
|
||||
|
||||
if test -z "$actual_pkgs$updated_pkgs$old_pkgs$next_pkgs"
|
||||
echo "fisher: nothing to commit -- try adding some plugins" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l out_pkgs
|
||||
if test "$cmd" = "rm"
|
||||
set out_pkgs $next_pkgs
|
||||
else
|
||||
for pkg in $next_pkgs
|
||||
if contains -- (echo $pkg | command sed "s|@.*||") $actual_pkgs
|
||||
set out_pkgs $out_pkgs $pkg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
printf "%s\n" (_fisher_fmt <$fishfile | _fisher_parse -W $cmd $out_pkgs | command sed "s|^$HOME|~|") >$fishfile
|
||||
|
||||
_fisher_complete
|
||||
|
||||
command awk -v A=(count $actual_pkgs) -v U=(count $updated_pkgs) -v O=(count $old_pkgs) -v E=(_fisher_now $elapsed) '
|
||||
BEGIN {
|
||||
res = fmt("removed", O - U, fmt("updated", U, fmt("added", A - U)))
|
||||
printf((res ? res : "done") " in %.2fs\n", E / 1000)
|
||||
}
|
||||
function fmt(action, n, s) {
|
||||
return n ? (s ? s ", " : s) action " " n " plugin" (n > 1 ? "s" : "") : s
|
||||
}
|
||||
' >&2
|
||||
end
|
||||
|
||||
function _fisher_parse -a mode cmd
|
||||
set -e argv[1..2]
|
||||
command awk -v FS="[[:space:]]*#+" -v MODE="$mode" -v CMD="$cmd" -v ARGSTR="$argv" '
|
||||
BEGIN {
|
||||
for (n = split(ARGSTR, a, " "); i++ < n;) pkgs[getkey(a[i])] = a[i]
|
||||
}
|
||||
!NF { next } { k = getkey($1) }
|
||||
MODE == "-R" && !(k in pkgs) && ($0 = $1)
|
||||
MODE == "-W" && (/^#/ || k in pkgs || CMD != "rm") { print pkgs[k] (sub($1, "") ? $0 : "") }
|
||||
MODE == "-W" || CMD == "rm" { delete pkgs[k] }
|
||||
END {
|
||||
for (k in pkgs) {
|
||||
if (CMD != "rm" || MODE == "-W") print pkgs[k]
|
||||
else print "fisher: cannot remove \""k"\" -- plugin is not in fishfile" > "/dev/stderr"
|
||||
}
|
||||
}
|
||||
function getkey(s, a) {
|
||||
return (split(s, a, /@+|:/) > 2) ? a[2]"/"a[1]"/"a[3] : a[1]
|
||||
}
|
||||
'
|
||||
end
|
||||
|
||||
function _fisher_fetch
|
||||
set -l pkg_jobs
|
||||
set -l out_pkgs
|
||||
set -l next_pkgs
|
||||
set -l local_pkgs
|
||||
set -q fisher_user_api_token; and set -l curl_opts -u $fisher_user_api_token
|
||||
|
||||
for pkg in $argv
|
||||
switch $pkg
|
||||
case \~\* /\*
|
||||
set -l path (echo "$pkg" | command sed "s|^~|$HOME|")
|
||||
if test -e "$path"
|
||||
set local_pkgs $local_pkgs $path
|
||||
else
|
||||
echo "fisher: cannot add \"$pkg\" -- is this a valid file?" >&2
|
||||
end
|
||||
continue
|
||||
end
|
||||
|
||||
command awk -v PKG="$pkg" -v FS=/ '
|
||||
BEGIN {
|
||||
split(PKG, tmp, /@/)
|
||||
pkg = split(PKG, _, "/") <= 2 ? "github.com/"tmp[1] : tmp[1]
|
||||
tag = tmp[2] ? tmp[2] : "HEAD"
|
||||
print pkg "\t" (\
|
||||
pkg ~ /^github/ ? "https://codeload."pkg"/tar.gz/"tag : \
|
||||
pkg ~ /^gitlab/ ? "https://"pkg"/-/archive/"tag"/"tmp[split(pkg, tmp, "/")]"-"tag".tar.gz" : \
|
||||
pkg ~ /^bitbucket/ ? "https://"pkg"/get/"tag".tar.gz" : pkg\
|
||||
)
|
||||
}
|
||||
' | read -l pkg url
|
||||
|
||||
if test ! -d "$fisher_data/$pkg"
|
||||
fish -c "
|
||||
echo fetching $url >&2
|
||||
command mkdir -p $fisher_data/$pkg $fisher_cache/(command dirname $pkg)
|
||||
if command curl $curl_opts -Ss -w \"\" $url 2>&1 | command tar -xzf- -C $fisher_data/$pkg 2>/dev/null
|
||||
command rm -Rf $fisher_cache/$pkg
|
||||
command mv -f $fisher_data/$pkg/* $fisher_cache/$pkg
|
||||
command rm -Rf $fisher_data/$pkg
|
||||
command cp -Rf {$fisher_cache,$fisher_data}/$pkg
|
||||
else if test -d \"$fisher_cache/$pkg\"
|
||||
echo fisher: cannot connect to server -- looking in \"$fisher_cache/$pkg\" | command sed 's|$HOME|~|' >&2
|
||||
command cp -Rf $fisher_cache/$pkg $fisher_data/$pkg/..
|
||||
else
|
||||
command rm -Rf $fisher_data/$pkg
|
||||
echo fisher: cannot add \"$pkg\" -- is this a valid plugin\? >&2
|
||||
end
|
||||
" >/dev/null &
|
||||
set pkg_jobs $pkg_jobs (_fisher_jobs --last)
|
||||
set next_pkgs $next_pkgs "$fisher_data/$pkg"
|
||||
end
|
||||
end
|
||||
|
||||
if set -q pkg_jobs[1]
|
||||
while for job in $pkg_jobs
|
||||
contains -- $job (_fisher_jobs); and break
|
||||
end
|
||||
end
|
||||
for pkg in $next_pkgs
|
||||
if test -d "$pkg"
|
||||
set out_pkgs $out_pkgs $pkg
|
||||
_fisher_add $pkg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set -l local_prefix $fisher_data/local/$USER
|
||||
if test ! -d "$local_prefix"
|
||||
command mkdir -p $local_prefix
|
||||
end
|
||||
for pkg in $local_pkgs
|
||||
set -l target $local_prefix/(command basename $pkg)
|
||||
if test ! -L "$target"
|
||||
command ln -sf $pkg $target
|
||||
set out_pkgs $out_pkgs $pkg
|
||||
_fisher_add $pkg --link
|
||||
end
|
||||
end
|
||||
|
||||
if set -q out_pkgs[1]
|
||||
_fisher_fetch (
|
||||
for pkg in $out_pkgs
|
||||
if test -s "$pkg/fishfile"
|
||||
_fisher_fmt <$pkg/fishfile | _fisher_parse -R
|
||||
end
|
||||
end)
|
||||
printf "%s\n" $out_pkgs | _fisher_fmt
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_add -a pkg opts
|
||||
for src in $pkg/{functions,completions,conf.d}/**.* $pkg/*.fish
|
||||
set -l target (command basename $src)
|
||||
switch $src
|
||||
case $pkg/conf.d\*
|
||||
set target $fisher_path/conf.d/$target
|
||||
case $pkg/completions\*
|
||||
set target $fisher_path/completions/$target
|
||||
case $pkg/{functions,}\*
|
||||
switch $target
|
||||
case uninstall.fish
|
||||
continue
|
||||
case {init,key_bindings}.fish
|
||||
set target $fisher_path/conf.d/(command basename $pkg)\_$target
|
||||
case \*
|
||||
set target $fisher_path/functions/$target
|
||||
end
|
||||
end
|
||||
echo "linking $target" | command sed "s|$HOME|~|" >&2
|
||||
if set -q opts[1]
|
||||
command ln -sf $src $target
|
||||
else
|
||||
command cp -f $src $target
|
||||
end
|
||||
switch $target
|
||||
case \*.fish
|
||||
source $target >/dev/null 2>/dev/null
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_rm -a pkg
|
||||
for src in $pkg/{conf.d,completions,functions}/**.* $pkg/*.fish
|
||||
set -l target (command basename $src)
|
||||
set -l filename (command basename $target .fish)
|
||||
switch $src
|
||||
case $pkg/conf.d\*
|
||||
test "$filename.fish" = "$target"; and emit "$filename"_uninstall
|
||||
set target conf.d/$target
|
||||
case $pkg/completions\*
|
||||
test "$filename.fish" = "$target"; and complete -ec $filename
|
||||
set target completions/$target
|
||||
case $pkg/{,functions}\*
|
||||
test "$filename.fish" = "$target"; and functions -e $filename
|
||||
switch $target
|
||||
case uninstall.fish
|
||||
source $src
|
||||
continue
|
||||
case {init,key_bindings}.fish
|
||||
set target conf.d/(command basename $pkg)\_$target
|
||||
case \*
|
||||
set target functions/$target
|
||||
end
|
||||
end
|
||||
command rm -f $fisher_path/$target
|
||||
end
|
||||
if not functions -q fish_prompt
|
||||
source "$__fish_datadir$__fish_data_dir/functions/fish_prompt.fish"
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_jobs
|
||||
jobs $argv | command awk '/^[0-9]+\t/ { print $1 }'
|
||||
end
|
||||
|
||||
function _fisher_now -a elapsed
|
||||
switch (command uname)
|
||||
case Darwin \*BSD
|
||||
command perl -MTime::HiRes -e 'printf("%.0f\n", (Time::HiRes::time() * 1000) - $ARGV[0])' $elapsed
|
||||
case \*
|
||||
math (command date "+%s%3N") - "0$elapsed"
|
||||
end
|
||||
end
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-github/fkill.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-github/forgit.plugin.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-fzf/fzf-bcd-widget.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-fzf/fzf-cdhist-widget.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-fzf/fzf-complete.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-fzf/fzf-select.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.fzf/shell/key-bindings.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-audio/pacmd-loopback.fish
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#Regex for shortning prompt(after$args_pre) : -e 's-\([^/.]\)[^/]*/-\1/-g'
|
||||
|
||||
function prompt_pwd --description 'Print the current working directory, shortened to fit the prompt'
|
||||
set -l args_post
|
||||
set -l args_pre
|
||||
set -l realhome ~
|
||||
echo $PWD | sed -e "s|^$realhome|~|" $args_pre $args_post
|
||||
end
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/shawn/.config/fish/fisher/fish-github/readme.fish
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/ygg/.rsvm/rsvm.fish
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#!/usr/bin/env fish
|
||||
if not set --query fzf_fish_custom_keybindings
|
||||
bind --erase --all \cf
|
||||
bind --erase --all \cr
|
||||
bind --erase --all \cv
|
||||
bind --erase --all \e\cl
|
||||
bind --erase --all \e\cs
|
||||
|
||||
set_color --italics cyan
|
||||
echo "fzf.fish key bindings removed"
|
||||
set_color normal
|
||||
end
|
||||
|
||||
# Not going to erase FZF_DEFAULT_OPTS because too hard to tell if it was set by the user or by this plugin
|
||||
Loading…
Reference in New Issue