All Projects → aluxian → fish-kube-prompt

aluxian / fish-kube-prompt

Licence: MIT license
⎈ kubectl context/namespace in your fish shell prompt

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to fish-kube-prompt

fishline
A powerline prompt framework for the fish-shell built in fish-shell.
Stars: ✭ 66 (-7.04%)
Mutual labels:  fish, prompt, fish-shell
terminer
Upgrade your terminal experience with a single command.
Stars: ✭ 28 (-60.56%)
Mutual labels:  fish, prompt
Silver
A cross-shell customizable powerline-like prompt with icons
Stars: ✭ 238 (+235.21%)
Mutual labels:  fish, prompt
sublime-fish
A robust Sublime Text syntax package for fish
Stars: ✭ 32 (-54.93%)
Mutual labels:  fish, fish-shell
Plugin Nvm
Node version manager wrapper for Fish shell
Stars: ✭ 173 (+143.66%)
Mutual labels:  fish, fish-shell
Zoxide
A smarter cd command. Supports all major shells.
Stars: ✭ 4,422 (+6128.17%)
Mutual labels:  fish, fish-shell
fish-color-scheme-switcher
A fish shell 🐟 plugin to switch color schemes 🌈
Stars: ✭ 48 (-32.39%)
Mutual labels:  fish, fish-shell
Packages Main
Primary Oh My Fish package repository.
Stars: ✭ 138 (+94.37%)
Mutual labels:  fish, fish-shell
dotfiles
Dotfiles for Neovim (0.7+), Fish shell, git, Kitty, tmux, and more.
Stars: ✭ 54 (-23.94%)
Mutual labels:  fish, fish-shell
fish-symnav
Symbolic link navigation for Fish shell
Stars: ✭ 11 (-84.51%)
Mutual labels:  fish, fish-shell
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 (+15.49%)
Mutual labels:  fish, fish-shell
Powerline
Powerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including zsh, bash, tmux, IPython, Awesome and Qtile.
Stars: ✭ 12,989 (+18194.37%)
Mutual labels:  fish, prompt
Dotfiles
My personal dotfiles.
Stars: ✭ 162 (+128.17%)
Mutual labels:  fish, fish-shell
Pisces
♓️ Fish shell plugin that helps you to work with paired symbols in the command line
Stars: ✭ 210 (+195.77%)
Mutual labels:  fish, fish-shell
Sdkman For Fish
Adds support for SDKMAN! to fish
Stars: ✭ 139 (+95.77%)
Mutual labels:  fish, fish-shell
agnoster
Agnoster for Fish 🐠
Stars: ✭ 42 (-40.85%)
Mutual labels:  fish, fish-shell
Fish Utils
🔧 My utility belt of fish functions, writing these has saved me many hours in the long run... I hope...
Stars: ✭ 94 (+32.39%)
Mutual labels:  fish, fish-shell
Fish Bd
Quickly go back to a parent directory up in your current working directory tree. Don't write 'cd ../../..' redundantly, use bd instead.
Stars: ✭ 113 (+59.15%)
Mutual labels:  fish, fish-shell
fish
Fish config with awesome flexible prompt, unicode symbols, better fzf integration and lot of handy functions.
Stars: ✭ 27 (-61.97%)
Mutual labels:  fish, fish-shell
AwsTerm
A collection of awesome terminal utilities
Stars: ✭ 37 (-47.89%)
Mutual labels:  fish, fish-shell

fish-kube-prompt

⎈ kubectl context/namespace in your fish shell prompt

preview

Install

mkdir -p ~/.config/fish/functions/
cd ~/.config/fish/
git clone https://github.com/aluxian/fish-kube-prompt
ln -s ../fish-kube-prompt/functions/__kube_prompt.fish functions/
ln -s ../fish-kube-prompt/functions/kube_ps.fish functions/

Then create or edit ~/.config/fish/functions/fish_prompt.fish to include __kube_prompt:

function fish_prompt
  echo -s (set_color blue) (__kube_prompt) (set_color $fish_color_cwd) " " (prompt_pwd) (set_color normal) "> "
end

Speed

Running the kubectl commands to get the context and namespace every time the prompt is shown would slow down the prompt significantly. Therefore, fish-kube-prompt caches the context and namespace by only calling kubectl when the env var KUBECONFIG has changed since the last cache update, or when the 'last modified' timestamp of the files in KUBECONFIG is newer than the timestamp of the last cache update.

This was not my idea, I took it from jonmosco/kube-ps1.

Config

You can toggle the prompt on or off like this:

kube_ps on
kube_ps off

kube_ps is a simple function that just updates a universal variable __kube_ps_enabled.

Many choices have been hard-coded (e.g. colors, delimiters). If there's anything you'd like to customize, please add an env var and send a PR.

Credits

Inspired from the awesome work of:

Author

Alexandru Rosianu (https://github.com/aluxian/dotfiles-fish)

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].