But what about plugins like
That use some external formatters.
I find them slow, because it need to start program when called from Vim.
And they say, it means you need to have some type of service running on your system.
Like for 'prettier', you need 'prettierd' to not have lag when calling it.
But I tried to setup 'prettierd', and got lost.
And there is also some efm-langserver , which they say is fastest, because it formats only lines that need to be formatted (if I understood correctly).
But I just have no idea what to do with this, how to install it, how to connect it to other external formatters, Vim plugins..
Vim-autoformat have explanation how to setup. But as I said, it takes time to start up program, so it already need to be running, using some sort of something, like efm-langserver ?
I don't know really how to do this.
I just want to have code more readable.
sub, 27. maj 2023. 23:22 Bram Moolenaar <Bram@moolenaar.net> је написао/ла:
> 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.
To get you started:
au FileType pascal au BufWritePre <buffer> * normal gg=G
This will add a BufWritePre autocommand to a buffer where 'filetype' is
set to "pascal". You probably want to ehance this. E.g. add an augroup,
so you can delete the autocommand again.
Although this is what you asked for, you probably soon find out that
formatting text only when editing it works better. Formatting the whole
file may mess things up without you noticing.
--
From "know your smileys":
:-) Funny
|-) Funny Oriental
(-: Funny Australian
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
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/CADZsa2rhiA%3Dh7SvXPJLDdHWM5cHKqS26tNLhkxBnD%2BkPSojz%3Dw%40mail.gmail.com.
No comments:
Post a Comment