Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.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
如何访问vim中的映射密钥?_Vim - Fatal编程技术网

如何访问vim中的映射密钥?

如何访问vim中的映射密钥?,vim,Vim,当一个键已经映射到my.vimrc中时,如何访问它(其原始功能) 就我而言: 我已经映射了,以注释当前行。但是如果您使用f/f/t/t在当前行中搜索字符,则,也用于继续搜索。 那么,如何在其原始功能中访问,(继续搜索)?如果要保留原始的,命令,则必须将该命令映射到不同的键: :nnoremap \\ , 或者更改遮住命令的映射。我知道这很难;最终,短键和可记忆键将用尽,必须进行权衡:-( 最好保持,键没有冲突,因此可以使用\c。如果已经使用了,c,也可以工作。对于原始命令,会有一个短暂的延迟,

当一个键已经映射到my.vimrc中时,如何访问它(其原始功能)

就我而言: 我已经映射了
以注释当前行。但是如果您使用f/f/t/t在当前行中搜索字符,则
也用于继续搜索。
那么,如何在其原始功能中访问
(继续搜索)?

如果要保留原始的
命令,则必须将该命令映射到不同的键:

:nnoremap \\ ,
或者更改遮住命令的映射。我知道这很难;最终,短键和可记忆键将用尽,必须进行权衡:-(

最好保持
键没有冲突,因此可以使用
\c
。如果已经使用了
,c
,也可以工作。对于原始命令,会有一个短暂的延迟,因为Vim需要确定
是完整的命令,还是
,c
映射的第一个键。如果您这样做te,也许
:nnoremap,,
会有帮助。猛击
比等待超时快两倍

以编程方式 虽然以交互方式键入时不可行,但您始终可以通过
:normal!
(注意
)调用原始的未映射功能:


这里有一组映射,允许您执行原始的内置映射。它们依赖于这样一个事实,即从
:help:map expression
返回的任何内容都是按字面意思进行的(无需重新映射),因此只需将任何命令的第一个键传递给它,即可跳过覆盖它的自定义映射

"[count]["x]<Leader><BS>{cmd}
"<Leader><BS>[count]["x]{cmd}
"           Use the built-in, unmapped normal / visual /
"           operator-pending mode {cmd} instead of the mapping that
"           overrides the command.
"CTRL-G <BS>{cmd}   Use the built-in, unmapped insert / command-line mode
"           {cmd} instead of the mapping that overrides the command.
function! s:BuiltInCommand()
    let l:sequence = ''
    while 1
        let l:key = ingo#query#get#Char()
        if l:key ==# "\<Esc>"
            " Abort with beep.
            return l:key
        elseif l:key ==# '"'
            let l:sequence .= l:key
            " Query the register; we won't handle the expression register here.
            let l:key = ingo#query#get#Register("\<Esc>", '=')
            if l:key ==# "\<Esc>"
                " Abort with beep.
                return l:key
            endif
        elseif l:key !~# '\d'
            " This is the beginning of the built-in command; we're done.
            let l:sequence .= l:key
            return l:sequence
        endif
        " Keep querying for [count] numbers, registers, or the beginning of the
        " command.
        let l:sequence .= l:key
    endwhile
endfunction
noremap <expr> <Leader><BS> <SID>BuiltInCommand()
sunmap <Leader><BS>
noremap! <expr> <C-g><BS> ingo#query#get#Char()
“[count][”x]{cmd}
“[count][“x]{cmd}”
“使用内置的、未映射的法线/可视/
“运算符挂起模式{cmd}而不是
“覆盖该命令。
“CTRL-G{cmd}使用内置的、未映射的插入/命令行模式
“{cmd}而不是重写命令的映射。
函数!s:内置命令()
设l:sequence=''
而1
让l:key=ingo#query#get#Char()
如果l:key=\“\”
“用嘟嘟声中止。
返回l:键
elseif l:key==#'“'
设l:序列。=l:键
“查询寄存器;此处不处理表达式寄存器。
让l:key=ingo#query#get#Register(“\”,“=”)
如果l:key=\“\”
“用嘟嘟声中止。
返回l:键
恩迪夫
elseif l:键!~#'\d'
“这是内置命令的开始;我们完成了。
设l:序列。=l:键
返回l:序列
恩迪夫
“继续查询[count]编号、寄存器或数据的开头
“命令。
设l:序列。=l:键
循环结束
端功能
noremap内置命令()
太阳地图
noremap!ingo#query#get#Char()

这需要我的一些函数。要使用原始的
,例如,键入

您的映射不会覆盖
,它只会增加一个短的超时时间。我想/希望有可能避免或绕过映射,可能在前缀中使用一个特殊的键(例如反斜杠).哦,这是可能的。我的配置中有这样的配置,尽管我很少使用它。请看看我的其他答案。
"[count]["x]<Leader><BS>{cmd}
"<Leader><BS>[count]["x]{cmd}
"           Use the built-in, unmapped normal / visual /
"           operator-pending mode {cmd} instead of the mapping that
"           overrides the command.
"CTRL-G <BS>{cmd}   Use the built-in, unmapped insert / command-line mode
"           {cmd} instead of the mapping that overrides the command.
function! s:BuiltInCommand()
    let l:sequence = ''
    while 1
        let l:key = ingo#query#get#Char()
        if l:key ==# "\<Esc>"
            " Abort with beep.
            return l:key
        elseif l:key ==# '"'
            let l:sequence .= l:key
            " Query the register; we won't handle the expression register here.
            let l:key = ingo#query#get#Register("\<Esc>", '=')
            if l:key ==# "\<Esc>"
                " Abort with beep.
                return l:key
            endif
        elseif l:key !~# '\d'
            " This is the beginning of the built-in command; we're done.
            let l:sequence .= l:key
            return l:sequence
        endif
        " Keep querying for [count] numbers, registers, or the beginning of the
        " command.
        let l:sequence .= l:key
    endwhile
endfunction
noremap <expr> <Leader><BS> <SID>BuiltInCommand()
sunmap <Leader><BS>
noremap! <expr> <C-g><BS> ingo#query#get#Char()