Ramilito / kubectl.nvim

Apache License 2.0
165 stars 5 forks source link

Pre-define namespaces in config #189

Closed Elyviere closed 3 weeks ago

Elyviere commented 3 weeks ago

Is your feature request related to a problem? Please describe. It's a pain to have to remember all my available namespaces when I lack access to see available nasespaces.

Describe the solution you'd like Add a config option to input available namespaces which will be available to select from. Extra bonus if it's possible to override these values for specific contexts, also through the config.

Describe alternatives you've considered kubectl.nvim can remember previously input namespaces inside of a certain context and show them the next time the user changes namespace.

Additional context With a quick additional config, "Only show user-defined namespaces", which should obviously be toggleable in the config, this feature can also be useful to users with access to view all namespaces but who only use a fraction of the available namespaces.

Ramilito commented 3 weeks ago

There is partially what you wanted using the namespace_fallback config option. It's not per context unfortunately, but try it out and we can see if that's enough. It should look like this:

image

Using a config that looks like this:

      require("kubectl").setup({
        namespace = "ns1",
        namespace_fallback = {"ns1", "ns2", "ns3"},
Elyviere commented 3 weeks ago

Yea that works well enough for my setup, thank you!