I can't understand why when I open (Win10) gvim91 and press :<up>
I don't see my most recent command. I'm sure it used to be this way in previous versions of vim (I updated recently).
What I see are kind of recent, but there are obvious gaps where I know there should be commands I've done in the past session.
Also, when I press q:
and view command history this way, I see a different view of my commands. Again, obviously recent but with gaps.
In both I don't see commands I would expect and know I have made.
And then, when I view my viminfo file, after the header "# Command Line History (newest to oldest):", the list is different again from both q:
command history and :<up>
.
I believe that viminfo is only written when a buffer or window is closed and I've taken this into account.
Can someone explain what's going on?
[Edit]
OK I realise I'll need some proof of this. I've recorded the following actions with vim closed.
- Open viminfo. You can see the list of the latest commands (which are not in fact latest commands but that's the problem!)
- Open a test file and source a session file to get it sitting pretty under the viminfo file for recording purposes. (My problem doesn't usually involve session files).
- Hit
:<up>
. As you can see, if you're quick, is that as I hit<up>
the supposed most recent commands do not match those in the viminfo files. - I now enter command history with
q:
. Again, as you can see, the list doesn't match that in viminfo file. Nor, if you care to watch the gif from the beginning, does it match the list when entering:<up>
. - I close the test file. The opened viminfo wants to load the newly written viminfo file; which it does. But look! The 'latest' commands do not list the commands from the test file. In fact, the first one is a command from a session ages ago.
PS: A pity can't post vid files here: GIFs are difficult to 'parse'.
[Edit]
[Edit]
More forensics :) For this I renamed (ie removed) the viminfo to start a new one.
- Open blank vim.
- Run
:grep 'drawtext' *ffmpeg*
,:cope
,:cclo
and:q!
. - Open blank vim.
- Run
:e ffmpeg …
,:g/drawtext
,q:
,:q
and:q!
.
The output of the last q:
was:
grep 'drawtext' *ffmpeg*
cope
cclo
q!
e ffmpeg-video-text-overlay.md
g/drawtext
- I open another blank vim and run
:history
then:q
.
The output from this :history
command was:
:history
# cmd history
1 cclo
2 cope
3 grep 'drawtext' *ffmpeg*
4 e ffmpeg-video-text-overlay.md
5 g/drawtext
6 q
7 q!
> 8 history
- I open viminfo file. The contents of
# Command Line History
section (in its entirety):
# Command Line History (newest to oldest):
:q
|2,0,1709726741,,"q"
:g/drawtext
|2,0,1709726741,,"g/drawtext"
:e ffmpeg-video-text-overlay.md
|2,0,1709726741,,"e ffmpeg-video-text-overlay.md"
:grep 'drawtext' *ffmpeg*
|2,0,1709726741,,"grep 'drawtext' *ffmpeg*"
:cope
|2,0,1709726741,,"cope"
:cclo
|2,0,1709726741,,"cclo"
:q!
|2,0,1709726741,,"q!"
:history
|2,0,1709726741,,"history"
.viminfo
being different fromq:
or:<Up>
is expected, but without seeing either list it will be hard to reason about the discrepancies you describe. Can we have a minimal reproducible example? How many sessions do you have open at the same time?:wviminfo
commandq:
and the order of the command that comes with:<up>
?q:
and order of commands when hitting:<up>
. Also a discrepancy between listing of either of the above when first opening vim and the contents of viminfo # Commands