在 sublime-text 中使用制表符跳过自动完成的括号、逗号等 [英] Skip autocompleted brackets, commas etc. with tab in sublime-text

查看:63
本文介绍了在 sublime-text 中使用制表符跳过自动完成的括号、逗号等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 sublime 中,如果你输入,alert("{ 它会自动补全右括号和引号:alert("{}").

In sublime, if you type, alert("{<cursor> it will autocomplete the closing brackets and quotes to: alert("{<cursor>}").

在visual studio中,如果你点击tab,它会将光标放在自动完成字符的末尾.

In visual studio, if you hit tab, it will place the cursor at the end of the autocompleted characters.

如何在 sublime 中复制这种确切的行为?如果您无论如何都必须输入这些字符或使用箭头键,我认为自动完成没有多大意义.

How can I replicate this exact behaviour in sublime? I don't see much point in autocompletion if you have to type those characters anyway or use arrow keys.

推荐答案

基于@AGS 的 answer 和您的评论,有两种可能的选择.第一个(如果您没有使用 OS X)是点击 End,这会将光标移动到行尾 (eol).

Building on @AGS's answer and your comment, there are two possible options. The first (if you're not using OS X) is to just hit End, which will move the cursor to the end of the line (eol).

第二个选项是将@AGS 的键盘映射稍微修改为以下内容:

The second option is to slightly modify @AGS's keymap to the following:

{ 
    "keys": ["shift+enter"], "command": "move_to", "args": {"to": "eol", "extend": false}, "context":
    [
        { "key": "following_text", "operator": "regex_contains", "operand": "^[)\"\\]\\}\\$]", "match_all": true },
        { "key": "auto_complete_visible", "operator": "equal", "operand": false }
    ]   
}

eol 功能绑定到 ShiftEnter,并包括正则表达式支持,如果需要,可以将其删除.

The binds the eol functionality to ShiftEnter, and includes the regex support, which can be removed if you want.

我希望这会有所帮助!

这篇关于在 sublime-text 中使用制表符跳过自动完成的括号、逗号等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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