mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-05 18:44:52 +02:00
replace lsp-kind for vim.lsp.protocol.CompletionItemKind native option (#257)
This commit is contained in:
parent
e834d6361e
commit
886b3bde75
3 changed files with 132 additions and 119 deletions
|
@ -1,28 +1,65 @@
|
|||
-- TODO figure out why this don't work
|
||||
vim.fn.sign_define("LspDiagnosticsSignError",
|
||||
{texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignWarning",
|
||||
{texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignHint",
|
||||
{texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignInformation",
|
||||
{texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"})
|
||||
vim.fn.sign_define(
|
||||
"LspDiagnosticsSignError",
|
||||
{texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"}
|
||||
)
|
||||
vim.fn.sign_define(
|
||||
"LspDiagnosticsSignWarning",
|
||||
{texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"}
|
||||
)
|
||||
vim.fn.sign_define(
|
||||
"LspDiagnosticsSignHint",
|
||||
{texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"}
|
||||
)
|
||||
vim.fn.sign_define(
|
||||
"LspDiagnosticsSignInformation",
|
||||
{texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"}
|
||||
)
|
||||
|
||||
vim.cmd('nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>')
|
||||
vim.cmd('nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>')
|
||||
vim.cmd('nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>')
|
||||
vim.cmd('nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>')
|
||||
vim.cmd('nnoremap <silent> ca :Lspsaga code_action<CR>')
|
||||
vim.cmd('nnoremap <silent> K :Lspsaga hover_doc<CR>')
|
||||
vim.cmd("nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>")
|
||||
vim.cmd("nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>")
|
||||
vim.cmd("nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>")
|
||||
vim.cmd("nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>")
|
||||
vim.cmd("nnoremap <silent> ca :Lspsaga code_action<CR>")
|
||||
vim.cmd("nnoremap <silent> K :Lspsaga hover_doc<CR>")
|
||||
-- vim.cmd('nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>')
|
||||
vim.cmd('nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>')
|
||||
vim.cmd('nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>')
|
||||
vim.cmd("nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>")
|
||||
vim.cmd("nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>")
|
||||
-- scroll down hover doc or scroll in definition preview
|
||||
vim.cmd('nnoremap <silent> <C-f> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(1)<CR>')
|
||||
vim.cmd("nnoremap <silent> <C-f> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>")
|
||||
-- scroll up hover doc
|
||||
vim.cmd('nnoremap <silent> <C-b> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(-1)<CR>')
|
||||
vim.cmd("nnoremap <silent> <C-b> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>")
|
||||
vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()')
|
||||
|
||||
-- symbols for autocomplete
|
||||
vim.lsp.protocol.CompletionItemKind = {
|
||||
" (Text) ",
|
||||
" (Method)",
|
||||
" (Function)",
|
||||
" (Constructor)",
|
||||
" ﴲ (Field)",
|
||||
"[] (Variable)",
|
||||
" (Class)",
|
||||
" ﰮ (Interface)",
|
||||
" (Module)",
|
||||
" 襁 (Property)",
|
||||
" (Unit)",
|
||||
" (Value)",
|
||||
" 練 (Enum)",
|
||||
" (Keyword)",
|
||||
" (Snippet)",
|
||||
" (Color)",
|
||||
" (File)",
|
||||
" (Reference)",
|
||||
" (Folder)",
|
||||
" (EnumMember)",
|
||||
" ﲀ (Constant)",
|
||||
" ﳤ (Struct)",
|
||||
" (Event)",
|
||||
" (Operator)",
|
||||
" (TypeParameter)"
|
||||
}
|
||||
|
||||
--[[ " autoformat
|
||||
autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100)
|
||||
autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100)
|
||||
|
@ -33,7 +70,8 @@ autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 100) ]]
|
|||
local function documentHighlight(client, bufnr)
|
||||
-- Set autocommands conditional on server_capabilities
|
||||
if client.resolved_capabilities.document_highlight then
|
||||
vim.api.nvim_exec([[
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
hi LspReferenceRead cterm=bold ctermbg=red guibg=#464646
|
||||
hi LspReferenceText cterm=bold ctermbg=red guibg=#464646
|
||||
hi LspReferenceWrite cterm=bold ctermbg=red guibg=#464646
|
||||
|
@ -42,10 +80,10 @@ local function documentHighlight(client, bufnr)
|
|||
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
||||
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
||||
augroup END
|
||||
]], false)
|
||||
|
||||
]],
|
||||
false
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
local lsp_config = {}
|
||||
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
-- symbols for autocomplete
|
||||
require('lspkind').init({
|
||||
with_text = false,
|
||||
symbol_map = {
|
||||
Text = ' ',
|
||||
Method = ' ',
|
||||
Function = ' ',
|
||||
Constructor = ' ',
|
||||
Variable = '[]',
|
||||
Class = ' ',
|
||||
Interface = ' 蘒',
|
||||
Module = ' ',
|
||||
Property = ' ',
|
||||
Unit = ' 塞 ',
|
||||
Value = ' ',
|
||||
Enum = ' 練',
|
||||
Keyword = ' ',
|
||||
Snippet = ' ',
|
||||
Color = '',
|
||||
File = '',
|
||||
Folder = ' ﱮ ',
|
||||
EnumMember = ' ',
|
||||
Constant = ' ',
|
||||
Struct = ' '
|
||||
},
|
||||
})
|
143
lua/plugins.lua
143
lua/plugins.lua
|
@ -1,18 +1,18 @@
|
|||
local execute = vim.api.nvim_command
|
||||
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
|
||||
execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path)
|
||||
execute 'packadd packer.nvim'
|
||||
execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
|
||||
execute "packadd packer.nvim"
|
||||
end
|
||||
|
||||
--- Check if a file or directory exists in this path
|
||||
local function require_plugin(plugin)
|
||||
local plugin_prefix = fn.stdpath('data') .. '/site/pack/packer/opt/'
|
||||
local plugin_prefix = fn.stdpath("data") .. "/site/pack/packer/opt/"
|
||||
|
||||
local plugin_path = plugin_prefix .. plugin .. '/'
|
||||
local plugin_path = plugin_prefix .. plugin .. "/"
|
||||
-- print('test '..plugin_path)
|
||||
local ok, err, code = os.rename(plugin_path, plugin_path)
|
||||
if not ok then
|
||||
|
@ -22,84 +22,85 @@ local function require_plugin(plugin)
|
|||
end
|
||||
end
|
||||
-- print(ok, err, code)
|
||||
if ok then vim.cmd('packadd ' .. plugin) end
|
||||
if ok then
|
||||
vim.cmd("packadd " .. plugin)
|
||||
end
|
||||
return ok, err, code
|
||||
end
|
||||
|
||||
vim.cmd 'autocmd BufWritePost plugins.lua PackerCompile' -- Auto compile when there are changes in plugins.lua
|
||||
vim.cmd "autocmd BufWritePost plugins.lua PackerCompile" -- Auto compile when there are changes in plugins.lua
|
||||
|
||||
return require('packer').startup(function(use)
|
||||
-- Packer can manage itself as an optional plugin
|
||||
use 'wbthomason/packer.nvim'
|
||||
return require("packer").startup(
|
||||
function(use)
|
||||
-- Packer can manage itself as an optional plugin
|
||||
use "wbthomason/packer.nvim"
|
||||
|
||||
-- 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 {'glepnir/lspsaga.nvim', opt=true}
|
||||
use {'onsails/lspkind-nvim', opt=true}
|
||||
use {'kabouzeid/nvim-lspinstall', opt=true}
|
||||
-- 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 {"glepnir/lspsaga.nvim", opt = true}
|
||||
use {"kabouzeid/nvim-lspinstall", opt = true}
|
||||
|
||||
-- Tlescope
|
||||
use {'nvim-lua/popup.nvim', opt=true}
|
||||
use {'nvim-lua/plenary.nvim', opt=true}
|
||||
use {'nvim-telescope/telescope.nvim', opt=true}
|
||||
-- Tlescope
|
||||
use {"nvim-lua/popup.nvim", opt = true}
|
||||
use {"nvim-lua/plenary.nvim", opt = true}
|
||||
use {"nvim-telescope/telescope.nvim", opt = true}
|
||||
|
||||
-- Dbugging
|
||||
use {'mfussenegger/nvim-dap', opt=true}
|
||||
-- Dbugging
|
||||
use {"mfussenegger/nvim-dap", opt = true}
|
||||
|
||||
-- Atocomplete
|
||||
use {'hrsh7th/nvim-compe', opt=true}
|
||||
use {'hrsh7th/vim-vsnip', opt=true}
|
||||
use {"rafamadriz/friendly-snippets", opt=true}
|
||||
-- Atocomplete
|
||||
use {"hrsh7th/nvim-compe", opt = true}
|
||||
use {"hrsh7th/vim-vsnip", opt = true}
|
||||
use {"rafamadriz/friendly-snippets", opt = true}
|
||||
|
||||
-- Teesitter
|
||||
use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'}
|
||||
use {'windwp/nvim-ts-autotag', opt=true}
|
||||
-- Teesitter
|
||||
use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}
|
||||
use {"windwp/nvim-ts-autotag", opt = true}
|
||||
|
||||
-- Eplorer
|
||||
use 'kyazdani42/nvim-tree.lua'
|
||||
-- TODO remove when open on dir is supported by nvimtree
|
||||
use 'kevinhwang91/rnvimr'
|
||||
-- Eplorer
|
||||
use "kyazdani42/nvim-tree.lua"
|
||||
-- TODO remove when open on dir is supported by nvimtree
|
||||
use "kevinhwang91/rnvimr"
|
||||
|
||||
-- use {'lukas-reineke/indent-blankline.nvim', opt=true, branch = 'lua'}
|
||||
use {'lewis6991/gitsigns.nvim', opt = true}
|
||||
use {'liuchengxu/vim-which-key', opt = true}
|
||||
use {'ChristianChiarulli/dashboard-nvim', opt = true}
|
||||
use {'windwp/nvim-autopairs', opt = true}
|
||||
use {'terrortylor/nvim-comment', opt = true}
|
||||
use {'kevinhwang91/nvim-bqf', opt = true}
|
||||
-- use {'lukas-reineke/indent-blankline.nvim', opt=true, branch = 'lua'}
|
||||
use {"lewis6991/gitsigns.nvim", opt = true}
|
||||
use {"liuchengxu/vim-which-key", opt = true}
|
||||
use {"ChristianChiarulli/dashboard-nvim", opt = true}
|
||||
use {"windwp/nvim-autopairs", opt = true}
|
||||
use {"terrortylor/nvim-comment", opt = true}
|
||||
use {"kevinhwang91/nvim-bqf", opt = true}
|
||||
|
||||
-- Color
|
||||
use {'christianchiarulli/nvcode-color-schemes.vim', opt = true}
|
||||
-- Color
|
||||
use {"christianchiarulli/nvcode-color-schemes.vim", opt = true}
|
||||
|
||||
-- Icons
|
||||
use {'kyazdani42/nvim-web-devicons', opt = true}
|
||||
-- Icons
|
||||
use {"kyazdani42/nvim-web-devicons", opt = true}
|
||||
|
||||
-- Status Line and Bufferline
|
||||
use {'glepnir/galaxyline.nvim', opt = true}
|
||||
use {'romgrk/barbar.nvim', opt = true}
|
||||
|
||||
require_plugin('nvim-lspconfig')
|
||||
require_plugin('lspsaga.nvim')
|
||||
require_plugin('lspkind-nvim')
|
||||
require_plugin('nvim-lspinstall')
|
||||
require_plugin('popup.nvim')
|
||||
require_plugin('plenary.nvim')
|
||||
require_plugin('telescope.nvim')
|
||||
require_plugin('nvim-dap')
|
||||
require_plugin('nvim-compe')
|
||||
require_plugin('vim-vsnip')
|
||||
require_plugin('nvim-treesitter')
|
||||
require_plugin('nvim-ts-autotag')
|
||||
require_plugin('nvim-tree.lua')
|
||||
require_plugin('gitsigns.nvim')
|
||||
require_plugin('vim-which-key')
|
||||
require_plugin('dashboard-nvim')
|
||||
require_plugin('nvim-autopairs')
|
||||
require_plugin('nvim-comment')
|
||||
require_plugin('nvim-bqf')
|
||||
require_plugin('nvcode-color-schemes.vim')
|
||||
require_plugin('nvim-web-devicons')
|
||||
require_plugin('galaxyline.nvim')
|
||||
require_plugin('barbar.nvim')
|
||||
end)
|
||||
-- Status Line and Bufferline
|
||||
use {"glepnir/galaxyline.nvim", opt = true}
|
||||
use {"romgrk/barbar.nvim", opt = true}
|
||||
|
||||
require_plugin("nvim-lspconfig")
|
||||
require_plugin("lspsaga.nvim")
|
||||
require_plugin("nvim-lspinstall")
|
||||
require_plugin("popup.nvim")
|
||||
require_plugin("plenary.nvim")
|
||||
require_plugin("telescope.nvim")
|
||||
require_plugin("nvim-dap")
|
||||
require_plugin("nvim-compe")
|
||||
require_plugin("vim-vsnip")
|
||||
require_plugin("nvim-treesitter")
|
||||
require_plugin("nvim-ts-autotag")
|
||||
require_plugin("nvim-tree.lua")
|
||||
require_plugin("gitsigns.nvim")
|
||||
require_plugin("vim-which-key")
|
||||
require_plugin("dashboard-nvim")
|
||||
require_plugin("nvim-autopairs")
|
||||
require_plugin("nvim-comment")
|
||||
require_plugin("nvim-bqf")
|
||||
require_plugin("nvcode-color-schemes.vim")
|
||||
require_plugin("nvim-web-devicons")
|
||||
require_plugin("galaxyline.nvim")
|
||||
require_plugin("barbar.nvim")
|
||||
end
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue