Browse Source

add plugins

scorpio 1 year ago
parent
commit
e6bc2743fc

+ 0 - 1
init.lua

@@ -12,4 +12,3 @@ end
 vim.opt.rtp:prepend(lazypath)
 require("vim-options")
 require("lazy").setup("plugins")
-

+ 15 - 1
keymaps.lua

@@ -6,4 +6,18 @@ local function map(mode, lhs, rhs, opts)
     vim.api.nvim_set_keymap(mode, lhs, rhs, options)
 end
 
-map("n", "<leader>gt", ":LazyGit<CR>", { desc = "Lazygit" })
+-- 基础配置
+map("n", "qq", ":q!<CR>", { desc = "exit" })
+map("n", "<leader>w", ":w<CR>", { desc = "w" })
+map("n", "<leader>wq", ":wqa!<CR>", { desc = "wqa!" })
+-- 取消 s 默认功能
+map("n", "s", "", {})
+map("n", "sv", ":vsp<CR>", { desc = "split window" })
+map("n", "sh", ":sp<CR>", { desc = "split " })
+map("n", "sc", "<C-w>c", { desc = "close windows" })
+map("n", "so", "<C-w>o", { desc = " close other windows" })
+-- 切换窗口
+map("n", "<A-Right>", "<C-w>l", {})
+map("n", "<A-Down>", "<C-w>j", {})
+map("n", "<A-Up>", "<C-w>k", {})
+map("n", "<A-Left>", "<C-w>h", {})

+ 11 - 11
lazy-lock.json

@@ -4,22 +4,22 @@
   "catppuccin": { "branch": "main", "commit": "079500a625f3ae5aa6efb758f1a17fe4c7a57e52" },
   "dashboard-nvim": { "branch": "master", "commit": "63df28409d940f9cac0a925df09d3dc369db9841" },
   "gruvbox.nvim": { "branch": "main", "commit": "0940564208a490c173216c3b7d2188b0a5ad3491" },
-  "indent-blankline.nvim": { "branch": "master", "commit": "ceaf730b13e332cd76600d9795722413c236c684" },
+  "indent-blankline.nvim": { "branch": "master", "commit": "d4c718467d35bc93714425a7102d82e7e5065280" },
   "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
-  "lazygit.nvim": { "branch": "main", "commit": "3466e48439601445e26c65635421625886f2d0c0" },
+  "lazygit.nvim": { "branch": "main", "commit": "1e08e3f5ac1152339690140e61a4a32b3bdc7de5" },
   "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
   "mini.indentscope": { "branch": "main", "commit": "dc26fa1a6c8976f42930c9f53da88d3d441bb13f" },
   "mini.pairs": { "branch": "main", "commit": "71f117fd57f930da6ef4126b24f594dd398bac26" },
   "neo-tree.nvim": { "branch": "v3.x", "commit": "230ff118613fa07138ba579b89d13ec2201530b9" },
-  "noice.nvim": { "branch": "main", "commit": "6c87c1d11c38180fb72bf8f45518a0a3e081afc1" },
-  "nui.nvim": { "branch": "main", "commit": "698e75814cd7c56b0dd8af4936bcef2d13807f3c" },
-  "nvim-notify": { "branch": "master", "commit": "f3024b912073774111202f5fa6518b0cd2a74432" },
-  "nvim-treesitter": { "branch": "master", "commit": "a76db88548bb7fe008cd7e4f2d2ec2ccc080dede" },
-  "nvim-web-devicons": { "branch": "master", "commit": "2a125024a137677930efcfdf720f205504c97268" },
-  "plenary.nvim": { "branch": "master", "commit": "52544825d6b8be677eb395983515ad5e30ae1f2e" },
+  "noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" },
+  "nui.nvim": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" },
+  "nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" },
+  "nvim-treesitter": { "branch": "master", "commit": "5a713474e38a3999b85c6cb3f5cac3248a16c7d0" },
+  "nvim-web-devicons": { "branch": "master", "commit": "a1425903ab52a0a0460622519e827f224e5b4fee" },
+  "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
   "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
-  "telescope.nvim": { "branch": "master", "commit": "6d3fbffe426794296a77bb0b37b6ae0f4f14f807" },
-  "todo-comments.nvim": { "branch": "main", "commit": "09b0b17d824d2d56f02ff15967e8a2499a89c731" },
+  "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
+  "todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" },
   "vim-floaterm": { "branch": "master", "commit": "3f01a623376957437f9376327637491b74719e38" },
-  "which-key.nvim": { "branch": "main", "commit": "e271c28118998c93a14d189af3395812a1aa646c" }
+  "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
 }

+ 0 - 1
lua/plugins/catppuccin.lua

@@ -9,4 +9,3 @@ return {
     end
   }
 }
-

+ 1 - 1
lua/plugins/colorscheme.lua

@@ -6,7 +6,7 @@ return {
   {
     "LazyVim/LazyVim",
     opts = {
-      colorscheme = "gruvbox",
+      colorscheme = "tokyonight-moon",
     },
   }
 }

+ 11 - 4
lua/plugins/dashboard.lua

@@ -2,6 +2,9 @@ return {
   'nvimdev/dashboard-nvim',
   event = 'VimEnter',
   config = function()
+    -- keymap
+    vim.keymap.set("n", "<leader>hh", ":Dashboard<CR>", {})
+    vim.keymap.set("n", "<leader>u", ":Lazy update<CR>", {})
     require('dashboard').setup {
       -- config
       theme = 'doom',
@@ -40,12 +43,16 @@ return {
           key = 'u',
           name = "DsStore",
           keymap = 'SPC u',
-        } } -- your footer
+        } },
+        -- your footer
+        footer = function()
+          local stats = require("lazy").stats()
+          local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
+          return { '🧑🏻sdaduanbilei', '🎉 Have fun with neovim 🎉', "🎉 Neovim loaded " ..
+          stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
+        end
       }
     }
   end,
   dependencies = { { 'nvim-tree/nvim-web-devicons' } },
-  config = function()
-    vim.keymap.set("n", "<leader>hh", ":Dashboard<CR>", {})
-  end
 }

+ 1 - 0
lua/plugins/indent-blankline.lua

@@ -1,5 +1,6 @@
 return {
   "lukas-reineke/indent-blankline.nvim",
+  main = "ibl",
   opts = {
     indent = {
       char = "│",

+ 22 - 0
lua/plugins/keybind.lua

@@ -0,0 +1,22 @@
+return {
+    {
+        "folke/tokyonight.nvim",
+        config = function()
+            -- 基础配置
+            vim.keymap.set("n", "qq", ":q!<CR>", { desc = "exit" })
+            vim.keymap.set("n", "<leader>w", ":w<CR>", { desc = "w" })
+            vim.keymap.set("n", "<leader>wq", ":wqa!<CR>", { desc = "wqa!" })
+            -- 取消 s 默认功能
+            vim.keymap.set("n", "s", "", {})
+            vim.keymap.set("n", "sv", ":vsp<CR>", { desc = "split window" })
+            vim.keymap.set("n", "sh", ":sp<CR>", { desc = "split " })
+            vim.keymap.set("n", "sc", "<C-w>c", { desc = "close windows" })
+            vim.keymap.set("n", "so", "<C-w>o", { desc = " close other windows" })
+            -- 切换窗口
+            vim.keymap.set("n", "<A-Right>", "<C-w>l", {})
+            vim.keymap.set("n", "<A-Down>", "<C-w>j", {})
+            vim.keymap.set("n", "<A-Up>", "<C-w>k", {})
+            vim.keymap.set("n", "<A-Left>", "<C-w>h", {})
+        end
+    }
+}

+ 3 - 0
lua/plugins/lazygit.lua

@@ -5,4 +5,7 @@ return
     dependencies = {
         "nvim-lua/plenary.nvim",
     },
+    config = function()
+        vim.keymap.set("n", "<leader>gt", ":LazyGit<CR>", { desc = "Lazygit" })
+    end
 }

+ 14 - 3
lua/plugins/project.lua

@@ -1,6 +1,17 @@
 return {
   "ahmedkhalf/project.nvim",
-  config = function()
-    vim.keymap.set('n', '<leader>p', '<c-f>', {})
-  end
+  opts = {
+    manual_mode = true,
+  },
+  event = "VeryLazy",
+  config = function(_, opts)
+    require("project_nvim").setup(opts)
+    require("lazyvim.util").on_load("telescope.nvim", function()
+      require("telescope").load_extension("projects")
+    end)
+  end,
+  keys = {
+    { "<leader>p", ":Telescope projects<CR>",  desc = "Projects" },
+    { "<leader>k", ":Telescope live_grep<CR>", desc = "Projects" },
+  },
 }

+ 5 - 0
lua/plugins/tokyonight.lua

@@ -0,0 +1,5 @@
+return {
+  "folke/tokyonight.nvim",
+  lazy = true,
+  opts = { style = "moon" },
+}