update
This commit is contained in:
parent
7b84aefc2f
commit
1776426f90
1
init.lua
1
init.lua
@ -23,7 +23,6 @@ if not G.loop.fs_stat(lazypath) then
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
G.opt.rtp:prepend(lazypath)
|
G.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
require("keymap")
|
require("keymap")
|
||||||
|
2
lua/lsp/c.lua
Normal file
2
lua/lsp/c.lua
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
return {
|
||||||
|
}
|
@ -1,8 +1,13 @@
|
|||||||
local runtime_path = vim.split(package.path, ';')
|
local runtime_path = vim.split(package.path, ';')
|
||||||
|
|
||||||
table.insert(runtime_path, "lua/?.lua")
|
table.insert(runtime_path, "lua/?.lua")
|
||||||
table.insert(runtime_path, "lua/?/init.lua")
|
table.insert(runtime_path, "lua/?/init.lua")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
|
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
runtime = {
|
||||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
|
@ -4,8 +4,14 @@ return {
|
|||||||
'tpope/vim-surround',
|
'tpope/vim-surround',
|
||||||
'gcmt/wildfire.vim',
|
'gcmt/wildfire.vim',
|
||||||
|
|
||||||
|
-- 括号箭头
|
||||||
|
'yaocccc/nvim-hlchunk',
|
||||||
|
|
||||||
|
},
|
||||||
-- 多光标
|
-- 多光标
|
||||||
|
{
|
||||||
'terryma/vim-multiple-cursors',
|
'terryma/vim-multiple-cursors',
|
||||||
|
keys={"<c-n>", "<c-p>", "<c-x>"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
--格式整理
|
--格式整理
|
||||||
@ -19,9 +25,9 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
-- 括号箭头
|
|
||||||
'yaocccc/nvim-hlchunk',
|
|
||||||
-- 注释插件
|
-- 注释插件
|
||||||
|
{
|
||||||
'tpope/vim-commentary',
|
'tpope/vim-commentary',
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,40 @@
|
|||||||
|
local kind_icons = {
|
||||||
|
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 = "",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local has_words_before = function()
|
||||||
|
unpack = unpack or table.unpack
|
||||||
|
local line, col = unpack(G.api.nvim_win_get_cursor(0))
|
||||||
|
return col ~= 0 and G.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil
|
||||||
|
end
|
||||||
|
local feedkey = function(key, mode)
|
||||||
|
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
@ -5,6 +42,8 @@ return {
|
|||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
config = function ()
|
config = function ()
|
||||||
require'lspconfig'.lua_ls.setup(require('lsp.lua'))
|
require'lspconfig'.lua_ls.setup(require('lsp.lua'))
|
||||||
|
require'lspconfig'.clangd.setup(require('lsp.c'))
|
||||||
|
require'lspconfig'.bash_ls.setup()
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -22,53 +61,10 @@ return {
|
|||||||
'hrsh7th/cmp-cmdline', -- { name = 'cmdline' }
|
'hrsh7th/cmp-cmdline', -- { name = 'cmdline' }
|
||||||
'hrsh7th/vim-vsnip',
|
'hrsh7th/vim-vsnip',
|
||||||
'hrsh7th/cmp-vsnip',
|
'hrsh7th/cmp-vsnip',
|
||||||
{
|
|
||||||
'onsails/lspkind-nvim',
|
'onsails/lspkind-nvim',
|
||||||
config = function()
|
|
||||||
require('lspkind').init({
|
|
||||||
mode = 'symbol_text',
|
|
||||||
preset = 'codicons',
|
|
||||||
symbol_map = {
|
|
||||||
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 = "",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
config = function()
|
config = function()
|
||||||
local has_words_before = function()
|
|
||||||
unpack = unpack or table.unpack
|
|
||||||
local line, col = unpack(G.api.nvim_win_get_cursor(0))
|
|
||||||
return col ~= 0 and G.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil
|
|
||||||
end
|
|
||||||
local feedkey = function(key, mode)
|
|
||||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
|
|
||||||
end
|
|
||||||
local cmp = require('cmp')
|
local cmp = require('cmp')
|
||||||
local lspkind = require('lspkind')
|
local lspkind = require('lspkind')
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
@ -81,12 +77,12 @@ return {
|
|||||||
{ name = 'vnsip'},
|
{ name = 'vnsip'},
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
{ name = 'buffer' },
|
{ name = 'buffer' },
|
||||||
{ name = 'path' },
|
-- { name = 'path' },
|
||||||
{ name = 'cmdline' },
|
-- { name = 'cmdline' },
|
||||||
}),
|
}),
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
["<c-n>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
elseif vim.fn["vsnip#available"](1) == 1 then
|
elseif vim.fn["vsnip#available"](1) == 1 then
|
||||||
@ -98,67 +94,51 @@ return {
|
|||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
|
|
||||||
["<S-Tab>"] = cmp.mapping(function()
|
["<n-p>"] = cmp.mapping(function()
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
|
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
|
||||||
feedkey("<Plug>(vsnip-jump-prev)", "")
|
feedkey("<Plug>(vsnip-jump-prev)", "")
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
|
|
||||||
}),
|
}),
|
||||||
window = {
|
window = {
|
||||||
completion = {
|
|
||||||
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
|
|
||||||
col_offset = -3,
|
|
||||||
side_padding = 0,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
fomatting = {
|
fomatting = {
|
||||||
format = lspkind.cmp_format({
|
format = lspkind.cmp_format({
|
||||||
mode = 'symbol',
|
with_text = true,
|
||||||
maxwidth = 50,
|
maxwidth = 50,
|
||||||
ellipsis_char = '...',
|
mode = 'symbol',
|
||||||
before = function (_, vim_item)
|
before = function (entry, vim_item)
|
||||||
|
vim_item.kind = kind_icons[vim_item.kind]
|
||||||
|
vim_item.menu = ({
|
||||||
|
buffer = "[Buffer]",
|
||||||
|
nvim_lsp = "[LSP]",
|
||||||
|
})[entry.source.name]
|
||||||
return vim_item
|
return vim_item
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
cmp.setup.cmdline('/', {
|
||||||
|
view = {
|
||||||
|
entries = {name = 'wildmenu', separator = '|' }
|
||||||
|
},
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
-- 语法高亮
|
-- 语法高亮 --
|
||||||
|
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
config = function()
|
config = function()
|
||||||
require'nvim-treesitter.configs'.setup{
|
require'nvim-treesitter.configs'.setup{
|
||||||
-- A list of parser names, or "all" (the four listed parsers should always be installed)
|
|
||||||
ensure_installed = {},
|
ensure_installed = {},
|
||||||
|
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
|
|
||||||
-- Automatically install missing parsers when entering buffer
|
|
||||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
|
|
||||||
-- List of parsers to ignore installing (for "all")
|
|
||||||
-- ignore_install = { "javascript" },
|
|
||||||
|
|
||||||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
|
||||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
|
||||||
|
|
||||||
highlight = {
|
highlight = {
|
||||||
-- `false` will disable the whole extension
|
|
||||||
enable = true,
|
enable = true,
|
||||||
|
|
||||||
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
|
||||||
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
|
||||||
-- the name of the parser)
|
|
||||||
-- list of language that will be disabled
|
|
||||||
-- disable = { "c", "rust" },
|
|
||||||
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
|
|
||||||
disable = function(lang, buf)
|
disable = function(lang, buf)
|
||||||
local max_filesize = 100 * 1024 -- 100 KB
|
local max_filesize = 100 * 1024 -- 100 KB
|
||||||
local ok, stats = pcall(G.loop.fs_stat, G.api.nvim_buf_get_name(buf))
|
local ok, stats = pcall(G.loop.fs_stat, G.api.nvim_buf_get_name(buf))
|
||||||
@ -166,11 +146,6 @@ return {
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
|
||||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
|
||||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
|
||||||
-- Instead of true it can also be a list of languages
|
|
||||||
additional_vim_regex_highlighting = false,
|
additional_vim_regex_highlighting = false,
|
||||||
},
|
},
|
||||||
parsers = {
|
parsers = {
|
||||||
@ -187,10 +162,3 @@ return {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,9 @@ return {
|
|||||||
'kyazdani42/nvim-web-devicons',
|
'kyazdani42/nvim-web-devicons',
|
||||||
{
|
{
|
||||||
"nvim-tree/nvim-tree.lua",
|
"nvim-tree/nvim-tree.lua",
|
||||||
|
keys = {
|
||||||
|
"<c-e>"
|
||||||
|
},
|
||||||
config = function ()
|
config = function ()
|
||||||
|
|
||||||
require'nvim-tree'.setup {
|
require'nvim-tree'.setup {
|
||||||
|
Loading…
Reference in New Issue
Block a user