summaryrefslogtreecommitdiff
path: root/lua/filetypes.lua
blob: 78a2c70e1a258846b5f0839b8fd65d8f3afa663f (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
--
-- Configuration Tools
--
local ct = require('conftool')
local defs = require('defaults')
--
-- Templates
--
ct.augroup('templates',
	{'BufNewFile', '*.c', '0r', defs.template_dir .. '/c_stdio.c'},
	{'BufNewFile', '*.cpp', '0r', defs.template_dir .. '/cpp_iostream.cpp'},
	{'BufNewFile', '*.go', '0r', defs.template_dir .. '/go.go'},
	{'BufNewFile', '*.html', '0r', defs.template_dir .. '/html.html'},
	{'BufNewFile', '*.html', '0r', defs.template_dir .. '/html.html'},
	{'BufNewFile', '*.py', '0r', defs.template_dir .. '/py.py'},
	{'BufNewFile', '*.sh', '0r', defs.template_dir .. '/sh.sh'}
)

--
-- FileType based Settings
--
ct.augroup('filetypeSettings',
	{'FileType', 'python',		'setlocal', 'tabstop=4 shiftwidth=4 expandtab'},
	{'FileType', 'html',		'setlocal', 'tabstop=2 shiftwidth=2'},
	{'FileType', 'javascript',	'setlocal', 'tabstop=2 shiftwidth=2'},
	{'FileType', 'typescript',	'setlocal', 'tabstop=2 shiftwidth=2'},
	{'FileType', 'typescriptreact','setlocal', 'tabstop=2 shiftwidth=2'},
	{'FileType', 'vue',			'setlocal', 'tabstop=2 shiftwidth=2'}
)

--
-- Misc.
--
vim.cmd 'autocmd BufWritePost *.go,*.py,*.js,*.ts,*tsx,*.tex LspFormat' -- run lspformat when saving in go