caderek / gramma

command-line grammar checker
https://caderek.github.io/gramma/
ISC License
251 stars 18 forks source link

Running Gramma in VIM #31

Closed jrejaud closed 2 years ago

jrejaud commented 2 years ago

Hi there,

I was wondering how I could run gramma when I am running VIM with a file open.

I would like gramma to run on the contents of my active text buffer (and then update the text buffer with the corrections).

I tried: :w !gramma check

as described on: https://teddit.net/r/vim/comments/i3zwmk/grammar_check_for_vim_is_there_any_good_plugin_to/, but to no avail.

This looks like a wonderful tool, please assist :)

caderek commented 2 years ago

For now you can probably only list the mistakes, for example on Linux:

:w !gramma check /dev/stdin -pn 

I'm not sure if the interactive fix in VIM is possible without a dedicated extension - but I will investigate it further.

Edit:

This seems to work:

:terminal gramma check %  

It will open an interactive terminal inside VIM - when fix prompts pop out, go into the edit mode (standard Vim i or a) and you can then use gramma as usual (press Enter at the end to return to the editor):

Gramma VIM

I added a relevant section to the README: https://github.com/caderek/gramma#usage-vim

caderek commented 2 years ago

Ok, I'm closing this as this seems to resolve the issue, and I'm not planning to add a custom integration with VIM.