9
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ファイル作成時にテンプレートを挿入する

Posted at

プログラムなどで新規にファイルを作成する際に、HTMLであれば<html><head></head>...</html>や、rubyであれば先頭に#!/usr/bin/env rubyなど決まった内容をいれる場合が結構あるかと思います。auto-insert-modeを使うと自動でそういった内容を作成時に自動的にいれてくれます。

~/.emacs.d/init.el
(auto-insert-mode)
(setq auto-insert-directory "~/.emacs.d/insert/")
(define-auto-insert "\\.rb$" "ruby-template.rb")

.rbのファイルを新しく作成した際に、ruby-template.rbの内容が自動的に挿入されます。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?