[vim/vim] runtime(hare): update hare.vim to match upstream (PR #14836)

12 views
Skip to first unread message

Amelia Clarke

unread,
May 23, 2024, 7:27:02 PMMay 23
to vim/vim, Subscribed

This is a (long overdue) update of the hare.vim included within Vim to match the current state of the upstream repository. I also modified the username in the MAINTAINERS file as I have migrated to this account from my previous one (@rsaihe).

Outside of the various other changes, this also adds a new haredoc filetype for documentation files inside Hare modules. Per Hare's documentation, these files use the name README. As this is a very common file name, automatic file detection must be opted into using g:filetype_haredoc.

When enabled, a recursive directory search is used to search for Hare source files. If any are found, the current directory is considered to be a Hare module and the README file is given the haredoc filetype. By default, this search recurses into only the first level of subdirectories, but this can be configured with g:haredoc_search_depth.

I did my best to ensure any potential performance impact for the automatic filetype detection remains minimal, especially given README's prevalence as a file name. Hopefully g:filetype_haredoc being opt-in is sufficient, but I'm willing to pursue alternatives if not.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/14836

Commit Summary

  • 72086d5 runtime(hare): update hare.vim to match upstream

File Changes

(15 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14836@github.com>

Christian Brabandt

unread,
May 24, 2024, 1:53:24 AMMay 24
to vim/vim, Subscribed

thanks!


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14836/c2128591254@github.com>

Christian Brabandt

unread,
May 24, 2024, 2:09:23 AMMay 24
to vim/vim, Subscribed

Thanks. While merging I noticed a few minor problems so I added the following patch on top:

diff --git a/runtime/doc/ft_hare.txt b/runtime/doc/ft_hare.txt
index 7fe28a13e..937c5e096 100644
--- a/runtime/doc/ft_hare.txt
+++ b/runtime/doc/ft_hare.txt
@@ -43,7 +43,7 @@ The following options are set by default, in accordance with the official Hare
 style guide: >
        setlocal noexpandtab
        setlocal shiftwidth=0
-       setlocal softtabstop=8
+       setlocal softtabstop=0
        setlocal tabstop=8
        setlocal textwidth=80
 <
diff --git a/runtime/ftplugin/hare.vim b/runtime/ftplugin/hare.vim
index ef51c7141..422bb7b4e 100644
--- a/runtime/ftplugin/hare.vim
+++ b/runtime/ftplugin/hare.vim
@@ -31,7 +31,7 @@ setlocal suffixesadd=.ha
 setlocal path-=/usr/include,,
 let &l:path .= ',' .. hare#GetPath() .. ',,'

-let b:undo_ftplugin = 'setl cms< com< flp< fo< inc< inex< isf< pa< sua<'
+let b:undo_ftplugin = 'setl cms< com< flp< fo< inc< inex< isf< pa< sua< mp<'

 " Follow the Hare style guide by default.
 if get(g:, 'hare_recommended_style', 1)

You might want to take that change back upstream.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14836/c2128618351@github.com>

Christian Brabandt

unread,
May 24, 2024, 2:09:31 AMMay 24
to vim/vim, Subscribed

Closed #14836 via 35dfe58.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14836/issue_event/12919426692@github.com>

Amelia Clarke

unread,
May 24, 2024, 2:37:51 AMMay 24
to vim/vim, Subscribed

Oh, oops! Those are both very good finds, thank you!


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14836/c2128680497@github.com>

Amelia Clarke

unread,
May 24, 2024, 2:46:06 AMMay 24
to vim/vim, Subscribed

Should efm< also be added to b:undo_ftplugin? I didn't think to reset the options set with CompilerSet before but I assume that one should also be reset.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14836/c2128700386@github.com>

Christian Brabandt

unread,
May 24, 2024, 4:48:58 AMMay 24
to vim/vim, Subscribed

Oh yes, that should also be reset. Thanks for checking.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14836/c2128970854@github.com>

dkearns

unread,
May 24, 2024, 7:28:30 AMMay 24
to vim/vim, Subscribed

@dkearns commented on this pull request.

I just added a couple of suggestions for the next update.


In runtime/autoload/hare.vim:

> @@ -0,0 +1,26 @@
+" Vim autoload file.
+" Language:     Hare
+" Maintainer:   Amelia Clarke <sel...@perilune.dev>
+" Last Updated: 2024-05-10

Unless this header means something at your end could we change the format in all files to "Last Change: YYYY Mon DD" for the next update?


In runtime/ftplugin/hare.vim:

>  
 if exists('b:did_ftplugin')
   finish
 endif
 let b:did_ftplugin = 1
 
-" Formatting settings.
-setlocal formatoptions-=t formatoptions+=croql/
+let s:cpo_save = &cpo
+set cpo&vim

This is usually only needed when line continuations are used in the file. So unless I'm missing some other reason to do so the setting/resetting of 'cpo' can be removed from both ftplugins.


In runtime/indent/hare.vim:

> @@ -41,7 +38,11 @@ setlocal cinwords=if,else,for,switch,match
 
 setlocal indentexpr=GetHareIndent()

This and similar options can now use a script local function if you prefer. See :help indentexpr for an example.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14836/review/2076611406@github.com>

Amelia Clarke

unread,
May 24, 2024, 1:45:28 PMMay 24
to vim/vim, Subscribed

@selenebun commented on this pull request.


In runtime/ftplugin/hare.vim:

>  
 if exists('b:did_ftplugin')
   finish
 endif
 let b:did_ftplugin = 1
 
-" Formatting settings.
-setlocal formatoptions-=t formatoptions+=croql/
+let s:cpo_save = &cpo
+set cpo&vim

Mmmm, I'm pretty sure I added those as a safety measure just in case any other contributors happen to use line continuations in the file. But as I'm the primary maintainer of the plugin, that situation feels pretty unlikely in practice. I'm more than happy to remove them in the places that are unnecessary.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14836/review/2077517392@github.com>

Amelia Clarke

unread,
May 24, 2024, 1:50:35 PMMay 24
to vim/vim, Subscribed

@selenebun commented on this pull request.


In runtime/indent/hare.vim:

> @@ -41,7 +38,11 @@ setlocal cinwords=if,else,for,switch,match
 
 setlocal indentexpr=GetHareIndent()

I've been working on refactoring a lot of the indentation for a while and have done that for all the functions in the indent file, but the whole thing is still pretty WIP.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14836/review/2077524584@github.com>

Amelia Clarke

unread,
May 24, 2024, 1:52:21 PMMay 24
to vim/vim, Subscribed

@selenebun commented on this pull request.


In runtime/autoload/hare.vim:

> @@ -0,0 +1,26 @@
+" Vim autoload file.
+" Language:     Hare
+" Maintainer:   Amelia Clarke <sel...@perilune.dev>
+" Last Updated: 2024-05-10

Sure! I personally prefer using YYYY-MM-DD as a date format, but I am totally fine with changing it if that's the preferred format for runtime files.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14836/review/2077530543@github.com>

Reply all
Reply to author
Forward
0 new messages