我们如何编写一个 alfred 工作流来从 finder 打开文件到 vim 编辑器?
这是我第一次尝试在 Alfred 中创建工作流。我仍在学习并想从一个简单的工作流程开始。
在这里,我首先创建了 Hotkey 和 Keyword。
Open the Alfred3
Go to Workflows
Click + sign at the bottom left sidebar
Choose Blak Workflow
Name: Vim Launcher
Description: Opens a file in the terminal inside vim editor
1. Right-click > Trigger > press cmd-alt-v
2. Right-click > Inputs > Keyword > open in vim and title also open in vim
3. Right-click > Actions > Run NSAppleScipt
里面复制粘贴以下内容Run NSAppleScipt
on alfred_script(q)
tell application "Terminal"
activate
do script "vim '" & q & "'"
end tell
end alfred_script
此工作流程有效,但会打开两个终端而不是一个。我们如何解决这个问题,使它只打开一个窗口?