4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Sublime Text でマルチカーソルに連番の数字を入力するプラグイン

Last updated at Posted at 2013-03-24

Sublime Text でマルチカーソルに連番の数字を入力するプラグインをつくりました

プラグインの入力欄に「1」を入力すると上のカーソルから順に1,2,3,4…と入力し、
「3 by 2」と入力すると3,5,7,9…と入力されます。

multi_number_input.py
import sublime_plugin

class MultiNumberInputCommand(sublime_plugin.TextCommand):
    def on_done(self, args):
        args_array = args.split(" by ")
        num = args_array[0]
        by = int(args_array[1]) if 1 < len(args_array) else 1
        edit = self.view.begin_edit()
        for region in self.view.sel():
            self.view.replace(edit, region, str(num))
            num = int(num) + by
        self.view.end_edit(edit)
    def run(self, edit):
        # Show input panel for surround word, then handling input
        self.view.window().show_input_panel(
             'Initial number ex) 1 by 3: ', '1', self.on_done, None, None)

Excelでやると早いのですが、より早く入力するために作りました。
PackageControlに登録していないので、必要な人は手動でもっていってください。

4
4
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?