Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
“如何逃离”&书信电报;CR>&引用;在vimscript中的映射中_Vim - Fatal编程技术网

“如何逃离”&书信电报;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>