Comments (9)
That is not how the normal d
command is supposed to work. Posix states:
- If there are less than count -1 lines after the current line in the edit buffer, it shall be an error.
from vim.
2. If there are less than count -1 lines after the current line in the edit buffer, it shall be an error.
Then, the following behavior doesn't follow POSIX?
Another reason why I think this is incorrect bechavious is because in this example:
line 1 line 2 line 3| <- cursor line 4
when you type like
6dd
the outcome is:line 1 line 2
from vim.
Then, the following behavior doesn't follow POSIX?
Ah, when :set compatible
, 6dd
doesn't delete the last two lines.
from vim.
In compatible
mode (especially when cpo
includes -
), both cases do not delete the lines. In nocompatible
mode, as the original intention of this report, I think it is more consistent to delete the last line when the cursor is at the last line. However, as we can tell from the fact this behavior is related to cpo--
, it seems to be related to the beep alarmed when we try to move down from the last line. I'm not sure we can only change the behavior of [count]dd
at the last line without messing the common code.
from vim.
Yes, that makes sense when in compatible
mode but in nocompatible
mode even considering everything, I still don't understand how this is not a bug.
it seems to be related to the beep alarmed when we try to move down from the last line. I'm not sure we can only change the behavior of [count]dd at the last line without messing the common code.
yes that could be the case, but it also could be that when it counts rows, it takes the rows that are below and when it does the calculations mentioned here: #14769 (comment) it gets a negative number and then it bugs somehow
from vim.
That is not how the normal
d
command is supposed to work. Posix states:
- If there are less than count -1 lines after the current line in the edit buffer, it shall be an error.
can you give more of an explenation on why it is that way
from vim.
can you give more of an explenation on why it is that way
You should ask this the authors of POSIX :)
In any case, I don't think changing this behaviour will be even considered, since this would be a backward incompatible change and is probably how original vi behaves.
from vim.
We're talking about non-POSIX behavior of Vim, because 6dd
at :$-2
in nocompatible
mode deletes the lines in contrary to the POSIX statements. Should 6dd
at :$
behave like how it already works with 6dd
at :$-2
, or not? But this raises another question to the opener, should dj
at :$
, and dk
at :1
delete the current line?
from vim.
Yes, my comment was directed directly at the OP, who questioned the POSIX behaviour. Regarding the dd
behaviour it may seem inconsistent, but I'd prefer not to change it now, because for one, this is backwards incompatible change and secondly, it raises other questions as mentioned already.
from vim.
Related Issues (20)
- Vimscript colorization doesn't support non matching parenthesis in the pattern section of the substitute command HOT 3
- Fuzzy-matching support for insert-completion not working (as expected) HOT 2
- Type mismatch error in ccomplete#Complete HOT 7
- Inconsistency between macvim and vim in :redir result HOT 2
- Copy (ctrl+c. ctrl+shift+c) does not work in Vim or ignored (windows 11) HOT 1
- Seach counter should perhaps be placed in the far right corner HOT 5
- "all links" argument to glob() not working on Windows
- `command -complete=file` ignore E194 HOT 4
- `autocmd_get()` segmentation fault HOT 1
- Unexpected text formatting with colon and formatoptions+=m HOT 2
- Enhancing Support for Sentence and WORD Delimiters in Chinese and Japanese HOT 2
- key logger
- "Ctrl+o u" in Insert mode is performed with about 4 seconds delay HOT 10
- buf_write does not properly handle non-US-ASCII filename extension
- Netrw incorrectly handles folders containing [] in their names HOT 1
- CI: Test_ColonEight_MultiByte() fails with the latest GHA image HOT 2
- [termdebug vim9script] problems with saving/restoring options HOT 4
- E342 due to an unsigned integer underflow in op_change when in visual-block mode HOT 11
- Support for syntax highlighting of `jinja` files HOT 1
- Diff highlighing not replaced by text property highlighting when `combine` false HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim.