Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upGenerator star spacing doesn't play nice with cindent #334
Comments
This comment has been minimized.
This comment has been minimized.
|
Thanks for opening such a thorough issue with examples. This is an unfortunate bug in vim. :( But I don't think we should change this rule in standard just to accommodate (what seems like a clear) bug in vim. Have you tried opening an issue on the appropriate issue tracker for vim? (Going to close this issue, but feel free to continue commenting.) |
feross
closed this
Feb 5, 2016
This comment has been minimized.
This comment has been minimized.
|
long term vim user here... i dont think that'll ever get fixed in vim. |
This comment has been minimized.
This comment has been minimized.
|
@rstacruz Drat... what makes you believe that? |
This comment has been minimized.
This comment has been minimized.
|
the resolution for the /*
* aoeu
* aeou
*/
* aoeu
* aoeuokay, after reading the docs, now i'm not sure if that's by design or not... but that's just how it's always worked :\ |
This comment has been minimized.
This comment has been minimized.
|
So, there's a way to work around it in the CSS case, though. Right? |
This comment has been minimized.
This comment has been minimized.
|
nope! |
This comment has been minimized.
This comment has been minimized.
|
Wait, so you literally can't type the desired text in vim? Or, you just can't do it with the cindent preference enabled? |
This comment has been minimized.
This comment has been minimized.
|
Maybe @pangloss from https://github.com/pangloss/vim-javascript could help us? |
This comment has been minimized.
This comment has been minimized.
|
You'll have to type it out, then delete the '* ' afterwards |
This comment has been minimized.
This comment has been minimized.
|
I suspect For now, I have hacked a workaround that I find satisfactory (and which should work for CSS, too):
It has a limitations:
I don't particularly care about (2) and (3). Point (1) is a little annoying, If anyone wants to suggest improvements, I am all ears ;) |
simonratner commentedNov 18, 2015
Requirement for a space after the generator star, in combination with ES6 object literal syntax, makes it impractical to use together with vim's cindent, which is usually the basis of all javascript indenters.
For example, consider:
With the cursor on line 2, pressing
oin vim to open a new line triggers a builtin cindent multi-line-comment continuation rule, resulting in:This does not happen on line 4, since cindent explicitly requires a space after the comment leader to avoid treating pointer dereferences as comments:
I prefer spaces around generator stars when they are used as part of
function * genfn (), or any other context, but it would be nice to relax this rule when the*is the first non-whitespace character on a line, to avoid running into this conflict.See: http://vimdoc.sourceforge.net/htmldoc/change.html#format-comments, default setting for javascript files on my system seems to be:
comments=sO:* -,mO:* ,exO:*/,s1:/*,mb:*,ex:*/,://