ペースト時にクリップボード中の「%s」を選択している箇所の文字列と置換してペーストする
クリップボード中に「ほげほげ%sふがふが」こういう文字列があるとき、
文字列「hogehoge」を選択した状態でCtrl+bを行うと
「ほげほげhogehgoeふがふが」のような形でペーストするだけのプラグインを習作として作ってみました。
プラグイン本体(python)
ReplePaste.py
import sublime, sublime_plugin
class RepleCommand(sublime_plugin.TextCommand):
def run(self, edit):
clip = sublime.get_clipboard()
for sel in self.view.sel():
if not sel.empty():
rep = clip % self.view.substr(sel)
self.view.replace(edit, sel, rep)
キーマップ
Default.sublime-keymap
[
{
"keys": ["ctrl+b"], "command": "reple"
}
]