Suggestion: follow link to .viminfo when vim quit

114 vues
Accéder directement au premier message non lu

cs86661

non lue,
27 avr. 2014, 23:32:3927/04/2014
à vim...@googlegroups.com
when I set ~/.viminfo to be symbolic link to /tmp/.viminfo, then close vim.
The symbolic link will be replaced with an reqular .viminfo file ?
So I can't simply use symbolic link on ~/.viminfo :(

reproduce:
cd
mv .viminfo /tmp/
ln -s /tmp/.viminfo .viminfo
file .viminfo (.viminfo: symbolic link to `/tmp/.viminfo')
vi (then close it)
file .viminfo (.viminfo: UTF-8 Unicode text)

Christian Brabandt

non lue,
30 avr. 2014, 15:04:1830/04/2014
à vim...@googlegroups.com
I think, this patch does it:

diff --git a/src/ex_cmds.c b/src/ex_cmds.c
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -1771,6 +1771,16 @@ write_viminfo(file, forceit)
fname = viminfo_filename(file); /* may set to default if NULL */
if (fname == NULL)
return;
+#ifdef HAVE_READLINK
+ {
+ char_u buf[MAXPATHL];
+ if (resolve_symlink(fname, buf) == OK)
+ {
+ vim_free(fname);
+ fname = vim_strsave(buf);
+ }
+ }
+#endif

fp_in = mch_fopen((char *)fname, READBIN);
if (fp_in == NULL)


Best,
Christian
--
Beurteile einen Menschen lieber nach seinen Handlungen als nach seinen
Worten; denn viele handeln schlecht und sprechen vortrefflich.
-- Matthias Claudius

Ken Takata

non lue,
3 mai 2014, 10:16:0603/05/2014
à vim...@googlegroups.com
Hi,

Maybe it is intended.
See ":help viminfo-write":

(snip)
Notes for Unix:
(snip)
- The viminfo file cannot be a symbolic link. This is to avoid security
issues.

Regards,
Ken Takata

Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message