Browse Source

完成基础配置

scorpio 1 year ago
parent
commit
0f5a36ec3c
6 changed files with 71 additions and 186 deletions
  1. 1 0
      README.md
  2. 2 2
      lua/basic.lua
  3. 2 0
      lua/keybindings.lua
  4. 7 1
      lua/plugin-config/dashboard.lua
  5. 32 1
      lua/plugins.lua
  6. 27 182
      plugin/packer_compiled.lua

+ 1 - 0
README.md

@@ -0,0 +1 @@
+sdfot:qa

+ 2 - 2
lua/basic.lua

@@ -12,7 +12,7 @@ vim.wo.cursorline = true
 -- 显示左侧图标事例
 vim.wo.signcolumn = "yes"
 -- 右侧参考线,超过表示代码太长,换行
-vim.wo.colorcolumn = "120"
+vim.wo.colorcolumn = "180"
 -- 缩进2 个空格等于一个tab
 vim.o.tabstop = 2
 vim.bo.tabstop = 2
@@ -36,7 +36,7 @@ vim.o.hlsearch = false
 -- 边输入边搜索
 vim.o.insearch = true
 -- 命令行高未2 提供足够的显示空间
-vim.o.cmdheight = 2
+vim.o.cmdheight = 1
 -- 当前文件将被外部程序修改时自动加载
 vim.o.autoread = true
 vim.bo.autoread = true

+ 2 - 0
lua/keybindings.lua

@@ -57,6 +57,8 @@ map("n", "<leader>k", ":Telescope live_grep<CR>", opt)
 map("n", "<leader>g", ":Telescope git_files<CR>", opt)
 -- project
 map("n", "<leader>p", ":Telescope projects<CR>", opt)
+-- packer update
+map("n", "<leader>u", ":PackerUpdate<CR>", opt)
 -- 插件快捷键
 local pluginKeys = {}
 

+ 7 - 1
lua/plugin-config/dashboard.lua

@@ -30,7 +30,7 @@ db.setup({
             icon = ' ',
             desc = 'Find Word',
             key = 'k',
-            keymap = 'SPC k',
+            keymap = 'SPC k33',
             action = 'lua print(3)'
         }, {
             icon = ' ',
@@ -38,6 +38,12 @@ db.setup({
             key = 'p',
             keymap = 'SPC p',
             action = 'lua print(4)'
+        }, {
+            icon = ' ',
+            desc = 'Project',
+            key = 'u',
+            keymap = 'SPC u',
+            action = 'lua print(4)'
         }},
         footer = db.custom_footer -- your footer
     }

+ 32 - 1
lua/plugins.lua

@@ -1,4 +1,30 @@
-local packer = require("packer")
+-- 自动安装 Packer.nvim
+-- 插件安装目录
+-- ~/.local/share/nvim/site/pack/packer/
+local fn = vim.fn
+local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
+local paccker_bootstrap
+if fn.empty(fn.glob(install_path)) > 0 then
+    vim.notify("正在安装Pakcer.nvim,请稍后...")
+    paccker_bootstrap = fn.system({"git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim",
+    -- "https://gitcode.net/mirrors/wbthomason/packer.nvim",
+                                   install_path})
+
+    -- https://github.com/wbthomason/packer.nvim/issues/750
+    local rtp_addition = vim.fn.stdpath("data") .. "/site/pack/*/start/*"
+    if not string.find(vim.o.runtimepath, rtp_addition) then
+        vim.o.runtimepath = rtp_addition .. "," .. vim.o.runtimepath
+    end
+    vim.notify("Pakcer.nvim 安装完毕")
+end
+
+-- Use a protected call so we don't error out on first use
+local status_ok, packer = pcall(require, "packer")
+if not status_ok then
+    vim.notify("没有安装 packer.nvim")
+    return
+end
+
 packer.startup({
     function(use)
         -- Packer 可以管理自己本身
@@ -31,6 +57,11 @@ packer.startup({
         }
         -- project
         use("ahmedkhalf/project.nvim")
+        -- treesitter (新增)
+        use({
+            "nvim-treesitter/nvim-treesitter",
+            run = ":TSUpdate"
+        })
 
     end,
     config = {

+ 27 - 182
plugin/packer_compiled.lua

@@ -74,170 +74,33 @@ end
 time([[try_loadstring definition]], false)
 time([[Defining packer_plugins]], true)
 _G.packer_plugins = {
-  ["Comment.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/Comment.nvim",
-    url = "https://github.com/numToStr/Comment.nvim"
-  },
-  ["bufferline.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/bufferline.nvim",
-    url = "https://github.com/akinsho/bufferline.nvim"
-  },
-  ["cmp-buffer"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/cmp-buffer",
-    url = "https://github.com/hrsh7th/cmp-buffer"
-  },
-  ["cmp-cmdline"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
-    url = "https://github.com/hrsh7th/cmp-cmdline"
-  },
-  ["cmp-nvim-lsp"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
-    url = "https://github.com/hrsh7th/cmp-nvim-lsp"
-  },
-  ["cmp-nvim-lsp-signature-help"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp-signature-help",
-    url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help"
-  },
-  ["cmp-path"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/cmp-path",
-    url = "https://github.com/hrsh7th/cmp-path"
-  },
-  ["cmp-vsnip"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/cmp-vsnip",
-    url = "https://github.com/hrsh7th/cmp-vsnip"
-  },
-  ["fidget.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/fidget.nvim",
-    url = "https://github.com/j-hui/fidget.nvim"
-  },
-  ["formatter.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/formatter.nvim",
-    url = "https://github.com/mhartington/formatter.nvim"
-  },
-  ["friendly-snippets"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/friendly-snippets",
-    url = "https://github.com/rafamadriz/friendly-snippets"
-  },
-  ["gitsigns.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
-    url = "https://github.com/lewis6991/gitsigns.nvim"
-  },
-  ["gruvbox.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/gruvbox.nvim",
-    url = "https://github.com/ellisonleao/gruvbox.nvim"
-  },
-  ["lspkind-nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/lspkind-nvim",
-    url = "https://github.com/onsails/lspkind-nvim"
-  },
-  ["lspsaga.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/lspsaga.nvim",
-    url = "https://github.com/tami5/lspsaga.nvim"
-  },
-  ["lua-dev.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/lua-dev.nvim",
-    url = "https://github.com/folke/lua-dev.nvim"
+  ["dashboard-nvim"] = {
+    loaded = false,
+    needs_bufread = false,
+    only_cond = false,
+    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/opt/dashboard-nvim",
+    url = "https://github.com/glepnir/dashboard-nvim"
   },
   ["lualine.nvim"] = {
     loaded = true,
     path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/lualine.nvim",
     url = "https://github.com/nvim-lualine/lualine.nvim"
   },
-  ["lush.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/lush.nvim",
-    url = "https://github.com/rktjmp/lush.nvim"
-  },
-  ["nightfox.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nightfox.nvim",
-    url = "https://github.com/EdenEast/nightfox.nvim"
-  },
-  ["nord.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nord.nvim",
-    url = "https://github.com/shaunsingh/nord.nvim"
-  },
-  ["null-ls.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/null-ls.nvim",
-    url = "https://github.com/jose-elias-alvarez/null-ls.nvim"
-  },
-  ["nvim-autopairs"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
-    url = "https://github.com/windwp/nvim-autopairs"
-  },
-  ["nvim-cmp"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nvim-cmp",
-    url = "https://github.com/hrsh7th/nvim-cmp"
-  },
-  ["nvim-dap"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nvim-dap",
-    url = "https://github.com/mfussenegger/nvim-dap"
-  },
-  ["nvim-dap-ui"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nvim-dap-ui",
-    url = "https://github.com/rcarriga/nvim-dap-ui"
-  },
-  ["nvim-dap-virtual-text"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nvim-dap-virtual-text",
-    url = "https://github.com/theHamsta/nvim-dap-virtual-text"
-  },
-  ["nvim-lsp-installer"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer",
-    url = "https://github.com/williamboman/nvim-lsp-installer"
-  },
-  ["nvim-lsp-ts-utils"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nvim-lsp-ts-utils",
-    url = "https://github.com/jose-elias-alvarez/nvim-lsp-ts-utils"
-  },
-  ["nvim-lspconfig"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
-    url = "https://github.com/neovim/nvim-lspconfig"
-  },
   ["nvim-tree.lua"] = {
     loaded = true,
     path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
     url = "https://github.com/kyazdani42/nvim-tree.lua"
   },
-  ["nvim-web-devicons"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
-    url = "https://github.com/kyazdani42/nvim-web-devicons"
-  },
-  ["oceanic-next"] = {
+  ["nvim-treesitter"] = {
     loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/oceanic-next",
-    url = "https://github.com/mhartington/oceanic-next"
+    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
+    url = "https://github.com/nvim-treesitter/nvim-treesitter"
   },
-  ["onedark.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/onedark.nvim",
-    url = "https://github.com/ful1e5/onedark.nvim"
+  ["nvim-web-devicons"] = {
+    loaded = false,
+    needs_bufread = false,
+    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons",
+    url = "https://github.com/nvim-tree/nvim-web-devicons"
   },
   ["packer.nvim"] = {
     loaded = true,
@@ -249,49 +112,31 @@ _G.packer_plugins = {
     path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/plenary.nvim",
     url = "https://github.com/nvim-lua/plenary.nvim"
   },
-  ["rust-tools.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/rust-tools.nvim",
-    url = "https://github.com/simrat39/rust-tools.nvim"
-  },
-  ["schemastore.nvim"] = {
+  ["project.nvim"] = {
     loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/schemastore.nvim",
-    url = "https://github.com/b0o/schemastore.nvim"
+    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/project.nvim",
+    url = "https://github.com/ahmedkhalf/project.nvim"
   },
-  ["surround.nvim"] = {
+  ["telescope.nvim"] = {
     loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/surround.nvim",
-    url = "https://github.com/ur4ltz/surround.nvim"
-  },
-  ["toggleterm.nvim"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/toggleterm.nvim",
-    url = "https://github.com/akinsho/toggleterm.nvim"
+    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/telescope.nvim",
+    url = "https://github.com/nvim-telescope/telescope.nvim"
   },
   ["tokyonight.nvim"] = {
     loaded = true,
     path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/tokyonight.nvim",
     url = "https://github.com/folke/tokyonight.nvim"
-  },
-  ["vim-bbye"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/vim-bbye",
-    url = "https://github.com/moll/vim-bbye"
-  },
-  ["vim-vsnip"] = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/vim-vsnip",
-    url = "https://github.com/hrsh7th/vim-vsnip"
-  },
-  vimspector = {
-    loaded = true,
-    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/vimspector",
-    url = "https://github.com/puremourning/vimspector"
   }
 }
 
 time([[Defining packer_plugins]], false)
+vim.cmd [[augroup packer_load_aucmds]]
+vim.cmd [[au!]]
+  -- Event lazy-loads
+time([[Defining lazy-load event autocommands]], true)
+vim.cmd [[au VimEnter * ++once lua require("packer.load")({'dashboard-nvim'}, { event = "VimEnter *" }, _G.packer_plugins)]]
+time([[Defining lazy-load event autocommands]], false)
+vim.cmd("augroup END")
 
 _G._packer.inside_compile = false
 if _G._packer.needs_bufread == true then