How can I define a shell function (named `:` would be neat) from a terminal buffe and send commands to current vim clientr?

瀏覽次數:16 次
跳到第一則未讀訊息

陈世用

未讀,
2019年7月14日 凌晨2:53:522019/7/14
收件者:vim_use
Like in a terminal buffer, typing:

```
$ :vsp demo.file
```

`:` is the custom shell function's name.

It's expand to `<c-w>:vsp demo.file` or something.

Christian Brabandt

未讀,
2019年7月14日 上午9:19:032019/7/14
收件者:vim_use
I think it is unclear, what you are asking exactly. Please clarify.

Best,
Christian
--
Munterbleiben, heute ist Weltuntergang!

Salman Halim

未讀,
2019年7月14日 上午10:46:492019/7/14
收件者:Vim Users


--

Salman

On Sun, Jul 14, 2019, 09:18 Christian Brabandt <cbl...@256bit.org> wrote:

On Sa, 13 Jul 2019, 陈世用 wrote:

> Like in a terminal buffer, typing:
>
> ```
> $ :vsp demo.file
> ```
>
> `:` is the custom shell function's name.
>
> It's expand to `<c-w>:vsp demo.file` or something.

I think it is unclear, what you are asking exactly. Please clarify.

Best,
Christian

Sound like you want a terminal mapping. I think :help tmap may give you what you want, but if you remap the colon, you'll have trouble if you need to use it in an actual command. You could either map the double colon (::) to do this or to insert an actual single colon:

tmap : <c-w>:
tnoremap :: :

Or, depending on which you prefer, reverse the two mappings. 

Salman

吴祖姜

未讀,
2019年7月15日 下午1:20:132019/7/15
收件者:vim...@googlegroups.com
No, not a tmap. I know tmap. 

What I want is, to invoke vim command from a terminal with shell commands, without typing <c-w> prefix or entering normal mode. 

Like providing a shell function ‘send-keys-to-host-vim’ (and I want its name be ‘:’), then run

$ send-keys-to-host-vim vsp my.file<enter>

It equals to <c-w>:vsp my.file<enter>

Sorry for my poor English, hope it is explained clearly this time. 

Salman Halim <salma...@gmail.com>于2019年7月14日 周日下午10:46写道:
--
--
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+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANuxnEcCesOnUPGDGUsjjRAiQxfnJ7E_JskEzLiXcQrSJyF7DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

吴祖姜

未讀,
2019年7月15日 下午1:25:032019/7/15
收件者:vim...@googlegroups.com
Salman Halim,

Your mapping idea seems good. I will try it. Thanks.

吴祖姜 <billb...@gmail.com>于2019年7月16日 周二上午1:19写道:

Christian Brabandt

未讀,
2019年7月15日 下午1:25:442019/7/15
收件者:vim...@googlegroups.com

On Di, 16 Jul 2019, 吴祖姜 wrote:

> No, not a tmap. I know tmap. 
>
> What I want is, to invoke vim command from a terminal with shell commands,
> without typing <c-w> prefix or entering normal mode. 
>
> Like providing a shell function ‘send-keys-to-host-vim’ (and I want its name be
> ‘:’), then run
>
> $ send-keys-to-host-vim vsp my.file<enter>
>
> It equals to <c-w>:vsp my.file<enter>
>
> Sorry for my poor English, hope it is explained clearly this time. 

Have a look at `:h terminal-api`. I have a plugin that does something
similar: https://github.com/chrisbra/vpager you can also have a look
there.

Best,
Christian
--
Wie man sein Kind nicht nennen sollte:
Clara Schnaps

吴祖姜

未讀,
2019年7月16日 凌晨3:12:072019/7/16
收件者:vim...@googlegroups.com
Thank you! It really helps!

Christian Brabandt <cbl...@256bit.org> 于2019年7月16日周二 上午1:25写道:
--
--
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+u...@googlegroups.com.
回覆所有人
回覆作者
轉寄
0 則新訊息