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

(Neovim) Using hindent to save haskell files puts cursor to top of file #11

Open
Ashe opened this issue Jul 28, 2018 · 14 comments
Open

Comments

@Ashe
Copy link

Ashe commented Jul 28, 2018

After disabling this plugin, this behaviour is no longer experienced so it's something to do with vim-hindent. This happens with the simple :w as well as any additional bindings.

If you need more info, just ask, but I'm only using this, haskell-vim and intero for haskell development. I use ALE and Deoplete for all languages. As stated though, the problem disappears when I disable this plugin. I'm using Plug, if that matters.

Thanks for reading!

@alx741
Copy link
Owner

alx741 commented Jul 29, 2018

Thanks for reporting it!

The exact same issue was solve recently in #9 , maybe you're using a previous version before that fix (?) please try removing the plugin (followed by :PlugClean) and then reinstalling it to make sure the new version is pulled.

If that doesn't help, please let me know the output of :version to try replicate it.

@Ashe
Copy link
Author

Ashe commented Aug 1, 2018

Hey there, unfortunately I did not get the same results as the issue you mentioned. I also apologise for taking so long to get back to you.

Here is the output of :version like you asked for. I commented out the line in my init.vim file, restarted nvim, ran PlugClean, restarted again, then reinserted it followed by restarting once more and using PlugInstall. After loading up a .hs file it continued the annoying behaviour described in my issue.

Thanks for reading!

:version
NVIM v0.3.0
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -Wconversion -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstac
k-protector-strong -fdiagnostics-color=auto -Wno-array-bounds -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.3.0/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser

Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

@alx741
Copy link
Owner

alx741 commented Aug 4, 2018

I'm having trouble to reproduce this, didn't manage to get NVIM v0.3.0 to compile so tried with NVIM v0.3.1 instead with no init.vim file and manually copying ftplugin directory from this plugin to ~/.config/nivm, everything worked as expected.

There are quite a few variables in play here, so can't really tell if it's the Neovim version, you think you could try and update your neovim to see if that helps? Alternatively, temporarily cleaning ~/.config/nvim except for this plugin's ftplugin and running $ nvim -U NONE might get some useful insight at the issue.

@Ashe
Copy link
Author

Ashe commented Aug 4, 2018

Thank you for prompting me to update nvim, which I have done. I am now on v0.3.1 and I have followed the steps you have given. I am quite perplexed too as to why this is happening.

I have commented out and uninstall every other plugin and I am still experiencing this issue (I PlugCleaned and deleted my plugin folder). I have also completely emptied my init.vim file to the following and also have no luck:

" Start loading plugins
call plug#begin('~/.config/nvim/plugged')
Plug 'alx741/vim-hindent'
call plug#end()

To make sure we're on the same page (and to fix the issue if it indeed is an issue), here's a link to my init.vim file. As mentioned above, I'm experiencing this from the bare minimum and running PlugInstall, so either my fundamental usage of Plug is incorrect or something is a bit odd. Either way, this is what I'll be testing it with in the end so I'll leave it here just in case it is of any value.

You manually copied the file but you did not use Plug, is there something different involved with this process even though it uses your git repo? I don't understand and I'm not good enough at all this :(

@Janiczek
Copy link

I have this issue also. Can I somehow help with debugging this?

@Ashe
Copy link
Author

Ashe commented Oct 12, 2018

@Janiczek I unfortunately stopped using this plugin as it was an unbearable issue and I just couldn't fathom what was going on. It clearly isn't a conflict with other plugins as I didn't use any others when I tested previously.

@alx741
Copy link
Owner

alx741 commented Oct 12, 2018

I have this issue also. Can I somehow help with debugging this?

That would be great actually! I failed at reproducing this issue, and thus couldn't fix it :/
@Janiczek Does your setup matches @Crysikrend's ?
Also, did you try temporarily removing everything else (plugins, configs, etc) ?

@drewboardman
Copy link

I also have this issue. I'm also having the issue where either hindent or stylish-haskell will undo changes that have been saved.

@NorfairKing
Copy link

NorfairKing commented Apr 12, 2020

I'm having the same issue, with vim and vim-hindent on nixos.

@alx741
Copy link
Owner

alx741 commented Apr 18, 2020

Right now I can't even get hindent on my system. Archlinux's hindent package was removed, the latest version (5.3.1) only compiles with ghc 7.6.3 (https://matrix.hackage.haskell.org/#/package/hindent) ghcup currently supports down to ghc 7.10.3. It's all a big mess.

I haven't given up on this completely though, the issue should in theory also occur for stylish-haskell, so I will try to replicate it there and hopefully bring a fix back here.

@NorfairKing
Copy link

@alx741 Don't use the arch packages for haskell on arch. Just use stack in a given project directory.

@thytom
Copy link

thytom commented Jun 1, 2020

Hi, I know this is quite an old issue by now, but I had this issue as well and found some things while fixing it.

It appears that this problem has something to do with vim-hindent not properly throwing an error when hindent cannot be found, but only when run through the autocmd on save. While running :Hindent properly complains about hindent not being in the path, the autosaving does not, so the issue must be to do with calling hindent#Hindent() from hindent#HindentOnSave().

For those who can't install hindent, this issue states that you should run

$ stack --resolver lts-14.22 install hindent

to install it for now. For me, this installed to ~/.local/bin, so be sure to add that to your $PATH if you still can't find it, and set your g:hindent_command accordingly.

Bear in mind that hindent is currently looking for a maintainter, and has been since November, so it likely won't compile under latest versions for a while...

Hopefully this helps. I'm gonna take a look at the code and see if I can resolve this in the meantime.

@alx741
Copy link
Owner

alx741 commented Jun 2, 2020

@thytom thanks for having a look at it!

@thytom
Copy link

thytom commented Jun 3, 2020

Okay, after a bit of digging, I can't actually reproduce the error anymore...

I think this is to do with hindent's current compilation issues, however, and not a bug in this plugin, as I vaguely remember manually removing /usr/bin/hindent or some other executable when installing through stack. I originally reinstalled it because the AUR package was taken down and it was having some library issues.

Seems like the solution is to just re-install hindent through stack like I explained, this doesn't look like an issue with the plugin.

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