[vim/vim] Cannot permanently clear the last search pattern (`@/`) (Issue #20718)

1 view
Skip to first unread message

Barrett Ruth

unread,
Jul 5, 2026, 3:06:02 PM (12 hours ago) Jul 5
to vim/vim, Subscribed
barrettruth created an issue (vim/vim#20718)

Steps to reproduce

  1. echo foo > /tmp/foo.txt
  2. vim -N -i /tmp/vinfo /tmp/foo.txt
  3. /foo
  4. :let @/ = ""
  5. :wq
  6. vim -N -i /tmp/vinfo /tmp/foo.txt
  7. :echo @/

@/ prints "foo" again, and pressing n jumps to the next match; clear from step 4 is gone.

Expected behaviour

After :let @/ = "" the last search pattern should stay cleared after restarting, just like within the session.

Version of Vim

9.2.0782

Environment

Operating system: NixOS
Terminal: ghostty
Value of $TERM: xterm-256color
Shell: zsh

Logs and stack traces

pattern.txt says :let @/ = "" leaves the pattern ["really cleared, like when starting Vim"](https://github.com/vim/vim/blob/v9.2.0653/runtime/doc/pattern.txt#L273-L276), but viminfo puts it back on the next start.

If persisting the clear isn't wanted maybe clarify in docs?


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/issues/20718@github.com>

Reply all
Reply to author
Forward
0 new messages