etc/nvim/lua/indent.lua

52 lines
1 KiB
Lua
Raw Normal View History

2023-08-27 13:31:42 +03:00
2023-09-01 14:13:12 +03:00
-- Golang, C based configuration
2023-08-27 13:31:42 +03:00
vim.o.autoindent = true
2023-09-10 12:10:15 +03:00
vim.o.foldmethod = 'indent'
2023-08-27 13:31:42 +03:00
createAutoCmd = vim.api.nvim_create_autocmd
2023-09-10 12:10:15 +03:00
-- Basic thing for compiling languages.
2023-08-27 13:31:42 +03:00
createAutoCmd({
2023-09-10 13:36:08 +03:00
"BufNewFile",
"BufRead",
2023-08-27 13:31:42 +03:00
},{
2023-09-10 13:36:08 +03:00
pattern = "*.go,*.c,*.cc,*.C,*.cpp,*.rs,*.mk",
callback = function()
local buf = vim.bo[vim.api.nvim_get_current_buf()]
2023-09-10 12:10:15 +03:00
vim.o.expandtab = false
vim.o.tabstop = 4
vim.o.shiftwidth = 4
2023-09-10 13:36:08 +03:00
end,
2023-09-10 12:10:15 +03:00
})
createAutoCmd({
2023-09-10 13:36:08 +03:00
"BufNewFile",
"BufRead",
2023-09-10 12:10:15 +03:00
},{
2023-09-10 13:36:08 +03:00
pattern = "*.txt,*.lua,*.js,*.jsx,*.scss,*.css,*.sass,*.html,*.htmlx,*.tmpl,*.tpl,*.yml,*.yaml,*.toml,*.tml",
callback = function()
local buf = vim.bo[vim.api.nvim_get_current_buf()]
buf.expandtab = true
buf.shiftwidth=2
buf.tabstop=2
buf.softtabstop = 0
end,
2023-08-27 13:31:42 +03:00
})
createAutoCmd({
2023-09-10 13:36:08 +03:00
"BufNewFile",
"BufRead",
2023-08-27 13:31:42 +03:00
},{
2023-09-10 13:36:08 +03:00
pattern = "*.md,*.py",
callback = function()
local buf = vim.bo[vim.api.nvim_get_current_buf()]
buf.expandtab = true
buf.shiftwidth=4
buf.tabstop=4
buf.softtabstop = 0
end,
2023-08-27 13:31:42 +03:00
})
2023-09-10 12:10:15 +03:00