Re: [dev] suckless indentation with vim

From: David Demelier <markand_AT_malikania.fr>
Date: Tue, 05 Jul 2022 08:54:20 +0200

On Sat, 2022-07-02 at 23:07 +0600, NRK wrote:
> Hi,
>
> The suckless coding style follows "tabs for indent, spaces for
> alignment" philosophy. But afaik, vim doesn't support it natively.
>
> I remember trying out a couple plugins from here:
> https://vim.fandom.com/wiki/Indent_with_tabs,_align_with_spaces
> but they all failed miserably on many cases.
>
> 'clang-format' can do this with 'UseTab: AlignWithSpaces' but it also
> does a bunch of *other* stuff (which I don't like) and I also don't
> like
> external formatters and would much rather have my editor do the
> formatting as I'm typing.
>
> If someone's using vim and follows this style, what plugin and/or
> setting do you use?

I'm not sure if it's really easy to implement a smart alignment. I use
some mapping to switch between et/noet option to insert spaces instead
of tabs and align manually.

nmap ,<TAB> :set et!<CR>

Of course, always better to view whitespaces when dealing with that
mix.

-- 
David
Received on Tue Jul 05 2022 - 08:54:20 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 05 2022 - 09:00:09 CEST