LoginSignup
0
0

More than 5 years have passed since last update.

EvilでのW/Bの挙動の変更

Last updated at Posted at 2014-10-01

EvilでのW/B(大文字のwとb)は日本語を書いていると思わぬところにすっ飛んでしまうので、変更してみました。

~/.emacs.d/init.elで

(custom-set-variables 
   '(evil-bigword "^ \t\r\n、。;?!?!を" ))

とするだけでした。デフォルトは「^ \t\r\n」なので、日本語を書いていると思わぬところにすっ飛んでしまうわけです。

ここでは「、。;?!?!を」を追記していますが、この辺はデフォルトも含めて好みに応じて変更していただければよろしいかと思います。

MS-DOSのjstevieはitojunさんが「ひらがな」と「漢字」の間や「ひらがな」と「ASCII文字」の間で止まるようにして下さった、と何となくですが記憶にあります。たとえば「漢字」と「ひらがな」が並んでいる場合にはそこで止まるのではなく、通過して次の「漢字」のところで止まります。日本語の文節を意識して作られているのですね。

この仕様は非常に便利で自然だと思いますが、現在のEvilのちょっとしたカスタマイズの範囲内では無理なようです。

付記

現在(2014/11/23)のバージョンのEvilではうまく動かなくなっています。

(defun forward-evil-WORD (&optional count)
  "Move forward COUNT \"WORDS\".
Moves point COUNT WORDS forward or (- COUNT) WORDS backward if
COUNT is negative. Point is placed after the end of the WORD (if
forward) or at the first character of the WORD (if backward). A
WORD is a sequence of non-whitespace characters
'[^\\n\\r\\t\\f ]', or an empty line matching ^$."
  (evil-forward-nearest count
                        #'(lambda (&optional cnt)
                            (evil-forward-chars evil-bigword cnt))
                        #'forward-evil-empty-line))

とinit.elに書くことで解決しました。

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