diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..251e77fe --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: +- repo: https://github.com/JohnnyMorganz/StyLua + rev: v0.16.1 + hooks: + - id: stylua diff --git a/config/nvim/init.lua b/config/nvim/init.lua index f1761f5b..7370a2fe 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -13,7 +13,7 @@ if not vim.loop.fs_stat(lazypath) then } end vim.opt.rtp:prepend(lazypath) -require("lazy").setup("plugins", require("config.lazy")) +require("lazy").setup("plugins", require "config.lazy") -- Set vim options require "config" diff --git a/config/nvim/lua/config/mason.lua b/config/nvim/lua/config/mason.lua new file mode 100644 index 00000000..7707a8d7 --- /dev/null +++ b/config/nvim/lua/config/mason.lua @@ -0,0 +1,13 @@ +return { + pip = { + upgrade_pip = true, + }, + ui = { + border = "single", + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, +} diff --git a/config/nvim/lua/config/mason_lspconfig.lua b/config/nvim/lua/config/mason_lspconfig.lua new file mode 100644 index 00000000..6fdde511 --- /dev/null +++ b/config/nvim/lua/config/mason_lspconfig.lua @@ -0,0 +1,4 @@ +return { + ensure_installed = { "lua_ls" }, + automatic_installation = true, +} diff --git a/config/nvim/lua/lsp/config.lua b/config/nvim/lua/lsp/config.lua index f71fc178..4cd03cb8 100644 --- a/config/nvim/lua/lsp/config.lua +++ b/config/nvim/lua/lsp/config.lua @@ -14,34 +14,22 @@ for type, icon in pairs(signs) do vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) end +require("mason").setup() +require("mason-lspconfig").setup(require "config.mason_lspconfig") require("neodev").setup() -local lspconfig = require "lspconfig" M.on_attach = require "lsp.attach" M.lsp_flags = require "lsp.flags" M.capabilities = require("cmp_nvim_lsp").default_capabilities() -lspconfig.pyright.setup { - on_attach = M.on_attach, - flags = M.lsp_flags, - capabilities = M.capabilities, +require("mason-lspconfig").setup_handlers { + function(server_name) + require("lspconfig")[server_name].setup { + on_attach = M.on_attach, + flags = M.lsp_flags, + capabilities = M.capabilities, + } + end, } -lspconfig.fortls.setup { - on_attach = M.on_attach, - flags = M.lsp_flags, - capabilities = M.capabilities, -} - -lspconfig.lua_ls.setup { - on_attach = M.on_attach, - flags = M.lsp_flags, - capabilities = M.capabilities, -} - -lspconfig.texlab.setup { - on_attach = M.on_attach, - flags = M.lsp_flags, - capabilities = M.capabilities, -} return M diff --git a/config/nvim/lua/plugins/mason.lua b/config/nvim/lua/plugins/mason.lua index 60d023fd..e23604e4 100644 --- a/config/nvim/lua/plugins/mason.lua +++ b/config/nvim/lua/plugins/mason.lua @@ -1,5 +1,15 @@ return { - "williamboman/mason.nvim", - lazy = false, - config = function() require("mason").setup() end, + { + "williamboman/mason.nvim", + lazy = false, + config = function() require("mason").setup(require "config.mason") end, + }, + { + "williamboman/mason-lspconfig.nvim", + dependencies = { + "williamboman/mason.nvim", + "neovim/nvim-lspconfig", + }, + lazy = true, + }, } diff --git a/pkglist.txt b/pkglist.txt index ce9e3bf2..91fcb68a 100644 --- a/pkglist.txt +++ b/pkglist.txt @@ -1,11 +1,7 @@ fzf lazygit -lua-language-server neovim -prettier python -python-black -python-isort python-pip python-pipx python-poetry @@ -13,9 +9,9 @@ python-pre-commit python-pynvim python-virtualenv ripgrep -shfmt -stylua tmux tree-sitter wezterm zsh +rust +npm