Saturday, May 27, 2023

Re: vim autoformat ?


сб, 27 мая 2023 г., 18:31 Igor Lerinc <igor.lerinc7@gmail.com>:
I can't wrap my head around Vim autoformat at all. 
I want to have autoformat on save feature. 
I don't want it to have delays, so when i press `:w` it immediatelly saves and formats indentation properly.

I have no idea what is going on in (neo)Vim discussions about this autoformating. Looks like those people never coded in their life, and never do any useful thing with their godly configs other than to brag.

Using Vim feature `gg=G` i format and indent whole file. 
This is what I want to have, but discussions related to this are so complicated. They just say 'look at my config', but I have no idea, what is that I should look into his config, or just copying his whole config with a lot of bloat. 

Please help. 

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/961e2663-4abb-46d7-aabe-c5be9ac94498n%40googlegroups.com.

Basically, you need to catch BufWritePre event and do whatever it takes to format file there.

However, note that such "auto-features" quickly become very annoying, so think twice on what conditions to apply or to bypass it.

Kind regards,
Matvey

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAFsTB%2BJ74fWwSj%2BW0U6GU8tCLku%3DVujHN4kGkvuzduj2BOkw5A%40mail.gmail.com.

No comments:

Post a Comment