如何使用netrw-C?

Nik*_*ita 5 vim netrw

我最近偶然发现了 netrw 中的一个功能,称为netrw-C. 来自文档:

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|
Run Code Online (Sandbox Code Playgroud)

我已经设法通过手动设置来实现所描述的行为 g:netrw_chgwin,但我无法理解或发现“C”映射是如何工作的。

是的,我可以直接绘制地图

:let g:netrw_chgwin = winnr()
Run Code Online (Sandbox Code Playgroud)

但我很好奇原始netrw-C映射是如何工作的。

有谁知道如何使用文档中描述的“C”映射?

FDi*_*off 2

在 netrw 内部,C映射看起来就像刚刚映射到

:let g:netrw_chgwin = winnr()
Run Code Online (Sandbox Code Playgroud)

如果你执行 a:map C你会得到输出

n  C           *@:let g:netrw_chgwin= winnr()<CR> 
Run Code Online (Sandbox Code Playgroud)

:h map-listing

Just before the {rhs} a special character can appear:
    *       indicates that it is not remappable
    @       indicates a buffer-local mapping
Run Code Online (Sandbox Code Playgroud)

因此与 netrw 缓冲区本地的情况C相同。:let g:netrw_chgwin= winnr()<CR>