ExpandRegion for Sublime Text:快速選擇文本

來源:互聯網
上載者:User

標籤:

有沒有特別羨慕WebStrom上的CTRL+W快速鍵,通過它可以迅速的選擇游標下的文本,多按幾次可以逐漸擴大選擇的地區,這在編輯文本的時候簡直太方便了。Vim也有類似的概念,在Vim中叫文字物件(text object),可以快速選擇不同大小的文字物件。

在Sublime Text中雖然也有選擇文本的快速鍵,但是不夠好用,直到有一天遇到這個外掛程式:sublime-expand-region,一切的煩惱都消失了。

Like "Expand Selection to Scope". But better!

ExpandRegion works a bit like the build in "Expand Selection to Scope", however it does not depend on Scopes (Scopes are used by ST to "understand" code, i.e. for syntax highlighting). Therefore selection expansion can be more granular and customizable.

It works similar to ExpandRegion for Emacs and "Structural Selection" (Control-W) in the JetBrains IDE‘s (i.e. IntelliJ IDEA).

安裝方法就不說了,一是上面的連結說到怎麼安裝了,另外用SublimeText的人大概也都知道怎麼安裝外掛程式。所以這裡就不羅嗦了。

這裡只說一下我配置的快速鍵。光安裝還不能使用,得自訂兩個快速鍵,一個用於擴大選區,一個用於減小選區。

    {        "keys": ["alt+up"],        "command": "expand_region"    },    {        "keys": ["alt+down"],        "command": "expand_region",        "args": {"undo": true},        "context": [{ "key": "expand_region_soft_undo" }]    },

以上快速鍵定義適用於Windows、Linux、macOS

下面是幾個:

JavaScript (should also work for other c‘ish languages like Java).

Python

HTML

 

ExpandRegion for Sublime Text:快速選擇文本

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.