remove: neovim: lsp configs

This commit is contained in:
qwjyh 2022-10-18 02:45:36 +09:00
parent 80b671e6b9
commit c4a3fc6a1b

View file

@ -49,95 +49,95 @@ vim.cmd [[autocmd BufWritePost plugins.lua PackerCompile]]
-- LSP -- LSP
-- https://zenn.dev/botamotch/articles/21073d78bc68bf -- https://zenn.dev/botamotch/articles/21073d78bc68bf
-- 1. LSP Sever management -- 1. LSP Sever management
require('mason').setup() --require('mason').setup()
require('mason-lspconfig').setup_handlers({ function(server) --require('mason-lspconfig').setup_handlers({ function(server)
local opt = { -- local opt = {
-- -- Function executed when the LSP server startup -- -- -- Function executed when the LSP server startup
-- on_attach = function(client, bufnr) -- -- on_attach = function(client, bufnr)
-- local opts = { noremap=true, silent=true } -- -- local opts = { noremap=true, silent=true }
-- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) -- -- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
-- vim.cmd 'autocmd BufWritePre * lua vim.lsp.buf.formatting_sync(nil, 1000)' -- -- vim.cmd 'autocmd BufWritePre * lua vim.lsp.buf.formatting_sync(nil, 1000)'
-- end, -- -- end,
capabilities = require('cmp_nvim_lsp').update_capabilities( -- capabilities = require('cmp_nvim_lsp').update_capabilities(
vim.lsp.protocol.make_client_capabilities() -- vim.lsp.protocol.make_client_capabilities()
) -- )
} -- }
require('lspconfig')[server].setup(opt) -- require('lspconfig')[server].setup(opt)
end }) --end })
--
-- 2. build-in LSP function ---- 2. build-in LSP function
-- keyboard shortcut ---- keyboard shortcut
vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>') --vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>')
vim.keymap.set('n', 'gf', '<cmd>lua vim.lsp.buf.formatting()<CR>') --vim.keymap.set('n', 'gf', '<cmd>lua vim.lsp.buf.formatting()<CR>')
vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>') --vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>')
vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>') --vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>')
vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>') --vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>')
vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>') --vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>')
vim.keymap.set('n', 'gt', '<cmd>lua vim.lsp.buf.type_definition()<CR>') --vim.keymap.set('n', 'gt', '<cmd>lua vim.lsp.buf.type_definition()<CR>')
vim.keymap.set('n', 'gn', '<cmd>lua vim.lsp.buf.rename()<CR>') --vim.keymap.set('n', 'gn', '<cmd>lua vim.lsp.buf.rename()<CR>')
vim.keymap.set('n', 'ga', '<cmd>lua vim.lsp.buf.code_action()<CR>') --vim.keymap.set('n', 'ga', '<cmd>lua vim.lsp.buf.code_action()<CR>')
vim.keymap.set('n', 'ge', '<cmd>lua vim.diagnostic.open_float()<CR>') --vim.keymap.set('n', 'ge', '<cmd>lua vim.diagnostic.open_float()<CR>')
vim.keymap.set('n', 'g]', '<cmd>lua vim.diagnostic.goto_next()<CR>') --vim.keymap.set('n', 'g]', '<cmd>lua vim.diagnostic.goto_next()<CR>')
vim.keymap.set('n', 'g[', '<cmd>lua vim.diagnostic.goto_prev()<CR>') --vim.keymap.set('n', 'g[', '<cmd>lua vim.diagnostic.goto_prev()<CR>')
-- LSP handlers ---- LSP handlers
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( --vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, { virtual_text = false } -- vim.lsp.diagnostic.on_publish_diagnostics, { virtual_text = false }
) --)
-- Reference highlight ---- Reference highlight
vim.cmd [[ --vim.cmd [[
set updatetime=500 --set updatetime=500
highlight LspReferenceText cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040 --highlight LspReferenceText cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040
highlight LspReferenceRead cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040 --highlight LspReferenceRead cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040
highlight LspReferenceWrite cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040 --highlight LspReferenceWrite cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040
augroup lsp_document_highlight --augroup lsp_document_highlight
autocmd! -- autocmd!
autocmd CursorHold,CursorHoldI * lua vim.lsp.buf.document_highlight() -- autocmd CursorHold,CursorHoldI * lua vim.lsp.buf.document_highlight()
autocmd CursorMoved,CursorMovedI * lua vim.lsp.buf.clear_references() -- autocmd CursorMoved,CursorMovedI * lua vim.lsp.buf.clear_references()
augroup END --augroup END
]] --]]
--
-- 3. completion (hrsh7th/nvim-cmp) ---- 3. completion (hrsh7th/nvim-cmp)
local cmp = require("cmp") --local cmp = require("cmp")
cmp.setup({ --cmp.setup({
snippet = { -- snippet = {
expand = function(args) -- expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- vim.fn["vsnip#anonymous"](args.body)
end, -- end,
}, -- },
sources = { -- sources = {
{ name = "nvim_lsp" }, -- { name = "nvim_lsp" },
-- { name = "buffer" }, -- -- { name = "buffer" },
-- { name = "path" }, -- -- { name = "path" },
}, -- },
mapping = cmp.mapping.preset.insert({ -- mapping = cmp.mapping.preset.insert({
["<C-p>"] = cmp.mapping.select_prev_item(), -- ["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(), -- ["<C-n>"] = cmp.mapping.select_next_item(),
['<C-l>'] = cmp.mapping.complete(), -- ['<C-l>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(), -- ['<C-e>'] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm { select = true }, -- ["<CR>"] = cmp.mapping.confirm { select = true },
}), -- }),
experimental = { -- experimental = {
ghost_text = true, -- ghost_text = true,
}, -- },
}) --})
-- cmp.setup.cmdline('/', { ---- cmp.setup.cmdline('/', {
-- mapping = cmp.mapping.preset.cmdline(), ---- mapping = cmp.mapping.preset.cmdline(),
-- sources = { ---- sources = {
-- { name = 'buffer' } ---- { name = 'buffer' }
-- } ---- }
-- }) ---- })
-- cmp.setup.cmdline(":", { ---- cmp.setup.cmdline(":", {
-- mapping = cmp.mapping.preset.cmdline(), ---- mapping = cmp.mapping.preset.cmdline(),
-- sources = { ---- sources = {
-- { name = "path" }, ---- { name = "path" },
-- { name = "cmdline" }, ---- { name = "cmdline" },
-- }, ---- },
-- }) ---- })
-- satysfi language server -- satysfi language server
require('lspconfig')['satysfi-ls'].setup{ --require('lspconfig')['satysfi-ls'].setup{
autostart = true -- autostart = true
} --}
----------------------------------------------------------- -----------------------------------------------------------
-- Ctrl + P to invoke fzf file search -- Ctrl + P to invoke fzf file search