rottencandy / vimkubectl

Manage Kubernetes resources from Vim
https://www.vim.org/scripts/script.php?script_id=5862
MIT License
74 stars 5 forks source link

Feature request: Prettifying of YAML "document here" #9

Open phmarek opened 10 months ago

phmarek commented 10 months ago

Sometimes - one trigger is a space before a newline, but there seem to be others as well - my "document here" in YAML (Dockerfiles, shell scripts, etc.) get "reformatted" into a long string containing \n and other escape sequences.

Like

foo: |
  this is "a"
  text
  # with comments

and after reloading I get

foo: "this is \"a\"\ntext\n# with comments"

Needless to say, this is awful to work with.

So I'd like to ask for a keybinding that reformats the current element to the nice form above.

If Kapply detects trailing whitespace it would be great if it asked whether to remove it, abort, or ignore, as well ; )

rottencandy commented 10 months ago

I'm not able to reproduce this. Multiline strings that start with | are being preserved with formatting for me.

Could it be kubectl version again?

Does kubectl get -o yaml ... also return formatted string? That is what the plugin uses when fetching & reloading.