Brett's Fish Files
A collection of configuration files and functions for the Fish shell. These would be installed in ~/.config/fish/
, though I don't recommend overwriting your current setup wholesale. Pick and choose, use this repo as examples for your own exploration.
The folders
-
bash_scripts: some utilities that were too much trouble to port from Bash and work just as well run with hashbangs. They just need to be in the $PATH (some commands reference my local path,
~/scripts/fish
, which will need updating). -
completions: various completion configurations for custom commands.
-
custom: some files I source at login (from
config.fish
), mostly shared functions I think I need to have in memory (as opposed to autoloaded), and some aliases that don't make great functions. -
functions: the mother lode. All of my favorite commands (and some experimental ones). Most have a description on the function declaration, so you can see it in source or by running the
describe
command that you'll find in this folder (which essentially runsfunctions -Dv
, but prettier).
COMPLETIONS NOTE: for the file extension completion function to work, it needs to be able to find the filecomplete.rb
script located in the bash_scripts
directory. Edit functions/__complete_extension.fish
to point to that file on your system.
All the functions
64enc
: encode a given image file as base64 and output css background property to clipboard64font
: encode a given font file as base64 and output css background property to clipboard64svg
: encode a given svg file as base64 and output css background-image property to clipboard__auto_dir
: if command fails see if it's a directory or local executable__best_pager
: Choose the best available pager (opinionated)__complete_extension
:__exec_available
: test if command is available__expand_path
: commandline function to expand str/str using fasd and fzf__f_dir_regex
:__fuzzy_cd
: n/a__human_time
: Humanize a time interval for display__is_text
: Test if a file is plain text__ls_text_files
: List all text files in current directory__prev_token
: Get the previous token on the command line__re_extension
: remove extension from word under/before cursor__regex_from_args
: Helper to create greedy regular expression from multiple arguments__unfuck_previous_command
:_tide_item_doing_active
:_tide_item_doing_now
:_tide_item_message
:_tide_item_ssh_badge
:abbrs
: Search abbreviationsack
: ack defaults, ~/.ackrc for moreacorn
: Open Acorn.app with optional file(completion available)add_user_path
: Shortcut to add a user pathaffd
: Open Affinity Designer with optional file (completion available)afff
: Open Affinity Photo with optional file (completion available)ag
: Silver Surfer defaults, smart case, ignore VCSalpha
: Open ImageAlpha with optional file (completion available)ax
: Make file executablebadge
: Set iTerm session badgebak
: Back up a file by moving or copying to FILE.bakbe
:bid
: Get bundle id for app namebld
: Run howzit build systembox
: Draw a box around text.browser
: Write output to a temp HTML file and open in default browserbunches
: Edit Bunches in Sublimec
: n/acalc
: CLI calculatorcat
: Use bat instead of cat unless it's a Markdown file, then use mdlesscbp
: ClipBoard Previewcd_fuzz
: n/acdb
: Open broot with folders onlycdd
: Choose cd dir from menu (fzf)cdr
: cd to a recently visited directorycdt
: Change dir based on TagFiler tagschrome
: Open Google Chrome with optional file (completion available)cl
: copy output of last command to clipboardclip
: Copy file to clipboardcode
: n/acopy
:corner_print
:cpu
:cpwd
: Copy the current directory path to the clipboardcr
: Open CodeRunnercrush
: pngcrushcursor
: Show or hide the terminal cursordadjoke
: Get a dad joke from icanhazdadjoke.comdash
: Open argument in Dashdays_in
: get the number of days in a given month/yearddg
: search duckduckgodegit
: Remove all traces of git from a folderdesc
: Print the description of a Fish function.describe
: Show description for functiondhelp
: alias dhelp open "dash://fish:"(urlenc $argv)dirfor
: get origin directory for running processdman
: Open man page in Dashdockcomm
: commit a docker imagedocx2mmd
: Convert docx to markdown: docx2md [source] [target]eds
: Shortcut for editscripter
: edit recent file using fasd and fzfesc
: Ruby cgi escapeeschtml
: Ruby cgi HTML escapeextract
: unarchive any file typef
: Open directory in Finder with jump shortcutsfallback
: allow a fallback value for variablefarch
: Test Architecture of Frameworkfasdfzf
: Helper function to return a file via fasd and fzfffdir
: fuzzy find a directory, pass root dir and sequential search stringsfffile
: fuzzy find a file, pass root dir and sequential search stringsffmark
: fuzzy find a jump markfiletype
: Returns the kMDItemContentTypeTree for a filefindgist
: select gist from list and display contentsfindgistid
: select gist from list and display contentsfinish
: Finish last unfinished task by searchfire
: Open Firefox with optional file (completion available)fish_prompt
: Write out the promptfix
: Fix up last command with search/replaceflush
: Flush DNS cachefo
: Open file using jump shortcuts and fuzzy matchingfp
: Find and list processes matching a case-insensitive fuzzy-match stringft
: A shortcut for mdfinding tagged items system-widefuck
: Correct your previous console commandg2
: Fish "jump" replacement with fuzzy subdirectory matchinggc
: n/ageminfo
: Get info for a gem with partial name matchinggeminstall
: install a gem with fuzzy searchgemuninstall
: Uninstall a gem with partial name matchingget_ext
: Get the file extension from the argumentget
: alias get=git clonegetignore
: Get ignore file from gitignore.io and save to .gitignoregetignores
: Pull gitignore.io list of available .gitignore filesgg
: Commit pending changes and quote all args as messagegitar
: Automatically add new and remove deleted files from the git indexgitrelease
: Create a git releasegmine
: Resolve git conflicts with minegsearch
: Grep git commit historygt
: jump to top level of git repogtheirs
: Resolve git conflicts with theirshalp
: Get help for any builtin, alias, or functionhook
: n/ahooks
: Return a list of files hooked to target (Hook.app)howlong
: alias howlong=echo $CMD_DURATIONhs
: Search, select, and exec from historyidea
: Record an idea with doingimdown
: Test for internet connection and notify when it comes upimgsize
: Quickly get image dimensions from the command lineindex_of
: return the 1-based index of the first argument in remaining argumentsip
: Get external IP addressips
: Display all ip addresses for this hostis
: test if given file is of a file type. is TYPE FILEistext
: test if given file is plain textjfind
: jtag: search for tagsjothers
: jtag: List tags of other posts containing (all) tagsjs
: lint with jslintjump_fasd
: n/ajump
: Fish "jump" replacement with subdirectory matchinglb
: Select file in LaunchBar, fall back to the current directorylbash
: launch bash login shelllicense
:lld
: n/alno
: Print file with line numberslsgrep
: Wildcard folder/file searchlsregister
:lsz
: ls for inside of compressed archiveslt
: List directory from oldest to newestltr
: List directory from newest to oldestm.
: Check if the current directory is bookmarkedmack
: ack for markdownmd
: n/amdgrep
: alias mdgrep=rg -S --type markdownmem
:mkdir
: mkdir with subdirs, option to cd after creatingmmdc
: Open MultiMarkdown Composer with optional file (completion available)nope
: echo "nope"o
: Shortcut to open an app from the command lineoptim
: Open ImageOptim with optional file (completion available)pbgist
: private gist from clipboardpbgistp
: private gist from clipboardpbp
: Pasteboard Previewpbpmd
: Pasteboard Markdown Previewpercentof
: Quick calculation for sale discountspercentoff
: Quick calculation for sale discountspg
: alias pg=ps -ax | grep -ipless
: cat a file with pygments highlightingpman
: Display a man page as a PostScript PDF in Preview.appprev
: Open Preview with optional file (completion available)preview
: Preview text files using fzf and batprioritize
: set a numeric prefix on a file for sortingprompt_message
:r
: Run Reiki via bashraise
: Like ruby raise, but for fishrule
: Print a horizontal rulerulem
: Print a horizontal rule with messagervm
: n/aserve
: Start a local server for the current directory, open in browsershellesc
: Ruby shellwords escapeshellunesc
: Ruby shellwords unescapeshellwords
: Split a string like a shell wouldshorten
: Truncate every line of input to specified widthshortest
: Return the shortest string in arrayshowalias
: Show an aliassign
: alias sign=codesign --force --verbose --sign 'Developer ID Application' -o runtimeskylight
: alias skylight=skylighting -n -t ~/styles/kde/breeze-dark.themespell
: Get spelling options from aspellspellcheck
: Check all Markdown files in git repo (recursive)spellf
: Get spelling options from aspellsrc
: reload config filesublp
: Open a Sublime Text project (completion available)sum
: Take a list of numbers and return the sumtd
: [Create and] open project todotmj
: For use with my tmux utility (bash_scripts/tm)todos
: alias todos=ack --nobreak --nocolor "(TODO|FIXME):"|sed -E "s/(.:[[:digit:]]+):.((TODO|FIXME):.)/\2 :>> \1/"|grep -E --color=always ":>>.:\d+"tower
: Open Tower for directory (default CWD)tp
: Open TaskPaper with optional file (completion available)unbak
: remove bak extensionuncolor
: Remove color codes from stringunesc
: Ruby cgi unescapeup
: cd to a parent folder with fuzzy matchingupdown
: cd to a directory and then fuzzy search its treeurlenc
: url encode the passed stringv
: vim via fasd and fzfverify
: alias verify=codesign --deep -vv --verifywarn
: Echo to STDERRwatchthis
: Watch for changes in the current directory and execute commandxc
: Open Xcode with optional file (completion available)yep
: echo "yep"yn
: Simple pass/fail test for given commandz
: Custom fasd cd with fzfzipup
: exports a clean copy of the current git repo (master) to a zip file
Utility functions
__by_length
:__ff_dir_regex
:__ff_dir_to_regex
:__should_na
:__sort_by_length
:append_slash
: append a slash to each line/argument if neededmap
:remove_empty
: removes empty elements from an arrayreturn_array
: Echo out an array one line at a timeshorten_home
: substitutes $HOME with ~shortest_common
:slash_if_dir
: Add trailing slash if directoryslugify
:to_slug
:trim_pwd
: removes the current working directory from an array of paths
I'll update these every once in a while. If you're digging through and spot a problem, a stupid mistake, or something that could just plain be done better, please add an issue and let me know!