LoginSignup
8
8

More than 3 years have passed since last update.

vimmerに殺されるその前に

Posted at

viは、モードのあるエディターです。一般人のみなさんがお使いになっている、WindowsやMacのデスクトップアプリケーションのエディターは、モードレス(モードのない)エディターです。

注:Twitterなどのクソレスホイホイを使っていると、viやemacsを愛用するご老人からクソレスがたくさん張り付くのですが、事前にお伝えしておくと、私は毎日viを利用しています。gitなどで。

viがなぜモード(標準モード・挿入モード)を持つかというと、アローキー(矢印キー)を使わずにカーソル移動・ページ移動をできるようにするためです。これの何が便利かというと、指をキーボードのホームポジションから離さずに、カーソル移動ができるのです。逆にいうと、ここにメリットを感じないなら、モードのあるエディターはうざいだけです。

エンジニアの多くは、短気で癇癪持ちで高効率にこだわります。キー入力の0.1秒にこだわるのです。

以前、私はtwitterでviをdisったら、viを愛する方からウンコ💩を投げられました。だから容赦なく💩を投げ返しました。

ブラウザのURLの入力欄でviのキーバインドが使えますか?

レスは返ってきませんでした。

ちなみに、MacならデフォルトでEmacsのキーバインドが利用できます。Controlキーを押しながらbfを押してみて下さい。カーソルが移動します。Controlキーとhで削除です。他にもたくさんありますが、覚えにくいのが難点です。操作性も良いとは言い難いでしょう。

そこで登場したのが、私が考案したダイヤモンドカーソルです。

Controlキーとi k j lを利用します。
i → 上
k → 下
j → 左
l → 右
です。

これをtwitterで投稿したら、

ダイヤモンドの意味を知らねーんじゃねーの?w

っていう💩を投げられました。

Krabiner-Element

macOS標準では、私の考案したダイヤモンドカーソルは実現できません。私の考案したダイヤモンドカーソルを使いたい方は、Krabiner-Elementをインストールして下さい。

~/.config/karabiner/assets/complex_modifications ディレクトリに以下のjsonファイルを保存して、環境設定から有効にして下さい。

diamond_cursor.json
{
  "title": "Diamond Cursor",
  "rules": [
    {
      "description": "LControl + i, k, j, l is change to arrow cursor",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "i",
            "modifiers": {
              "mandatory": [
                  "left_control"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "up_arrow"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "k",
            "modifiers": {
              "mandatory": [
                  "left_control"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "down_arrow"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "j",
            "modifiers": {
              "mandatory": [
                  "left_control"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_arrow"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "l",
            "modifiers": {
              "mandatory": [
                  "left_control"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_arrow"
            }
          ]
        }
      ]
    },
    {
      "description": "LControl + < or > is word jump!",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "comma",
            "modifiers": {
              "mandatory": [
                  "left_control"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_arrow",
              "modifiers": [
                  "left_option"
              ]
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "period",
            "modifiers": {
              "mandatory": [
                  "left_control"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_arrow",
              "modifiers": [
                  "left_option"
              ]
            }
          ]
        }
      ]
    },
    {
      "description": "LControl + : or ; is line jump!",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "semicolon",
            "modifiers": {
              "mandatory": [
                  "left_control"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_arrow",
              "modifiers": [
                  "left_command"
              ]
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "quote",
            "modifiers": {
              "mandatory": [
                  "left_control"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_arrow",
              "modifiers": [
                  "left_command"
              ]
            }
          ]
        }
      ]
    },
    {
      "description": "LControl + [ or ] is page up/down!",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "close_bracket",
            "modifiers": {
              "mandatory": [
                  "left_control"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "page_up"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "backslash",
            "modifiers": {
              "mandatory": [
                  "left_control"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "page_down"
            }
          ]
        }
      ]
    }
  ]
}

え?Windows???

XPの時は、猫まねき とか 窓使いの憂鬱 を使っていましたが、Windows10では動かないんじゃないかなぁ?

8
8
0

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
8
8