Emacs: Set tab indent for just one file on the fly

前端 未结 6 1526
无人及你
无人及你 2021-02-01 17:02

I work on an open source project where the creator sets his tab-indents to 2 spaces.

I\'d like to just enable it on the fly for the one file I work on and not other fil

6条回答
  •  感情败类
    2021-02-01 18:03

    Create a file ".dir-locals.el" in the project's directory and fill it like this:

    ((nil . ((tab-width . 2))))
    

    This will take care of setting tab-width automatically and you don't have to modify the actual file (which is likely version-controlled.)

    See the manual for more information about the format. I believe this requires Emacs 23.

提交回复
热议问题