From 6a6580cef9c28c54fc374082c0a0042ba6945087 Mon Sep 17 00:00:00 2001 From: Adam <24621027+adoyle0@users.noreply.github.com> Date: Mon, 8 Jan 2024 18:18:08 -0500 Subject: [PATCH] more nvim --- configs/nvim/lua/cmp-setup.lua | 1 - configs/nvim/lua/lazy-plugins.lua | 42 +++++++++++++++++++++++++-- configs/nvim/lua/lsp-setup.lua | 25 +++++++++++----- configs/nvim/lua/treesitter-setup.lua | 9 ++++-- 4 files changed, 64 insertions(+), 13 deletions(-) diff --git a/configs/nvim/lua/cmp-setup.lua b/configs/nvim/lua/cmp-setup.lua index fd0c727..6172e41 100644 --- a/configs/nvim/lua/cmp-setup.lua +++ b/configs/nvim/lua/cmp-setup.lua @@ -2,7 +2,6 @@ -- See `:help cmp` local cmp = require 'cmp' local luasnip = require 'luasnip' -local lspkind = require('lspkind') require('luasnip.loaders.from_vscode').lazy_load() luasnip.config.setup {} diff --git a/configs/nvim/lua/lazy-plugins.lua b/configs/nvim/lua/lazy-plugins.lua index 4d5167c..0b245a6 100644 --- a/configs/nvim/lua/lazy-plugins.lua +++ b/configs/nvim/lua/lazy-plugins.lua @@ -26,7 +26,7 @@ require('lazy').setup({ -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, + { 'j-hui/fidget.nvim', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', @@ -51,7 +51,7 @@ require('lazy').setup({ }, -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, + { 'folke/which-key.nvim', opts = {} }, { -- Adds git related signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', @@ -183,6 +183,42 @@ require('lazy').setup({ }, }, + { + 'stevearc/conform.nvim', + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + local conform = require 'conform' + + conform.setup { + formatters_by_ft = { + bash = { 'beautysh', 'shellharden' }, + css = { { 'prettierd', 'prettier' } }, + html = { 'htmlbeautifier' }, + javascript = { { 'prettierd', 'prettier' } }, + javascriptreact = { { 'prettierd', 'prettier' } }, + json = { { 'prettierd', 'prettier' } }, + kotlin = { 'ktlint' }, + lua = { 'stylua' }, + markdown = { { 'prettierd', 'prettier' } }, + rust = { 'rustfmt' }, + scss = { { 'prettierd', 'prettier' } }, + sh = { 'shellharden', 'beautysh' }, + toml = { 'taplo' }, + typescript = { { 'prettierd', 'prettier' } }, + typescriptreact = { { 'prettierd', 'prettier' } }, + yaml = { 'yamlfix' }, + }, + } + + vim.keymap.set({ 'n', 'v' }, 'f', function() + conform.format { + lsp_fallback = true, + async = true, + timeout_ms = 500, + } + end, { desc = 'Format file or range (in visual mode)' }) + end, + }, { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', @@ -192,7 +228,7 @@ require('lazy').setup({ build = ':TSUpdate', }, - require 'kickstart.plugins.autoformat', + -- require 'kickstart.plugins.autoformat', -- require 'kickstart.plugins.debug', -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins }, {}) diff --git a/configs/nvim/lua/lsp-setup.lua b/configs/nvim/lua/lsp-setup.lua index 2675a81..bc492fc 100644 --- a/configs/nvim/lua/lsp-setup.lua +++ b/configs/nvim/lua/lsp-setup.lua @@ -75,13 +75,14 @@ require('mason-lspconfig').setup() -- If you want to override the default filetypes that your language server will attach to you can -- define the property 'filetypes' to the map in question. local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - -- tsserver = {}, - -- html = { filetypes = { 'html', 'twig', 'hbs'} }, - + bashls = {}, + cssls = {}, + docker_compose_language_service = {}, + dockerls = {}, + gopls = {}, + html = {}, + jsonls = {}, + kotlin_language_server = {}, lua_ls = { Lua = { workspace = { checkThirdParty = false }, @@ -90,6 +91,15 @@ local servers = { -- diagnostics = { disable = { 'missing-fields' } }, }, }, + marksman = {}, + mutt_ls = {}, + pyright = {}, + rust_analyzer = {}, + tailwindcss = {}, + tsserver = {}, + yamlls = {}, + zls = {}, + } -- Setup neovim lua configuration @@ -104,6 +114,7 @@ local mason_lspconfig = require 'mason-lspconfig' mason_lspconfig.setup { ensure_installed = vim.tbl_keys(servers), + automatic_installation = true, } mason_lspconfig.setup_handlers { diff --git a/configs/nvim/lua/treesitter-setup.lua b/configs/nvim/lua/treesitter-setup.lua index dd0c1d1..5ca8700 100644 --- a/configs/nvim/lua/treesitter-setup.lua +++ b/configs/nvim/lua/treesitter-setup.lua @@ -4,12 +4,17 @@ vim.defer_fn(function() require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, + ensure_installed = { + 'markdown_inline' -- Markdown has/needs(atm) 2 packages and this one isn't installed automatically + }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = true, - highlight = { enable = true }, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, indent = { enable = true }, incremental_selection = { enable = true,