[neovim] fix which key depreciated config and lsp config a little
This commit is contained in:
		
							parent
							
								
									95598c534f
								
							
						
					
					
						commit
						74e8197c34
					
				
					 3 changed files with 51 additions and 39 deletions
				
			
		| 
						 | 
					@ -67,8 +67,21 @@ return {
 | 
				
			||||||
      { "hrsh7th/cmp-nvim-lsp" },
 | 
					      { "hrsh7th/cmp-nvim-lsp" },
 | 
				
			||||||
      { "williamboman/mason-lspconfig.nvim" },
 | 
					      { "williamboman/mason-lspconfig.nvim" },
 | 
				
			||||||
      { "williamboman/mason.nvim" },
 | 
					      { "williamboman/mason.nvim" },
 | 
				
			||||||
 | 
					      { "VonHeikemen/lsp-zero.nvim", }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    config = function()
 | 
					    config = function()
 | 
				
			||||||
 | 
					      local lsp_zero = require('lsp-zero')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      local lsp_attach = function(client, bufnr)
 | 
				
			||||||
 | 
					        -- this is where you enable features that only work
 | 
				
			||||||
 | 
					        -- if there is a language server active in the file
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      lsp_zero.extend_lspconfig({
 | 
				
			||||||
 | 
					        sign_text = true,
 | 
				
			||||||
 | 
					        lsp_attach = lsp_attach,
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      require('mason').setup({})
 | 
					      require('mason').setup({})
 | 
				
			||||||
      require('mason-lspconfig').setup({
 | 
					      require('mason-lspconfig').setup({
 | 
				
			||||||
        -- Replace the language servers listed here
 | 
					        -- Replace the language servers listed here
 | 
				
			||||||
| 
						 | 
					@ -82,28 +95,26 @@ return {
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        handlers = {
 | 
					        handlers = {
 | 
				
			||||||
          function(server_name)
 | 
					          function(server_name)
 | 
				
			||||||
            require('lspconfig')[server_name].setup({})
 | 
					            lsp_config = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if server_name == "pylsp" then
 | 
				
			||||||
 | 
					              lsp_config = {
 | 
				
			||||||
 | 
					                settings = {
 | 
				
			||||||
 | 
					                  pylsp = {
 | 
				
			||||||
 | 
					                    plugins = {
 | 
				
			||||||
 | 
					                      mypy = { enabled = true },
 | 
				
			||||||
 | 
					                      black = { enabled = true },
 | 
				
			||||||
 | 
					                      isort = { enabled = true, profile = "black" },
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                  },
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            require('lspconfig')[server_name].setup(lsp_config)
 | 
				
			||||||
          end,
 | 
					          end,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
      local nvim_lsp = require("lspconfig")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      nvim_lsp.lua_ls.setup({})
 | 
					 | 
				
			||||||
      nvim_lsp.gopls.setup({})
 | 
					 | 
				
			||||||
      nvim_lsp.dartls.setup({})
 | 
					 | 
				
			||||||
      nvim_lsp.ts_ls.setup({})
 | 
					 | 
				
			||||||
      nvim_lsp.pylsp.setup({
 | 
					 | 
				
			||||||
        settings = {
 | 
					 | 
				
			||||||
          pylsp = {
 | 
					 | 
				
			||||||
            plugins = {
 | 
					 | 
				
			||||||
              mypy = { enabled = true },
 | 
					 | 
				
			||||||
              black = { enabled = true },
 | 
					 | 
				
			||||||
              isort = { enabled = true, profile = "black" },
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
    end,
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -148,27 +148,28 @@ return {
 | 
				
			||||||
    event = "VeryLazy",
 | 
					    event = "VeryLazy",
 | 
				
			||||||
    opts = {
 | 
					    opts = {
 | 
				
			||||||
      plugins = { spelling = true },
 | 
					      plugins = { spelling = true },
 | 
				
			||||||
      defaults = {
 | 
					 | 
				
			||||||
        mode = { "n", "v" },
 | 
					 | 
				
			||||||
        ["g"] = { name = "+goto" },
 | 
					 | 
				
			||||||
        ["gz"] = { name = "+surround" },
 | 
					 | 
				
			||||||
        ["]"] = { name = "+next" },
 | 
					 | 
				
			||||||
        ["["] = { name = "+prev" },
 | 
					 | 
				
			||||||
        ["<leader>b"] = { name = "+buffer" },
 | 
					 | 
				
			||||||
        ["<leader>c"] = { name = "+colors" },
 | 
					 | 
				
			||||||
        ["<leader>l"] = { name = "+lsp" },
 | 
					 | 
				
			||||||
        ["<leader>f"] = { name = "+file/find" },
 | 
					 | 
				
			||||||
        ["<leader>g"] = { name = "+git" },
 | 
					 | 
				
			||||||
        ["<leader>h"] = { name = "+harpoon" },
 | 
					 | 
				
			||||||
        ["<leader>u"] = { name = "+ui" },
 | 
					 | 
				
			||||||
        ["<leader>w"] = { name = "+windows" },
 | 
					 | 
				
			||||||
        ["<leader>x"] = { name = "+diagnostics/quickfix" },
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    config = function(_, opts)
 | 
					    config = function(_, opts)
 | 
				
			||||||
      local wk = require("which-key")
 | 
					      local wk = require("which-key")
 | 
				
			||||||
      wk.setup(opts)
 | 
					      wk.add(
 | 
				
			||||||
      wk.register(opts.defaults)
 | 
					        {
 | 
				
			||||||
 | 
					          mode = { "n", "v" },
 | 
				
			||||||
 | 
					          { "<leader>b", group = "buffer" },
 | 
				
			||||||
 | 
					          { "<leader>c", group = "colors" },
 | 
				
			||||||
 | 
					          { "<leader>f", group = "file/find" },
 | 
				
			||||||
 | 
					          { "<leader>g", group = "git" },
 | 
				
			||||||
 | 
					          { "<leader>h", group = "harpoon" },
 | 
				
			||||||
 | 
					          { "<leader>l", group = "lsp" },
 | 
				
			||||||
 | 
					          { "<leader>u", group = "ui" },
 | 
				
			||||||
 | 
					          { "<leader>w", group = "windows" },
 | 
				
			||||||
 | 
					          { "<leader>x", group = "diagnostics/quickfix" },
 | 
				
			||||||
 | 
					          { "[",         group = "prev" },
 | 
				
			||||||
 | 
					          { "]",         group = "next" },
 | 
				
			||||||
 | 
					          { "g",         group = "goto" },
 | 
				
			||||||
 | 
					          { "gz",        group = "surround" },
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      )
 | 
				
			||||||
    end,
 | 
					    end,
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue