initial config

This commit is contained in:
Fabio Montefuscolo 2024-02-26 15:54:13 +01:00
commit e01b9b8901
Signed by: fabiomontefuscolo
GPG key ID: B98DA1C6A4DE48B5
5 changed files with 87 additions and 0 deletions

8
chadrc.lua Normal file
View file

@ -0,0 +1,8 @@
---@type ChadrcConfig
local M = {}
M.ui = { theme = 'chadracula' }
M.plugins = "custom.plugins"
M.mappings = require "custom.mappings"
return M

13
configs/lspconfig.lua Normal file
View file

@ -0,0 +1,13 @@
local config = require("plugins.configs.lspconfig")
local on_attach = config.on_attach
local capabilities = config.capabilities
local lspconfig = require("lspconfig")
lspconfig.pyright.setup({
on_attach = on_attach,
capabilities = capabilities,
filetypes = {"python"},
})

27
configs/null-ls.lua Normal file
View file

@ -0,0 +1,27 @@
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local null_ls = require('null-ls')
local opts = {
sources = {
null_ls.builtins.formatting.black,
null_ls.builtins.diagnostics.mypy,
null_ls.builtins.diagnostics.ruff,
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({
group = augroup,
buffer = bufnr,
})
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end,
})
end
end,
}
return opts

14
mappings.lua Normal file
View file

@ -0,0 +1,14 @@
local M = {}
M.general = {
n = {
["<A-j>"] = { "10+", "Move cursor forward by 10 lines"},
["<A-k>"] = { "10-", "Move cursor backward by 10 lines"},
},
v = {
["<A-j>"] = { "10+", "Move cursor forward by 10 lines"},
["<A-k>"] = { "10-", "Move cursor backward by 10 lines"},
},
}
return M

25
plugins.lua Normal file
View file

@ -0,0 +1,25 @@
local plugins = {
{
"nvimtools/none-ls.nvim",
ft = {"python"},
opts = function()
return require "custom.configs.null-ls"
end,
},
{
"neovim/nvim-lspconfig",
config = function()
require "plugins.configs.lspconfig"
require "custom.configs.lspconfig"
end,
},
{
"github/copilot.vim",
lazy=false
},
{
"karoliskoncevicius/vim-sendtowindow",
lazy=false
},
}
return plugins