LoginSignup
10
9

More than 5 years have passed since last update.

nginx関連ファイルに自動でnginx-modeを適用

Last updated at Posted at 2013-05-09

nginx-modeはELPAまたはGithub ajc / nginx-modeから入手。

通常は.confファイルを開くとconf-modeが適用されます。
confファイルであり、かつパスに"nginx"の文字が含まれているとnginx-modeを適用する設定です。

nginxフォルダ以下で複数のconfファイルに毎回 "M-x nginx-mode" としなくてもいいので便利かもしれません。

(require 'nginx-mode)

;;(add-to-list 'auto-mode-alist '("nginx\\.conf$" . nginx-mode))
(add-hook 'conf-mode-hook
          (lambda ()
            (when (string-match "nginx" (buffer-file-name))
              (nginx-mode))))

別法:

(require 'nginx-mode)
(add-to-list 'auto-mode-alist '("nginx\\(.*\\).conf[^/]*$" . nginx-mode))
10
9
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
10
9