[vim] Hare vim plugin
git clone https://git.torresjrjr.com/hare.vim.git
Log | Files | Refs | README | LICENSE

commit 5d84305a3c11f467b1ef94b2a7f7b821d54acd23
parent 30df75bb0625c3400154361aead72b8718bb5f5b
Author: Amelia Clarke <me@rsaihe.dev>
Date:   Wed, 28 Sep 2022 13:16:12 -0700

ftplugin: conform to Vim style

This commit makes a few minor adjustments to the Hare filetype plugin to
conform to the style used by Vim itself. Specifically, the preferred
indentation and textwidth settings for Hare are now gated behind
'g:hare_recommended_style' but are still set by default. Additionally,
the required 'b:undo_ftplugin' has been added.

Besides minor adjustments to formatting and the addition of 'comments'
and 'suffixesadd', '/' has been added to 'formatoptions', meaning that
comments are only continued by 'o' and 'O' if the comment is at the
beginning of the line. When the comment is at the end of a statement,
comments will not be continued:

	defer free(buf); // This comment will not be continued.

Signed-off-by: Amelia Clarke <me@rsaihe.dev>

Mftplugin/hare.vim | 30++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/ftplugin/hare.vim b/ftplugin/hare.vim @@ -2,26 +2,32 @@ " Language: Hare " Maintainer: Amelia Clarke <me@rsaihe.dev> " Previous Maintainer: Drew DeVault <sir@cmpwn.com> -" Last Updated: 2022-09-21 +" Last Updated: 2022-09-28 -" Only do this when not done yet for this buffer if exists('b:did_ftplugin') finish endif - -" Don't load another plugin for this buffer let b:did_ftplugin = 1 -setlocal noexpandtab -setlocal tabstop=8 -setlocal shiftwidth=0 -setlocal softtabstop=0 -setlocal textwidth=80 +" Formatting settings. +setlocal formatoptions-=t formatoptions+=croql/ + +" Miscellaneous. +setlocal comments=:// setlocal commentstring=//\ %s +setlocal suffixesadd=.ha -" Set 'formatoptions' to break comment lines but not other lines, -" and insert the comment leader when hitting <CR> or using "o". -setlocal fo-=t fo+=croql +" Hare recommended style. +if get(g:, "hare_recommended_style", 1) + setlocal noexpandtab + setlocal shiftwidth=8 + setlocal softtabstop=0 + setlocal tabstop=8 + setlocal textwidth=80 +endif compiler hare + +let b:undo_ftplugin = "setl cms< com< et< fo< sts< sua< sw< ts< tw<" + " vim: tabstop=2 shiftwidth=2 expandtab