Hotkey to end the line with a semicolon and jump to a new line in Sublime Text 2

后端 未结 6 1991
粉色の甜心
粉色の甜心 2021-01-30 13:50

I\'m trying to figure out a hotkey at work. I just got this job and I am using a Mac for more or less the first time in my life.

Back home on my Laptop, when using Eclip

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-30 14:20

    You can also use a ready-made sublime package built for this purpose: AppendSemiColon

    You can use package control to install it, just search for "AppendSemiColon".

    Place a semicolon at the end of the cursor's current line(s) by pressing:
    Command+; on OS X
    Ctrl+; on Windows and Linux
    

    and

    You can also automatically go to the next line at the same time like this:
    Command+Shift+; on OS X
    Ctrl+Shift+; on Windows and Linux
    

    I've been using this package for a while now, and it works great.

    UPDATE: As the author mentioned in a comment, you can now also change the default hotkeys if you like (personally, I love the defaults). As an example, just change:

    [
      { "keys": ["ctrl+;"], "command": "append_semi_colon" }, 
      { "keys": ["ctrl+shift+;"], "command": "append_semi_colon", "args": {"enter_new_line": "true"} }
    ]
    

    in your sublime-keymap to use whatever keys you want.

    I tested the latest version, and this feature too works fine. There was a bug where extra semicolons were being appended incorrectly upon extra hotkey presses - this minor annoyance has been fixed too. Thanks, MauriceZ/mzee99!

提交回复
热议问题