From c11f08877b51f97abb2f47f9fa07a09b23c796a2 Mon Sep 17 00:00:00 2001 From: Young Xu Date: Mon, 6 Feb 2023 17:36:34 +0800 Subject: [PATCH] add plugins --- lua/plugins-config.lua | 40 ++++++++++++++++++++-- lua/plugins.lua | 75 ++++++++++++++++++++++++++---------------- 2 files changed, 84 insertions(+), 31 deletions(-) diff --git a/lua/plugins-config.lua b/lua/plugins-config.lua index 880fbd5..0b05f60 100644 --- a/lua/plugins-config.lua +++ b/lua/plugins-config.lua @@ -17,6 +17,38 @@ require('nvim-treesitter.configs').setup({ }, }) +-- :h mason-default-settings +require("mason").setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, + mason = true +}) + +-- mason-lspconfig uses the `lspconfig` server names in the APIs it exposes - not `mason.nvim` package names +-- https://github.com/williamboman/mason-lspconfig.nvim/blob/main/doc/server-mapping.md +require("mason-lspconfig").setup({ + -- 确保安装,根据需要填写 + ensure_installed = { + "sumneko_lua", + "bashls", + "cssls", + "dockerls", + "emmet_ls", + "html", + "jsonls", + "rust_analyzer", + "yamlls", + "gopls" + }, +}) + +require('navigator').setup() +vim.notify = require("notify") require('symbols-outline').setup() require('feline').setup() require('bufferline').setup() @@ -85,17 +117,19 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities() --nvim-cmp local on_attach = function(client, bufnr) local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end + local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end + buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') end -- Setup lspconfig. local nvim_lsp = require('lspconfig') --- setup languages +-- setup languages -- GoLang -nvim_lsp['gopls'].setup{ - cmd = {'gopls'}, +nvim_lsp['gopls'].setup { + cmd = { 'gopls' }, on_attach = on_attach, capabilities = capabilities, settings = { diff --git a/lua/plugins.lua b/lua/plugins.lua index be508ee..e3b7ec8 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -9,23 +9,23 @@ return require('packer').startup(function() }, tag = 'nightly' -- optional, updated every week. (see issue #1193) } - -- 欢迎页 - use { + -- 欢迎页 + use { 'goolord/alpha-nvim', requires = { 'nvim-tree/nvim-web-devicons' }, - config = function () - require'alpha'.setup(require'alpha.themes.startify'.config) + config = function() + require 'alpha'.setup(require 'alpha.themes.startify'.config) end } - -- 主题 - use { "ellisonleao/gruvbox.nvim" } - -- 代码缩略图 - use 'simrat39/symbols-outline.nvim' - -- 状态栏 - use 'feline-nvim/feline.nvim' - -- bufferline 标题栏 - use {'akinsho/bufferline.nvim', tag = "v3.*", requires = 'nvim-tree/nvim-web-devicons'} - -- golang ide + -- 主题 + use { "ellisonleao/gruvbox.nvim" } + -- 代码缩略图 + use 'simrat39/symbols-outline.nvim' + -- 状态栏 + use 'feline-nvim/feline.nvim' + -- bufferline 标题栏 + use { 'akinsho/bufferline.nvim', tag = "v3.*", requires = 'nvim-tree/nvim-web-devicons' } + -- golang ide --auto complete use 'hrsh7th/cmp-nvim-lsp' use 'hrsh7th/cmp-buffer' @@ -35,23 +35,30 @@ return require('packer').startup(function() use 'hrsh7th/cmp-vsnip' use 'hrsh7th/vim-vsnip' vim.opt.completeopt = { "menu", "menuone", "noselect" } - use 'ray-x/go.nvim' + use({ + 'ray-x/navigator.lua', + requires = { + { 'ray-x/guihua.lua', run = 'cd lua/fzy && make' }, + { 'neovim/nvim-lspconfig' }, + }, + }) + use 'ray-x/go.nvim' use 'ray-x/guihua.lua' -- recommended if need floating window support - use {'neovim/nvim-lspconfig', config = function() - require('lspconfig').gopls.setup{} - require('lspconfig').golangci_lint_ls.setup{} - end + use { "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim" } + use { 'neovim/nvim-lspconfig', config = function() + require('lspconfig').gopls.setup {} + end } use 'nvim-treesitter/nvim-treesitter' use 'mfussenegger/nvim-dap' use 'theHamsta/nvim-dap-virtual-text' - use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} } + use { "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } } -- 当前工作目录 - use { + use { "ahmedkhalf/project.nvim", config = function() - require("project_nvim").setup{ - exclude_dirs = {".git", "node_modules", "dist", "target"}, + require("project_nvim").setup { + exclude_dirs = { ".git", "node_modules", "dist", "target" }, } end } @@ -60,16 +67,16 @@ return require('packer').startup(function() -- 改善启动时间 use 'lewis6991/impatient.nvim' -- 终端管理 - use {"akinsho/toggleterm.nvim", tag = '*', config = function() - require("toggleterm").setup() - end + use { "akinsho/toggleterm.nvim", tag = '*', config = function() + require("toggleterm").setup() + end } -- TODO管理 use { "folke/todo-comments.nvim", requires = "nvim-lua/plenary.nvim", config = function() - require("todo-comments").setup{} + require("todo-comments").setup {} end } -- git 管理 @@ -84,10 +91,22 @@ return require('packer').startup(function() end } -- coc 代码提示 - use {'neoclide/coc.nvim', branch = 'release'} + use { 'neoclide/coc.nvim', branch = 'release' } -- 搜索 use { 'nvim-telescope/telescope.nvim', tag = '0.1.1', - requires = { {'nvim-lua/plenary.nvim'} } + requires = { { 'nvim-lua/plenary.nvim' } } } + -- 自动保存 + use({ + "Pocco81/auto-save.nvim", + config = function() + require("auto-save").setup { + -- your config goes here + -- or just leave it empty :) + } + end, + }) + -- 通知 + use 'rcarriga/nvim-notify' end)