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

web-mode のインデント設定

More than 5 years have passed since last update.

tl;dr

html とか twig 書くのに web-mode を使ってたけど、ずっと放置してたので久々にバージョンアップ。
したら、インデントが狂い始めちゃったので、そんときのメモ

バージョン上げる前

http://qiita.com/elbowroomer/items/30bdf1c062a6ed3fa488
とかにもあるように

(defun web-mode-hook ()
  "Hooks for Web mode."
  (setq web-mode-html-offset   4)
(add-hook 'web-mode-hook 'web-mode-hook)

な設定でいける。完璧。パーフェクト。

バージョン上げた後

上のように記述した .emacs での設定が反映されず、インデントが 2 のまま。
マジ泣ける。

原因は単純明快。web-mode-html-offset がなくなって、web-mode-markup-indent-offset になってたから。

(defun web-mode-hook ()
  "Hooks for Web mode."
  (setq web-mode-markup-indent-offset   4)
(add-hook 'web-mode-hook 'web-mode-hook)

で解決。

なんというか...

  • Indentation

HTML offset indentation

(setq web-mode-markup-indent-offset 2)

via http://web-mode.org

ドキュメントにはちゃんと書いてあった...orz

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
ユーザーは見つかりませんでした