Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indentation is broken #20

Open
RobertAudi opened this issue Dec 6, 2013 · 10 comments
Open

Indentation is broken #20

RobertAudi opened this issue Dec 6, 2013 · 10 comments

Comments

@RobertAudi
Copy link

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
Copy link
Owner

dag commented Dec 6, 2013

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

@RobertAudi
Copy link
Author

@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
Copy link
Owner

dag commented Dec 6, 2013

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
Copy link
Owner

dag commented Dec 6, 2013

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
Copy link
Author

@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
Copy link

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
Copy link

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

@nhooyr
Copy link

nhooyr commented Jan 6, 2017

Any updates?

@nhooyr
Copy link

nhooyr commented Jan 6, 2017

@c02y
Copy link

c02y commented Jul 19, 2019

@nhooyr None of them works well on indentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants