update
This commit is contained in:
parent
ca0520cd1e
commit
3d02627fcb
@ -27,21 +27,18 @@ local kind_icons = {
|
||||
}
|
||||
|
||||
|
||||
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 {
|
||||
{
|
||||
-- lsp的config
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"folke/neodev.nvim",
|
||||
},
|
||||
config = function()
|
||||
require 'neodev'.setup {}
|
||||
|
||||
require 'lspconfig'.lua_ls.setup(require('lsp.lua'))
|
||||
require 'lspconfig'.clangd.setup(require('lsp.c'))
|
||||
require 'lspconfig'.bashls.setup(require('lsp.bash'))
|
||||
@ -49,6 +46,7 @@ return {
|
||||
require 'lspconfig'.jsonls.setup {}
|
||||
require 'lspconfig'.yamlls.setup(require('lsp.yaml'))
|
||||
|
||||
|
||||
G.map({
|
||||
|
||||
{ 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>' },
|
||||
@ -61,7 +59,6 @@ return {
|
||||
{ 'n', '<cs-i>', '<cmd>lua vim.lsp.buf.format()<CR>' },
|
||||
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
},
|
||||
@ -87,7 +84,7 @@ return {
|
||||
-- lsp 下载器
|
||||
"williamboman/mason.nvim",
|
||||
config = function()
|
||||
require("mason").setup({})
|
||||
require "mason".setup {}
|
||||
end
|
||||
},
|
||||
{ --
|
||||
@ -164,6 +161,9 @@ return {
|
||||
},
|
||||
{
|
||||
-- lsp补全
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-nvim-lsp', -- { name = 'nvim_lua' }
|
||||
'hrsh7th/cmp-buffer', -- { name = 'buffer' },
|
||||
'hrsh7th/cmp-path', -- { name = 'path' }
|
||||
@ -171,9 +171,26 @@ return {
|
||||
'hrsh7th/vim-vsnip',
|
||||
'hrsh7th/cmp-vsnip',
|
||||
'onsails/lspkind-nvim',
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
},
|
||||
config = function()
|
||||
require "cmp-nvim-lsp".setup {}
|
||||
require "cmp-buffer".setup {}
|
||||
require "cmp-path".setup {}
|
||||
require "cmp-cmdline".setup {}
|
||||
require "cmp-vsnip".setup {}
|
||||
require "vim-vsnip".setup {}
|
||||
require "lspkind-nvim".setup {}
|
||||
|
||||
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 lspkind = require('lspkind')
|
||||
cmp.setup {
|
||||
@ -183,10 +200,10 @@ return {
|
||||
end,
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'vnsip' },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
{ name = 'vnsip' },
|
||||
-- { name = 'cmdline' },
|
||||
}),
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
@ -251,7 +268,6 @@ return {
|
||||
kind.menu = " (" .. (strings[2] or "") .. ")"
|
||||
|
||||
return kind
|
||||
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
@ -1,41 +1,41 @@
|
||||
return {
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = {
|
||||
'kyazdani42/nvim-web-devicons'
|
||||
},
|
||||
keys = {
|
||||
"<c-e>"
|
||||
},
|
||||
config = function ()
|
||||
config = function()
|
||||
|
||||
require'nvim-tree'.setup {
|
||||
require 'nvim-web-devicons'.setup{}
|
||||
|
||||
require 'nvim-tree'.setup {
|
||||
sort_by = "case_sensitive",
|
||||
view = {
|
||||
width = 30,
|
||||
},
|
||||
filters = { dotfiles = true, },
|
||||
git = { enable = true },
|
||||
on_attach = function (bufnr)
|
||||
local api = require'nvim-tree.api'
|
||||
on_attach = function(bufnr)
|
||||
local api = require 'nvim-tree.api'
|
||||
api.config.mappings.default_on_attach(bufnr)
|
||||
|
||||
-- override a default
|
||||
G.map({
|
||||
{'n', 'v', api.node.open.vertical, {buffer = bufnr}},
|
||||
{'n', 's', api.node.open.horizontal, {buffer = bufnr}},
|
||||
{ 'n', 'v', api.node.open.vertical, { buffer = bufnr } },
|
||||
{ 'n', 's', api.node.open.horizontal, { buffer = bufnr } },
|
||||
})
|
||||
|
||||
G.delmap({
|
||||
{'n', '<C-e>', { buffer = bufnr }},
|
||||
{'n', '<C-v>', { buffer = bufnr }},
|
||||
{'n', '<C-x>', { buffer = bufnr }},
|
||||
{ 'n', '<C-e>', { buffer = bufnr } },
|
||||
{ 'n', '<C-v>', { buffer = bufnr } },
|
||||
{ 'n', '<C-x>', { buffer = bufnr } },
|
||||
})
|
||||
|
||||
end
|
||||
}
|
||||
G.map({
|
||||
{"n", "<C-e>", ":NvimTreeToggle<CR>", { noremap = true }},
|
||||
{ "n", "<C-e>", ":NvimTreeToggle<CR>", { noremap = true } },
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user