Thomas 1 年之前
父节点
当前提交
45a0bba5c0
共有 7 个文件被更改,包括 217 次插入125 次删除
  1. 1 0
      lazy-lock.json
  2. 5 6
      lua/config/mappings.lua
  3. 34 8
      lua/plugins/bar.lua
  4. 32 30
      lua/plugins/edgy.lua
  5. 18 15
      lua/plugins/file_tree.lua
  6. 65 66
      lua/plugins/lualine.lua
  7. 62 0
      lua/plugins/utils.lua

+ 1 - 0
lazy-lock.json

@@ -39,6 +39,7 @@
   "onedark": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" },
   "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
   "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" },

+ 5 - 6
lua/config/mappings.lua

@@ -134,9 +134,7 @@ wk.add({
 		},
 		{
 			"<leader>cd",
-			function()
-				vim.diagnostic.setqflist()
-			end,
+			"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
 			desc = "LSP code diagnostic",
 		},
 
@@ -165,7 +163,9 @@ 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>", "<cmd>noh<CR>", desc = "clears search highlights", noremap = true, silent = true },
+
+    { "<leader>ib", function() print(vim.bo.filetype) end, desc = "Print the filetype of current buffer" },
 	},
 	{
 		mode = "v",
@@ -175,7 +175,6 @@ wk.add({
 		-- Comment
 		{ "<leader>/", "gc", desc = "comment toggle", remap = true },
 
-
-    { "<Esc>", "<cmd>noh<CR>", desc = "clears search highlights", noremap = true, silent = true },
+		{ "<Esc>", "<cmd>noh<CR>", desc = "clears search highlights", noremap = true, silent = true },
 	},
 })

+ 34 - 8
lua/plugins/bar.lua

@@ -1,10 +1,36 @@
 return {
-  'akinsho/bufferline.nvim',
-  version = "*",
-  dependencies = 'nvim-tree/nvim-web-devicons',
-  config = function()
-    vim.opt.termguicolors = true
-    require("bufferline").setup{}
-  end
-}
+	"akinsho/bufferline.nvim",
+	version = "*",
+	dependencies = "nvim-tree/nvim-web-devicons",
+	opts = function()
+		local Offset = require("bufferline.offset")
+		if not Offset.edgy then
+			local get = Offset.get
+			Offset.get = function()
+				if package.loaded.edgy then
+					local layout = require("edgy.config").layout
+					local ret = { left = "", left_size = 0, right = "", right_size = 0 }
+					for _, pos in ipairs({ "left", "right" }) do
+						local sb = layout[pos]
+						if sb and #sb.wins > 0 then
+							local title = " Sidebar" .. string.rep(" ", sb.bounds.width - 8)
+							ret[pos] = "%#EdgyTitle#" .. title .. "%*" .. "%#WinSeparator#│%*"
+							ret[pos .. "_size"] = sb.bounds.width
+						end
+					end
+					ret.total_size = ret.left_size + ret.right_size
+					if ret.total_size > 0 then
+						return ret
+					end
+				end
+				return get()
+			end
+			Offset.edgy = true
+		end
+	end,
 
+	config = function()
+		vim.opt.termguicolors = true
+		require("bufferline").setup({})
+	end,
+}

+ 32 - 30
lua/plugins/edgy.lua

@@ -1,3 +1,4 @@
+---@diagnostic disable: undefined-doc-name
 return {
   "folke/edgy.nvim",
   event = "VeryLazy",
@@ -46,36 +47,36 @@ return {
         end,
         size = { height = 0.2 },
       },
-      {
-        title = "Neo-Tree Git",
-        ft = "neo-tree",
-        filter = function(buf)
-          return vim.b[buf].neo_tree_source == "git_status"
-        end,
-        pinned = true,
-        collapsed = true, -- show window as closed/collapsed on start
-        open = "Neotree position=right git_status",
-      },
-      {
-        title = "Neo-Tree Buffers",
-        ft = "neo-tree",
-        filter = function(buf)
-          return vim.b[buf].neo_tree_source == "buffers"
-        end,
-        pinned = true,
-        collapsed = true, -- show window as closed/collapsed on start
-        open = "Neotree position=top buffers",
-      },
-      {
-        title = function()
-          local buf_name = vim.api.nvim_buf_get_name(0) or "[No Name]"
-          return vim.fn.fnamemodify(buf_name, ":t")
-        end,
-        ft = "Outline",
-        pinned = true,
-        open = "SymbolsOutlineOpen",
-
-      },
+      -- {
+      --   title = "Neo-Tree Git",
+      --   ft = "neo-tree",
+      --   filter = function(buf)
+      --     return vim.b[buf].neo_tree_source == "git_status"
+      --   end,
+      --   pinned = true,
+      --   collapsed = true, -- show window as closed/collapsed on start
+      --   open = "Neotree position=right git_status",
+      -- },
+      -- {
+      --   title = "Neo-Tree Buffers",
+      --   ft = "neo-tree",
+      --   filter = function(buf)
+      --     return vim.b[buf].neo_tree_source == "buffers"
+      --   end,
+      --   pinned = true,
+      --   collapsed = true, -- show window as closed/collapsed on start
+      --   open = "Neotree position=top buffers",
+      -- },
+      -- {
+      --   title = function()
+      --     local buf_name = vim.api.nvim_buf_get_name(0) or "[No Name]"
+      --     return vim.fn.fnamemodify(buf_name, ":t")
+      --   end,
+      --   ft = "Outline",
+      --   pinned = true,
+      --   open = "SymbolsOutlineOpen",
+      --
+      -- },
       -- any other neo-tree windows
       "neo-tree",
     },
@@ -85,6 +86,7 @@ return {
       right = { size = 30 },
       top = { size = 10 },
     },
+
     -- edgebar animations
     animate = {
       enabled = true,

+ 18 - 15
lua/plugins/file_tree.lua

@@ -18,19 +18,22 @@
 --   end,
 -- }
 return {
-{
-    "nvim-neo-tree/neo-tree.nvim",
-    branch = "v3.x",
-    dependencies = {
-      "nvim-lua/plenary.nvim",
-      "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
-      "MunifTanjim/nui.nvim",
-      "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
-    },
-    config = function()
-      require('lualine').setup { 
-        extensions = { "neo-tree", "lazy", "mason" } 
-      }
-    end
-  }
+	{
+		"nvim-neo-tree/neo-tree.nvim",
+		branch = "v3.x",
+		dependencies = {
+			"nvim-lua/plenary.nvim",
+			"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
+			"MunifTanjim/nui.nvim",
+			"3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
+		},
+		opts = {
+			open_files_do_not_replace_types = { "terminal", "Trouble", "qf", "edgy" },
+		},
+		config = function()
+			require("lualine").setup({
+				extensions = { "neo-tree", "lazy", "mason" },
+			})
+		end,
+	},
 }

+ 65 - 66
lua/plugins/lualine.lua

@@ -10,75 +10,74 @@ local colors = {
 }
 
 local bubbles_theme = {
-  normal = {
-    a = { fg = colors.black, bg = colors.violet },
-    b = { fg = colors.white, bg = colors.grey },
-    c = { fg = colors.white },
-  },
+	normal = {
+		a = { fg = colors.black, bg = colors.violet },
+		b = { fg = colors.white, bg = colors.grey },
+		c = { fg = colors.white },
+	},
 
-  insert = { a = { fg = colors.black, bg = colors.blue } },
-  visual = { a = { fg = colors.black, bg = colors.cyan } },
-  replace = { a = { fg = colors.black, bg = colors.red } },
+	insert = { a = { fg = colors.black, bg = colors.blue } },
+	visual = { a = { fg = colors.black, bg = colors.cyan } },
+	replace = { a = { fg = colors.black, bg = colors.red } },
 
-  inactive = {
-    a = { fg = colors.white, bg = colors.black },
-    b = { fg = colors.white, bg = colors.black },
-    c = { fg = colors.white },
-  },
+	inactive = {
+		a = { fg = colors.white, bg = colors.black },
+		b = { fg = colors.white, bg = colors.black },
+		c = { fg = colors.white },
+	},
 }
 
 return {
-  {
-    'nvim-lualine/lualine.nvim',
-    dependencies = { 'nvim-tree/nvim-web-devicons' },
-    config = function()
-      require('lualine').setup {
-        options = {
-          icons_enabled = true,
-          theme = bubbles_theme,
-          -- theme = 'onedark',
-          component_separators = '',
-          section_separators = { left = '', right = '' },
-          -- component_separators = { left = '', right = ''},
-          -- section_separators = { left = '', right = ''},
-          disabled_filetypes = {
-            'NvimTree',
-            statusline = {},
-            winbar = {},
-          },
-          ignore_focus = {},
-          always_divide_middle = true,
-          globalstatus = false,
-          refresh = {
-            statusline = 1000,
-            tabline = 1000,
-            winbar = 1000,
-          }
-        },
-        sections = {
-          lualine_a = { { 'mode', separator = { left = '' }, right_padding = 2 } },
-          lualine_b = { 'filename', 'branch' },
-          lualine_c = {
-            '%=', --[[ add your center compoentnts here in place of this comment ]]
-          },
-          lualine_x = {},
-          lualine_y = { 'filetype', 'progress' },
-          lualine_z = {
-            { 'location', separator = { right = '' }, left_padding = 2 },
-          },
-        },
-        inactive_sections = {
-          lualine_a = { 'filename' },
-          lualine_b = {},
-          lualine_c = {},
-          lualine_x = {},
-          lualine_y = {},
-          lualine_z = { 'location' },
-        },
-        tabline = {},
-        extensions = {},
-
-      }
-    end,
-  }
+	{
+		"nvim-lualine/lualine.nvim",
+		dependencies = { "nvim-tree/nvim-web-devicons" },
+		config = function()
+			require("lualine").setup({
+				options = {
+					icons_enabled = true,
+					theme = bubbles_theme,
+					-- theme = 'onedark',
+					component_separators = "",
+					section_separators = { left = "", right = "" },
+					-- component_separators = { left = '', right = ''},
+					-- section_separators = { left = '', right = ''},
+					disabled_filetypes = {
+						"neo-tree", "trouble",
+						statusline = {},
+						winbar = {},
+					},
+					ignore_focus = {},
+					always_divide_middle = true,
+					globalstatus = false,
+					refresh = {
+						statusline = 1000,
+						tabline = 1000,
+						winbar = 1000,
+					},
+				},
+				sections = {
+					lualine_a = { { "mode", separator = { left = "" }, right_padding = 2 } },
+					lualine_b = { "filename", "branch" },
+					lualine_c = {
+						"%=", --[[ add your center compoentnts here in place of this comment ]]
+					},
+					lualine_x = {},
+					lualine_y = { "filetype", "progress" },
+					lualine_z = {
+						{ "location", separator = { right = "" }, left_padding = 2 },
+					},
+				},
+				inactive_sections = {
+					lualine_a = { "filename" },
+					lualine_b = {},
+					lualine_c = {},
+					lualine_x = {},
+					lualine_y = {},
+					lualine_z = { "location" },
+				},
+				tabline = {},
+				extensions = {},
+			})
+		end,
+	},
 }

+ 62 - 0
lua/plugins/utils.lua

@@ -87,4 +87,66 @@ return {
 		opts = {},
 	},
 	{ "eandrju/cellular-automaton.nvim" },
+	{
+		"lewis6991/satellite.nvim",
+		config = function()
+			require("satellite").setup({
+				current_only = false,
+				winblend = 50,
+				zindex = 40,
+				excluded_filetypes = {},
+				width = 2,
+				handlers = {
+					cursor = {
+						enable = true,
+						-- Supports any number of symbols
+						symbols = { "⎺", "⎻", "⎼", "⎽" },
+						-- symbols = { '⎻', '⎼' }
+						-- Highlights:
+						-- - SatelliteCursor (default links to NonText
+					},
+					search = {
+						enable = true,
+						-- Highlights:
+						-- - SatelliteSearch (default links to Search)
+						-- - SatelliteSearchCurrent (default links to SearchCurrent)
+					},
+					diagnostic = {
+						enable = true,
+						signs = { "-", "=", "≡" },
+						min_severity = vim.diagnostic.severity.HINT,
+						-- Highlights:
+						-- - SatelliteDiagnosticError (default links to DiagnosticError)
+						-- - SatelliteDiagnosticWarn (default links to DiagnosticWarn)
+						-- - SatelliteDiagnosticInfo (default links to DiagnosticInfo)
+						-- - SatelliteDiagnosticHint (default links to DiagnosticHint)
+					},
+					gitsigns = {
+						enable = true,
+						signs = { -- can only be a single character (multibyte is okay)
+							add = "│",
+							change = "│",
+							delete = "-",
+						},
+						-- Highlights:
+						-- SatelliteGitSignsAdd (default links to GitSignsAdd)
+						-- SatelliteGitSignsChange (default links to GitSignsChange)
+						-- SatelliteGitSignsDelete (default links to GitSignsDelete)
+					},
+					marks = {
+						enable = true,
+						show_builtins = false, -- shows the builtin marks like [ ] < >
+						key = "m",
+						-- Highlights:
+						-- SatelliteMark (default links to Normal)
+					},
+					quickfix = {
+						signs = { "-", "=", "≡" },
+						-- Highlights:
+						-- SatelliteQuickfix (default links to WarningMsg)
+					},
+				},
+			})
+		end,
+	},
 }