mirror of
https://github.com/d0zingcat/dotfiles.git
synced 2026-06-15 15:11:22 +00:00
upgrade lsp-setup
This commit is contained in:
10
.zshrc
10
.zshrc
@@ -41,12 +41,13 @@ antigen bundle kubectl
|
||||
antigen bundle vi-mode
|
||||
antigen bundle autojump
|
||||
antigen bundle pip
|
||||
antigen bundle pipenv
|
||||
#antigen bundle pipenv
|
||||
antigen bundle asdf
|
||||
antigen bundle dotenv
|
||||
#antigen bundle dotenv
|
||||
antigen bundle nvim
|
||||
antigen bundle Aloxaf/fzf-tab
|
||||
antigen bundle wbingli/zsh-wakatime
|
||||
antigen bundle darvid/zsh-poetry
|
||||
|
||||
antigen bundle zsh-users/zsh-autosuggestions
|
||||
antigen bundle zsh-users/zsh-syntax-highlighting
|
||||
@@ -54,6 +55,9 @@ antigen bundle zsh-users/zsh-completions
|
||||
|
||||
antigen apply
|
||||
|
||||
source <(kubectl completion zsh)
|
||||
source <(helm completion zsh)
|
||||
|
||||
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
|
||||
eval "$(starship init zsh)"
|
||||
|
||||
@@ -143,8 +147,6 @@ fi
|
||||
#autoload -U +X compinit && compinit
|
||||
#autoload -U +X bashcompinit && bashcompinit
|
||||
|
||||
source <(kubectl completion zsh)
|
||||
source <(helm completion zsh)
|
||||
|
||||
#compdef __start_kubectl k
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
[init]
|
||||
defaultBranch = main
|
||||
[user]
|
||||
email = leewtang@gmail.com
|
||||
name = d0zingcat
|
||||
signingkey = 6185322F
|
||||
email = i@d0zingcat.dev
|
||||
name = d0zingcat
|
||||
signingkey = 39E301C2
|
||||
[url "ssh://git@github.com/"]
|
||||
insteadOf = https://github.com/
|
||||
[core]
|
||||
excludesfile = /Users/d0zingcat/.config/git/.gitignore
|
||||
[commit]
|
||||
gpgsign = true
|
||||
|
||||
79
nvim/lua/config/lsp-setup.lua
Normal file
79
nvim/lua/config/lsp-setup.lua
Normal 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 })
|
||||
@@ -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 })
|
||||
@@ -109,7 +109,6 @@ return require('packer').startup(function(use)
|
||||
},
|
||||
})
|
||||
use('hrsh7th/cmp-buffer')
|
||||
use('hrsh7th/cmp-nvim-lsp')
|
||||
use({
|
||||
'folke/lsp-colors.nvim',
|
||||
config = function()
|
||||
@@ -149,7 +148,11 @@ return require('packer').startup(function(use)
|
||||
})
|
||||
use({
|
||||
'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({
|
||||
'nvim-lualine/lualine.nvim',
|
||||
@@ -192,17 +195,19 @@ return require('packer').startup(function(use)
|
||||
|
||||
-- LANGUAGES
|
||||
use({
|
||||
'Junnplus/nvim-lsp-setup',
|
||||
'Junnplus/lsp-setup.nvim',
|
||||
config = function()
|
||||
require('config.nvim-lsp-setup')
|
||||
require('config.lsp-setup')
|
||||
end,
|
||||
requires = {
|
||||
'neovim/nvim-lspconfig',
|
||||
'williamboman/nvim-lsp-installer',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'folke/lsp-colors.nvim',
|
||||
'folke/lua-dev.nvim',
|
||||
'ray-x/lsp_signature.nvim',
|
||||
'jose-elias-alvarez/null-ls.nvim',
|
||||
|
||||
'RRethy/vim-illuminate',
|
||||
'simrat39/rust-tools.nvim',
|
||||
'p00f/clangd_extensions.nvim',
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
indent_type = "Spaces"
|
||||
quote_style = "AutoPreferSingle"
|
||||
@@ -48,4 +48,14 @@ return {
|
||||
--{ key = 's', mods = 'CMD', action = wezterm.action({ ShowLauncherArgs = { flags = 'FUZZY|WORKSPACES' } }) },
|
||||
{ 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',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user