[vim/vim] feat: add initial filetype plugin for autohotkey (PR #15345)

15 views
Skip to first unread message

Peter Aronoff

unread,
Jul 25, 2024, 12:53:18 PM (2 days ago) Jul 25
to vim/vim, Subscribed

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

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

Commit Summary

  • 1608e92 feat: add initial filetype plugin for autohotkey

File Changes

(1 file)

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/15345@github.com>

Peter Aronoff

unread,
Jul 25, 2024, 12:55:21 PM (2 days ago) Jul 25
to vim/vim, Subscribed

This is a very minimal ftplugin, and I don't really want to be the maintainer (though I will if that's what it takes). But after looking at runtime/ftplugin, there seem to be many that are minimal. Also a search on GitHub turns up several examples of autohotkey.vim that include these comment settings.


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/15345/c2250976955@github.com>

dkearns

unread,
Jul 25, 2024, 1:12:14 PM (2 days ago) Jul 25
to vim/vim, Subscribed

@dkearns requested changes on this pull request.


In runtime/ftplugin/autohotkey.vim:

> +let s:cpo_save = &cpo
+set cpo&vim
+
⬇️ Suggested change
-let s:cpo_save = &cpo
-set cpo&vim
-

The save/restore is only needed when using continuation lines which do not appear in this file.


In runtime/ftplugin/autohotkey.vim:

> +let &cpo = s:cpo_save
+unlet s:cpo_save
+
⬇️ Suggested change
-let &cpo = s:cpo_save
-unlet s:cpo_save
-

In runtime/ftplugin/autohotkey.vim:

> @@ -0,0 +1,22 @@
+" Vim filetype plugin file
+" Language:     Autohotkey
+" Maintainer:   <Someone's name goes here>
+" Last Changed: 2024-07-25
⬇️ Suggested change
-" Last Changed: 2024-07-25
+" Last Change: 2024 Jul 25

In runtime/ftplugin/autohotkey.vim:

> @@ -0,0 +1,22 @@
+" Vim filetype plugin file
+" Language:     Autohotkey
+" Maintainer:   <Someone's name goes here>

The general rule has always been, I believe, that new runtime files need a maintainer. Could you also add yourself to https://github.com/vim/vim/blob/master/.github/MAINTAINERS?

Maybe the syntax file maintainer, @mmikeww, would be willing to take it on?


In runtime/ftplugin/autohotkey.vim:

> @@ -0,0 +1,22 @@
+" Vim filetype plugin file
+" Language:     Autohotkey
⬇️ Suggested change
-" Language:     Autohotkey
+" Language:     AutoHotkey


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/15345/review/2199895760@github.com>

Peter Aronoff

unread,
Jul 25, 2024, 1:23:44 PM (2 days ago) Jul 25
to vim/vim, Subscribed

@telemachus commented on this pull request.


In runtime/ftplugin/autohotkey.vim:

> +let s:cpo_save = &cpo
+set cpo&vim
+

Cool. Thanks for saving me from cargo-culting my copy-pasta. :)


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/15345/review/2199944389@github.com>

Peter Aronoff

unread,
Jul 25, 2024, 1:25:01 PM (2 days ago) Jul 25
to vim/vim, Subscribed

@telemachus commented on this pull request.


In runtime/ftplugin/autohotkey.vim:

> @@ -0,0 +1,22 @@
+" Vim filetype plugin file
+" Language:     Autohotkey
+" Maintainer:   <Someone's name goes here>

I'll take it for now then, and add my name to MAINTAINERS.


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/15345/review/2199946607@github.com>

Peter Aronoff

unread,
Jul 25, 2024, 1:26:40 PM (2 days ago) Jul 25
to vim/vim, Push

@telemachus pushed 1 commit.

  • 235b076 feat: add initial filetype plugin for autohotkey


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15345/before/1608e9256599420af777b8dd1ffbdac1510aa089/after/235b076f8472860c1bd57e6c9e613da4fb3dc9b7@github.com>

Peter Aronoff

unread,
Jul 25, 2024, 1:29:29 PM (2 days ago) Jul 25
to vim/vim, Subscribed

One last question for @dkearns: I was inclined to add setlocal formatoptions+=croq, but I could not decide if that was too opinionated. Let me know if you think I should add it (and the corresponding undo).


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/15345/c2251037281@github.com>

mmikeww

unread,
Jul 25, 2024, 2:15:48 PM (2 days ago) Jul 25
to vim/vim, Subscribed

i'm the current maintainer of the ahk syntax highlighting (https://github.com/mmikeww/autohotkey.vim), although all i've really done is just add new keywords onto the older maintainers work. and its mostly been just for ahk v1. i didnt even know that a filetype plugin was necessary


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/15345/c2251125800@github.com>

Peter Aronoff

unread,
Jul 25, 2024, 3:24:03 PM (2 days ago) Jul 25
to vim/vim, Subscribed

i didnt even know that a filetype plugin was necessary

@mmikeww I could be wrong, but I believe you normally need (and have) both a syntax/something.vim and a ftplugin/something.vim. (And usually also indent/something.vim and others.) These files do different jobs.

that syntax file should already be included with default vim, and commenting should work

The syntax file is there, and that handles detection of comments for highlighting. But more is required for commenting to work fully. A ftplugin/something.vim file normally sets both comments and commentstring (as this one does). Without those being set, vim falls back to defaults, and those defaults apply (I think) to C files. If those are set, then vim can do various things automatically (like correctly apply the comment marker to the next line) and plugins can interact with comments through scripting. At the moment, none of that applies to AutoHotkey files. (That's sort of how I ended up here: someone filed a bug in neovim because a built-in commenting plugin doesn't work with AutoHotkey files.

tl;dr the syntax file is only part of what AutoHotkey needs; this file will help add more capabilities for AutoHotkey 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/15345/c2251241205@github.com>

mmikeww

unread,
Jul 26, 2024, 12:35:12 AM (yesterday) Jul 26
to vim/vim, Subscribed

thanks @telemachus
if you want to submit the files to my repo, thats fine. or if you want to submit them here too. or if you want to take over maintainership of both this and also the syntax file, thats also fine by me. whatever you think is best, let me know


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/15345/c2251957400@github.com>

Peter Aronoff

unread,
Jul 26, 2024, 6:21:16 AM (yesterday) Jul 26
to vim/vim, Subscribed

i use the tcomment plugin with normal vim and i havent had a problem using gcc and the likes in order to comment ahk files

@mmikeww If I start vim without this added filetype plugin and run :set commentstring?, the result is commentstring=/* %s */. That's a default derived from C. So with tcomment installed, commenting will work in the sense that it gives me C-style comments. E.g., "This is a test" becomes "/* This is a test */". That (sort of? maybe?) works because AutoHotkey allows for multiline comments with /*...*/ too. But (strictly speaking), AutoKey says that multiline comments "can be used to comment out an entire section, but only if the symbols appear at the beginning of a line (excluding whitespace)." With vim's defaults, that's not what you get as a result. Instead, you get a single-line comment with /* at the start and */ at the end. When you use tcomment, what kind of comments do you get? Also, I thought that the primary way to comment in AutoHotkey is single-line comments with ; . That does not seem to be supported for me unless this filetype plugin is added.

@dkearns I'm okay to maintain this for now. Let me know if you want me to make any other changes.


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/15345/c2252448150@github.com>

dkearns

unread,
Jul 26, 2024, 9:54:19 AM (22 hours ago) Jul 26
to vim/vim, Subscribed

One last question for @dkearns: I was inclined to add setlocal formatoptions+=croq, but I could not decide if that was too opinionated. Let me know if you think I should add it (and the corresponding undo).

That's a bit of a hot topic, as far as filetype plugins are concerned. Most of the early files modified formatoptions like this and it was a bit of a de facto standard. Some people like it, some don't. In general, it's been left up to the maintainer.


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/15345/c2252821281@github.com>

dkearns

unread,
Jul 26, 2024, 9:55:20 AM (22 hours ago) Jul 26
to vim/vim, Subscribed

@dkearns approved this pull request.

@dkearns I'm okay to maintain this for now. Let me know if you want me to make any other changes.

Thanks. LGTM.


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/15345/review/2201922507@github.com>

Peter Aronoff

unread,
Jul 26, 2024, 10:22:33 AM (22 hours ago) Jul 26
to vim/vim, Subscribed

Thanks. LGTM.

Great. I will leave out the format options, so this is ready. Thanks again for review and guidance.


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/15345/c2252879273@github.com>

mmikeww

unread,
Jul 26, 2024, 10:42:13 AM (22 hours ago) Jul 26
to vim/vim, Subscribed

@telemachus using gcc does use ; for ahk comments for me, so maybe i've made other changes to my config somewhere to get that to happen, not sure


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/15345/c2252916077@github.com>

Christian Brabandt

unread,
Jul 26, 2024, 1:24:54 PM (19 hours ago) Jul 26
to vim/vim, Subscribed

thanks all!


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/15345/c2253178833@github.com>

Christian Brabandt

unread,
Jul 26, 2024, 1:27:12 PM (19 hours ago) Jul 26
to vim/vim, Subscribed

Closed #15345 via a7295ae.


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/15345/issue_event/13663994933@github.com>

Reply all
Reply to author
Forward
0 new messages