Useful with tpope's commentary plugin.
There is no ftplugin for asm, so I haven't contacted the maintainer.
This might be controversial because asm has a bunch of different
dialects and ; is only a comment in some of them. This is also true of
the current default of /* */, but I think ; is right more of the
time (used in nasm, yasm, the official ARM assemblers, MASM, etc).
https://github.com/vim/vim/pull/6125
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
Not sure how useful this is. At least setting 'comments' is wrong, the double quote starts a comment.
Fixed the comments bit. Thanks! And thanks for writing and maintaining vim!
I'd like the commentstring set so that I can do gcc to correctly comment out a line and I'd like comments set so that I can use gww to have comment lines wrap properly (with a leading comment marker on each line).
It's useful to me 🤷
Merging #6125 into master will increase coverage by
0.04%.
The diff coverage isn/a.
@@ Coverage Diff @@ ## master #6125 +/- ## ========================================== + Coverage 87.29% 87.34% +0.04% ========================================== Files 137 141 +4 Lines 156787 157148 +361 ========================================== + Hits 136869 137257 +388 + Misses 19918 19891 -27
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/netbeans.c | 74.66% <0.00%> (-0.52%) |
⬇️ |
| src/term.c | 81.89% <0.00%> (-0.06%) |
⬇️ |
| src/version.c | 92.13% <0.00%> (ø) |
|
| src/kword_test.c | 67.74% <0.00%> (ø) |
|
| src/memfile_test.c | 100.00% <0.00%> (ø) |
|
| src/message_test.c | 100.00% <0.00%> (ø) |
|
| src/json_test.c | 100.00% <0.00%> (ø) |
|
| src/gui.c | 63.40% <0.00%> (+0.10%) |
⬆️ |
| src/if_xcmdsrv.c | 88.90% <0.00%> (+0.17%) |
⬆️ |
| src/mbyte.c | 65.95% <0.00%> (+0.18%) |
⬆️ |
| ... and 6 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered by Codecov. Last update 591cec8...20188af. Read the comment docs.
—
You are receiving this because you commented.
@cmcaine commented on this pull request.
> @@ -0,0 +1,11 @@
+" Vim filetype plugin file
+" Language: asm
+" Maintainer: Colin Caine <cmcaine at the common googlemail domain>
+" Last Changed: 23 May 2020
+
+if exists("b:did_ftplugin") | finish | endif
+
+setl comments=:;
⬇️ Suggested change
-setl comments=:; +setl comments=:;,s1:/*,mb:*,ex:*/,://
—
You are receiving this because you commented.
The comments setting can happily accommodate both GAS and other assemblers, so that's hopefully not a problem?
This works for both and I've amended the PR accordingly, thanks for the prod.
comments=:;,s1:/,mb:,ex:*/,://
The commentstring setting has to pick a style and I don't intend to write something to detect what asm syntax is in use (I think this would be impossible to do well). I think the default should be semicolon, but if this is opposed then obviously we can just leave it as whatever the user has as the default (usually C multiline comment format). Users can just configure it themselves.
A question for the list: is it appropriate to add r to formatopts in this ftplugin? Again, it's useful to me, and I think it's a good default (especially if one were writing multiline C comments), but it is a small change.
—
You are receiving this because you commented.
OK, no recent objections. Let me include this, we can always adjust it.
—
You are receiving this because you commented.
Thanks for the link to that code, Gary. Unfortunately, it has very little ability to detect which asm syntax is being used:
func dist#ft#FTasmsyntax() " see if file contains any asmsyntax=foo overrides. If so, change " b:asmsyntax appropriately let head = " ".getline(1)." ".getline(2)." ".getline(3)." ".getline(4). \" ".getline(5)." " let match = matchstr(head, '\sasmsyntax=\zs[a-zA-Z0-9]\+\ze\s') if match != '' let b:asmsyntax = match elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library')) let b:asmsyntax = "vmasm" endif endfunc
And the default is asm, which is the only one where we would not want these changes...
If the default was instead unknown asm or something, then we could probably do something with that, but that sounds quite breaking. Another option would be to set the comments and commentstring values in ft.vim (where we know if we're selecting asm as the default or if we're sure), but I think in practice that would make very little difference to doing as I have done in this patch (because the default is selected basically every time).
—
You are receiving this because you commented.