sublime 中箭头键的键绑定

时间:2021-06-17 12:41:58

标签: visual-studio-code windows-10 sublimetext3 key-bindings alt-key

我用sublime text editor写代码,想给方向键设置一个按键绑定,所以不用经常动右手。为此,我在 sublime-keymap 中添加了代码:

$(document).ready(function() {
    var myDropzone = new Dropzone("#dropzoneForm",
    {
        dictDefaultMessage: "Drop file here or search.",
        url: "file_upload.php",
        paramName: "file",
        maxFiles : 5,
        method : "post",
        maxFilesize : 10,
        acceptedFiles : '.jpg, .png, .pdf',
        success: function(response){
            var xhr = response.xhr;

            if(xhr.readyState == 4 && xhr.status == 200) {
                maintainAjaxResponse(xhr.responseText);
                listAllImages();
            } else {
                maintainAjaxResponse(xhr.responseText);
            }
        }
    })
});

但是,[ { "keys": ["alt+j"], "command": "move", "args": {"by": "characters", "forward": false} }, { "keys": ["alt+l"], "command": "move", "args": {"by": "characters", "forward": true} }, { "keys": ["alt+i"], "command": "move", "args": {"by": "lines", "forward":false} }, { "keys": ["alt+k"], "command": "move", "args": {"by": "lines", "forward": true} }, ] alt+j 不起作用。请帮忙。 我也尝试在 alt+k 中进行键绑定,发生了同样的问题。 我使用的是 Windows 10 操作系统; Windows 定义的热键是否会导致此问题?

1 个答案:

答案 0 :(得分:0)

仅对于 vscode,命令略有不同(在您的 keybindings.json 中):

{
    "key": "alt+j",
    "command": "cursorMove",
    "args": {
        "to": "left",
        "by": "character"
    },
    "when": "editorTextFocus"
},
{
    "key": "alt+l",
    "command": "cursorMove",
    "args": {
        "to": "right",
        "by": "character"
    },
    "when": "editorTextFocus"
},
    {
    "key": "alt+i",
    "command": "cursorMove",
    "args": {
        "to": "up",
        "by": "line"
    },
    "when": "editorTextFocus"
},
    {
    "key": "alt+k",
    "command": "cursorMove",
    "args": {
        "to": "down",
        "by": "line"
    },
    "when": "editorTextFocus"
}

这是用于在编辑器中移动光标。如果您想在列表中使用类似箭头键的功能(例如资源管理器文件),则必须使用不同的命令添加更多键绑定。但看起来您只想在文本编辑器中使用。

相关问题