Question

I recently stubled upon a feature in netrw that's called netrw-C. From the docs:

SETTING EDITING WINDOW                  *netrw-C* {{{2

One may select a netrw window for editing with the "C" mapping, or by setting
g:netrw_chgwin to the selected window number.  Subsequent selection of a file
to edit (|netrw-cr|) will use that window.

Related topics:         |netrw-cr|
Associated setting variables:   |g:netrw_chgwin|

I've managed to achieve the described behavior by manually setting g:netrw_chgwin but I couldn't understand or find how that "C" mapping works.

Yes, I could just map

:let g:netrw_chgwin = winnr()

but I'm curious how the original netrw-C mapping works.

Does anybody know how to use the "C" mapping described in the docs?

Was it helpful?

Solution

While inside netrw the C mapping looks like its just mapped to

:let g:netrw_chgwin = winnr()

If you do a :map C you will get the output

n  C           *@:let g:netrw_chgwin= winnr()<CR> 

From :h map-listing

Just before the {rhs} a special character can appear:
    *       indicates that it is not remappable
    @       indicates a buffer-local mapping

So C is the same as :let g:netrw_chgwin= winnr()<CR> that is just local to the netrw buffer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top