let @x = '^ \+[1-9][0-9]\{3}-[-A-Z0-9]*. \+$'

You don't even need to load it explicitly in the vimrc,
registers are remembered by the viminfo (see ":help viminfo").

...as long as your copy of vim is

1) compiled with +viminfo
2) set to use viminfo (non-empty 'viminfo') and
3) the 'viminfo' set to remember registers (s >0)
4) the length of the saved text doesn't exceed either the kb limit ("s") or the line-length limit ("<") of your viminfo setting

For the example at hand, #3 and #4 aren't likely to be problematic, but #1 or #2 may. Several of my boxes have viminfo disabled because I like to know the state of my vim rather than try to remember which vim process I last used and what information it saved in my viminfo. Not a big deal, but enough to have been bothered by startup times enough to disable viminfo on occasion.

However, as Tony says, if your viminfo is set to remember registers, all you have to do is remember not to tromp over the saved register, and you're good to go.

Just my $0.02

-tim






Reply via email to