[Slackbuilds-users] Vim indent settings for SlackBuilds
flinchx
flinchx at protonmail.com
Sat Sep 5 00:13:22 UTC 2020
Vim has a thing called modeline.
Perhaps such settings could be added straighgt into SlackBuild template files, this will exclude the need for each contributor to manage them explicitly in vimrc?
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, September 4, 2020 7:09 PM, Dave Woodfall <dave at slackbuilds.org> wrote:
> On 04/09/20 15:16,
> Slackbuilds Users slackbuilds-users at slackbuilds.org put forth the proposition:
>
> > Hi list,
> > Does anyone have (or aware of) a vim formatting rules file for SlackBuilds? I recently submitted a SlackBuild that had mixed tabs and spaces... I want to avoid that oversight in the future.
> > After a quick internet search all I turned up was this, which is for automatically treating the *.info file as a shell script:
> >
> > --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> >
> > https://www.linuxquestions.org/questions/slackware-14/tip-have-vim-handle-slackbuild-info-files-properly-4175628148/
> > Put the following in .vimrc:
> > autocmd BufEnter,BufNew *.info call CheckSlackBuildInfo()
> > function CheckSlackBuildInfo()
> > if filereadable(expand('%:p:r'). '.SlackBuild')
> > setlocal filetype=sh
> > endif
> > endfunction
> > Then, if you open a file whose extension is .info and there's a corresponding SlackBuild in the same directory, vim will treat the .info file as shell script.
> >
> > -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> >
> > Based on the SlackBuild template file, it looks like SlackBuild files should be indented 2 spaces, and indentation should always be with spaces (no tabs).
> > I think I want the following options set:
> > :set expandtab
> > :set tabstop=2
> > :set shiftwidth=2
> > After inheriting all other settings from the filetype 'sh'.
> > Erich
>
> I use those settings everywhere mostly, but you can make an autocmd
> for slackbuilds something like:
>
> au BufRead,BufNewFile *.SlackBuild setl expandtab |
> \ setl tabstop=2 |
> \ setl etc...
>
> `setl' is short for`setlocal', and it only works in the buffer with
> the slackbuild open, in case you have other buffers open.
>
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Dave
>
> Love is a snowmobile racing across the tundra and then suddenly it flips over,
> pinning you underneath. At night, the ice weasels come.
> --Friedrich Nietzsche
>
> SlackBuilds-users mailing list
> SlackBuilds-users at slackbuilds.org
> https://lists.slackbuilds.org/mailman/listinfo/slackbuilds-users
> Archives - https://lists.slackbuilds.org/pipermail/slackbuilds-users/
> FAQ - https://slackbuilds.org/faq/
More information about the SlackBuilds-users
mailing list