Lädt...


🔧 Search alias or find alias in zsh plugins


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

I got back to Zsh after having some months playing Fish. I found Fish was so convenience to me, but I really want to get back to use Bash as default for some work stuffs, for example working with Bash. Some other stuffs like using Bash programs or HEREDOC aren't available, not too important but sometimes searching for Fish-targetted things was also not fun.

Then I felt missing function auto completion of Fish, that I can easily search a Fish function and see its original command. It's very helpful because I built a lot of alias for cli stuffs like kubectl, git, docker, github cli, ... Made my works being faster, I didn't have to type too much.

I know in Zsh, there is a way to have useful aliases is using zsh plugins, but I have to deal with cheatsheets of every plugin to learn and remember them. There is a way for it, bookmarking. But I though that a Bash function to do offline searching on plugins folder would be very simple and just need to scan README.md of the specified plugin and grep the keyword.

# Gist: https://gist.github.com/vuon9/bdeb471d9cbd6f8c0fac23a9f291196a
function zpa() {
    # Command: zpa
    # Options:
    # [1]: plugin name, e.g: git, brew, kubectl, docker, etc.
    # [2]: grep string, e.g: gc, 'git clone', 'git rebase'
    # [3] (optional): -a (if you want to search in all official plugins)

    # Examples:
    # zpa git gc: Search alias gc in git plugin to see what is it
    # zpa kubectl 'kubectl': I want to learn if there is an alias of 'git clone' is existed

    installedPlugins=("${plugins[@]}")
    if [ "$3" = "-a" ]; then
        installedPlugins=($(ls $ZSH/plugins))
    fi

    for plugin in $installedPlugins
    do
        if [ "$1" = $plugin ]; then
            bat $ZSH/plugins/$plugin/README.md | grep "$2"
        fi
    done
}

Examples:
Given

  • I enabled kubectl plugin for zsh
  • I haven't enabled brew plugin for zsh

When & Then
Image description

Look at the screenshot, I found some clues if Zsh plugins supported for my search keywords.

Hope it helps and happy coding!

...

🔧 Search alias or find alias in zsh plugins


📈 62.89 Punkte
🔧 Programmierung

🔧 Using Zsh and zsh-autosuggestions on Windows Terminal with Oh My Posh theme


📈 30.91 Punkte
🔧 Programmierung

🔧 Como instalar ZSH e Oh My Zsh no WSL2


📈 30.91 Punkte
🔧 Programmierung

🔧 Zsh + Oh My Zsh


📈 30.91 Punkte
🔧 Programmierung

🐧 How to Install Zsh and Oh My Zsh on Fedora


📈 30.91 Punkte
🐧 Linux Tipps

🐧 Custom Key Bindings in ZSH: A Comprehensive Guide to ZSH Bindkey


📈 30.91 Punkte
🐧 Linux Tipps

🐧 ZSH Autoload: A Guide to Dynamic Loading in ZSH


📈 30.91 Punkte
🐧 Linux Tipps

🐧 Speeding up zsh and oh-my-zsh


📈 30.91 Punkte
🐧 Linux Tipps

🕵️ Medium CVE-2014-10070: Zsh project ZSH


📈 30.91 Punkte
🕵️ Sicherheitslücken

🕵️ Medium CVE-2014-10070: Zsh project ZSH


📈 30.91 Punkte
🕵️ Sicherheitslücken

🕵️ Medium CVE-2018-7549: Zsh project ZSH


📈 30.91 Punkte
🕵️ Sicherheitslücken

🕵️ Medium CVE-2018-7549: Zsh project ZSH


📈 30.91 Punkte
🕵️ Sicherheitslücken

⚠️ [shellcode] Linux/x86 - setreuid(0,0) + execve("/bin/zsh", [/bin/zsh, NULL]) + XOR Encoded Shellcode (53 bytes)


📈 30.91 Punkte
⚠️ PoC

⚠️ [shellcode] Linux/x86-64 - setreuid(0,0) + execve(/bin/zsh, [/bin/zsh, NULL]) + XOR Encoded Shellcode (87 bytes)


📈 30.91 Punkte
⚠️ PoC

🔧 How to install oh-my-zsh and zsh-autosuggestions for macbook


📈 30.91 Punkte
🔧 Programmierung

🐧 I made a thing: aliasman - cross-shell (POSIX-compliant) alias manager for bash, zsh, and fish


📈 27.65 Punkte
🐧 Linux Tipps

🐧 Ardour project says it can’t find the default Ardour plugins, but they are present in the list of plugins


📈 27.51 Punkte
🐧 Linux Tipps

🐧 Git Made Easy: Exploring Oh My Zsh Git Plugins and Features


📈 25.73 Punkte
🐧 Linux Tipps

🐧 Boosting Your Terminal Productivity: Oh My Zsh Plugins that You Need


📈 25.73 Punkte
🐧 Linux Tipps

🔧 Setting up ZSH and Oh-my-ZHS with autocomplete plugins


📈 25.73 Punkte
🔧 Programmierung

🔧 Great ZSH Terminal Plugins


📈 25.73 Punkte
🔧 Programmierung

🪟 This alias cannot be added to your account, Choose a different alias


📈 24.39 Punkte
🪟 Windows Tipps

🕵️ PrestaShop up to 1.7.6.4 Search Page alias/search Reflected cross site scripting


📈 23.82 Punkte
🕵️ Sicherheitslücken

🔧 15 WordPress Search Plugins to Supercharge Your Website’s Search Functionality


📈 21.9 Punkte
🔧 Programmierung

📰 DSA-3717 gst-plugins-bad1.0 / gst-plugins-bad0.10 - security update


📈 20.55 Punkte
🐧 Unix Server

📰 DSA-3717 gst-plugins-bad1.0 / gst-plugins-bad0.10 - security update


📈 20.55 Punkte
🐧 Unix Server

🔧 How to Install Plugins in Kubernetes and Essential Plugins to Get Started


📈 20.55 Punkte
🔧 Programmierung

matomo