vim-fish icon indicating copy to clipboard operation
vim-fish copied to clipboard

Indentation is broken

Open RobertAudi opened this issue 11 years ago • 10 comments
trafficstars

When I add an if statement, and press <Enter>, the end keyword is added. So far so good. However, if the if statement is indented already (or nested), i.e.: The i of the if and the e of end is not in column 0, and if I indent the selection with = (in normal mode using ==, or in visual mode), then the indentation completely breaks.

The breakage gets worse every time a block of code is indented, as shown in the screenshots.

macvim

macvim

macvim

macvim

RobertAudi avatar Dec 06 '13 00:12 RobertAudi

Hmm, I thought I fixed this. I'll have a look at it again.

dag avatar Dec 06 '13 12:12 dag

@dag Why don't you use the indentation stuff from this other fish vim plugin?

https://github.com/Soares/fish.vim/blob/master/indent/fish.vim

RobertAudi avatar Dec 06 '13 12:12 RobertAudi

Have you tried that with endwise? Thinking about it more now I think the problem is that if you make = work then you break endwise, and what's in vim-fish currently is a compromise optimized for input - at the expense of editing. If you manually write it line by line, everything is good and you get end inserted for you, but as you discovered trying to format blocks of existing code gets messed up.

If I can't figure out how to make everything work together maybe I should add an option for disabling endwise for fish all together, and make = work instead. Thoughts?

dag avatar Dec 06 '13 12:12 dag

I should note, you can also use gq to format using the native fish_indent. Downside is that only produces tabulators. Maybe I could hack that to run a substitute on the result to post-process.

dag avatar Dec 06 '13 12:12 dag

@dag I managed to make endwise work with = using the indentation stuff I linked in my previous comment. I created a plugin that combines your stuff with the stuff of the other plugin. My version can be found here:

https://github.com/AzizLight/fish.vim

RobertAudi avatar Dec 06 '13 13:12 RobertAudi

IMHO, vim-fish should not break =.

I don't have endwise installed, but my vim is still unable to indent code properly when using vim-fish.

Endwise is nice but a luxury, indenting code properly is a must.

How can I tell vim-fish to be compatible with =?

alcortesm avatar Jan 17 '16 14:01 alcortesm

Yeah, I'm also seeing broken behaviour when indenting using =. Have anyone come to any conclusions regarding this?

hovsater avatar Feb 14 '16 16:02 hovsater

Any updates?

nhooyr avatar Jan 06 '17 04:01 nhooyr

https://github.com/RobertAudi/fish.vim (same as https://github.com/AzizLight/fish.vim) works much better

nhooyr avatar Jan 06 '17 04:01 nhooyr

@nhooyr None of them works well on indentation.

c02y avatar Jul 19 '19 05:07 c02y