2

I am using VIM version 8.1.1401 on Debian Buster. I am pretty new to VIM (just few days ago I started using it) and trying to get some plugin which can detect the grammatical mistakes. After few google searches I found vim-LanguageTool and vim-grammarous. There was little information regarding vim-grammarous's installation steps for newbies. Nonetheless, I finally got both of them working. I can see errors from these two. However, I am unable to correct or navigate between them. I am stuck on 'Scratch' windows. I can see some text suggesting few corrections and mistakes in that window but I am unable to understand how to use them. Can anyone explain it to me in layman's term how to use these plugins? I tried to check how to switch between buffers and scratch windows but none of those have worked.

Following is my .vimrc file (Comments are removed for brevity)

runtime! debian.vim

set nocompatible              
filetype off         
set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'ervandew/supertab'
Plugin 'Valloric/YouCompleteMe'
Plugin 'dpelle/vim-LanguageTool'
Plugin 'SirVer/ultisnips'
Plugin 'lervag/vimtex'
Plugin 'honza/vim-snippets'
Plugin 'mtth/scratch.vim'

call vundle#end()            
filetype plugin indent on    


let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:SuperTabDefaultCompletionType = '<C-n>'

if !exists('g:ycm_semantic_triggers')
    let g:ycm_semantic_triggers = {}
endif

let g:ycm_semantic_triggers.tex = g:vimtex#re#youcompleteme
let g:tex_flavor='latex'

syntax on
filetype plugin indent on
set showcmd     
set showmatch       

if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif

nnoremap <buffer> <F9> :exec '!python3' shellescape(@%, 1)<cr>
map <f2> :w<cr><leader>ll

autocmd VimLeave * call system("xsel -ib", getreg('+'))

noremap j gj
noremap k gk

:let g:languagetool_jar='/path/to/LanguageTool-4.7/languagetool-commandline.jar'
:let g:languagetool_lang='en-GB'

When I try to use any of the commands given in the documentation, I am getting some or another error. Like one I am showing below, enter image description here

2

Normally, :help is your friend!

Unfortunately, in the case of grammarous, :help grammarous is rather short and incomplete.

But it still gives you pointers to where you can find more about the command it exposes:

Please do :GrammarousCheck --help to show more detail about the command.

And about the mappings available in an information window:

In information window, some local mappings are available. Please enter ? in the window to show the help.

So you can probably start with these two... In the information window, you simply press the ? key to get help (no : or "enter", etc.)

The README file in the Git repo also has some useful information, including a table of keybindings for the information window:

q - Quit the info window
<CR> - Move to the location of the error
f - Fix the error automatically
r - Remove the error without fix
R - Disable the grammar rule in the checked buffer
n - Move to the next error's location
p - Move to the previous error's location
? - Show help of the mapping in info window

So hopefully those should get you started?

BTW, <CR> means pressing the "enter" or "return" key on your keyboard ("CR" stands for "carriage return".)

Normally, though. Start exploring plug-ins through the Vim help system. The help system is very good and makes it easy for plug-ins to ship their documentation that way. So most well written plug-ins do. Unfortunately, there isn't that much consistency within the Vim plug-in ecosystem, and many plug-ins will use their own means for documentation.


You mentioned you're new to Vim, so perhaps it would be helpful to familiarize yourself with the Vim base concepts, in particular the underlying features used by the plug-ins you're interested in.

You mentioned scratch windows (which these plug-ins make heavy use of), so maybe start with :help windows? You can read that help page as a whole if you want. In particular, you might want to take a close look at all the CTRL-W commands to switch to different windows and control them.

You might also benefit from using windows in your workflows without the plug-ins, so that you get a good hang for what they do and how they work. From there, it might be easier to understand what the plug-ins are doing and how you can use your Vim windows knowledge to navigate and control the windows created and used by the plug-in.

Plug-ins which make use of Vim windows will typically leverage the Vim settings and bindings, so that you can navigate and manage them with the commands you already know. But, then, not all plug-ins do, and some try to make windows look and behave differently and use their own keystrokes. Unfortunately, there's not much consistency among Vim plug-ins, so YMMV.

Oh, and while I focused on windows here (since this is the concept you singled out as used by vim-grammarous), the advice is valid for other Vim features used by plug-ins as well. Try to figure out which Vim underlying feature is used by a plug-in implemetation and learn about that feature.

Use the Vim help system. Start at the table of contents if you're not sure what you're looking for. Feel free to post further questions at the Vi and Vim Stack Exchange if you have specific questions.

  • 1
    Thank you +1. Although I could not get answer to my question but this is very nice compilation of information, especially for newbie like me. Most important thing I learned from this answer is that 'Cr' is 'Enter/Return' and not 'Ctrl' key :) – Dexter Jul 26 '19 at 7:43
  • If you're still stuck... Can you be more specific where exactly? Can you describe where you are, what you typed, what you were expecting to get and what you got instead? If you do so, it might be easy to help you! But your question is pretty general as it stands, so best I could do was to give you general advice on how to learn more on Vim and on specific plug-ins... Good luck with your Vimming!!! 😁 – filbranden Jul 26 '19 at 9:00
  • I just added few more details to the question. I tried all those shortcuts and mapping keys but I am still missing something. The error showed in the picture is after I try to get help by typing "?" in the window. – Dexter Jul 26 '19 at 9:37
  • 1
    I finally able to achieve this ! Problem was that I have to change it to the scratch window by (Ctrl + w + Down Arrow) and then perform all operations :) – Dexter Jul 26 '19 at 10:46
  • 1
    @Dexter That's great! Glad this helped! Hopefully the advice on reading :help windows (or, more generally, learning Vim underlying features behind plug-ins) got you the pointers you needed. Cheers! – filbranden Jul 26 '19 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.