aboutsummaryrefslogtreecommitdiff
path: root/README
blob: 95bc3a260391c689cb0b50fcb2d20a944a759677 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Git Modeline
============

This is a vim plugin which reads modelines from the git config and sets it to
the current buffer.
To set a modeline in the git config you can do it with the following command:

  git config --add vim.modeline "tabstop=8 shiftwidth=8 noexpandtab cindent"

To set a format specific modeline (you'll need the filetype plugin on), just
define a vim.modeline.<FT> git config entry.

Example, C indented with 4 spaces, but Makefile with 8 space tabs:

  git config --add vim.modeline-c "ts=4 sw=4 et"
  git config --add vim.modeline-make "ts=8 sw=8 noet"

If no filetype specific entry can be found it will use the default modeline.

The allowed modelines are defined in a variable and can be overwritten and
extended by setting the following in your .vimrc:

  let g:git_modeline_allowed_items = [
              \ "textwidth",   "tw",
              \ "softtabstop", "sts",
              \ "tabstop",     "ts",
              \ "shiftwidth",  "sw",
              \ "expandtab",   "et",   "noexpandtab", "noet",
              \ "filetype",    "ft",
              \ "foldmethod",  "fdm",
              \ "readonly",    "ro",   "noreadonly", "noro",
              \ "rightleft",   "rl",   "norightleft", "norl",
              \ "cindent",     "cin",  "nocindent", "nocin",
              \ "smartindent", "si",   "nosmartindent", "nosi",
              \ "autoindent",  "ai",   "noautoindent", "noai",
              \ "spell",
              \ "spelllang"
              \ ]