除了使用箭头键以外,还有其他更快的选择吗? [英] Is there a faster alternative to using the arrow keys?

查看:66
本文介绍了除了使用箭头键以外,还有其他更快的选择吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常用R编码,我才意识到将手向下移到箭头键,然后又回到键盘上的字母对我来说是多么痛苦.在Rstudio中,我必须定期执行此操作,因为Studio会自动完成某些Synax(例如括号和引号),然后我必须按箭头键移出括号(或引号),然后删除所有可能的内容.让R为我完成语法的好处.这对我来说是额外的开销,因为我是惯用左手的.快捷键是否更接近字母键?

I regularly code in R, and I just realized how much of a pain it is for me to move my hand down to the arrow keys and then back to they letters on the keyboard. In Rstudio, I have to do this regularly because the studio completes certain synax automatically, (like parentheses and quotation marks) and then I have to press the arrow key to move out of the parentheses (or quotation marks), this then removed any possible advantage from having R complete the syntax for me. This is extra costly for me because I'm left handed. Is there a shortcut for the arrow keys that's closer to the letter keys?

推荐答案

INTRO:

为此,您前面有两种方法:

INTRO:

to do this you have two approaches in front:

  1. 使用您自己的代码
  2. 使用第三方软件

在这些答案中,我介绍了最高效,最简单的方法,因此对于某些操作系统而言,编写自己的代码既简单又有效,而在另一些操作系统中,效率却不是很高,并且需要艰巨的工作,既没有成果,又浪费时间

in these answer i introduce the most efficient and easy approache so for some OSs it's easy and efficient to write your own code while in others its not really efficient and need a harsh work which have no achivement but wasting time

♣在这种方法中,您将使用:
alt + I 代替
alt + K 代替
alt + J 代替
alt + L 代替
♣要使用此功能,请按照以下步骤操作:

♣in this method you will use :
alt+I instead of
alt+K instead of
alt+J instead of
alt+L instead of
♣in order to use this feature these are the steps in your way:

  1. 下载并安装 autohotkey
  2. 右键单击您的桌面区域,然后转到new并制作一个新的记事本"文件
  3. 打开空的记事本文件,并将下面的代码复制/粘贴到该文件中
  4. 使用* .ahk格式重命名您想要的记事本文件
  5. 点击文件以运行脚本
  6. 现在您可以享受并且不再使用箭头键...
  1. download and install autohotkey
  2. right-click in your desktop area then go to new and make a new "notepad" file
  3. open empty notepad file and copy/paste codes below into that
  4. rename your notepad file eveything you want but with *.ahk format
  5. click your file to run your script
  6. now you can enjoy and never use arrow keys again...

        ; #Warn  ; Enable warnings to assist with detecting common errors.
        SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
        SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
        
        ; AHK Command       ; key   = Effect        (Description)
        
        ; ALT Keypress Implied for all below
        
        !i::Send {UP}       ; i UP          (Cursor up line)
        !k::Send {DOWN}     ; k DOWN            (Cursor down line)
        
        !j::Send {LEFT}     ; j LEFT        (Cursor left one character)
        !l::Send {RIGHT}    ; l RIGHT       (Cursor right one character)
        
        !h::Send {HOME}     ; h     ALT + RIGHT (Cursor to beginning of line)
        !;::Send {END}      ; ; ALT + LEFT  (Cursor to end of line)
        
        !u::Send ^{HOME}    ; h     SHIFT + HOME    (Cursor to beginning of document)
        !o::Send ^{END}     ; o SHIFT + END (Cursor to end of document)
        
        ; CTRL + ALT Keypress Implied for all below
        
        !^j::Send ^{LEFT}   ; j     CTRL + LEFT (Cursor left per word)
        !^l::Send ^{RIGHT}  ; l CTRL + RIGHT    (Cursor right per word)
        
        ; SHIFT + ALT Keypress Implied for all below
        
        !+i::Send +{UP}     ; i SHIFT + UP  (Highlight per line)
        !+k::Send +{DOWN}   ; k SHIFT + DOWN    (Highlight per line)
        
        !+j::Send +{LEFT}   ; j SHIFT + LEFT    (Highlight per character)
        !+l::Send +{RIGHT}  ; l SHIFT + RIGHT   (Highlight per character)
        
        !+h::Send +{HOME}   ; h SHIFT + ALT + LEFT  (Highlight to beginning of line)
        !+;::Send +{END}    ; ; SHIFT + ALT + RIGHT (Hightlight to end of line)
        
        !+u::Send ^+{HOME}  ; u SHIFT + CTRL + HOME (Highlight to beggininng of document)
        !+o::Send ^+{END}   ; o SHIFT + CTRL + END  (Hightlight to end of document)
        
        ; SHIFT + CTRL + ALT Keypress Implied for all below
        
        !+^j::Send +^{LEFT}     ; j SHIFT + CTRL + LEFT (Highlight per word)
        !+^l::Send +^{RIGHT}    ; l SHIFT + CTRL + RIGHT    (Hightlight per word)
        
        !+^i::Send +!{UP}   ; i SHIFT + ALT + UP    (Multiply cursor up)
        !+^k::Send +!{DOWN} ; k SHIFT + ALT + DOWN  (Multiply cursor down)
        
        ; CTRL + SHIFT Keypress Implied for all below
        
        +^i::Send +^{UP}
        +^k::Send +^{DOWN}

重要说明

要使用您制作的自动热键脚本,每次打开计算机时都可以(而不是每次单击脚本)将其复制到启动文件夹中.

to use autohotkey script which you made, every time you turn on computer instead of clicking on your script every time ,you can copy your script in startup folder.

  1. win + R
  2. 类型: shell:启动
  3. 将脚本复制到该文件夹​​
  1. win+R
  2. type: shell:startup
  3. copy your script into that Folder

MACOS用户:

♣在这种方法中,您将使用:
option + I 代替
选项 + K ,而不是
option + J 代替
选项 + L ,而不是

MACOS USERS:

♣in this method you will use :
option+I instead of
option+K instead of
option+J instead of
option+L instead of

使用锤子

hammerspoon是一个强大的工具,可用于多种用途(不仅分配键绑定,例如,您可以将其用于Windows sanping或...),而且我认为这是任何macOS中必须具备的工具之一

hammerspoon is a tremendous tool for many purposes (not just assign a keybinding, for example you can use it for windows sanping or ...) and i think that is one of the MUST-HAVE tools in any macos

因为Hammerspoon的文档非常简单,所以我只是将代码放在此处,您可以从

since the documentation of hammerspoon is very very straightforward i just put the code here and you can install and config hammerspoon from it's Getting Started with Hammerspoon

hs.hotkey.bind({"alt"}, "I", function()
  hs.eventtap.keyStroke({}, "up")
end)
hs.hotkey.bind({"alt"}, "K", function()
  hs.eventtap.keyStroke({}, "down")
end)
hs.hotkey.bind({"alt"}, "J", function()
  hs.eventtap.keyStroke({}, "left")
end)
hs.hotkey.bind({"alt"}, "L", function()
  hs.eventtap.keyStroke({}, "right")
end)

重要说明

如果您认为Hammerspoon速度慢或不能如您所愿地灵活,那么请选择 Karabiner

if you think hammerspoon is slow or not working as genious as you want another option is Karabiner

♣在这种方法中,您将使用:
CapsLock + I ,而不是
CapsLock + K ,而不是
CapsLock + J 而不是
CapsLock + L ,而不是

alt_gr 而不是 CapsLock

♣in this method you will use :
CapsLock+I instead of
CapsLock+K instead of
CapsLock+J instead of
CapsLock+L instead of
and
alt_gr instead of CapsLock

♣又如何?好吧:

  1. 打开终端,在文件中写入键盘布局(我将其命名为modmap),然后打开该文件并对其进行编辑,因为您将按照以下步骤进行操作:

  1. open up Terminal, write your keyboard layout on in a file(i named it modmap), then open that file and edit it as you will follow next steps:

xmodmap -pke > modmap
gedit modmap

  • 更改keyCode 108(alt_Gr/ISO_Level3_Shift)的值,因此修改后应如下所示:

  • change keyCode 108 (alt_Gr/ISO_Level3_Shift) value, so it should be like this after modifying:

    keycode 108 = Caps_Lock Caps_Lock Caps_Lock Caps_Lock Caps_Lock Caps_Lock
    

  • 更改keyCode 66(CapsLock)的值,因此修改后应如下所示:

  • change keyCode 66 (CapsLock) value, so it should be like this after modifying:

    keycode  66 = Mode_switch Mode_switch Mode_switch Mode_switch Mode_switch Mode_switch
    

  • 更改keyCode 31(i)的值,因此修改后应如下所示:

  • change keyCode 31 (i) value, so it should be like this after modifying:

    keycode  31 = i I Up NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol
    

  • 更改keyCode 44(j)的值,因此修改后应如下所示:

  • change keyCode 44 (j) value, so it should be like this after modifying:

    keycode  44 = j J Left NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol
    

  • 更改keyCode 45(k)的值,因此修改后应如下所示:

  • change keyCode 45 (k) value, so it should be like this after modifying:

    keycode  45 = k K Down NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol
    

  • 更改keyCode 46(l)的值,因此修改后应如下所示:

  • change keyCode 46 (l) value, so it should be like this after modifying:

    keycode  46 = l L Right NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol
    

  • 重要说明

    1- Ubuntu不再使用/不支持xmodmap(因为它对许多用户而言并不方便,我认为他们从2013年起不再使用xmodmap),但这是一个非常快速的编码以及与计算机和计算机一起工作的专业问题.也编码,我看到许多专业人士使用Debian或他们自己的基于Debian的linux(不是Ubuntu),他们总是更喜欢本机解决方案,而不是插件或... 无论如何,如果您使用的是Ubuntu,则可以使用xkb或gnome调整工具,在那里您可以在GUI中调整键盘映射

    1- xmodmap is no longer used/supported on Ubuntu (because it wasn't handy for many users ,i think they stop using xmodmap from 2013) but since this is a professional question for very fast coding and working with computer and also coding,i see many professionals using Debian or theit own debian-based linux (not Ubuntu) and they always prefer native solutions instead of plugins or ... anyway if you are using Ubuntu you can use xkb or gnome tweak tools where you maybe can adjust your keyboard mapping in a GUI

    2-如果您的键盘上有多个语言/输入,您将无法轻松使用此解决方案,但是您可以像下面这样使用它:

    2- you can't use this solution easily if you got multi langs/inputs on your keyboard but you can use it like below:

    CapsLock + shift + i ,而不是
    CapsLock + shift + k ,而不是
    CapsLock + shift + j ,而不是
    CapsLock + shift + l ,而不是
    例如,如果您还想拥有 persian_language_input ,则可以执行上面的步骤1,2,3,然后更改其他步骤,如下所示:

    CapsLock+shift+i instead of
    CapsLock+shift+k instead of
    CapsLock+shift+j instead of
    CapsLock+shift+l instead of
    for example if you also want to have persian_language_input you can do step 1,2,3 above then change other steps like below:

    keycode  31 = i I Arabic_heh Up 5 6 7 8
    keycode  44 = j J Arabic_teh Left 5 6 7 8
    keycode  45 = k K Arabic_noon Down 5 6 7 8
    keycode  46 = l L Arabic_meem Right 5 6 7 8
    

    注意不要在终端中测试以上键盘快捷键

    be careful that you shouldn't test above keyboard shortcuts in Terminal

    3-因为我们使用的是xmodmap工具(因为它本机不同于xkb),所以您只能为已经使用AltGr的键码更改AltGr键符.因此,我们可以使用CapsLock进行更改,以解决此问题,因为Capslock使手指更舒适,发现它是一个非常可接受的解决方案.

    3- since we're using xmodmap tool(because it's native unlike xkb), You can only change the AltGr keysyms for keycodes that are already using AltGr. So we change it with CapsLock to overcome this problem since capslock is more comfort for fingers to find it is a very acceptable solution.

    在大多数情况下,4-是alt_Gr是键盘上的正确alt键

    4- in most cases alt_Gr is the right alt Key on your keyboard

    进一步了解xmodmap: ArchWiki-xmodmap

    further reading about xmodmap: ArchWiki - xmodmap

    如果有人在BSD OS(或基于BSD-Based)中对此答案有知识,我将不胜感激,如果他/她将其添加到我的答案中

    if anyone has knowledge about this answer in BSD OS(or BSD-BASED) I'll appreciate that if he/she add it to my answer

    这篇关于除了使用箭头键以外,还有其他更快的选择吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆