[vim/vim] :startinsert enters Insert mode in a non-modifiable buffer (PR #20806)

3 views
Skip to first unread message

h_east

unread,
Jul 21, 2026, 4:35:52 PM (13 hours ago) Jul 21
to vim/vim, Subscribed
Problem:  ":startinsert" enters Insert mode in a buffer where
          'modifiable' is off, the error only appears when a character
          is typed.  Typing "i" gives the error right away.
Solution: Give the error when the buffer is not modifiable, like "i"
          does.  Keep ignoring the command in a terminal window, where
          ":startinsert" is documented to be ineffective, and keep
          accepting it when 'insertmode' is set, like "i" does.

fixes: #20804


Behaviour change

Handling of the "!" is now done after the terminal check and the 'modifiable'
check, so it is skipped when the command does nothing. Before this change
":startinsert!" moved the cursor to the end of the line first, and only then
was the command ignored or rejected:

:set nomodifiable
:startinsert!     " E21, but the cursor had moved to the end of the line

Typing "A" in the same buffer gives E21 without moving the cursor, so the old
behaviour is considered a bug. This also affects a terminal window, where the
cursor was moved even though ":startinsert" is documented to be ineffective
there.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/20806

Commit Summary

  • aa5b883 :startinsert enters Insert mode in a non-modifiable buffer

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20806@github.com>

Christian Brabandt

unread,
5:23 AM (1 hour ago) 5:23 AM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#20806)

thanks


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20806/c5044114978@github.com>

Reply all
Reply to author
Forward
0 new messages