[Slackbuilds-users] Vim indent settings for SlackBuilds
dave at slackbuilds.org
Fri Sep 4 16:09:02 UTC 2020
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:
> Put the following in .vimrc:
> autocmd BufEnter,BufNew *.info call CheckSlackBuildInfo()
> function CheckSlackBuildInfo()
> if filereadable(expand('%:p:r'). '.SlackBuild')
> setlocal filetype=sh
> 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'.
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.
Love is a snowmobile racing across the tundra and then suddenly it flips over,
pinning you underneath. At night, the ice weasels come.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 801 bytes
Desc: not available
More information about the SlackBuilds-users