Sunday, March 22, 2020

Re: getting the full path of arguments in command completion=file

Ah, it works from within the function too, that is smart. And the nicer solution. Thanks! 

On Sun, Mar 22, 2020 at 11:15 PM Gary Johnson <garyjohn@spocom.com> wrote:
On 2020-03-22, Martin Alaçam wrote:

> command! -nargs=* -complete=file Loader call Test(<f-args>)
>
> How would I get the <f-args> to be full paths to the arguments (file names)?
> I am guessing it has to be done in the command, and not in the function being
> called (Test)? 

Here's one way to do it.  Replace "echo path" by your actual
processing of each file.

    function! Test(...)
        for file in a:000
            let path = fnamemodify(file, ":p")
            echo path
        endfor
    endfunction

Regards,
Gary

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200322221328.GA25471%40phoenix.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAHvr%2BSVCScYzWUJd1tPXgL-YnUVJ-enBhCXyfZ9qSkhGp7trNg%40mail.gmail.com.

No comments:

Post a Comment