簡體   English   中英

Vim更改列表行為

[英]Vim change list behaviour

我試圖查看vim上的更改列表,但無法理解以下行為:

作為示例,我插入以下文本:

I like chips and fish.

意識到我以錯誤的順序獲得了名詞,所以我想得到:

I like fish and chips.

從沒有.vimrc的新鮮vim實例開始( vim -u NONE ),這正是我要做的(#僅用於說明):

iI like chips and fish.<Esc>  # Insert text. Realize I want to switch the words
Fc                            # Jump back to 'chips'
de                            # Delete the word (and put it in anon register)
ff                            # Jump to the 'fish' word
vep                           # Select the word, and paste from anon register
g;                            # Try to jump back to the position where I change
                              # the word 'chips'. It doesn't work and I get:
E19: Mark has invalid line number

# To see what is going on i print the change list:
:changes
    change line  col text
        2     1   12 I like  and chips.
        1     2   12 -invalid-
    >

我的第一個問題是,為什么跳躍首先沒有起作用?

其次,更改列表的-invalid-條目對我來說沒有任何意義。 如您所見,我從未超出第1行。為什么有第2行的條目?

我正在使用Vim 7.4.52

更新: -invalid-似乎是一個錯誤。 我已經報告了它:

https://code.google.com/p/vim/issues/detail?id=283

在Mac OS X上的默認Vim(7.3普通版,無GUI,無補丁)中, g; 將光標移至chipsc:changes的輸出與您的不同:

change line  col text
>   0     1   16 I like fish and chops.

只記住一個更改的事實與:help g;這一段一致:help g;

When two undo-able changes are in the same line and at a column position less
than 'textwidth' apart only the last one is remembered.  This avoids that a
sequence of small changes in a line, for example "xxxxx", adds many positions
to the change list.  When 'textwidth' is zero 'wrapmargin' is used.  When that
also isn't set a fixed number of 79 is used.  Detail: For the computations
bytes are used, not characters, to avoid a speed penalty (this only matters
for multi-byte encodings).

因此一切正常(如果有些意外)。

使用相當近期的MacVim(7.4.258),我得到了您描述的g;行為g; :changes輸出略有不同(您的“缺少”魚):

change line  col text
    1     1   16 I like fish and chips.
>   0     2   16 -invalid-

它聞起來很像你發現一個錯誤,我強烈建議你通知了vim_dev郵件列表它(如果他們還不知道)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM