4

I am new to vim and currently learning as well. I just started using syntastic in vim to lint my code.

I have set following vars in my .vimrc file:

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0

If any error comes error window gets open, and show the list of errors. I just want to know is there any way to switch betweeb opened error window and current window.

Also is there any keystroke which I can use to move to next and prev error? (not by using :lnext and :lprev)

enter image description here

Thanks

  • 1
    You could map something to lprev and lnext. – muru Jun 5 '16 at 21:20
  • will you please explain me how to to do that? I am quite new to it. Thanks – WitVault Jun 5 '16 at 21:23
  • 1
    You don't. Well, you can do it, but it's better to stay in the editor window. See the FAQ. – Sato Katsura Jun 5 '16 at 21:33
7

To switch between two windows see :h window-move-cursor. Here you'll use Ctrl-wj and Ctrl-wk, since the windows are horizontally split.

Now to use :lnext and :lprev more easily you could use a mapping as suggested by @muru. To do so add something like that to your .vimrc:

nnoremap <c-n> :lnext<CR>

This line will make Ctrl-n execute :lnext in normal mode. See :h mapping.

Of course change the mapped keys (here <c-n>) to whatever fits your needs.

|improve this answer|||||

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.