aboutsummaryrefslogtreecommitdiff
path: root/lua/filetype_handing.lua
blob: 3cf00ca6bd5c320c5da463780f64a5cb4d3ee51f (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
local autocmd = vim.api.nvim_create_autocmd

-- Filetypes.
vim.cmd("filetype on")
vim.cmd("filetype plugin on")
vim.cmd("filetype indent on")

-- Python.
autocmd("Filetype", 
{pattern="python", command="set nocindent tabstop=4 shiftwidth=4 expandtab softtabstop=4"
})

-- Text files.
autocmd("Filetype",
{pattern="*.txt", command="set formatoptions+=t textwidth=72 nocindent noexpandtab shiftwidth=8 tabstop=8 softtabstop=8"
})

-- C and c++.
autocmd("Filetype",
{pattern={"c", "cpp", "slang"},
command="set cindent tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab"
})

-- Only c.
autocmd("Filetype",
{pattern="c", command="set formatoptions+=ro"
})

-- Assembly.
autocmd("Filetype",
{pattern="asm", command="set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab"
})

-- Lua.
autocmd("Filetype",
{pattern="lua", command="set cindent tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab"
})

-- css.
autocmd("Filetype",
{pattern="css", command="set smartindent"
})

-- html.
autocmd("Filetype",
{pattern="html", command="set formatoptions+=tl"
})

-- html and css.
autocmd("Filetype",
{pattern={"html", "css"}, command="set noexpandtab tabstop=2"
})

-- Make files.
autocmd("Filetype",
{pattern="make", command="set nocindent noexpandtab shiftwidth=8 tabstop=8 softtabstop=8"
})