Loading ...
Sorry, an error occurred while loading the content.

Suggestion: follow link to .viminfo when vim quit

Expand Messages
  • cs86661
    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
    Message 1 of 3 , Apr 27, 2014
    • 0 Attachment
      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)

      --
      --
      You received this message from the "vim_dev" 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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • Christian Brabandt
      ... I think, this patch does it: diff --git a/src/ex_cmds.c b/src/ex_cmds.c ... +++ b/src/ex_cmds.c @@ -1771,6 +1771,16 @@ write_viminfo(file, forceit) fname =
      Message 2 of 3 , Apr 30, 2014
      • 0 Attachment
        On So, 27 Apr 2014, cs86661 wrote:

        > 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)

        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

        --
        --
        You received this message from the "vim_dev" 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

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • Ken Takata
        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
        Message 3 of 3 , May 3, 2014
        • 0 Attachment
          Hi,

          2014/4/28 Mon 12:32:39 UTC+9 cs86661 wrote:
          > 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)

          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

          --
          --
          You received this message from the "vim_dev" 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

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        Your message has been successfully submitted and would be delivered to recipients shortly.