次のことができます。次の操作を行うためにキーバインド、たとえば、CTRL +シフト+ Bを作るのが好きこれを行うためのプラグインを作成し、キーバインドでそれを実行します。
- [ツール]メニューから - >開発 - >新しいプラグイン...
- は、ユーザーのキーバインド
{ "keys": ["ctrl+shift+b"], "command": "paste_and_reindent" },
に以下を追加し、すべて選択して保存するには、次
import sublime
import sublime_plugin
class PasteAndReindentCommand(sublime_plugin.TextCommand):
def run(self, edit):
before_selections = [sel for sel in self.view.sel()]
self.view.run_command('paste')
after_selections = [sel for sel in self.view.sel()]
new_selections = list()
delta = 0
for before, after in zip(before_selections, after_selections):
new = sublime.Region(before.begin() + delta, after.end())
delta = after.end() - before.end()
new_selections.append(new)
self.view.sel().clear()
self.view.sel().add_all(new_selections)
self.view.run_command('reindent')
- と交換し、フォルダ内のSTは
paste_and_reindent.py
- のようなものとして、(
Packages/User/
)を提案します
Ctrl + Shift + B wi "Build With"のデフォルトバインディングを置き換えます。どのように動作する
:
- をキーバインドが押されたときに、それはプラグイン
- で作成した新しいコマンドを実行し、これが現在のテキスト選択位置
- を格納し、それがペースト操作
を行い、
- 新しいテキストキャレット位置
- を取得し、古い位置と新しい位置を比較し、貼り付けられたテキストを選択します。
- それはあなたが(選択の末尾にテキストキャレットを再配置することにより、 - 貼り付けた後、デフォルトの動作をIE)、それはその後、再び選択をクリアするために得ることができる
reindent
コマンド
を実行する別の比較を行うことによって、再インデントの前と後の選択。
魅力のように機能し、あなたが提案したように1分しかかかりませんでした。ありがとうございました! – Piwwoli