]> git.huck.website - nvim.git/commitdiff
added: latex lsp
authorHuck Boles <huck.boles@metalplasmatechnology.com>
Fri, 20 Oct 2023 16:52:56 +0000 (09:52 -0700)
committerHuck Boles <huck.boles@metalplasmatechnology.com>
Fri, 20 Oct 2023 16:52:56 +0000 (09:52 -0700)
lua/huck/settings.lua
lua/plugins/cmp.lua
lua/plugins/lsp.lua

index f9cf0d3ab6ae709fc20f00cedb314e2f65172415..b72c1a4e378bf62c25041ecbbcf9bfcefddf83d2 100644 (file)
@@ -32,7 +32,7 @@ vim.o.history = 10000
 vim.o.showmatch = true
 
 vim.o.autochdir = true
-vim.o.browsedir = 'buffer'
+-- vim.o.browsedir = 'buffer'
 vim.o.cdhome = true
 
 vim.o.wrapscan = true
index d60d6dcd6b44485ea18d3d4c558d5e3a75beb34e..ffb3899058df408f9d618bdff5a63c300fd3fb5f 100644 (file)
@@ -61,6 +61,7 @@ return {
 
             local capabilities = require('cmp_nvim_lsp').default_capabilities()
             require('lspconfig')['rust_analyzer'].setup { capabilities = capabilities }
+            require('lspconfig')['texlab'].setup { capabilities = capabilities }
         end
     },
 }
index 90ed57227dd4ba4b60914e729e56ff44784af746..03ac7a6005ece84f50e5d95b9b266073fecf6f77 100644 (file)
 local border = {
-    { "┏", "FloatBorder" },
-    { "━", "FloatBorder" },
-    { "┓", "FloatBorder" },
-    { "┃", "FloatBorder" },
-    { "┛", "FloatBorder" },
-    { "━", "FloatBorder" },
-    { "┗", "FloatBorder" },
-    { "┃", "FloatBorder" },
+       { "┏", "FloatBorder" },
+       { "━", "FloatBorder" },
+       { "┓", "FloatBorder" },
+       { "┃", "FloatBorder" },
+       { "┛", "FloatBorder" },
+       { "━", "FloatBorder" },
+       { "┗", "FloatBorder" },
+       { "┃", "FloatBorder" },
 }
 
 local keybinds = function()
-    vim.keymap.set('n', '<LEADER>n', vim.diagnostic.goto_next)
-    vim.keymap.set('n', '<LEADER>p', vim.diagnostic.goto_prev)
-    vim.keymap.set('n', '<LEADER>r', vim.lsp.buf.rename)
-    vim.keymap.set('n', '<LEADER>a', vim.lsp.buf.code_action)
-    vim.keymap.set('n', '<LEADER>k', vim.lsp.buf.hover)
-    vim.keymap.set('n', '<LEADER>K', vim.diagnostic.open_float)
-    vim.keymap.set('n', '<C-]>', vim.lsp.buf.definition)
+       vim.keymap.set('n', '<LEADER>n', vim.diagnostic.goto_next)
+       vim.keymap.set('n', '<LEADER>p', vim.diagnostic.goto_prev)
+       vim.keymap.set('n', '<LEADER>r', vim.lsp.buf.rename)
+       vim.keymap.set('n', '<LEADER>a', vim.lsp.buf.code_action)
+       vim.keymap.set('n', '<LEADER>k', vim.lsp.buf.hover)
+       vim.keymap.set('n', '<LEADER>K', vim.diagnostic.open_float)
+       vim.keymap.set('n', '<C-]>', vim.lsp.buf.definition)
 
-    -- toggle lsp diagnostics
-    vim.keymap.set('n', '<LEADER>d',
-        function()
-            if vim.g.visible_diagnostics then
-                vim.diagnostic.disable()
-                vim.g.visible_diagnostics = false
-            else
-                vim.diagnostic.enable()
-                vim.g.visible_diagnostics = true
-            end
-        end
-    )
+       -- toggle lsp diagnostics
+       vim.keymap.set('n', '<LEADER>d',
+               function()
+                       if vim.g.visible_diagnostics then
+                               vim.diagnostic.disable()
+                               vim.g.visible_diagnostics = false
+                       else
+                               vim.diagnostic.enable()
+                               vim.g.visible_diagnostics = true
+                       end
+               end
+       )
 end
 
 return {
-    {
-        "williamboman/mason-lspconfig",
-        dependencies = {
-            "nvim-treesitter",
-            {
-                "williamboman/mason.nvim",
-                build = ":MasonUpdate",
-                config = function()
-                    require("mason").setup()
-                end,
-            },
-        },
-        version = "1.3.0",
-        config = function()
-            require("mason-lspconfig").setup({
-                automatic_installation = false,
-                ensure_installed = { "clangd", "lua_ls", "solargraph" },
-            })
-        end,
-    },
-
-    {
-        "neovim/nvim-lspconfig",
-        event = { "BufReadPre", "BufNewFile" },
-        lazy = false,
-        dependencies = {
-            "mason-lspconfig",
-            "nvim-cmp",
-            "nvim-treesitter",
-            "Maan2003/lsp_lines.nvim",
-        },
-        config = function()
-            -- servers to setup
-            local lsp = require("lspconfig")
+       {
+               "williamboman/mason-lspconfig",
+               dependencies = {
+                       "nvim-treesitter",
+                       {
+                               "williamboman/mason.nvim",
+                               build = ":MasonUpdate",
+                               config = function()
+                                       require("mason").setup()
+                               end,
+                       },
+               },
+               version = "1.3.0",
+               config = function()
+                       require("mason-lspconfig").setup({
+                               automatic_installation = false,
+                               ensure_installed = {},
+                       })
+               end,
+       },
 
-            lsp.bashls.setup({ on_attach = keybinds })
-            lsp.clangd.setup({ on_attach = keybinds })
-            lsp.cssls.setup({ on_attach = keybinds })
-            lsp.html.setup({ on_attach = keybinds })
-            lsp.lua_ls.setup({ on_attach = keybinds })
-            lsp.solargraph.setup({ on_attach = keybinds })
+       {
+               "neovim/nvim-lspconfig",
+               event = { "BufReadPre", "BufNewFile" },
+               lazy = false,
+               dependencies = {
+                       "mason-lspconfig",
+                       "nvim-cmp",
+                       "nvim-treesitter",
+                       "Maan2003/lsp_lines.nvim",
+               },
+               config = function()
+                       -- servers to setup
+                       local lsp = require("lspconfig")
 
-            -- diagnostic settings
-            vim.lsp.diagnostics = {
-                signs = true,
-                underline = true,
-                update_in_insert = false,
-                severity_sort = { reverse = false },
-            }
+                       -- diagnostic settings
+                       vim.lsp.diagnostics = {
+                               signs = true,
+                               underline = true,
+                               update_in_insert = false,
+                               severity_sort = { reverse = false },
+                       }
 
-            -- don't override treesitter colors
-            vim.highlight.priorities.semantic_tokens = 95
+                       -- don't override treesitter colors
+                       vim.highlight.priorities.semantic_tokens = 95
 
-            -- custom signs
-            local signs = { Error = ">>", Warn = "> ", Hint = "- ", Info = "* " }
-            for type, icon in pairs(signs) do
-                local hl = "DiagnosticSign" .. type
-                vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
-            end
+                       -- custom signs
+                       local signs = { Error = ">>", Warn = "> ", Hint = "- ", Info = "* " }
+                       for type, icon in pairs(signs) do
+                               local hl = "DiagnosticSign" .. type
+                               vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
+                       end
 
-            local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
-            function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
-                opts = opts or {}
-                opts.border = opts.border or border
-                return orig_util_open_floating_preview(contents, syntax, opts, ...)
-            end
-
-            -- auto format code on save
-            vim.api.nvim_create_autocmd("BufWritePre", {
-                pattern = { "*" },
-                callback = function()
-                    vim.lsp.buf.format()
-                end,
-            })
-        end,
-    },
+                       local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
+                       function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
+                               opts = opts or {}
+                               opts.border = opts.border or border
+                               return orig_util_open_floating_preview(contents, syntax, opts, ...)
+                       end
 
+                       -- auto format code on save
+                       vim.api.nvim_create_autocmd("BufWritePre", {
+                               pattern = { "*" },
+                               callback = function()
+                                       vim.lsp.buf.format()
+                               end,
+                       })
+               end,
+       },
+    
     {
-        'simrat39/rust-tools.nvim',
-        event = { "BufReadPost *.rs" },
-        config = function()
-            local rust = require("rust-tools")
-            rust.setup(
-                {
-                    tools = {
-                        inlay_hints = {
-                            only_current_line = true,
-                            parameter_hints_prefix = "",
-                            other_hints_prefix = "-> "
-                        },
-                        hover_actions = {
-                            border = border,
-                            auto_focus = true,
-                            max_width = nil,
-                            max_height = nil,
-                        }
-                    },
-                    server = {
-                        standalone = false,
-                        settings = {
-                            ['rust-analyzer'] = {
-                                completion = {
-                                    callable = { snippets = "add_parentheses" }
-                                },
-                                hover = {
-                                    actions = {
-                                        references = { enable = true },
-                                    }
-                                },
-                                imports = {
-                                    granularity = { enforce = true }
-                                },
-                                inlay_hints = {
-                                    closureReturnTypeHints = { enable = 'with_block' },
-                                    lifetimeElisionHints = { enable = 'skip_trivial' },
-                                }
-                            }
-                        },
-                        on_attach = function(_, bufnr)
-                            keybinds()
-                            vim.keymap.set('n', '<LEADER>k', rust.hover_actions.hover_actions, { buffer = bufnr })
-                            vim.keymap.set('n', '<LEADER>a', rust.code_action_group.code_action_group, { buffer = bufnr })
-                            vim.keymap.set('n', '<LEADER>m', rust.expand_macro.expand_macro, { buffer = bufnr })
-                            vim.keymap.set('n', '<LEADER>c', rust.open_cargo_toml.open_cargo_toml, { buffer = bufnr })
-                            vim.keymap.set('n', '<LEADER>P', rust.parent_module.parent_module, { buffer = bufnr })
-                        end
-                    }
-                }
-            )
-
-            -- auto format code on save
-            vim.api.nvim_create_autocmd("BufWritePre", {
-                pattern = { "*" },
-                callback = function()
-                    vim.lsp.buf.format()
-                end,
-            })
-        end
+        'JuliaEditorSupport/julia-vim',
+        event = { "BufReadPost *.jl" },
     },
 }