Bläddra i källkod

fix keymap settings

scorpio 10 månader sedan
förälder
incheckning
dffc4514c6

+ 1 - 0
init.lua

@@ -11,4 +11,5 @@ if not vim.loop.fs_stat(lazypath) then
 end
 vim.opt.rtp:prepend(lazypath)
 require("vim-options")
+require("keymap")
 require("lazy").setup("plugins")

+ 22 - 0
keymap.lua

@@ -0,0 +1,22 @@
+-- 配置快捷键
+vim.g.mapleader = ' '
+local keymap = vim.keymap
+
+-- 基础配置
+keymap.set("n", "qq", ":q!<CR>", { desc = "exit" })
+keymap.set("n", "<leader>w", ":w<CR>", { desc = "w" })
+keymap.set("n", "<leader>wq", ":wqa!<CR>", { desc = "wqa!" })
+-- 开始配置
+keymap.set("n", "<leader>i", 'ggVG')
+
+-- 窗口控制
+keymap.set("n", "s", "", {})
+keymap.set("n", "sv", ":vsp<CR>", { desc = "split window" })
+keymap.set("n", "sh", ":sp<CR>", { desc = "split " })
+keymap.set("n", "sc", "<C-w>c", { desc = "close windows" })
+keymap.set("n", "so", "<C-w>o", { desc = " close other windows" })
+-- 切换窗口
+keymap.set("n", "<A-Right>", "<C-w>l", {})
+keymap.set("n", "<A-Down>", "<C-w>j", {})
+keymap.set("n", "<A-Up>", "<C-w>k", {})
+keymap.set("n", "<A-Left>", "<C-w>h", {})

+ 2 - 1
lazy-lock.json

@@ -8,6 +8,7 @@
   "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
   "lazygit.nvim": { "branch": "main", "commit": "1e08e3f5ac1152339690140e61a4a32b3bdc7de5" },
   "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
+  "mini.animate": { "branch": "main", "commit": "507c43c4402c7d7a2101bc72bece6e2202152afa" },
   "mini.indentscope": { "branch": "main", "commit": "dc26fa1a6c8976f42930c9f53da88d3d441bb13f" },
   "mini.pairs": { "branch": "main", "commit": "71f117fd57f930da6ef4126b24f594dd398bac26" },
   "neo-tree.nvim": { "branch": "v3.x", "commit": "230ff118613fa07138ba579b89d13ec2201530b9" },
@@ -19,7 +20,7 @@
   "nvim-web-devicons": { "branch": "master", "commit": "a1425903ab52a0a0460622519e827f224e5b4fee" },
   "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
   "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
-  "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
+  "telescope.nvim": { "branch": "master", "commit": "6213322ab56eb27356fdc09a5078e41e3ea7f3bc" },
   "todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" },
   "tokyonight.nvim": { "branch": "main", "commit": "f247ee700b569ed43f39320413a13ba9b0aef0db" },
   "vim-floaterm": { "branch": "master", "commit": "3f01a623376957437f9376327637491b74719e38" },

+ 0 - 22
lua/plugins/keybind.lua

@@ -1,22 +0,0 @@
-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
-    }
-}

+ 33 - 0
lua/plugins/mini-animate.lua

@@ -0,0 +1,33 @@
+return {
+    "echasnovski/mini.animate",
+    opts = function()
+        -- don't use animate when scrolling with the mouse
+        local mouse_scrolled = false
+        for _, scroll in ipairs({ "Up", "Down" }) do
+            local key = "<ScrollWheel" .. scroll .. ">"
+            vim.keymap.set({ "", "i" }, key, function()
+                mouse_scrolled = true
+                return key
+            end, { expr = true })
+        end
+
+        local animate = require("mini.animate")
+        return {
+            resize = {
+                timing = animate.gen_timing.linear({ duration = 100, unit = "total" }),
+            },
+            scroll = {
+                timing = animate.gen_timing.linear({ duration = 150, unit = "total" }),
+                subscroll = animate.gen_subscroll.equal({
+                    predicate = function(total_scroll)
+                        if mouse_scrolled then
+                            mouse_scrolled = false
+                            return false
+                        end
+                        return total_scroll > 1
+                    end,
+                }),
+            },
+        }
+    end,
+}

+ 12 - 1
lua/plugins/nvim-notify.lua

@@ -21,5 +21,16 @@ return {
     on_open = function(win)
       vim.api.nvim_win_set_config(win, { zindex = 100 })
     end,
-  }
+  },
+  config = function()
+    local async = require("plenary.async")
+    local notify = require("notify").async
+    local current_time = os.time()
+    local date_format = "%Y-%m-%d"
+    local current_time_str = os.date(date_format, current_time)
+    async.run(function()
+      -- 自定义 启动 notice
+      notify("Hollo, 🧑🏻sdaduanbilei today is " .. current_time_str)
+    end)
+  end
 }

+ 1 - 0
lua/plugins/nvim-ts-autotag.lua

@@ -1,3 +1,4 @@
+-- 配置后 可以自动 关闭 html 标签
 return {
   "windwp/nvim-ts-autotag",
   opts = {}

+ 2 - 6
lua/plugins/project.lua

@@ -5,13 +5,9 @@ return {
   },
   event = "VeryLazy",
   config = function(_, opts)
-    require("project_nvim").setup(opts)
-    require("lazyvim.util").on_load("telescope.nvim", function()
-      require("telescope").load_extension("projects")
-    end)
+    require("telescope").load_extension("projects")
   end,
   keys = {
-    { "<leader>p", ":Telescope projects<CR>",  desc = "Projects" },
-    { "<leader>k", ":Telescope live_grep<CR>", desc = "Projects" },
+    { "<leader>p", ":Telescope projects<CR>", desc = "Projects" },
   },
 }

+ 2 - 4
lua/plugins/telescope.lua

@@ -1,12 +1,10 @@
 return {
   {
     'nvim-telescope/telescope.nvim',
-    tag = '0.1.5',
     dependencies = { 'nvim-lua/plenary.nvim' },
     config = function()
-      local builtin = require("telescope.builtin")
-      vim.keymap.set('n', '<leader>f', builtin.find_files, {})
-      vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
+      vim.keymap.set('n', '<leader>f', ":Telescope find_files<CR>", {})
+      vim.keymap.set('n', '<leader>fg', ":Telescope live_grep<CR", {})
     end
   },
 }

+ 0 - 1
lua/vim-options.lua

@@ -3,4 +3,3 @@ vim.cmd("set tabstop=2")
 vim.cmd("set number")
 vim.cmd("set softtabstop=2")
 vim.cmd("set shiftwidth=2")
-vim.g.mapleader = " "