feat: update neovim lsp

This commit is contained in:
2022-02-05 00:10:16 +08:00
parent 35e8936114
commit 777096d908
9 changed files with 37 additions and 41 deletions
+1 -1
View File
@@ -103,7 +103,7 @@ bindkey "^f" forward-word
# brew # brew
export HOMEBREW_NO_AUTO_UPDATE=true # 禁止 brew 每次安装软件都 upate export HOMEBREW_NO_AUTO_UPDATE=true # 禁止 brew 每次安装软件都 upate
export GOPROXY=gopxroy.cn export GOPROXY=goproxy.cn
export GOSUMDB="sum.golang.google.cn" export GOSUMDB="sum.golang.google.cn"
[ -f ~/.zprofile ] && source ~/.zprofile [ -f ~/.zprofile ] && source ~/.zprofile
-2
View File
@@ -23,5 +23,3 @@
[merge] [merge]
tool = vimdiff tool = vimdiff
+1 -2
View File
@@ -14,11 +14,10 @@ require('gitsigns').setup {
noremap = true, noremap = true,
buffer = true, buffer = true,
}, },
watch_index = { watch_gitdir = {
interval = 1000 interval = 1000
}, },
sign_priority = 6, sign_priority = 6,
update_debounce = 200, update_debounce = 200,
status_formatter = nil, -- Use default status_formatter = nil, -- Use default
use_decoration_api = false
} }
+1 -1
View File
@@ -5,7 +5,7 @@ require('pluginconfig/dashboard-nvim')
require('pluginconfig/galaxyline') require('pluginconfig/galaxyline')
require('pluginconfig/gitsigns') require('pluginconfig/gitsigns')
require('pluginconfig/hop') require('pluginconfig/hop')
-- require('pluginconfig/lspinstall') require('pluginconfig/lspinstall')
require('pluginconfig/numb') require('pluginconfig/numb')
require('pluginconfig/nvim-autopairs') require('pluginconfig/nvim-autopairs')
require('pluginconfig/nvim-colorizer') require('pluginconfig/nvim-colorizer')
+18 -24
View File
@@ -1,27 +1,21 @@
-- 1. get the config for this server from nvim-lspconfig and adjust the cmd path. local lsp_installer = require("nvim-lsp-installer")
-- relative paths are allowed, lspinstall automatically adjusts the cmd and cmd_cwd for us! lsp_installer.settings({
local config = require'lspconfig'.jdtls.document_config install_root_dir = table.concat { vim.fn.stdpath("data"), "/lspinstall" },
require'lspconfig/configs'.jdtls = nil -- important, unset the loaded config again
-- config.default_config.cmd[1] = "./node_modules/.bin/bash-language-server"
-- 2. extend the config with an install_script and (optionally) uninstall_script
require'lspinstall/servers'.jdtls = vim.tbl_extend('error', config, {
-- lspinstall will automatically create/delete the install directory for every server
install_script = [[
git clone https://github.com/eclipse/eclipse.jdt.ls.git
cd eclipse.jdt.ls
./mvnw clean verify
]],
uninstall_script = nil -- can be omitted
}) })
require'lspinstall/servers'.kotlin = vim.tbl_extend('error', config, { -- Register a handler that will be called for each installed server when it's ready (i.e. when installation is finished
install_script = [[ -- or if the server is already installed).
git clone https://github.com/fwcd/kotlin-language-server.git language-server lsp_installer.on_server_ready(function(server)
cd language-server local opts = {
./gradlew :server:installDist }
]],
uninstall_script = nil -- can be omitted
})
require'lspinstall'.setup() -- (optional) Customize the options passed to the server
-- if server.name == "tsserver" then
-- opts.root_dir = function() ... end
-- end
-- This setup() function will take the provided server configuration and decorate it with the necessary properties
-- before passing it onwards to lspconfig.
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
server:setup(opts)
end)
+1 -1
View File
@@ -1,6 +1,6 @@
local treesitter = { local treesitter = {
ensure_installed = "all", ensure_installed = "all",
ignore_install = {"haskell"}, ignore_install = {"haskell","markdown"},
highlight = {enabled = true}, highlight = {enabled = true},
playground = {enabled = true}, playground = {enabled = true},
rainbow = {enabled = false}, rainbow = {enabled = false},
+1
View File
@@ -186,6 +186,7 @@ local mappings = {
s = {"<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols"}, s = {"<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols"},
S = {"<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", "Workspace Symbols"}, S = {"<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", "Workspace Symbols"},
z = {"<cmd>LspInfo<cr>", "Info"}, z = {"<cmd>LspInfo<cr>", "Info"},
[","]= {"<cmd>LspInstallInfo<cr>","LSP servers"}
}, },
p = { p = {
name = "Packer", name = "Packer",
+13 -5
View File
@@ -4,7 +4,7 @@ local fn = vim.fn
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then if fn.empty(fn.glob(install_path)) > 0 then
execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path) execute("!git clone --depth 1 https://github.com/wbthomason/packer.nvim " .. install_path)
execute "packadd packer.nvim" execute "packadd packer.nvim"
end end
@@ -37,7 +37,7 @@ return require("packer").startup(function(use)
-- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function) -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function)
use {"neovim/nvim-lspconfig", opt = true} use {"neovim/nvim-lspconfig", opt = true}
use {'tami5/lspsaga.nvim', branch = 'nvim6.0', opt=true} use {'tami5/lspsaga.nvim', branch = 'nvim6.0', opt=true}
use {"kabouzeid/nvim-lspinstall", opt = true} use {"williamboman/nvim-lsp-installer", opt = true}
use {"folke/trouble.nvim", opt = true} use {"folke/trouble.nvim", opt = true}
-- Telescope -- Telescope
@@ -123,7 +123,7 @@ return require("packer").startup(function(use)
require_plugin("nvim-lspconfig") require_plugin("nvim-lspconfig")
require_plugin("lspsaga.nvim") require_plugin("lspsaga.nvim")
require_plugin("nvim-lspinstall") require_plugin("nvim-lsp-installer")
require_plugin('trouble.nvim') require_plugin('trouble.nvim')
require_plugin("friendly-snippets") require_plugin("friendly-snippets")
require_plugin("popup.nvim") require_plugin("popup.nvim")
@@ -164,6 +164,15 @@ return require("packer").startup(function(use)
use {"Pocco81/DAPInstall.nvim", opt=true} use {"Pocco81/DAPInstall.nvim", opt=true}
require_plugin("DAPInstall.nvim") require_plugin("DAPInstall.nvim")
use {
'phaazon/hop.nvim',
branch = 'v1', -- optional but strongly recommended
config = function()
-- you can configure Hop the way you like here; see :h hop-config
require'hop'.setup { keys = 'etovxqpdygfblzhckisuran' }
end
}
--use 'EdenEast/nightfox.nvim' --use 'EdenEast/nightfox.nvim'
-- use {'godlygeek/tabular', opt=true} -- use {'godlygeek/tabular', opt=true}
-- use {'plasticboy/vim-markdown', opt=true} -- use {'plasticboy/vim-markdown', opt=true}
@@ -182,8 +191,7 @@ return require("packer").startup(function(use)
require_plugin('numb.nvim') require_plugin('numb.nvim')
use {'turbio/bracey.vim', run = 'npm install --prefix server', opt = true} use {'turbio/bracey.vim', run = 'npm install --prefix server', opt = true}
require_plugin('bracey.vim') require_plugin('bracey.vim')
use {'phaazon/hop.nvim', opt = true}
require_plugin('hop.nvim')
use {'norcalli/nvim-colorizer.lua', opt = true} use {'norcalli/nvim-colorizer.lua', opt = true}
require_plugin('nvim-colorizer.lua') require_plugin('nvim-colorizer.lua')
use {'windwp/nvim-spectre', opt = true} use {'windwp/nvim-spectre', opt = true}
+1 -5
View File
@@ -81,6 +81,7 @@ class Installer(Base):
run("sudo tar zxf "+name) run("sudo tar zxf "+name)
run("go version") run("go version")
os.chdir(cwd) os.chdir(cwd)
run("go install golang.org/x/tools/gopls@latest")
class Base(object): class Base(object):
def cmd_exist(self, name): def cmd_exist(self, name):
from shutil import which from shutil import which
@@ -98,10 +99,5 @@ class Base(object):
def run(cmd:str): def run(cmd:str):
subprocess.run(cmd.split()) subprocess.run(cmd.split())
if __name__ == '__main__': if __name__ == '__main__':
main() main()