stylish-haskell icon indicating copy to clipboard operation
stylish-haskell copied to clipboard

`:%!stylish-haskell` jumps cursor to top of file

Open drewboardman opened this issue 4 years ago • 3 comments

Reproduce:

Execute :%!stylish-haskell or :call HaskellFormat('stylish') on a file.

Issue:

Cursor jumps to the top of the file.

drewboardman avatar Nov 16 '19 16:11 drewboardman

This isn't really an issue with stylish-haskell, it's an issue with vim formatters that act as whole-file filters. They'll all do that.

You can work around it by setting a mark with m, running stylish-haskell, and then jumping back to the mark with '. My command is:

" Run stylish haskell on the file
nnoremap <leader>hs ms:%!stylish-haskell<cr>'s

parsonsmatt avatar Mar 13 '20 15:03 parsonsmatt

@parsonsmatt I think this hint is worth adding to readme, right?

EncodePanda avatar Mar 13 '20 17:03 EncodePanda

I didn't figure this out until I saw this issue and investigated myself, but it had low-level bothered me until then :sweat_smile:

parsonsmatt avatar Mar 13 '20 17:03 parsonsmatt