[Slackbuilds-users] Vim indent settings for SlackBuilds

Erich Ritz erich.public at protonmail.com
Fri Sep 4 15:16:55 UTC 2020


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


More information about the SlackBuilds-users mailing list