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

Re: reading contents from a file under directories specified by "path" variable

Expand Messages
  • Jean-Rene David
    ... As you noticed, :read doesn t consult path . Here s a quick implementation: fun! Read(file) let full_path = findfile(a:file) exe read . full_path
    Message 1 of 4 , Jun 3, 2011
      * Aman Jain [2011.06.03 14:40]:
      > But is there a way for reading in the contents of files present under
      > directories,
      > specified by path variable e.g.
      > :r file_inside_dir<TAB>

      As you noticed, :read doesn't consult 'path'.

      Here's a quick implementation:

      fun! Read(file)
      let full_path = findfile(a:file)
      exe "read " . full_path
      endfun

      fun! PathComplete(A,L,P)
      return split( globpath(&path, a:A."*"), "\n")
      endfun

      command! -complete=customlist,PathComplete -nargs=1 Read call Read('<args>')

      Use like so:

      :Read foo<tab>

      HTH,

      --
      JR

      --
      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
    Your message has been successfully submitted and would be delivered to recipients shortly.