Help us understand the problem. What is going on with this article?

SublimeText | 秀丸の5行移動機能をマクロで実現する

More than 5 years have passed since last update.

SublimeText | 秀丸の5行移動機能をマクロで実現する

概要

秀丸では

  • Ctrl+上下キーで上下に5行移動できます。
  • Ctrl+Shift+上下キーで上下に5行移動しつつ範囲選択できます。

SublimeTextの前は秀丸を使っていたこともあり、
この機能がすっかり手になじんでいるため、SublimeTextに移植してみました。

マクロ保存機能を活用

以下の手順でマクロを保存します

  1. マクロの記録開始(Ctrl+Q)
  2. 5行下に移動 / 5行上に移動 / Shiftを押しながら5行下に移動 / Shiftを押しながら5行上に移動
  3. マクロの記録終了(Ctrl+Q)
  4. マクロの保存(Tools => Save Macro)
  5. マクロのキー割り当て

上移動5、下移動5、上選択移動5、下選択移動5の回数分実施します。
内容に合わせて手順2を選択。

出来上がったマクロ

下移動5、下選択移動5を例示します。

下5移動のマクロ

[
  {
    "args":
    {
      "by": "lines",
      "forward": true
    },
    "command": "move"
  },
  {
    "args":
    {
      "by": "lines",
      "forward": true
    },
    "command": "move"
  },
  {
    "args":
    {
      "by": "lines",
      "forward": true
    },
    "command": "move"
  },
  {
    "args":
    {
      "by": "lines",
      "forward": true
    },
    "command": "move"
  },
  {
    "args":
    {
      "by": "lines",
      "forward": true
    },
    "command": "move"
  }
]

下5選択移動のマクロ

[
  {
    "args":
    {
      "by": "lines",
      "extend": true,
      "forward": true
    },
    "command": "move"
  },
  {
    "args":
    {
      "by": "lines",
      "extend": true,
      "forward": true
    },
    "command": "move"
  },
  {
    "args":
    {
      "by": "lines",
      "extend": true,
      "forward": true
    },
    "command": "move"
  },
  {
    "args":
    {
      "by": "lines",
      "extend": true,
      "forward": true
    },
    "command": "move"
  },
  {
    "args":
    {
      "by": "lines",
      "extend": true,
      "forward": true
    },
    "command": "move"
  }
]

補足

移動行数に拡張性を持たせたい場合は Python を利用した Plugin として実装したほうが良いですね。

私が欲しかったのは秀丸の5行移動だったので5行固定の機能のみ作成しました。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした