Skip to content

Switch kubectl context and namespace and display current setting in Emacs mode line

Notifications You must be signed in to change notification settings

terjesannum/emacs-kubectx-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 

Repository files navigation

kubectx-mode

Switch kubectl context and namespace and display current settings in Emacs mode line.

Install

Clone this repository and add to load-path:

(add-to-list 'load-path "~/.emacs.d/emacs-kubectx-mode")
(require 'kubectx-mode)
(kubectx-mode 1)

Keybindings

Keys Description
C-c C-k c Set kubectl context
C-c C-k n Set kubectl namespace

Mode line

The variable kubectx-mode-line-string-format defines what to display in the mode line, and mode line will be updated every 5 seconds or as often defined in kubectx-mode-line-update-interval.

Acknowledgements

kubectx-mode is inspired by kubectx by ahmetb and provides the same functionality in Emacs.

If you also change kubectl context or namespace in a shell, you can trigger a mode line update in Emacs with e.g. emacsclient as a PROMPT_COMMAND:

export PROMPT_COMMAND="emacsclient -e '(kubectx-mode-line-update)' &>/dev/null"

About

Switch kubectl context and namespace and display current setting in Emacs mode line

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published