Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the non-vim implementations of vi I've worked with, it's not possible to delete a line while in insert mode. vim does allows it—but it's my understanding that vim is not POSIX-compliant in its default configuration.

Is a POSIX-compliant vi implementation not supposed to allow the deletion of lines in insert mode? Please quote the relevant parts of the standard where possible.

share|improve this question
I remember the vi(1) in BSD 4.2 acting like that. It makes sense, either you are inserting (writing stuff into the file) or you are doing commands on the contents. Not that that counts as POSIXly correct... – vonbrand Mar 3 '14 at 2:27
It seems very unlikely that POSIX would dictate something you cannot be able to do in this case. However, if it's not something the standard requires, then an implementation which doesn't do it is compliant (as is one which does do it). Generally standards are about positive and not negative capabilities. pubs.opengroup.org/onlinepubs/9699919799/utilities/vi.html <- Have fun! – goldilocks Mar 3 '14 at 2:40
up vote 4 down vote accepted

No, it is not required. It is up to the implementation to decide, as the behavior is unspecified. In implementations which allow it, the contents of the current line after the newline is erased must be erased as well. The POSIX specification for vi states the following (source):

Input Mode Commands in vi

In text input mode, the current line shall consist of zero or more of the following categories, plus the terminating <newline>:


It is unspecified whether it is an error to attempt to erase past the beginning of a line that was created by the entry of a <newline> or <carriage-return> during text input mode. If it is not an error, the editor shall behave as if the erasing character was entered immediately after the last text input character entered on the previous line, and all of the non- <newline> characters on the current line shall be treated as erase-columns.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.