Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markbar plugin messing with viminfo history #56

Closed
jackanory101 opened this issue Mar 9, 2024 · 1 comment · Fixed by #57
Closed

Markbar plugin messing with viminfo history #56

jackanory101 opened this issue Mar 9, 2024 · 1 comment · Fixed by #57

Comments

@jackanory101
Copy link

With markbar plugin enabled, if I open vim, run several commands, close vim and then examine viminfo.vim, Command Line, Search and Expression History and Search History have been overwritten with the same timestamp.

Invariably, all command, search etc timestamps are overwritten with the same timestamp of the last command i.e. :q et al. That is all history timestamps in viminfo files not just last session's history.

I have recently installed:

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan  3 2024 00:15:11)
MS-Windows 32-bit GUI version with OLE support
Compiled by appveyor@APPVEYOR-VM

Tested with gvim running with Administrator and also no Admin privileges.

Testing with vimfiles including only:

├── autoload
│   └── pathogen.vim
├── bundle
│   └── vim-markbar-master
├── viminfo.vim
└── vimrc

Contents of vimrc is:

execute pathogen#infect()
set viminfo=!,'5000,s100,h
set viminfo+=n~/vimfiles/viminfo.vim

Resulting viminfo example when opening vim, running a couple of commands, and closing. Note that none of the commands, searches or expressions were run in previous session. The order of the history is all messed up as well. The timestamp is the time closed last session.

# Command Line History (newest to oldest):
:wqa
|2,0,1709946792,,"wqa"
:ChoresDateAdd
|2,0,1709946792,,"ChoresDateAdd"
:w
|2,0,1709946792,,"w"
:ChoresSort
|2,0,1709946792,,"ChoresSort"
:Ch
|2,0,1709946792,,"Ch"
:qa
|2,0,1709946792,,"qa"
:windo diffthis
|2,0,1709946792,,"windo diffthis"
:e c:\Users\tom\vimfiles\bundle_disabled\0_tmp\vim-markbar-master\plugin\vim-markbar.vim
|2,0,1709946792,,"e c:\\Users\\tom\\vimfiles\\bundle_disabled\\0_tmp\\vim-markbar-master\\plugin\\vim-markbar.vim"
# Search String History (newest to oldest):
? \s*$
|2,1,1709946792,,"\\s*$"
??^- 
|2,1,1709946792,63,"^- "
?/^---
|2,1,1709946792,47,"^---"
?/on
|2,1,1709946792,47,"on"
# Expression History (newest to oldest):
=800-340.79
|2,2,1709946792,,"800-340.79"
=1000-340.79
|2,2,1709946792,,"1000-340.79"
=140+1+1
|2,2,1709946792,,"140+1+1"
=160+5+10
|2,2,1709946792,,"160+5+10"
# Input Line History (newest to oldest):
@em
|2,3,1709946792,,"em"
@w
|2,3,1709946792,,"w"
@XX
|2,3,1709946792,,"XX"
@Yilin-Yang
Copy link
Owner

Hi, sorry for the delay.

I was able to reproduce the issue with Vim 8.2. I narrowed the source of the issue down to a single line:

   96 function! g:MarkbarSerializeRosters() abort
   97   " update v:oldfiles with the files whose marks will be recorded in
   98   " shada or viminfo
   99if has('nvim')
  100 ┊   ┊   rshada!
  101else
  102 ┊   ┊   rviminfo!  " <-- this line

Changing this line to rviminfo stops vim-markbar from clobbering the .viminfo file. Unfortunately, I'm not able to include that as a permanent fix, because using rviminfo instead of rviminfo! causes persistent mark names to stop working (i.e. run_tests.sh --vim -v -f standalone-test-sequential-name-persistence.vader fails).

You can stop vim-markbar from clobbering .viminfo by setting let g:markbar_persist_mark_names = v:false in your .vimrc, but this will prevent you from setting mark names that can persist between vim editor sessions. Alternatively, you can switch to neovim, which doesn't suffer from this issue.

Sorry that I'm not able to provide a fix. Even so, I appreciate the issue report; I'll make a note of this in the documentation.

Yilin-Yang added a commit that referenced this issue Apr 1, 2024
Setting g:markbar_persist_mark_names to v:true causes vim (not neovim)
to clobber timestamps and reorder history in the viminfo file, ref:
Issue #56. Unfortunately, this can't be fixed without entirely breaking
persistent mark names for vim users.

Document the issue in the README and help text.
Yilin-Yang added a commit that referenced this issue Apr 1, 2024
Setting g:markbar_persist_mark_names to v:true causes vim (not neovim)
to clobber timestamps and reorder history in the viminfo file, ref:
Issue #56. Unfortunately, this can't be fixed without entirely breaking
persistent mark names for vim users.

Document the issue in the README and help text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants