dag / vim-fish

Vim support for editing fish scripts
MIT License
432 stars 59 forks source link

Indentation is broken #20

Open RobertAudi opened 10 years ago

RobertAudi commented 10 years ago

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

dag commented 10 years ago

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

RobertAudi commented 10 years ago

@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

dag commented 10 years ago

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 commented 10 years ago

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.

RobertAudi commented 10 years ago

@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

alcortesm commented 8 years ago

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 =?

hovsater commented 8 years ago

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

nhooyr commented 7 years ago

Any updates?

nhooyr commented 7 years ago

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

c02y commented 5 years ago

@nhooyr None of them works well on indentation.