write to command0line prompt

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

write to command0line prompt

Renato Fabbri
: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?

Best,

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: write to command0line prompt

Tim Chase
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.

-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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: write to command0line prompt

Renato Fabbri
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: write to command0line prompt

Renato Fabbri


:'-|


may one assume that is is not possible to leave the cursor
in the command line with some text written if not through a mapping?

Best,
rf

On Sun, Feb 18, 2018 at 7:08 PM, Renato Fabbri <[hidden email]> wrote:
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/fZowH6oqwYE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--
Renato Fabbri
GNU/Linux User #479299

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: write to command0line prompt

Christian Brabandt

On Mi, 21 Feb 2018, Renato Fabbri wrote:

>
>
> :'-|
>
>
> may one assume that is is not possible to leave the cursor
> in the command line with some text written if not through a mapping?

:call feedkeys(':foobar', 'n')

Best,
Christian

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: write to command0line prompt

Renato Fabbri


On Wed, Feb 21, 2018 at 4:53 AM, Christian Brabandt <[hidden email]> wrote:

On Mi, 21 Feb 2018, Renato Fabbri wrote:

>
>
> :'-|
>
>
> may one assume that is is not possible to leave the cursor
> in the command line with some text written if not through a mapping?

:call feedkeys(':foobar', 'n')

Best,
Christian

ow that is something I eagerly looked... Today I stumbled on some functions
to change the position of the cursor on the command line, and remembered
your answer many times.

Thank you very much.

(I have been avoiding thank you messages for they might be regarded
verbose with little to add to que discussion.
Are there any guidelines for this list?
Answers here have been most useful.
Thanks again.
renato)
 

--
--
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/fZowH6oqwYE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--
Renato Fabbri
GNU/Linux User #479299

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