Browse Source

add config

scorpio 1 year ago
parent
commit
c8e1f6934f
6 changed files with 125 additions and 28 deletions
  1. 1 0
      init.lua
  2. 10 8
      lua/keybindings.lua
  3. 3 4
      lua/plugin-config/fidget.lua
  4. 23 0
      lua/plugin-config/neoscroll.lua
  5. 22 0
      lua/plugins.lua
  6. 66 16
      plugin/packer_compiled.lua

+ 1 - 0
init.lua

@@ -24,6 +24,7 @@ require("plugin-config.indent-blankline")
 require("plugin-config.nvim-notify")
 require("plugin-config.colorizer")
 require("plugin-config.noice")
+require("plugin-config.neoscroll")
 -- 内置LSP (新增)
 require("lsp.setup")
 require("lsp.config.mason")

+ 10 - 8
lua/keybindings.lua

@@ -23,25 +23,27 @@ keymap.set("i", "jj", "<ESC>")
 local map = vim.api.nvim_set_keymap
 -- 取消 s 默认功能
 map("n", "s", "", opt)
-map("n", "sv", ":vsp<CR>", opt)
-map("n", "sh", ":sp<CR>", opt)
-map("n", "sc", "<C-w>c", opt)
-map("n", "so", "<C-w>o", opt)
+map("n", "<leader>v", ":vsp<CR>", opt)
+map("n", "<leader>h", ":sp<CR>", opt)
+map("n", "<leader>c", "<C-w>c", opt)
+map("n", "<leader>o", "<C-w>o", opt)
 -- 切换窗口
 map("n", "<A-Right>", "<C-w>l", opt)
 map("n", "<A-Down>", "<C-w>j", opt)
 map("n", "<A-Up>", "<C-w>k", opt)
 map("n", "<A-Left>", "<C-w>h", opt)
 -- 返回dashboard 主页
-map("n", "<leader>h", ":Dashboard<CR>", opt)
+map("n", "<leader>hh", ":Dashboard<CR>", opt)
 -- gitsigns
 map("n", "git", ":Gitsigns toggle_current_line_blame<CR>", opt)
 -- lazygit
 map("n", "<leader>lg", ":LazyGit<CR>", opt)
+-- git diffview open
+map("n", "<leader>mg", ":DiffviewOpen<CR>", opt)
 -- terminal 相关
 map("n", "<leader>t", ":FloatermToggle<CR>", opt)
 -- 开启/关闭 全屏窗口
-map("n", "<leader>s", ":MaximizerToggle<CR>", opt)
+map("n", "<leader>M", ":MaximizerToggle<CR>", opt)
 -- 开始错误列表
 map("n", "<leader>i", ":TroubleToggle<CR>", opt)
 -- rename 插件
@@ -52,14 +54,14 @@ map("v", ">", ">gv", opt)
 map("v", "J", ":move '>+1<CR>gv-gv>'", opt)
 map("v", "K", ":move '<-2<CR>gv-gv>'", opt)
 -- 保存配置
-map("n", "<leader>w", ":w<CR>", opt)
+map("n", "<leader>s", ":w<CR>", opt)
 map("n", "<leader>wq", ":wqa!<CR>", opt)
 -- 退出
 map("n", "qq", ":q!<CR>", opt)
 map("n", "<leader>q", ":qa!<CR>", opt)
 -- 上下滚动浏览
 map("n", "<A-j>", "5j", opt)
-map("n", "<A-k>", "5k", opt)
+-- map("n", "<A-k>", "5k", opt)
 map("v", "<A-j>", "5j", opt)
 map("v", "<A-k>", "5k", opt)
 

+ 3 - 4
lua/plugin-config/fidget.lua

@@ -1,4 +1,3 @@
-
 local status, fidget = pcall(require, "fidget")
 if not status then
   vim.notify("没有找到 fidget")
@@ -7,9 +6,9 @@ end
 
 fidget.setup({
   text = {
-    spinner = "zip", -- animation shown when tasks are ongoing
-    done = "✔", -- character shown when all tasks are complete
-    commenced = "Started", -- message shown when task starts
+    spinner = "zip",         -- animation shown when tasks are ongoing
+    done = "✔",            -- character shown when all tasks are complete
+    commenced = "Started",   -- message shown when task starts
     completed = "Completed", -- message shown when task completes
   },
   sources = {

+ 23 - 0
lua/plugin-config/neoscroll.lua

@@ -0,0 +1,23 @@
+local status, neoscroll = pcall(require, "neoscroll")
+if not status then
+  vim.notify("没找到neoscroll")
+  return
+end
+
+neoscroll.setup({
+  hide_cursor = true,
+})
+
+local t = {}
+-- Syntax: t[keys] = {function, {function arguments}}
+t["<C-k>"] = { "scroll", { "-vim.wo.scroll", "true", "300", [['sine']] } }
+t["<C-j>"] = { "scroll", { "vim.wo.scroll", "true", "300", [['sine']] } }
+t["<C-b>"] = { "scroll", { "-vim.api.nvim_win_get_height(0)", "true", "20" } }
+t["<C-f>"] = { "scroll", { "vim.api.nvim_win_get_height(0)", "true", "20" } }
+t["<C-y>"] = { "scroll", { "-0.10", "false", "100" } }
+t["<C-e>"] = { "scroll", { "0.10", "false", "100" } }
+t["zt"] = { "zt", { "250" } }
+t["zz"] = { "zz", { "250" } }
+t["zb"] = { "zb", { "250" } }
+
+require("neoscroll.config").set_mappings(t)

+ 22 - 0
lua/plugins.lua

@@ -182,6 +182,7 @@ packer.startup({
     -- fidget.nvim
     use({
       "j-hui/fidget.nvim",
+      branch = "legacy",
       config = function()
         require("plugin-config.fidget")
       end,
@@ -200,6 +201,27 @@ packer.startup({
         require("inc_rename").setup()
       end,
     })
+    -- smooth scroll
+    use({
+      "karb94/neoscroll.nvim",
+      config = function()
+        require("plugin-config.neoscroll")
+      end,
+    })
+    -- code action menu
+    use({
+      "weilbith/nvim-code-action-menu",
+      cmd = "CodeActionMenu",
+    })
+    use({
+      "nacro90/numb.nvim",
+      config = function()
+        require("numb").setup()
+      end,
+    })
+    use("echasnovski/mini.nvim")
+    -- git merge diff view
+    use("sindrets/diffview.nvim")
   end,
   config = {
     -- 并发数限制

+ 66 - 16
plugin/packer_compiled.lua

@@ -120,6 +120,11 @@ _G.packer_plugins = {
     path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/dashboard-nvim",
     url = "https://github.com/glepnir/dashboard-nvim"
   },
+  ["diffview.nvim"] = {
+    loaded = true,
+    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/diffview.nvim",
+    url = "https://github.com/sindrets/diffview.nvim"
+  },
   ["eslint.nvim"] = {
     loaded = true,
     path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/eslint.nvim",
@@ -198,11 +203,22 @@ _G.packer_plugins = {
     path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/mason.nvim",
     url = "https://github.com/williamboman/mason.nvim"
   },
+  ["mini.nvim"] = {
+    loaded = true,
+    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/mini.nvim",
+    url = "https://github.com/echasnovski/mini.nvim"
+  },
   ["neodev.nvim"] = {
     loaded = true,
     path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/neodev.nvim",
     url = "https://github.com/folke/neodev.nvim"
   },
+  ["neoscroll.nvim"] = {
+    config = { "\27LJ\2\n7\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\28plugin-config.neoscroll\frequire\0" },
+    loaded = true,
+    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/neoscroll.nvim",
+    url = "https://github.com/karb94/neoscroll.nvim"
+  },
   ["noice.nvim"] = {
     loaded = true,
     path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/noice.nvim",
@@ -218,6 +234,12 @@ _G.packer_plugins = {
     path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/null-ls.nvim",
     url = "https://github.com/jose-elias-alvarez/null-ls.nvim"
   },
+  ["numb.nvim"] = {
+    config = { "\27LJ\2\n2\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\tnumb\frequire\0" },
+    loaded = true,
+    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/numb.nvim",
+    url = "https://github.com/nacro90/numb.nvim"
+  },
   ["nvim-autopairs"] = {
     config = { "\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0" },
     loaded = true,
@@ -229,6 +251,14 @@ _G.packer_plugins = {
     path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nvim-cmp",
     url = "https://github.com/hrsh7th/nvim-cmp"
   },
+  ["nvim-code-action-menu"] = {
+    commands = { "CodeActionMenu" },
+    loaded = false,
+    needs_bufread = true,
+    only_cond = false,
+    path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/opt/nvim-code-action-menu",
+    url = "https://github.com/weilbith/nvim-code-action-menu"
+  },
   ["nvim-colorizer.lua"] = {
     loaded = true,
     path = "/Users/sdaduanbilei/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua",
@@ -369,34 +399,54 @@ _G.packer_plugins = {
 }
 
 time([[Defining packer_plugins]], false)
--- Config for: inc-rename.nvim
-time([[Config for inc-rename.nvim]], true)
-try_loadstring("\27LJ\2\n8\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\15inc_rename\frequire\0", "config", "inc-rename.nvim")
-time([[Config for inc-rename.nvim]], false)
--- Config for: nvim-treesitter
-time([[Config for nvim-treesitter]], true)
-try_loadstring("\27LJ\2\n=\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\"plugin-config.nvim-treesitter\frequire\0", "config", "nvim-treesitter")
-time([[Config for nvim-treesitter]], false)
--- Config for: fidget.nvim
-time([[Config for fidget.nvim]], true)
-try_loadstring("\27LJ\2\n4\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\25plugin-config.fidget\frequire\0", "config", "fidget.nvim")
-time([[Config for fidget.nvim]], false)
 -- Config for: Comment.nvim
 time([[Config for Comment.nvim]], true)
 try_loadstring("\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0", "config", "Comment.nvim")
 time([[Config for Comment.nvim]], false)
+-- Config for: nvim-treesitter
+time([[Config for nvim-treesitter]], true)
+try_loadstring("\27LJ\2\n=\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\"plugin-config.nvim-treesitter\frequire\0", "config", "nvim-treesitter")
+time([[Config for nvim-treesitter]], false)
 -- Config for: hop.nvim
 time([[Config for hop.nvim]], true)
 try_loadstring("\27LJ\2\nU\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\1K\0\1\0\1\0\1\tkeys\28etovxqpdygfblzhckisuran\nsetup\bhop\frequire\0", "config", "hop.nvim")
 time([[Config for hop.nvim]], false)
--- Config for: nvim-notify
-time([[Config for nvim-notify]], true)
-try_loadstring("\27LJ\2\n9\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\30plugin-config.nvim-notify\frequire\0", "config", "nvim-notify")
-time([[Config for nvim-notify]], false)
+-- Config for: numb.nvim
+time([[Config for numb.nvim]], true)
+try_loadstring("\27LJ\2\n2\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\tnumb\frequire\0", "config", "numb.nvim")
+time([[Config for numb.nvim]], false)
+-- Config for: fidget.nvim
+time([[Config for fidget.nvim]], true)
+try_loadstring("\27LJ\2\n4\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\25plugin-config.fidget\frequire\0", "config", "fidget.nvim")
+time([[Config for fidget.nvim]], false)
+-- Config for: inc-rename.nvim
+time([[Config for inc-rename.nvim]], true)
+try_loadstring("\27LJ\2\n8\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\15inc_rename\frequire\0", "config", "inc-rename.nvim")
+time([[Config for inc-rename.nvim]], false)
+-- Config for: neoscroll.nvim
+time([[Config for neoscroll.nvim]], true)
+try_loadstring("\27LJ\2\n7\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\28plugin-config.neoscroll\frequire\0", "config", "neoscroll.nvim")
+time([[Config for neoscroll.nvim]], false)
 -- Config for: nvim-autopairs
 time([[Config for nvim-autopairs]], true)
 try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs")
 time([[Config for nvim-autopairs]], false)
+-- Config for: nvim-notify
+time([[Config for nvim-notify]], true)
+try_loadstring("\27LJ\2\n9\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\30plugin-config.nvim-notify\frequire\0", "config", "nvim-notify")
+time([[Config for nvim-notify]], false)
+
+-- Command lazy-loads
+time([[Defining lazy-load commands]], true)
+pcall(vim.api.nvim_create_user_command, 'CodeActionMenu', function(cmdargs)
+          require('packer.load')({'nvim-code-action-menu'}, { cmd = 'CodeActionMenu', l1 = cmdargs.line1, l2 = cmdargs.line2, bang = cmdargs.bang, args = cmdargs.args, mods = cmdargs.mods }, _G.packer_plugins)
+        end,
+        {nargs = '*', range = true, bang = true, complete = function()
+          require('packer.load')({'nvim-code-action-menu'}, {}, _G.packer_plugins)
+          return vim.fn.getcompletion('CodeActionMenu ', 'cmdline')
+      end})
+time([[Defining lazy-load commands]], false)
+
 
 _G._packer.inside_compile = false
 if _G._packer.needs_bufread == true then