用 Command+tab 可以切换程序焦点对吧,我想实现执行某个命令时切换焦点的某个程序,例如 Chrome
实现这一步,我就可以在 vim 中通过 F1 实现 保存 -> 用 Chrome 预览 Markdown -> 自动切换到 Chrome
实现这一步,我就可以在 vim 中通过 F1 实现 保存 -> 用 Chrome 预览 Markdown -> 自动切换到 Chrome
1
flyfire Aug 7, 2016 via Android
apple script
|
3
taued Aug 7, 2016 open -a /Applications/Google\ Chrome.app [$FILE_PATH]
-a application Specifies the application to use for opening the file -n Open a new instance of the application(s) even if one is already running. -g Do not bring the application to the foreground. 其他参数可以 man open 看一下 if has('gui') exec ":silent ! open -g -a \"Google Chrome\"" path else exec ":! open -g -a \"Google Chrome\"" path endif |
4
ynyounuo Aug 7, 2016 看你题目的描述以为是需要这个答案:
按住 ⌘ 然后可以用鼠标操作别的窗口 结果进来发现答非所问了。 那,来都来了。 |
5
kingddc314 Aug 8, 2016 via Android
3L 说的对,:!open 就行了
|
6
fatestigma Aug 8, 2016 3L 已经正解,对于 1L 说的 AppleScript ,可以用 `osascript -e 'tell app "Google Chrome" to activate'`。
|
8
sdjl OP @fatestigma 谢谢!这个也可以!
|