简体   繁体   中英

Xterm, Vim, PyQt

I have a PyQt application where it spawns an XTerm window in a widget. The XTerm window is launched with -e vim <file> which immediately runs Vim displaying the file for edit, etc.

When I hit : w ! in Vim, I'd like to somehow catch that event and echo it back to XTerm, and/or ultimately back to PyQt, so that I can modify another UI element.

I do know how to use a Vim autocmd to catch : w ! (BufWritePost) and execute a shell script,etc...

...but I think I need to have Vim echo back, either with simple ASCII text or via a SIGNAL, back to the XTerm window and hopefully back to the QProcess.

So I think the key is figuring how to tell XTerm to do this, but I'm a bit stumped and open to any and all suggestions about how to accomplish.
Thanks to all in advance.

Your script would have to take into account that XTerm will not do the echoing (text echoed/printed in the terminal goes to the terminal's screen). Your script would have to either make vim echo something to a file, or run vim (in xterm) from a helper script that would pass the information back in a file.

Usually this is done by allocating a temporary file in the parent process (your PyQt application), and passing its name to the child process.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM