Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
606 views
in Technique[技术] by (71.8m points)

vim - aw text object and whitespace characters

In Practical Vim, page 130, the author states:

The aw text object ... include(s) any whitespace characters after or before the word.

:help aw

states:

Leading or trailing white space is included, but not counted.

However, it seems to me that if both white spaces are present, only the trailing white space is included. If a trailing white space is not present, only then is the leading which space is included.

Consider the following line from vimtutor:

The approximate time required to complete the tutor is 30 minutes, 
depending upon how much time is spent with experimentation.

With cursor on e of experimentation daw gives with.

Fine, so in this case, there is no trailing space so the leading space gets deleted.

Now, subsequent to the above delete, with cursor on s of spent, daw renders is with.

So, in this case, with both trailing and leading white spaces are NOT included for if they were, one would have obtained iswith. Only one of the white spaces is included in daw. vaw on spent showed visually that the trailing white space is included.

So, my question is, should not the definition of aw motion be something along the lines of

  1. no leading or trailing whitespaces if none are present
  2. only trailing whitespace if both are present
  3. leading whitespace only if trailing whitespace is not present

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...