Saturday, December 8, 2012

behaviour of d_

Hi,

Given a file with the following lines (cursor position at '|')

First line
Second line beginning |with whitespace
Third line

the following commands produce the indicated results:
1) _ goes to first non-blank character in the same line ('S')
2) v_ visually select region between 'S' and cursor position
3) d_ deletes the *whole* second line (even characters after the current cursor position)

1 and 2 work as I'd expect. I don't understand the behaviour of d_ though.
According to :he d

"An exception for the d{motion} command: If the motion is not linewise, the
start and end of the motion are not in the same line, and there are only
blanks before the start and after the end of the motion, the delete becomes
linewise. This means that the delete also removes the line of blanks that you
might expect to remain."

However this doesn't cover my example since the condition 'start and end of the motion are not in the same line' doesn't apply. I wasn't able to find another documented exception.

Is this a bug or am I missing something?

I'm using Wu Yongwei's build [1] of gvim on Win7:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Nov 22 2012 04:16:46)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-725
Compiled by Yongwei@Shanghai

[1] http://wyw.dcweb.cn/#download

Same behaviour in Cygwin:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 31 2012 02:21:53)
Included patches: 1-646
Compiled by Cygwin Ports <cygwin-xfree@cygwin.com>


Thanks and regards
e.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment