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

Re: How do I make :e path completion follow symlinks?

Expand Messages
  • Andy Wokula
    ... e.g. ... press Ctrl-T to follow a symlink: cnoremap e(FollowSymlink()) func! FollowSymlink() return substitute(getcmdline(), %(
    Message 1 of 4 , May 28, 2008
      Simpleton schrieb:
      > Hi List,
      >
      > I am a VIM newbie. I am using VIM 7.1 on a Windows XP sp2 box.
      >
      > I have a bunch of symlinks in my default home directory (C:/Documents\
      > and\ Settings/simpleton/) which point to various other logical disks
      > on the same box.
      >
      > I can navigate through these links perfectly fine from a cygwin
      > command line.
      >
      > But when try to open a file from within VIM using :e VIM can't
      > navigate thru the link. It will tab complete up to the name of the
      > link (e.g., somelink.lnk), but won't let me follow the link to find
      > the files that the link points to.
      >
      > I have searched the vim docs and the web for a clue, but haven't found
      > anything useful. Does anyone know what I need to do to enable VIM to
      > follow links?
      >
      > Thanks :)

      :h resolve()

      e.g.

      :h c_CTRL-\_e

      " press Ctrl-T to follow a symlink:
      cnoremap <C-T> <C-\>e(FollowSymlink())<CR>

      func! FollowSymlink()
      return substitute(getcmdline(), '\%(\\ \|\f\)\+$', '\=Resolve(submatch(0))','')
      endfunc

      func! Resolve(fname)
      " unescape spaces, resolve(), escape spaces
      return escape(resolve(expand(a:fname))," ")
      endfunc

      --
      Andy





      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.