在 Vim 中修改 Ctrl-G

modify Ctrl-G in Vim

我希望按以下方式修改 Ctrl-G <C-g>

当前行为: <C-g>

"test.txt" 89 lines --1%--

我想要的是修改它的输出看起来像 1 Ctrl-G 1<C-g>

"~/Documents/test.txt" 89 lines --1%--

如果我进行以下映射:

map <C-g> echo expand('%:p')

我得到:

/home/me/Documents/test.txt

我想推送 <C-g> 并得到:

"~/Documents/test.txt" 89 lines --1%--

你能帮我修复映射以获得所需的输出吗?

我非常依赖这个问题:Display name of the current file in vim? by muthuh

怎么样

:noremap <C-g> 1<C-g>

哪个避免了递归?

尝试

:nnoremap <c-g> 1<c-g>