Quantcast

Dealing with viminfo overwriting?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Dealing with viminfo overwriting?

Benjamin R. Haskell-8
It's only within the last few years that Vim has become my main editor.  

Now that I tend to use many vim instances at a time, I'm finding it
frustrating that I'm losing much of my command history due to firing up
'temporary' sessions that overwrite more useful history.  A feature of
Zsh that I really love is INC_APPEND_HISTORY, where history items are
appended into history as soon as they're entered, instead of appending
the whole shell session's history upon exiting.

Is there any similar capability for viminfo?  How does everyone here
deal with this kind of problem?  (sessions? etc.)

--
Best,
Ben

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dealing with viminfo overwriting? -> :set vi=n..

Sven Guckes-3
* Benjamin R. Haskell <[hidden email]> [2010-09-08 16:36]:
> It's only within the last few years that Vim has become my main editor.

(but apparently not for edting emails..
 you can tell by the trailing spaces ;-)

> Now that I tend to use many vim instances at a time, I'm finding it
> frustrating that I'm losing much of my command history due to firing
> up 'temporary' sessions that overwrite more useful history.  A
> feature of Zsh that I really love is INC_APPEND_HISTORY, where
> history items are appended into history as soon as they're entered,
> instead of appending the whole shell session's history upon exiting.
> Is there any similar capability for viminfo?

no.. vim does not have an option for "merging" of viminfo files.

> How does everyone here deal with this kind of problem?

tell vim to write its info into separate viminfo files.

you could start vim from different directories
which have their own vimrc, directing it
to use a special (local) viminfo file, eg:

    :set vi=n.viminfo
    :set vi=n~/.vim/viminfo.foo

i had been thinking about this for
over a decade now.. but all solutions
seem to have been too hard to handle. ;)

Sven

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dealing with viminfo overwriting? -> :set vi=n..

Benjamin R. Haskell-8
On Wed, 8 Sep 2010, Sven Guckes wrote:

> * Benjamin R. Haskell [2010-09-08 16:36]:
> > It's only within the last few years that Vim has become my main
> > editor.
>
> (but apparently not for edting emails..  you can tell by the trailing
> spaces ;-)

The whitespace is intentional.  I still haven't gotten around to
fully automating the process of reformatting others' text, but I tend to
'gqap' quite frequently.

From my ~/.vim/alpine.vim:
set fo+=w

From :h 'fo-table':

w Trailing white space indicates a paragraph continues in the next line.
        A line that ends in a non-white character ends a paragraph.

Alpine sends 'flowed text'[1] by default, which is what I prefer.

[1] http://joeclark.org/ffaq.html


> > Now that I tend to use many vim instances at a time, I'm finding it
> > frustrating that I'm losing much of my command history due to firing
> > up 'temporary' sessions that overwrite more useful history.  A
> > feature of Zsh that I really love is INC_APPEND_HISTORY, where
> > history items are appended into history as soon as they're entered,
> > instead of appending the whole shell session's history upon exiting.  
> > Is there any similar capability for viminfo?
>
> no.. vim does not have an option for "merging" of viminfo files.
>
> > How does everyone here deal with this kind of problem?
>
> tell vim to write its info into separate viminfo files.
>
> you could start vim from different directories which have their own
> vimrc, directing it to use a special (local) viminfo file, eg:
>
>     :set vi=n.viminfo
>     :set vi=n~/.vim/viminfo.foo
>
> i had been thinking about this for over a decade now.. but all
> solutions seem to have been too hard to handle. ;)

Interesting idea.  Kind-of solves half of the problem (prevents losing
.viminfo data), but doesn't seem to lend itself to the other part of
what I want (contents of all .viminfos' command histories available from
everywhere).

I wish more Vim options had the 'backupdir'-style trailing-'//'
available.  (E.g. I use backupdir=~/.vim-tmp// to prevent splattering
.swp files everywhere.)  In this case,
set vi=n~/.vim/info//
could set the viminfo file for /foo/bar/baz to ~/.vim/info//%foo%bar%baz

--
Best,
Ben

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dealing with viminfo overwriting? -> :set vi=n..

Ben Fritz


On Sep 8, 10:45 am, "Benjamin R. Haskell" <[hidden email]> wrote:
>
> Interesting idea.  Kind-of solves half of the problem (prevents losing
> .viminfo data), but doesn't seem to lend itself to the other part of
> what I want (contents of all .viminfos' command histories available from
> everywhere).
>

I see :help :wviminfo says "the information in the file is first read
in to make a merge between old and new info" but from the preceding
text it looks like the extent of the "merge" only includes items that
are not included in both files. Maybe you can use :wviminfo
and :rviminfo, with appropriate autocmds (FocusGained/FocusLost?) and
parsing/combining of the history section of the .viminfo files to
achieve something close to your goals.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Loading...