• Skip to primary navigation
  • Skip to content
  • Skip to footer
alexdyas
  • Posts
  • Categories
  • Tags
  • About
    Alex Dyas

    Alex Dyas

    Dyas Ex Machina

    • Website
    • GitHub
    • Mastodon

    NeoVim - Tidy YAML on save

    less than 1 minute read

    I like my YAML files to be tidied and sorted (see Tidying YAML). What would be great is if your editor, currently NeoVim for me, would do this automatically on save:

    -- Sort YAML files on buffer write
    vim.cmd("autocmd BufWritePre *.yaml :%! yq --prettyPrint --indent 2 'sort_keys(..)' -")
    

    Tags: linux, neovim

    Categories: technical

    Updated: August 26, 2023

    Share on

    X Facebook LinkedIn Bluesky
    Previous Next

    You May Also Enjoy

    One imagePullBackoff reason amongst many

    less than 1 minute read

    I stumbled across a new to me reason for the irritating imagePullBackoff error in Kubernetes. Amongst the many well documented reasons this can happen, bad c...

    vim - Remove carriage returns on save

    less than 1 minute read

    I’ve been copying and pasting a lot from Windows sessions into vim recently, and often I get carriage returns copied with the text. I save all my files in vi...

    k9s Plugins load failed! error, one solution

    less than 1 minute read

    The k9s cli Kubernetes front-end is indispensable.

    vim macro to validate Jenkinsfile against remote Jenkins server

    1 minute read

    I’ve been doing a lot of Jenkins pipeline work recently. The development cycle is a bit laborious, code, git commit, re-run the pipeline in Jenkins, find out...

    • Mastodon
    • GitHub
    • Feed
    © 2025 alexdyas. Powered by Jekyll & Minimal Mistakes.