Thomas 1 年之前
父節點
當前提交
119ad8beee
共有 7 個文件被更改,包括 194 次插入25 次删除
  1. 8 2
      lazy-lock.json
  2. 22 4
      lua/config/mappings.lua
  3. 16 1
      lua/plugins/bar.lua
  4. 18 0
      lua/plugins/dashboard.lua
  5. 6 4
      lua/plugins/lualine.lua
  6. 65 11
      lua/plugins/treesitter.lua
  7. 59 3
      lua/plugins/utils.lua

+ 8 - 2
lazy-lock.json

@@ -14,14 +14,17 @@
   "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
   "conform.nvim": { "branch": "master", "commit": "cd75be867f2331b22905f47d28c0c270a69466aa" },
   "crates.nvim": { "branch": "main", "commit": "5d2751f3d31c952663ade44669b6b63efa06e295" },
+  "dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" },
   "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
   "dressing.nvim": { "branch": "master", "commit": "6741f1062d3dc6e4755367a7e9b347b553623f04" },
+  "drop.nvim": { "branch": "main", "commit": "8baef9546994ce380c1bf4d030a9f4f040f0bfe7" },
   "edgy.nvim": { "branch": "main", "commit": "9ea7b22048f08a1a0d49a4a789e36c2fe1b8579f" },
   "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
   "friendly-snippets": { "branch": "main", "commit": "45a1b96e46efe5fce8af325d4bed45feb9d29d0f" },
   "fzf-lua": { "branch": "main", "commit": "3d214f8db4a4119723ab5148b7a333aab3fa9063" },
   "gitsigns.nvim": { "branch": "main", "commit": "e9c4187c3774a46df2d086a66cf3a7e6bea4c432" },
   "image.nvim": { "branch": "master", "commit": "61c76515cfc3cdac8123ece9e9761b20c3dc1315" },
+  "indent-blankline.nvim": { "branch": "master", "commit": "65e20ab94a26d0e14acac5049b8641336819dfc7" },
   "lazy.nvim": { "branch": "main", "commit": "b02c9eae6a250f98908c146d1dc1a891f5019f0a" },
   "lualine.nvim": { "branch": "master", "commit": "6a40b530539d2209f7dc0492f3681c8c126647ad" },
   "mason-lspconfig.nvim": { "branch": "main", "commit": "37a336b653f8594df75c827ed589f1c91d91ff6c" },
@@ -29,24 +32,27 @@
   "mason.nvim": { "branch": "main", "commit": "f96a31855fa8aea55599cea412fe611b85a874ed" },
   "neo-tree.nvim": { "branch": "v3.x", "commit": "29f7c215332ba95e470811c380ddbce2cebe2af4" },
   "neogit": { "branch": "master", "commit": "a20031fb5d7d12148764764059243135085e5c9b" },
+  "neoscroll.nvim": { "branch": "master", "commit": "a7f5953dbfbe7069568f2d0ed23a9709a56725ab" },
   "none-ls.nvim": { "branch": "main", "commit": "0d1b3fa2ad0b371b94cb4b9a27ba6e5a1a915c91" },
   "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" },
   "nvim-cmp": { "branch": "main", "commit": "7e348da6e5085ac447144a2ef4b637220ba27209" },
   "nvim-lspconfig": { "branch": "master", "commit": "216deb2d1b5fbf24398919228208649bbf5cbadf" },
   "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
   "nvim-treesitter": { "branch": "master", "commit": "7f4ac678770175cdf0d42c015f4a5b6e18b6cb33" },
+  "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" },
   "nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" },
   "onedark": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" },
   "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
+  "rainbow-delimiters.nvim": { "branch": "master", "commit": "b29da4a6061a88270e875b38367d82c04c856128" },
   "rustaceanvim": { "branch": "master", "commit": "047f9c9d8cd2861745eb9de6c1570ee0875aa795" },
   "satellite.nvim": { "branch": "main", "commit": "777ed56e1ef45ec808df701730b6597fc4fb0fbc" },
   "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
   "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
   "transparent.nvim": { "branch": "main", "commit": "fd35a46f4b7c1b244249266bdcb2da3814f01724" },
-  "trouble.nvim": { "branch": "main", "commit": "03c1fbf518bef683422a3be9643c3da190903488" },
+  "trouble.nvim": { "branch": "main", "commit": "2946ce52869d3121637b962c31b1aab48d74a3c9" },
   "typst-preview.nvim": { "branch": "master", "commit": "15eaaffc0a2d8cd871f485f399d1d67ed3322a0b" },
   "typst.vim": { "branch": "main", "commit": "4d18ced62599ffe5b3c0e5e49566d5456121bc02" },
   "vim-lastplace": { "branch": "master", "commit": "e58cb0df716d3c88605ae49db5c4741db8b48aa9" },
   "vim-tmux-navigator": { "branch": "master", "commit": "5b3c701686fb4e6629c100ed32e827edf8dad01e" },
-  "which-key.nvim": { "branch": "main", "commit": "d077a3f36d4b4d29eccc7feb1ba8e78a421df920" }
+  "which-key.nvim": { "branch": "main", "commit": "c77cda8cd2f54965e4316699f1d124a2b3bf9d49" }
 }

+ 22 - 4
lua/config/mappings.lua

@@ -104,12 +104,18 @@ wk.add({
 			"<C-n>",
 			function()
 				-- ToggleTree("filesystem")
-        require("edgy").toggle("left")
+				require("edgy").toggle("left")
 			end,
 			desc = "Toggle left panel",
 		},
 
-    { "<leader>uh", function() require("edgy").toggle("left") end, desc = "left" },
+		{
+			"<leader>uh",
+			function()
+				require("edgy").toggle("left")
+			end,
+			desc = "left",
+		},
 
 		-- Typst format
 		{
@@ -166,7 +172,13 @@ wk.add({
 		{ "<leader>tn", "<cmd>tabn<CR>", desc = "Go to next tab" }, --  go to next tab
 		{ "<leader>tp", "<cmd>tabp<CR>", desc = "Go to previous tab" }, --  go to previous tab
 		{ "<leader>tf", "<cmd>tabnew %<CR>", desc = "Open current buffer in new tab" }, --  move current buffer to new tab
-		{ "<Esc>", "<cmd>noh<CR>", desc = "clears search highlights", noremap = true, silent = true },
+		{
+			"<ESC>",
+			":noh<CR>",
+			desc = "clears search highlights",
+			noremap = true,
+			silent = true,
+		},
 
 		{
 			"<leader>ib",
@@ -185,6 +197,12 @@ wk.add({
 		-- Comment
 		{ "<leader>/", "gc", desc = "comment toggle", remap = true },
 
-		{ "<Esc>", "<cmd>noh<CR>", desc = "clears search highlights", noremap = true, silent = true },
+		{
+			"<ESC>",
+			":noh<CR>",
+			desc = "clears search highlights",
+			noremap = true,
+			silent = true,
+		},
 	},
 })

+ 16 - 1
lua/plugins/bar.lua

@@ -31,6 +31,21 @@ return {
 
 	config = function()
 		vim.opt.termguicolors = true
-		require("bufferline").setup({})
+		require("bufferline").setup({
+			options = {
+				-- separator_style = "slant",
+				-- 	style_preset = bufferline.style_preset.no_italic,
+				diagnostics_indicator = function(count, level)
+					local icon = level:match("error") and " " or ""
+					return " " .. icon .. count
+				end,
+			},
+		})
+		vim.g.transparent_groups = vim.list_extend(
+			vim.g.transparent_groups or {},
+			vim.tbl_map(function(v)
+				return v.hl_group
+			end, vim.tbl_values(require("bufferline.config").highlights))
+		)
 	end,
 }

+ 18 - 0
lua/plugins/dashboard.lua

@@ -0,0 +1,18 @@
+return {
+	-- {
+	-- 	"folke/drop.nvim",
+	-- 	opts = {
+	-- 		-- ...
+	-- 	},
+	-- },
+	{
+		"nvimdev/dashboard-nvim",
+		event = "VimEnter",
+		config = function()
+			require("dashboard").setup({
+				-- config
+			})
+		end,
+		dependencies = { { "nvim-tree/nvim-web-devicons" } },
+	},
+}

+ 6 - 4
lua/plugins/lualine.lua

@@ -38,9 +38,9 @@ return {
 					theme = bubbles_theme,
 					-- theme = 'onedark',
 					component_separators = "",
-					section_separators = { left = "", right = "" },
+					-- section_separators = { left = "", right = "" },
 					-- component_separators = { left = '', right = ''},
-					-- section_separators = { left = '', right = ''},
+					section_separators = { left = '', right = ''},
 					disabled_filetypes = {
 						"neo-tree", "trouble",
 						statusline = {},
@@ -56,7 +56,8 @@ return {
 					},
 				},
 				sections = {
-					lualine_a = { { "mode", separator = { left = "" }, right_padding = 2 } },
+					lualine_a = { { "mode", separator = { left = "" }, right_padding = 0 } },
+					-- lualine_a = { { "mode", separator = { left = "" }, right_padding = 2 } },
 					lualine_b = { "filename", "branch" },
 					lualine_c = {
 						"%=", --[[ add your center compoentnts here in place of this comment ]]
@@ -64,7 +65,8 @@ return {
 					lualine_x = {},
 					lualine_y = { "filetype", "progress" },
 					lualine_z = {
-						{ "location", separator = { right = "" }, left_padding = 2 },
+						{ "location", separator = { right = "" }, left_padding = 0 },
+						-- { "location", separator = { right = "" }, left_padding = 2 },
 					},
 				},
 				inactive_sections = {

+ 65 - 11
lua/plugins/treesitter.lua

@@ -1,14 +1,68 @@
 return {
-	"nvim-treesitter/nvim-treesitter",
-	build = ":TSUpdate",
-	config = function()
-		local configs = require("nvim-treesitter.configs")
+	{
+		"nvim-treesitter/nvim-treesitter",
+		build = ":TSUpdate",
+		config = function()
+			local configs = require("nvim-treesitter.configs")
 
-		configs.setup({
-			ensure_installed = { "c", "lua", "vim", "vimdoc", "javascript", "html", "rust" },
-			sync_install = false,
-			highlight = { enable = true },
-			indent = { enable = true },
-		})
-	end,
+			configs.setup({
+				ensure_installed = { "c", "lua", "vim", "vimdoc", "javascript", "html", "rust" },
+				sync_install = false,
+				highlight = { enable = true },
+				indent = { enable = true },
+			})
+		end,
+	},
+	{
+		"nvim-treesitter/nvim-treesitter-textobjects",
+		build = ":TSUpdate",
+		config = function()
+			require("nvim-treesitter.configs").setup({
+				textobjects = {
+					select = {
+						enable = true,
+
+						-- Automatically jump forward to textobj, similar to targets.vim
+						lookahead = true,
+
+						keymaps = {
+							-- You can use the capture groups defined in textobjects.scm
+							["af"] = "@function.outer",
+							["if"] = "@function.inner",
+							["ac"] = "@class.outer",
+							-- You can optionally set descriptions to the mappings (used in the desc parameter of
+							-- nvim_buf_set_keymap) which plugins like which-key display
+							["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" },
+							-- You can also use captures from other query groups like `locals.scm`
+							["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" },
+              ["ap"] = "@parameter.outer",
+              ["ip"] = "@parameter.inner",
+						},
+						-- You can choose the select mode (default is charwise 'v')
+						--
+						-- Can also be a function which gets passed a table with the keys
+						-- * query_string: eg '@function.inner'
+						-- * method: eg 'v' or 'o'
+						-- and should return the mode ('v', 'V', or '<c-v>') or a table
+						-- mapping query_strings to modes.
+						selection_modes = {
+							["@parameter.outer"] = "v", -- charwise
+							["@function.outer"] = "V", -- linewise
+							["@class.outer"] = "<c-v>", -- blockwise
+						},
+						-- If you set this to `true` (default is `false`) then any textobject is
+						-- extended to include preceding or succeeding whitespace. Succeeding
+						-- whitespace has priority in order to act similarly to eg the built-in
+						-- `ap`.
+						--
+						-- Can also be a function which gets passed a table with the keys
+						-- * query_string: eg '@function.inner'
+						-- * selection_mode: eg 'v'
+						-- and should return true or false
+						include_surrounding_whitespace = true,
+					},
+				},
+			})
+		end,
+	},
 }

+ 59 - 3
lua/plugins/utils.lua

@@ -1,6 +1,6 @@
 return {
 	{
-		-- <S> to add ", (... Around selected text
+		-- <S> to add ", (... Surrounding selected text
 		"kylechui/nvim-surround",
 		version = "*", -- Use for stability; omit to use `main` branch for the latest features
 		event = "VeryLazy",
@@ -15,8 +15,14 @@ return {
 		"jiangmiao/auto-pairs",
 		lazy = false,
 	},
+	{ -- Scroll
+		"karb94/neoscroll.nvim",
+		config = function()
+			require("neoscroll").setup({})
+		end,
+	},
 	{
-		"farmergreg/vim-lastplace",
+		"farmergreg/vim-lastplace", -- when open go to the closed position
 	},
 	{
 		"nvim-tree/nvim-web-devicons",
@@ -86,8 +92,58 @@ return {
 		"stevearc/dressing.nvim",
 		opts = {},
 	},
-	{ "eandrju/cellular-automaton.nvim" },
+	{ "eandrju/cellular-automaton.nvim" }, -- stupid animation
+	{ url = "https://gitlab.com/HiPhish/rainbow-delimiters.nvim" }, -- rainbow delimiters
+	{
+		"lukas-reineke/indent-blankline.nvim",
+		main = "ibl",
+		opts = {},
+		config = function()
+			-- Config for matching colors with rainbow_delimiters
+			local highlight = {
+				"RainbowRed",
+				"RainbowYellow",
+				"RainbowBlue",
+				"RainbowOrange",
+				"RainbowGreen",
+				"RainbowViolet",
+				"RainbowCyan",
+			}
+			local hooks = require("ibl.hooks")
+			-- create the highlight groups in the highlight setup hook, so they are reset
+			-- every time the colorscheme changes
+			hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
+				vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
+				vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
+				vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
+				vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
+				vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
+				vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
+				vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
+			end)
+
+			vim.g.rainbow_delimiters = { highlight = highlight }
+			require("ibl").setup({
+				scope = { highlight = highlight },
+				exclude = {
+					filetypes = {
+						"lspinfo",
+						"packer",
+						"checkhealth",
+						"help",
+						"man",
+						"dashboard",
+						"",
+					},
+					-- filetypes = vim.g.exclude_filetypes,
+				},
+			})
+
+			hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
+		end,
+	},
 	{
+		-- Scrollbar
 		"lewis6991/satellite.nvim",
 		config = function()
 			require("satellite").setup({