-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvim.lua
More file actions
27 lines (26 loc) · 787 Bytes
/
vim.lua
File metadata and controls
27 lines (26 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-- 主要用来实现vim回到
local hs = _G.hs
local function vimnormal()
local win = hs.window.frontmostWindow()
if win ==nil then
return
end
hs.alert.show("MacVim normal")
local app = win:application()
if app:bundleID()=="org.vim.MacVim" then
end
end
local function viminsert()
local win = hs.window.frontmostWindow()
if win ==nil then
return
end
hs.alert.show("MacVim insert")
local app = win:application()
if app:bundleID()=="org.vim.MacVim" then
end
end
--可以在外部通过 open -g "hammerspoon://vimnormal" 执行这个函数
hs.urlevent.bind("vimnormal", function() vimnormal() end)
--可以在外部通过 open -g "hammerspoon://viminsert" 执行这个函数
hs.urlevent.bind("viminsert", function() viminsert() end)