alx741 / vim-hindent

Vim Haskell Hindent integration plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Ashe opened this issue · comments

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!

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.

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

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.

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 :(

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

@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.

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

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

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

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.

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

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.

@thytom thanks for having a look at it!

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.