Question

I've been trying to get a script working which would copy a line of text from vim, delete the line, then paste the line to another window. So far I've tried implementing the script with Autohotkey (on Windows 8) and Autokey (on a Ubuntu VM I run). Here's what I've put down:

On Autohotkey:

!^p::
SendRaw "*yydd
SendEvent !{tab}
SendPlay ^v

On Autokey (linked to Ctrl+Alt+p):

keyboard.send_keys("\"*yydd")
keyboard.send_keys("%{TAB}")
keyboard.send_keys("^v")

In both instances, the Vim commands (yank current line to system clipboard, delete current line) work properly, but the scripts fail to switch windows for the paste, and instead execute a Ctrl-v in vim.

Does anyone know what I would need to change in order to get the Alt-Tab functionality working?

Was it helpful?

Solution

Sending the raw Alt + Tab keys doesn't work, as application switching is a core Windows function. In AutoHotKey, there's the AltTab special command (look it up in the help), or better use the WinActivate command, as AutoHotKey seems to still have issues with Alt-Tab on Windows 8.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top