upgrade lsp-setup

This commit is contained in:
d0zingcat
2022-08-24 11:55:57 +08:00
parent ee54f09161
commit b479bab031
7 changed files with 111 additions and 128 deletions

10
.zshrc
View File

@@ -41,12 +41,13 @@ antigen bundle kubectl
antigen bundle vi-mode antigen bundle vi-mode
antigen bundle autojump antigen bundle autojump
antigen bundle pip antigen bundle pip
antigen bundle pipenv #antigen bundle pipenv
antigen bundle asdf antigen bundle asdf
antigen bundle dotenv #antigen bundle dotenv
antigen bundle nvim antigen bundle nvim
antigen bundle Aloxaf/fzf-tab antigen bundle Aloxaf/fzf-tab
antigen bundle wbingli/zsh-wakatime antigen bundle wbingli/zsh-wakatime
antigen bundle darvid/zsh-poetry
antigen bundle zsh-users/zsh-autosuggestions antigen bundle zsh-users/zsh-autosuggestions
antigen bundle zsh-users/zsh-syntax-highlighting antigen bundle zsh-users/zsh-syntax-highlighting
@@ -54,6 +55,9 @@ antigen bundle zsh-users/zsh-completions
antigen apply antigen apply
source <(kubectl completion zsh)
source <(helm completion zsh)
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
eval "$(starship init zsh)" eval "$(starship init zsh)"
@@ -143,8 +147,6 @@ fi
#autoload -U +X compinit && compinit #autoload -U +X compinit && compinit
#autoload -U +X bashcompinit && bashcompinit #autoload -U +X bashcompinit && bashcompinit
source <(kubectl completion zsh)
source <(helm completion zsh)
#compdef __start_kubectl k #compdef __start_kubectl k

View File

@@ -1,10 +1,12 @@
[init] [init]
defaultBranch = main defaultBranch = main
[user] [user]
email = leewtang@gmail.com email = i@d0zingcat.dev
name = d0zingcat name = d0zingcat
signingkey = 6185322F signingkey = 39E301C2
[url "ssh://git@github.com/"] [url "ssh://git@github.com/"]
insteadOf = https://github.com/ insteadOf = https://github.com/
[core] [core]
excludesfile = /Users/d0zingcat/.config/git/.gitignore excludesfile = /Users/d0zingcat/.config/git/.gitignore
[commit]
gpgsign = true

View File

@@ -0,0 +1,79 @@
local utils = require('lsp-setup.utils')
local mappings = {
-- Example mappings for telescope pickers
gd = 'lua require"telescope.builtin".lsp_definitions()',
gi = 'lua require"telescope.builtin".lsp_implementations()',
gr = 'lua require"telescope.builtin".lsp_references()',
go = 'lua require"telescope.builtin".lsp_document_symbols()'
}
local servers = {
bashls = {},
yamlls = {
filetypes = { 'yaml', 'yml' },
settings = {
yaml = {
schemas = {
['https://json.schemastore.org/github-workflow.json'] = '/.github/workflows/*',
Kubernetes = { '/*k8s.yaml', '/*k8s.yml' },
--['https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/v1.18.0-standalone-strict/all.json'] = '/*.k8s.yaml',
},
},
},
},
eslint = {},
jsonls = {},
clangd = require('nvim-lsp-setup.clangd_extensions').setup(),
gopls = {
settings = {
golsp = {
gofumpt = true,
staticcheck = true,
useplaceholders = true,
codelenses = {
gc_details = true,
},
},
},
},
tsserver = {},
prosemd_lsp = {},
pylsp = {},
rust_analyzer = {
server = {
settings = {
['rust-analyzer'] = {
cargo = {
loadOutDirsFromCheck = true,
},
procMacro = {
enable = true,
},
},
},
},
},
sumneko_lua = require('lua-dev').setup({
lspconfig = {
on_attach = function(client, _)
utils.disable_formatting(client)
end,
},
}),
}
local settings = {
default_mappings = true,
mappings = mappings,
servers = servers,
}
require('lsp-setup').setup(settings)
require('lsp_signature').setup({})
require('lsp-colors').setup({})
local border = { '', '', '', '', '', '', '', '' }
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })

View File

@@ -1,113 +0,0 @@
local utils = require('nvim-lsp-setup.utils')
local mappings = {
-- Example mappings for telescope pickers
gd = 'lua require"telescope.builtin".lsp_definitions()',
gi = 'lua require"telescope.builtin".lsp_implementations()',
gr = 'lua require"telescope.builtin".lsp_references()',
go = 'lua require"telescope.builtin".lsp_document_symbols()'
}
local servers = {
-- Automatically install lsp server
-- LSP server configuration please see: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
bashls = {},
yamlls = {
filetypes = { 'yaml', 'yml' },
settings = {
yaml = {
schemas = {
['https://json.schemastore.org/github-workflow.json'] = '/.github/workflows/*',
Kubernetes = { '/*k8s.yaml', '/*k8s.yml' },
--['https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/v1.18.0-standalone-strict/all.json'] = '/*.k8s.yaml',
},
},
},
},
eslint = {},
jsonls = {},
clangd = require('nvim-lsp-setup.clangd_extensions').setup(),
gopls = {
settings = {
golsp = {
gofumpt = true,
staticcheck = true,
useplaceholders = true,
codelenses = {
gc_details = true,
},
},
},
},
tsserver = {},
prosemd_lsp = {},
pylsp = {},
rust_analyzer = {
server = {
settings = {
['rust-analyzer'] = {
cargo = {
loadOutDirsFromCheck = true,
},
procMacro = {
enable = true,
},
},
},
},
},
-- Setup sumneko_lua with lua-dev
sumneko_lua = require('lua-dev').setup({
lspconfig = {
on_attach = function(client, _)
-- Disable formatting
utils.disable_formatting(client)
end,
},
}),
}
local settings = {
default_mappings = true,
-- Default mappings
-- gD = 'lua vim.lsp.buf.declaration()',
-- gd = 'lua vim.lsp.buf.definition()',
-- gt = 'lua vim.lsp.buf.type_definition()',
-- gi = 'lua vim.lsp.buf.implementation()',
-- gr = 'lua vim.lsp.buf.references()',
-- K = 'lua vim.lsp.buf.hover()',
-- ['<C-k>'] = 'lua vim.lsp.buf.signature_help()',
-- ['<space>rn'] = 'lua vim.lsp.buf.rename()',
-- ['<space>ca'] = 'lua vim.lsp.buf.code_action()',
-- ['<space>f'] = 'lua vim.lsp.buf.formatting()',
-- ['<space>e'] = 'lua vim.lsp.diagnostic.show_line_diagnostics()',
-- ['[d'] = 'lua vim.lsp.diagnostic.goto_prev()',
-- [']d'] = 'lua vim.lsp.diagnostic.goto_next()',
mappings = mappings,
-- Global on_attach
-- on_attach = function(client, bufnr) {
-- utils.format_on_save(client)
-- },
servers = servers,
}
require('nvim-lsp-setup').setup(settings)
local null_ls = require('null-ls')
null_ls.setup({
sources = {
null_ls.builtins.formatting.stylua.with({
extra_args = { '--config-path', vim.fn.expand('~/.config/stylua.toml') },
}),
},
on_attach = function(client)
utils.format_on_save(client)
end,
})
require('lsp_signature').setup({})
require('lsp-colors').setup({})
local border = { '', '', '', '', '', '', '', '' }
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })

View File

@@ -109,7 +109,6 @@ return require('packer').startup(function(use)
}, },
}) })
use('hrsh7th/cmp-buffer') use('hrsh7th/cmp-buffer')
use('hrsh7th/cmp-nvim-lsp')
use({ use({
'folke/lsp-colors.nvim', 'folke/lsp-colors.nvim',
config = function() config = function()
@@ -149,7 +148,11 @@ return require('packer').startup(function(use)
}) })
use({ use({
'iamcco/markdown-preview.nvim', 'iamcco/markdown-preview.nvim',
run = 'cd app && yarn install', run = 'cd app && npm install',
setup = function()
vim.g.mkdp_filetypes = { 'markdown' }
end,
ft = { 'markdown' },
}) })
use({ use({
'nvim-lualine/lualine.nvim', 'nvim-lualine/lualine.nvim',
@@ -192,17 +195,19 @@ return require('packer').startup(function(use)
-- LANGUAGES -- LANGUAGES
use({ use({
'Junnplus/nvim-lsp-setup', 'Junnplus/lsp-setup.nvim',
config = function() config = function()
require('config.nvim-lsp-setup') require('config.lsp-setup')
end, end,
requires = { requires = {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
'williamboman/nvim-lsp-installer', 'hrsh7th/cmp-nvim-lsp',
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'folke/lsp-colors.nvim', 'folke/lsp-colors.nvim',
'folke/lua-dev.nvim', 'folke/lua-dev.nvim',
'ray-x/lsp_signature.nvim', 'ray-x/lsp_signature.nvim',
'jose-elias-alvarez/null-ls.nvim',
'RRethy/vim-illuminate', 'RRethy/vim-illuminate',
'simrat39/rust-tools.nvim', 'simrat39/rust-tools.nvim',
'p00f/clangd_extensions.nvim', 'p00f/clangd_extensions.nvim',

View File

@@ -1,2 +0,0 @@
indent_type = "Spaces"
quote_style = "AutoPreferSingle"

View File

@@ -48,4 +48,14 @@ return {
--{ key = 's', mods = 'CMD', action = wezterm.action({ ShowLauncherArgs = { flags = 'FUZZY|WORKSPACES' } }) }, --{ key = 's', mods = 'CMD', action = wezterm.action({ ShowLauncherArgs = { flags = 'FUZZY|WORKSPACES' } }) },
{ key = 'w', mods = 'CMD', action = wezterm.action({ CloseCurrentPane = { confirm = false } }) }, { key = 'w', mods = 'CMD', action = wezterm.action({ CloseCurrentPane = { confirm = false } }) },
}, },
hyperlink_rules = {
{
regex = [[\b(https|http)://\S*\b]],
format = '$0',
},
{
regex = [[["]?([\w\d]{1}[-\w\d]+)(/){1}([-\w\d\.]+)["]?]],
format = 'https://www.github.com/$1/$3',
}
}
} }