potatomaster42 / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

GetLuaIndent unindents for words starting with "end" #280

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Start a new buffer with filetype=lua and filetype indentation enabled.
2. Type the following:
  if condition == true then
    endOfGame()
  end

What is the expected output? What do you see instead?
Vim should preserve the indentation above, but instead it tries to unindent 
when it sees "endOfGame". It forces the bad indent both as you type and if you 
format later with vim's "=" mapping.

What version of the product are you using? On what operating system?
vim 7.4.473 on Ubuntu 14.04

Original issue reported on code.google.com by dbarn...@google.com on 10 Nov 2014 at 4:56

GoogleCodeExporter commented 9 years ago
Looks like this could be fixed by adding some \> markers into the 
'^\s*\%(end\|else\|until\|}\)' pattern. That may not completely solve it, 
though. Since "end" is in indentkeys, it might unindent as you type "end" and 
never fix the indentation back if you keep typing.

Original comment by dbarn...@google.com on 10 Nov 2014 at 4:59

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The \> markers, with an extra elseif\> to match that pattern too, works wonder 
for me, thanks David. The failure in indentkeys seems unavoidable, and not too 
much of a hassle: it also fails in ruby. At least the =G commands will work 
fully now. Thanks!

Original comment by ju...@google.com on 10 Nov 2014 at 5:24

GoogleCodeExporter commented 9 years ago
Patch sent separately to vim-dev, also attached here for belts-and-braces 
approach.

Original comment by ju...@google.com on 10 Nov 2014 at 6:22

Attachments:

GoogleCodeExporter commented 9 years ago
Mail to maintainer bounced.

Anybody would like to take over maintance of the lua indent script and could 
review the patch? Julien, would you like to?

Original comment by chrisbr...@googlemail.com on 11 Nov 2014 at 9:35

GoogleCodeExporter commented 9 years ago
I saw the bounce, indeed. I am sorry, it's going to be hard for me to take upon 
the maintenance. However, there is a great beefed-up version of the script, 
developed by Raymond Ko: https://github.com/raymond-w-ko/vim-lua-indent. This 
is actually the script that I use, rather than the vanilla vim.lua. He has 
added some very cool features.
I have contacted him and pointed him here -- maybe he will be interested?

Original comment by ju...@google.com on 11 Nov 2014 at 9:43

GoogleCodeExporter commented 9 years ago
Hello,

I actually would be interested in taking over, seeing as I do use Lua at work 
every day.

But for anyone looking, don't use the GitHub one right now, I just recently 
realized some of my own changes are sort of breaking the cooler indents.

Use the one here if anyone is interested:
http://www.vim.org/scripts/script.php?script_id=4344

Due to other bugs, I plan on re-writing this and adding a mini test suite 
soon-ish.

Original comment by Raymond....@gmail.com on 11 Nov 2014 at 9:58

GoogleCodeExporter commented 9 years ago
Not that I have a whole lot of saying with that, but well, whenever you have a 
version you are content with, simply send that version to Bram for inclusion. 
Do not forget to updated the header and mention the current maintainer as 
former maintainer and perhaps include a small license statement.

Original comment by chrisbr...@googlemail.com on 12 Nov 2014 at 7:36

GoogleCodeExporter commented 9 years ago
Awesome, thanks Raymond for taking up on this. I'm looking forward to the 
goodies, and I'm not the only one :)

Original comment by ju...@google.com on 12 Nov 2014 at 9:08

GoogleCodeExporter commented 9 years ago
Closing this issue now as Bram has merged the patch into the lua indent file. 

@Raymond: That doesn't change anything for you though. Simply request taking 
over maintenance for the lua indent script and mention briefly this ticket 
where this was discussed.

Original comment by chrisbr...@googlemail.com on 15 Nov 2014 at 12:15