Giter VIP home page Giter VIP logo

Comments (6)

S1ngS1ng avatar S1ngS1ng commented on June 18, 2024

试试修改这些:https://github.com/S1ngS1ng/HammerSpoon/blob/master/vim-binding.lua#L11-L33

11 local keyHandler = function(e)
12   local watchFor = { h = "left", j = "down", k = "up", l = "right" }  -- 这里把 hjkl 改成 awsd

13   local actualKey = e:getCharacters(true)
  -- ......
19      if v and k ~= "ctrl" then  -- 这里把 ctrl 改成 capslock。详情参考:http://www.hammerspoon.org/docs/hs.keycodes.html
  -- .......
33 end

以及:https://github.com/S1ngS1ng/HammerSpoon/blob/master/vim-binding.lua#L35-L41

35 local modifierHandler = function(e)
  -- ...
38   for k, v in pairs(flags) do
39     onlyControlPressed = v and k == "ctrl"  -- 这里的 ctrl 改成 capslock
40     if not onlyControlPressed then break end
41   end

from hammerspoon.

mgdreamingstar avatar mgdreamingstar commented on June 18, 2024

改了之后并没有起作用……

from hammerspoon.

S1ngS1ng avatar S1ngS1ng commented on June 18, 2024

@mgdreamingstar
https://github.com/S1ngS1ng/HammerSpoon/blob/master/vim-binding.lua#L5
如果你只是改了上面说的这些部分,可以在第五行打开 debug,看一下输出对不对。
如果你不知道应该输出什么,可以先看一下原来的脚本输出啥,再和你改动之后的脚本比较一下。
或者你也可以把输出发上来。
再或者你也可以给我个你的配置链接。

现在就说一句“不起作用”,我也不知道你那里发生了什么

from hammerspoon.

S1ngS1ng avatar S1ngS1ng commented on June 18, 2024

还有就是,想先确认下你需要什么功能。这个功能,我的初衷是可以搭配 cmdalt 以及 shift 使用的。
如果你不需要这个,仅仅是想实现你说的 capslock + awsd,那完全可以直接用简单的 eventtap.keyStroke 去实现,不需要这么复杂

from hammerspoon.

zhangyu0806 avatar zhangyu0806 commented on June 18, 2024

基本操作
alt + h 左
alt + j 下
alt + k 上
alt + l 右
alt + , 句首
alt + . 句尾
alt + y = ctrl + k

与 ctrl 配合使用
Ctrl-Alt + h 光标向左移动一个词
Ctrl-Alt + l 光标向右移动一个词

与 Shift 配合使用
上面所列出的操作,配合 Shift 可以实现选中功能


想实现这样的功能怎么改?

from hammerspoon.

S1ngS1ng avatar S1ngS1ng commented on June 18, 2024

@zhangyu0806 https://github.com/kkamdooong/hammerspoon-control-hjkl-to-arrow/blob/master/init.lua
建议参考这个去写。
你提到的句首、句尾以及 ctrl + k,还有移动一个词,我觉得直接用 keyStroke 发送对应的按键组合就好,会比改我的要简单些

from hammerspoon.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.