|
|
|
-- General configuration
|
|
|
|
vim.g.ale_linters = {
|
|
|
|
python = {'black', 'flake8'},
|
|
|
|
c = {'clang-format'},
|
|
|
|
cpp = {'clang-format'}
|
|
|
|
}
|
|
|
|
|
|
|
|
vim.g.ale_fixers = {
|
|
|
|
['*'] = {'remove_trailing_lines', 'trim_whitespace'}
|
|
|
|
}
|
|
|
|
|
|
|
|
vim.g.ale_fix_on_save = 1
|
|
|
|
|
|
|
|
-- LSP Configurations
|
|
|
|
require("mason").setup({
|
|
|
|
ui = {
|
|
|
|
icons = {
|
|
|
|
package_installed = "✓",
|
|
|
|
package_pending = "➜",
|
|
|
|
package_uninstalled = "✗"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
require("mason-lspconfig").setup()
|
|
|
|
|
|
|
|
-- Auto-format code on save
|
|
|
|
vim.api.nvim_create_autocmd({"BufWritePre"}, {
|
|
|
|
callback = function()
|
|
|
|
vim.lsp.buf.format()
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Treesitter config.
|
|
|
|
require'nvim-treesitter.configs'.setup {
|
|
|
|
ensure_installed = {
|
|
|
|
"c",
|
|
|
|
"lua",
|
|
|
|
"markdown",
|
|
|
|
"python",
|
|
|
|
"rust",
|
|
|
|
"toml",
|
|
|
|
"query",
|
|
|
|
"vim",
|
|
|
|
"vimdoc",
|
|
|
|
},
|
|
|
|
|
|
|
|
-- Prefer asynchronous install for ensure_installed.
|
|
|
|
sync_install = false,
|
|
|
|
auto_install = true,
|
|
|
|
|
|
|
|
highlight = {
|
|
|
|
enable = true,
|
|
|
|
|
|
|
|
-- Disable for excessively large files.
|
|
|
|
disable = function(lang, buf)
|
|
|
|
local max_filesize = 100 * 1024 -- 100 KB
|
|
|
|
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
|
|
|
if ok and stats and stats.size > max_filesize then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- Disable vim regex highlighting. May intefer with some `indent` style stuff.
|
|
|
|
additional_vim_regex_highlighting = false,
|
|
|
|
},
|
|
|
|
ident = {enable = true },
|
|
|
|
rainbow = {
|
|
|
|
enable = true,
|
|
|
|
extended_mode = true,
|
|
|
|
max_file_lines = nil,
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|