vim - 为什么 ci` 跳到反引号中而 ci( 不跳到大括号中?

标签 vim

假设我有一个像这样的文本文件:

this is some test `more test` 
this is some test (more test)

如果我在第一行的开头并输入 ci`,光标将跳到反引号中,替换其中的内容并让我进行编辑。

但是,如果我在第二行的开头输入 ci( 什么都不会发生。

这种行为的原因是什么?是否有可能会改变它的设置?

最佳答案

关于 vim 7.4 的内部行为:

  • 对于 block () , {} , [] , <> :

Vim 向后搜索,然后从当前位置开始向前搜索以匹配开始和结束字符。

  • 报价 "" , ''``:

Vim 跨越光标所在的整行,直到找到引号。

这是最后一种情况,光标下没有 quotechar:

/* Search backward for a starting quote. */
    col_start = find_prev_quote(line, col_start, quotechar, curbuf->b_p_qe);
    if (line[col_start] != quotechar)
    {
        /* No quote before the cursor, look after the cursor. */
        col_start = find_next_quote(line, col_start, quotechar, NULL);
        if (col_start < 0)
        return FALSE;
    }

    /* Find close quote character. */
    col_end = find_next_quote(line, col_start + 1, quotechar,curbuf->b_p_qe);

关于vim - 为什么 ci` 跳到反引号中而 ci( 不跳到大括号中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41844277/

相关文章:

vim - 退格键在 Vim/vi 中不起作用

php - 在 Windows 上使用 vim-Syntastic 检查 PHP

list - Vim - 一次移动多行时跳回到之前的位置

linux - 如何在vim中启用文本颜色?

vim - 更改折叠中的文本

vim - 如何更改intellij idea中的编辑器行为

regex - 如何在vim中使用正则表达式来替换递增的数字变量

vim - 无法在 Windows 7 上的 gVim 上使用 fugitive.vim

configuration - 如何在vim中连接几行

regex - 在 Vim 中突出显示 Javascript 内联 block 注释