Persimmonium
Persimmonium

Reputation: 15771

vim: how to run a command on a specific window on startup

I'm on gvim 7.3 on windows.

I am using the Tail Bundle plugin, but in order to overcome a limitation on windows, I need to run some command on startup...BUT ONLY on the window/buffer that the plugin opens, not in the others.

This plugin opens a preview window, and if I ls, I dont see a buffer with the file I opened with this plugin...so my intent to use autocmd to limit somehow the action to only that buffer seems not doable.

Is there any way to run a command only on a specific preview window opened by this pluging? I guess so but I am quite a newbie in vim yet...


EDIT: ok, thanks to Kev, this part is solved, I leave open for the main question...

Aslo, as an addendum, I am running some commands on startup with

 -c "tabn" 

this works well, but when I try to run somethign like -c "<C-W> H" those dont work, how can I do this?

Upvotes: 0

Views: 989

Answers (2)

Conner
Conner

Reputation: 31040

This plugin uses a preview-window (see :h preview-window) to display the file it's tracking. Unfortunately, I don't think there is an event you can trigger when a preview-window is opened, so the only way to do this is to edit the plugin itself and add your command when it opens the window.

Upvotes: 0

kev
kev

Reputation: 161614

-c option only accept a ex command (AKA colon-command).
You need to re-write it as -c 'exe "norm \<C-w>H"'
Another way is -c 'wincmd H'

Upvotes: 1

Related Questions