V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
hazard
V2EX  ›  问与答

sublime text 3 里怎么自动加分号并换行?

  •  
  •   hazard · May 1, 2014 · 5523 views
    This topic created in 4393 days ago, the information mentioned may be changed or developed.
    我知道用VIM可以用map! 来在插入模式下定义个命令序列来实现这个功能,我想知道怎么在ST3下也可以按一个组合键,就可以在自动该行末尾加入一个分号并进入下一行(不切断当前行)?相当于在末尾加分号后再Ctrl+Enter。我感觉这样写C程序能顺手一些。。。
    3 replies    2014-05-01 23:49:31 +08:00
    P233
        1
    P233  
       May 1, 2014
    { "keys": [";"], "command": "insert", "args": {"characters": ";\n"} },
    P233
        2
    P233  
       May 1, 2014
    把分号替换成 ; + 换行,不知道如何实现自动
    NemoAlex
        3
    NemoAlex  
       May 1, 2014   ❤️ 1
    录一个 macro 就可以了
    Tools - Record Macro
    依次输入:
    Ctrl + E
    ;
    Enter
    然后停止记录,保存到用户目录下
    再把这个 macro 设一个热键,方法如下
    http://superuser.com/questions/609057/how-do-i-assign-a-keyboard-shortcut-to-recorded-macro-in-sublime-text
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3405 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 12:16 · PVG 20:16 · LAX 05:16 · JFK 08:16
    ♥ Do have faith in what you're doing.