Sunday, February 18, 2018

Re: write to command0line prompt

Em domingo, 18 de fevereiro de 2018 18:09:10 UTC-3, Tim Chase escreveu:
> On 2018-02-18 13:05, Renato Fabbri wrote:
> > :normal :ls
> > does not leave the user with the cursor at the command-line, e.g.
> > in: :ls
> >
> > Is there a way to write a function or is there a command I might
> > use to leave the user with a given string in the command-line?
>
> A mapping can leave you at the prompt if you don't append "<cr>" to
> it:
>
> :nnoremap <f2> :ls
>
> Without knowing the context and what you're hoping to do with it,
> it's hard to give much more detail.

Some context...

I have these mappings:
nnoremap ^[FF :Split echo globpath('/home/renato/repos/', "**/rdf*")
nnoremap ^[Ff :Split echo globpath(&rtp, "*/ttm*")
nnoremap ^[Fa :Split echo globpath(&rtp, "*/ttm*")<CR>
nnoremap ^[FA :Split echo globpath(&rtp, "**/pack/**")<CR>
(^[ stands for Alt here, achieved using <C-V>.)

I want the following mapping:
" nnoremap ^[Ff :Split echo globpath(&rtp, '"**/' . expand("<cword>") . "*")

which does not work because Vim considers the whole expression as a string
and does note evaluate expand().

To make this work, I made a function with variations such as:

fu! SearchFilenameRTP()
let a = expand("<cword>")
let b = '**/' . l:a . '*'
let c = ':Split echo globpath(&rtp, "' . l:b . '")'
normal l:c
endfu

but I can't get the string in l:c into the command-line.

-renato


>
> -tim

--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments: