All Projects β†’ gazorby β†’ fish-abbreviation-tips

gazorby / fish-abbreviation-tips

Licence: MIT license
πŸ’‘ Help you remembering your abbreviations

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to fish-abbreviation-tips

sponge
🧽 Clean fish history from typos automatically
Stars: ✭ 69 (-55.48%)
Mutual labels:  fish, fisher, fish-plugin
fish logo
🐠 Fish shell colorful ASCII-art logo
Stars: ✭ 82 (-47.1%)
Mutual labels:  fish, fisher, fish-plugin
fish-color-scheme-switcher
A fish shell 🐟 plugin to switch color schemes 🌈
Stars: ✭ 48 (-69.03%)
Mutual labels:  fish, fisher, fish-plugin
Xxh
πŸš€ Bring your favorite shell wherever you go through the ssh.
Stars: ✭ 2,559 (+1550.97%)
Mutual labels:  fish, fisher
fish-exa
🐟 exa aliases for fish
Stars: ✭ 24 (-84.52%)
Mutual labels:  fish, fish-plugin
Fisher
A plugin manager for Fish.
Stars: ✭ 5,386 (+3374.84%)
Mutual labels:  fish, fish-plugin
Awsm.fish
A curation of prompts, plugins & other resources for Fish. 🐚
Stars: ✭ 2,641 (+1603.87%)
Mutual labels:  fish, fish-plugin
fish
Fish config with awesome flexible prompt, unicode symbols, better fzf integration and lot of handy functions.
Stars: ✭ 27 (-82.58%)
Mutual labels:  fish
fishrc
Fish shell customizations
Stars: ✭ 16 (-89.68%)
Mutual labels:  fish
sublime-fish
A robust Sublime Text syntax package for fish
Stars: ✭ 32 (-79.35%)
Mutual labels:  fish
abbreviations-in-code
List of common abbreviation in program codes
Stars: ✭ 163 (+5.16%)
Mutual labels:  abbreviation
fish-poetry
🐟🐍 a fish plugin that automatically activates the poetry subshell
Stars: ✭ 25 (-83.87%)
Mutual labels:  fish
fishline
A powerline prompt framework for the fish-shell built in fish-shell.
Stars: ✭ 66 (-57.42%)
Mutual labels:  fish
kn
Alternative to cd. Navigate by typing abbreviations of paths.
Stars: ✭ 68 (-56.13%)
Mutual labels:  abbreviation
flock-ai-ue4-plugin
A fish flock AI plugin for Unreal Engine 4. δΈ€δΈͺεŸΊδΊŽθ™šεΉ»4ηš„ι±ΌηΎ€ AI 插仢.
Stars: ✭ 91 (-41.29%)
Mutual labels:  fish
dotfiles
Shell-related config files and scripts
Stars: ✭ 43 (-72.26%)
Mutual labels:  fish
AbbrevMan.nvim
🍍 A NeoVim plugin for managing vim abbreviations.
Stars: ✭ 82 (-47.1%)
Mutual labels:  abbreviations
FSA
FSA (Fisheries Stock Assessment) package provides R functions to conduct typical introductory fisheries analyses.
Stars: ✭ 54 (-65.16%)
Mutual labels:  fish
FAIRY
Fast and scalable search of whole-slide images via self-supervised deep learning - Nature Biomedical Engineering
Stars: ✭ 43 (-72.26%)
Mutual labels:  fish
dotfiles
macOS / Linux / Codespaces dotfiles with 1-line setup script. Tested on Apple Silicon Macs. Supports both zsh and fish. Now managed with https://github.com/twpayne/chezmoi
Stars: ✭ 82 (-47.1%)
Mutual labels:  fish

fish-abbreviation-tips Generic badge Generic badge Generic badge

asciicast

It helps you remember abbreviations and aliases by displaying tips when you can use them.

βœ… Requirements

πŸš€ Install

Install using Fisher:

fisher install gazorby/fish-abbreviation-tips

πŸ”§ Usage

Just use your shell normally and enjoy tips!

Adding / removing abbreviations or aliases

The plugin automatically track changes when adding/removing abbreviations or aliases using abbr or functions commands (see behind the scenes), so you won't see tips anymore for an abbreviation/alias that has been erased, and you will get new ones for newly added abbreviations/aliases

πŸ›  Configuration

Configuration is done through environment variables.

To avoid spamming your config.fish, you can set environment variables using set -U once to make them persistent across restarts and share them across fish's instances.

Default configuration

ABBR_TIPS_PROMPT "\nπŸ’‘ \e[1m{{ .abbr }}\e[0m => {{ .cmd }}"
ABBR_TIPS_ALIAS_WHITELIST # Not set

ABBR_TIPS_REGEXES '(^(\w+\s+)+(-{1,2})\w+)(\s\S+)' '(^( ?\w+){3}).*' '(^( ?\w+){2}).*' '(^( ?\w+){1}).*'
# 1 : Test command with arguments removed
# 2 : Test the firsts three words
# 3 : Test the firsts two words
# 4 : Test the first word

Tips prompt

ABBR_TIPS_PROMPT

By default, tips will show up like this :

πŸ’‘ ga => git add

But you can customize it using the prompt environment variable. The plugin will replace {{ .abbr }} with the abbreviation/alias and {{ .cmd }} with the corresponding command.

⚠️ tips are displayed using echo -e (interpretation of backslash escapes)

Alias whitelist

ABBR_TIPS_ALIAS_WHITELIST

By default, if the command is a user-defined function (alias), the plugin won't search for a matching abbreviation because your aliases names are likely to be uniques, so there wouldn't be abbreviations with the same names.

But, in some cases, you may write aliases that wrap existing commands without altering their actual execution (e.g., add some hooks before/after the command execution). In this special case, you may also have abbreviations using these aliases, so you don't want to ignore them.

To do that, add these aliases to the environment variable.

Regexes

ABBR_TIPS_REGEXES

If the command doesn't match an abbreviation/alias exactly, it is tested against some regexes to extract a possible abbreviation/alias.

For example, you could have an abbreviation/alias like this :

gcm => git commit -m

So you want a tip when typing git commit -m "my commit", but the command doesn't match exactly git commit -m. To tackle this, we have a default regex that will match commands with arguments removed, so your git commit -m "my commit" will be tested as git commit -m.

You can add such regexes to the ABBR_TIPS_REGEXES list, and they will be tested in the order in which they have been added (see default configuration). Matching is lazy, so if the string extracted with the first regex matches an abbreviation/alias, it won't go further. Remember that only the first matching group will be tested. (so you must have at least one per regex)

πŸŽ₯ Behind the scenes

In order to not slow down your prompt, the plugin store abbreviations/aliases and their corresponding commands in lists (actually simulating a dictionary, as fish doesn't support dict yet) to avoid iterating over all abbreviations/aliases each time you type a command. So retrieving an abbreviation or an alias from a command is fast as it doesn't involve any loop.

The plugin will create lists once during installation by calling __abbr_tips_init in the background (more precisely in spawned shell, because fish doesn't put functions in background). Then, lists will get updated when you add or remove abbreviation/alias using abbr or functions builtin.

πŸ’­ Inspiration

Inspired by zsh-fast-alias-tips and alias-tips zsh plugins

πŸ“ License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].