Initial commit

This commit is contained in:
Neil Hanlon 2023-03-20 18:13:41 -04:00
commit d4d1f1ece2
Signed by: neil
GPG Key ID: 705BC21EC3C70F34
8 changed files with 279 additions and 0 deletions

23
chadrc.lua Normal file
View File

@ -0,0 +1,23 @@
---@type ChadrcConfig
local M = {}
-- Path to overriding theme and highlights files
local highlights = require "custom.highlights"
M.ui = {
theme = "onedark",
theme_toggle = { "onedark", "one_light" },
hl_override = highlights.override,
hl_add = highlights.add,
nvdash = {
load_on_startup = true
}
}
M.plugins = "custom.plugins"
-- check core.mappings for table structure
M.mappings = require "custom.mappings"
return M

28
configs/lspconfig.lua Normal file
View File

@ -0,0 +1,28 @@
local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
local lspconfig = require "lspconfig"
-- if you just want default config for the servers then put them in a table
-- local servers = { "html", "cssls", "pyright", "ansiblels", "bashls", "yamlls", "sqlls" }
-- for _, lsp in ipairs(servers) do
-- lspconfig[lsp].setup {
-- on_attach = on_attach,
-- capabilities = capabilities,
-- }
-- end
lspconfig.gopls.setup {
-- on_attach = lspconfig.on_attach,
-- capabilities = lspconfig.capabilities,
cmd = { "gopls", "serve" },
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
},
},
}

57
configs/null-ls.lua Normal file
View File

@ -0,0 +1,57 @@
local present, null_ls = pcall(require, "null-ls")
if not present then
return
end
local b = null_ls.builtins
local sources = {
-- webdev stuff
b.formatting.deno_fmt,
b.formatting.prettier,
b.code_actions.eslint_d,
-- python stuff
b.diagnostics.pylint,
b.formatting.reorder_python_imports,
b.formatting.black,
-- Lua
b.formatting.stylua,
-- Shell
b.formatting.shfmt,
b.diagnostics.shellcheck.with { diagnostics_format = "#{m} [#{c}]" },
-- psql
b.formatting.sqlfluff.with {
extra_args = { "--dialect", "postgres" },
},
b.diagnostics.sqlfluff.with {
extra_args = { "--dialect", "postgres" },
},
-- Generic
-- b.formatting.remark,
-- b.diagnostics.semgrep,
b.code_actions.refactoring,
b.diagnostics.yamllint,
-- golang
b.diagnostics.golangci_lint,
b.formatting.gofmt,
b.formatting.goimports,
b.formatting.goimports_reviser,
b.formatting.protolint,
-- bazel
b.diagnostics.buildifier,
b.formatting.buildifier,
}
null_ls.setup {
debug = true,
sources = sources,
}

62
configs/overrides.lua Normal file
View File

@ -0,0 +1,62 @@
local M = {}
M.treesitter = {
ensure_installed = {
"bash",
"c",
"css",
"go",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"toml",
"vim",
"yaml",
},
indent = {
enable = true,
disable = {
"python"
},
},
}
M.mason = {
ensure_installed = {
-- lua stuff
"lua-language-server",
"stylua",
-- web dev stuff
"css-lsp",
"html-lsp",
"typescript-language-server",
"deno",
},
}
-- git support in nvimtree
M.nvimtree = {
git = {
enable = true,
},
view = {
width = 25,
adaptive_size = true
},
renderer = {
highlight_git = true,
symlink_destination = false,
icons = {
show = {
git = true,
},
},
},
}
return M

19
highlights.lua Normal file
View File

@ -0,0 +1,19 @@
-- To find any highlight groups: "<cmd> Telescope highlights"
-- Each highlight group can take a table with variables fg, bg, bold, italic, etc
-- base30 variable names can also be used as colors
local M = {}
---@type Base46HLGroupsList
M.override = {
Comment = {
italic = true,
},
}
---@type HLTable
M.add = {
-- NvimTreeOpenedFolderName = { fg = "green", bold = true },
}
return M

29
init.lua Normal file
View File

@ -0,0 +1,29 @@
-- local autocmd = vim.api.nvim_create_autocmd
-- Auto resize panes when resizing nvim window
-- autocmd("VimResized", {
-- pattern = "*",
-- command = "tabdo wincmd =",
-- })
vim.api.nvim_create_augroup('numbertoggle', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'FocusGained', 'InsertLeave', 'WinEnter' }, {
group = 'numbertoggle',
pattern = '*',
command = 'if &nu && mode() != "i" | set rnu | endif'
})
vim.api.nvim_create_autocmd({ 'BufLeave', 'FocusLost', 'InsertEnter', 'WinLeave' }, {
group = 'numbertoggle',
pattern = '*',
command = 'if &nu | set nornu | endif'
})
vim.api.nvim_create_autocmd({'BufWritePre'}, {
pattern = "<buffer>",
command = 'lua vim.lsp.buf.format()'
})
vim.api.nvim_create_autocmd({'BufWritePre'}, {
pattern = "*.go",
command = ":silent! lua require('go.format').gofmt()"
})

10
mappings.lua Normal file
View File

@ -0,0 +1,10 @@
---@type MappingsTable
local M = {}
M.general = {
n = {
[";"] = { ":", "enter command mode", opts = { nowait = true } },
},
}
return M

51
plugins.lua Normal file
View File

@ -0,0 +1,51 @@
local overrides = require("custom.configs.overrides")
---@type NvPluginSpec[]
local plugins = {
{
"neovim/nvim-lspconfig",
dependencies = {
{
"jose-elias-alvarez/null-ls.nvim",
config = function()
require "custom.configs.null-ls"
end,
},
},
config = function()
require "plugins.configs.lspconfig"
require "custom.configs.lspconfig"
end, -- Override to setup mason-lspconfig
},
{
"williamboman/mason.nvim",
opts = overrides.mason
},
{
"nvim-treesitter/nvim-treesitter",
opts = overrides.treesitter,
},
{
"nvim-tree/nvim-tree.lua",
opts = overrides.nvimtree,
},
{
"folke/which-key.nvim",
enabled = true,
},
{
"intrntbrn/awesomewm-vim-tmux-navigator"
},
{
"hashivim/vim-terraform",
config = function()
vim.g.terraform_align = 1
vim.g.terraform_fmt_on_save = 1
vim.g.hcl_align = 1
end,
},
}
return plugins