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

RE: How do you trap the output of filename completion?

Expand Messages
  • Keith Roberts
    ... For anyone else out there who is interested, here s an abbrev that will let you play with expansions in the . directory, tossing the matches into a new
    Message 1 of 5 , Dec 2, 2003
    • 0 Attachment
      >-----Original Message-----
      >From: Keith Roberts [mailto:kroberts@...]
      >Sent: Tuesday, December 02, 2003 10:07 AM
      >To: 'Benji Fisher'; 'vim@...'
      >Subject: RE: How do you trap the output of filename completion?
      >
      >>-----Original Message-----
      >>From: Benji Fisher [mailto:benji@...]
      >>Sent: Tuesday, December 02, 2003 6:57 AM
      >>To: vim@...
      >>Subject: Re: How do you trap the output of filename completion?
      >>
      >>On Mon, Dec 01, 2003 at 06:26:47PM -0800, Gary Johnson wrote:
      >>> On 2003-12-01, Keith Roberts <kroberts@...> wrote:
      >>> > [snip]I'd like to trap the output generated by
      >>> > the completion so I can :put it into a buffer [snip]
      >>>[snip]
      >>> I think the solution to your particular problem would then be:
      >>>
      >>> put=glob('some_path/abc*')
      >
      >This is a step in the right direction. Not *exactly* what I wanted, but I
      >can use it. Filename-completion just returns the filenames without the
      >path, which is what I was looking for, but it turns out not to make any
      >real difference to using 'lid' on <cword>. Plus, it's easy enough to
      >delete the paths. Thanks, Gary.

      For anyone else out there who is interested, here's an abbrev that will let
      you play with expansions in the "." directory, tossing the matches into a
      "new" buffer. Note that it lets you edit the command line before executing
      it.
      cnoreab %% <C-R>="new\|put!=glob('".expand('#:p')."')"<CR>

      And for deleting the paths from the above output for readability:
      cmap %f %s+\f*[\\/]++<CR>

      [I couldn't figure out how to do both in one step without losing the ability
      to edit the pathname being globbed.]
    Your message has been successfully submitted and would be delivered to recipients shortly.