neovimhaskell / nvim-hs

Neovim API for Haskell plugins as well as the plugin provider
Other
267 stars 18 forks source link

nvim-hs idiosyncratic way of writing to file? #81

Closed chrisgrounds closed 5 years ago

chrisgrounds commented 5 years ago

Hi again,

I'm not sure if github issues are the place for this, but I don't know where else to ask.

So I'm wondering if there is an idiosyncratic way to read and write to a file with nvim-hs? Obviously, since we are using Haskell we could just use Haskell's built-in readFile and writeFile commands, but on the other hand looking at RangeSpecification (http://hackage.haskell.org/package/nvim-hs-2.0.0.0/docs/Neovim.html#t:RangeSpecification) I can see there are options for CurrentLine, WholeFile, and RangeCount which would suggest the idiosyncratic way would be to use something else internal to nvim-hs, but I'm not clear what that is.

What would your recommendation for reading/writing a file to perform some modifications to the text inside be?

saep commented 5 years ago

The documentation is lacking. It's just a field of CommandOption which is passed as the first argument to functions that you define as a (neo)vim command.

There really doesn't exist a whole lot in the standard library to do things. If you have an idea for a nice API, feel free to open a PR on nvim-hs-contrib repository which could be considered as the standard library.