Format Code The Vim Way

Поділитися
Вставка
  • Опубліковано 29 сер 2024

КОМЕНТАРІ • 21

  • @JohannesEckhoff
    @JohannesEckhoff 3 роки тому +1

    Is there a good reason for using vim/ftplugin instead of vim/after/ftplugin ? Don't you risk your format program being overwritten with the former?
    I use clang-format through a plugin, bound to f. Using gq and formatprg might be easier?

    • @GavinFreeborn
      @GavinFreeborn  3 роки тому +1

      Ya after/ftplugin may have been a better suggestion. Thanks for mentioning that. gq is good for this but finding you config files and extra stuff may be better. so I can't say if gq would be easier without seeing the plugin.

  • @Zachthesloth
    @Zachthesloth 3 роки тому +6

    Hey Gavin, just wanted to say that I love your work. Keep it up. You haven't had a dud yet.

    • @GavinFreeborn
      @GavinFreeborn  3 роки тому +2

      Awe thanks man! Comments like this are what keep me making them.

  • @serenhampshire5988
    @serenhampshire5988 3 роки тому +4

    P.S. can’t wait to use all these helpful tips to make all my newly acquired vim skills even more EFFICIENT!

  • @serenhampshire5988
    @serenhampshire5988 3 роки тому +2

    Cool background! I love hotels 😍

  • @vernongrant7893
    @vernongrant7893 3 роки тому

    Thanks, this is awesome! I have been formatting things manually for some time LOL.

  • @BryanJenks
    @BryanJenks 3 роки тому

    Loving the Intro dude! Also, how the hell did I not know about this :O going to spam use `=` now
    AND I SEE THAT MOVEMENT AT 8:38 O_O

    • @GavinFreeborn
      @GavinFreeborn  3 роки тому

      Must have been a spooky scary skeleton 💀

    • @BryanJenks
      @BryanJenks 3 роки тому

      @@GavinFreeborn TOO SPOOPY GAVIN, MUCH TOO SPOOPY

  • @AtomToast
    @AtomToast 3 роки тому

    Oh, cool. I've been using = and gq a bit before but I didn't know that they actually also worked with external programs. That seems neat. I would definetly want to find a way to conveniently format on safe for some filetypes since that's just how I work. I won't remember to format each part of a file I edited when saving. Kind of weird that there is no inbuilt function that you could use in command mode for formatting though. Then you could just do like :%format. Alternatively you could maybe also just use a marker to get back to where you where before formatting.
    Similar to this bind I have for adding a semicolon to the end of a line: inoremap mbA;`ba
    Being synchronous hasn't really been a problem for me thus far since it's usually quite fast to format and while text is being moved around I wouldn't want to edit it anyways.
    Looking at the help page a bit, there also seems to be gw, which doesn't move your cursor but for some reason also doesn't use the formatprg?
    Also since you asked, the changes in camera were neat I guess and made the video a bit more dynamic. Definitely gave me more neuron activations than just looking at just one thing for an entire video

    • @GavinFreeborn
      @GavinFreeborn  3 роки тому

      The closest to the `%format` command would probably be `%!formatprg`.
      Sadly gw is pretty pointless imo.
      Thanks for the in depth response man!

    • @nithale
      @nithale 3 роки тому

      :map gg=G``zz " go to first line, indetn to the end and return to previos possition

  • @bjornballard119
    @bjornballard119 3 роки тому +2

    Oh crap! You're a Cyberman!
    Thanks for the tips. Hadn't come across gq. Looks like it could be v. useful for me. Your videos help me discover what I need to read up on.
    Tip for you: make the bed :-P

    • @GavinFreeborn
      @GavinFreeborn  3 роки тому

      I filmed this at a hotel so I had to take advantage of the house keeping haha.

  • @ranjithshegde
    @ranjithshegde 3 роки тому

    What advantages would you say formatprg has over nvim native lsp + efm (or other linter+formater integrators like diagnosticls)? On the one had I do like that I can have per filetype formatprg but it seems simpler to just use efm with native lsp

  • @vellankiindeevar5530
    @vellankiindeevar5530 3 роки тому

    pls do a vid on dirvish

  • @daveshouldaine2520
    @daveshouldaine2520 3 роки тому

    nice video, just want to say that your voice on recording is quite quiet

  • @notvoidz
    @notvoidz 3 роки тому

    your eyes i-