“如何逃离”&书信电报;CR>&引用;在vimscript中的映射中
我想使用“如何逃离”&书信电报;CR>&引用;在vimscript中的映射中,vim,Vim,我想使用:execute normal“commandstring”技术在映射中构造一个命令行。但我无法从映射中执行此操作,因为vim会立即将“”解释为按键。所以这不起作用: nnoremap <leader>jj :execute "normal :tabnew foo.txt\<cr>"<cr> nnoremap jj:execute“normal:tabnew foo.txt” 我试图双倍地避开反斜杠,但没有效果: nnoremap <lead
:execute normal“commandstring”
技术在映射中构造一个命令行。但我无法从映射中执行此操作,因为vim会立即将“”解释为按键。所以这不起作用:
nnoremap <leader>jj :execute "normal :tabnew foo.txt\<cr>"<cr>
nnoremap jj:execute“normal:tabnew foo.txt”
我试图双倍地避开反斜杠,但没有效果:
nnoremap <leader>jj :execute "normal :tabnew foo.txt\\<cr>"<cr>
nnoremap jj:execute“normal:tabnew foo.txt\\”
现在vim输入反斜杠,然后将解释为按键
有什么办法可以解决这个问题吗?这确实很棘手。你必须逃离
谢谢。该示例实际上不需要执行,因为它是一个简化的案例。实际映射执行一些字符串连接和对substitute()的调用。
nnoremap <leader>jj :execute "normal :tabnew foo.txt\<lt>cr>"<cr>
nnoremap <leader>jj :tabnew foo.txt<cr>