edgy.lua 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. --@diagnostic disable: undefined-doc-name
  2. return {
  3. {
  4. "lucobellic/edgy-group.nvim",
  5. event = "VeryLazy",
  6. dependencies = { "folke/edgy.nvim" },
  7. keys = {
  8. {
  9. "<leader>el",
  10. function()
  11. require("edgy-group").open_group_offset("left", 1)
  12. end,
  13. desc = "Edgy Group Next Left",
  14. },
  15. {
  16. "<leader>eh",
  17. function()
  18. require("edgy-group").open_group_offset("left", -1)
  19. end,
  20. desc = "Edgy Group Prev Left",
  21. },
  22. {
  23. "<c-,>",
  24. function()
  25. require("edgy-group.stl").pick()
  26. end,
  27. desc = "Edgy Group Pick",
  28. },
  29. },
  30. opts = {
  31. groups = {
  32. left = {
  33. { icon = "", titles = { "Neo-Tree", "Neo-Tree Buffers" } },
  34. { icon = "", titles = { "Neo-Tree Git" } },
  35. { icon = "", titles = { "Outline" } },
  36. },
  37. },
  38. statusline = {
  39. -- suffix and prefix separators between icons
  40. separators = { ' ', ' ' },
  41. clickable = false, -- open group on click
  42. colored = false, -- enable highlight support
  43. colors = { -- highlight colors
  44. active = 'Normal', -- highlight color for open group
  45. inactive = 'Normal', -- highlight color for closed group
  46. pick_active = 'PmenuSel', -- highlight color for pick key for open group
  47. pick_inactive = 'PmenuSel', -- highlight color for pick key for closed group
  48. },
  49. -- pick key position: left, right, left_separator, right_separator, icon
  50. -- left: before left separator
  51. -- right: after right separator
  52. -- left_separator, right_separator and icon: replace the corresponding element
  53. pick_key_pose = 'left',
  54. pick_function = nil, -- optional function to override default behavior
  55. },
  56. toggle = true,
  57. },
  58. },
  59. {
  60. "folke/edgy.nvim",
  61. event = "VeryLazy",
  62. init = function()
  63. vim.opt.laststatus = 3
  64. vim.opt.splitkeep = "screen"
  65. end,
  66. opts = {
  67. bottom = {
  68. -- toggleterm / lazyterm at the bottom with a height of 40% of the screen
  69. {
  70. ft = "toggleterm",
  71. size = { height = 0.4 },
  72. -- exclude floating windows
  73. filter = function(buf, win)
  74. return vim.api.nvim_win_get_config(win).relative == ""
  75. end,
  76. },
  77. {
  78. ft = "lazyterm",
  79. title = "LazyTerm",
  80. size = { height = 0.4 },
  81. filter = function(buf)
  82. return not vim.b[buf].lazyterm_cmd
  83. end,
  84. },
  85. "Trouble",
  86. { ft = "qf", title = "QuickFix" },
  87. {
  88. ft = "help",
  89. size = { height = 20 },
  90. -- only show help buffers
  91. filter = function(buf)
  92. return vim.bo[buf].buftype == "help"
  93. end,
  94. },
  95. { ft = "spectre_panel", size = { height = 0.4 } },
  96. },
  97. left = {
  98. {
  99. title = "Neo-Tree",
  100. ft = "neo-tree",
  101. filter = function(buf)
  102. return vim.b[buf].neo_tree_source == "filesystem"
  103. end,
  104. size = { height = 0.3 },
  105. open = "Neotree position=left filesystem",
  106. },
  107. {
  108. title = "Neo-Tree Buffers",
  109. ft = "neo-tree",
  110. filter = function(buf)
  111. return vim.b[buf].neo_tree_source == "buffers"
  112. end,
  113. open = "Neotree position=top buffers",
  114. },
  115. {
  116. title = "Neo-Tree Git",
  117. ft = "neo-tree",
  118. filter = function(buf)
  119. return vim.b[buf].neo_tree_source == "git_status"
  120. end,
  121. open = "Neotree position=right git_status",
  122. },
  123. {
  124. ft = "Outline",
  125. open = "SymbolsOutlineOpen",
  126. },
  127. },
  128. -- left = {
  129. -- -- Neo-tree filesystem always takes half the screen height
  130. -- {
  131. -- title = "Neo-Tree",
  132. -- ft = "neo-tree",
  133. -- filter = function(buf)
  134. -- return vim.b[buf].neo_tree_source == "filesystem"
  135. -- end,
  136. -- pinned = true,
  137. -- collapsed = false, -- show window as closed/collapsed on start
  138. -- open = "Neotree position=left filesystem",
  139. -- size = { height = 0.7 },
  140. -- },
  141. -- {
  142. -- title = "Neo-Tree Git",
  143. -- ft = "neo-tree",
  144. -- filter = function(buf)
  145. -- return vim.b[buf].neo_tree_source == "git_status"
  146. -- end,
  147. -- pinned = true,
  148. -- collapsed = false, -- show window as closed/collapsed on start
  149. -- open = "Neotree position=left git_status",
  150. -- size = { height = 0.3 },
  151. -- },
  152. -- {
  153. -- title = "Neo-Tree Buffers",
  154. -- ft = "neo-tree",
  155. -- filter = function(buf)
  156. -- return vim.b[buf].neo_tree_source == "buffers"
  157. -- end,
  158. -- pinned = true,
  159. -- collapsed = true, -- show window as closed/collapsed on start
  160. -- open = "Neotree position=top buffers",
  161. -- },
  162. -- {
  163. -- title = function()
  164. -- local buf_name = vim.api.nvim_buf_get_name(0) or "[No Name]"
  165. -- return vim.fn.fnamemodify(buf_name, ":t")
  166. -- end,
  167. -- ft = "Outline",
  168. -- pinned = true,
  169. -- open = "SymbolsOutlineOpen",
  170. --
  171. -- },
  172. -- any other neo-tree windows
  173. -- },
  174. options = {
  175. left = { size = 25 },
  176. bottom = { size = 10 },
  177. right = { size = 30 },
  178. top = { size = 10 },
  179. },
  180. -- edgebar animations
  181. animate = {
  182. enabled = true,
  183. fps = 100, -- frames per second
  184. cps = 120, -- cells per second
  185. on_begin = function()
  186. vim.g.minianimate_disable = true
  187. end,
  188. on_end = function()
  189. vim.g.minianimate_disable = false
  190. end,
  191. -- Spinner for pinned views that are loading.
  192. -- if you have noice.nvim installed, you can use any spinner from it, like:
  193. -- spinner = require("noice.util.spinners").spinners.circleFull,
  194. spinner = {
  195. frames = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" },
  196. interval = 80,
  197. },
  198. },
  199. -- enable this to exit Neovim when only edgy windows are left
  200. exit_when_last = false,
  201. -- close edgy when all windows are hidden instead of opening one of them
  202. -- disable to always keep at least one edgy split visible in each open section
  203. close_when_all_hidden = true,
  204. -- global window options for edgebar windows
  205. ---@type vim.wo
  206. wo = {
  207. -- Setting to `true`, will add an edgy winbar.
  208. -- Setting to `false`, won't set any winbar.
  209. -- Setting to a string, will set the winbar to that string.
  210. winbar = true,
  211. winfixwidth = true,
  212. winfixheight = false,
  213. winhighlight = "WinBar:EdgyWinBar,Normal:EdgyNormal",
  214. spell = false,
  215. signcolumn = "no",
  216. },
  217. -- buffer-local keymaps to be added to edgebar buffers.
  218. -- Existing buffer-local keymaps will never be overridden.
  219. -- Set to false to disable a builtin.
  220. ---@type table<string, fun(win:Edgy.Window)|false>
  221. keys = {
  222. -- close window
  223. ["q"] = function(win)
  224. win:close()
  225. end,
  226. -- hide window
  227. ["<c-q>"] = function(win)
  228. win:hide()
  229. end,
  230. -- close sidebar
  231. ["Q"] = function(win)
  232. win.view.edgebar:close()
  233. end,
  234. -- next open window
  235. ["]w"] = function(win)
  236. win:next({ visible = true, focus = true })
  237. end,
  238. -- previous open window
  239. ["[w"] = function(win)
  240. win:prev({ visible = true, focus = true })
  241. end,
  242. -- next loaded window
  243. ["]W"] = function(win)
  244. win:next({ pinned = false, focus = true })
  245. end,
  246. -- prev loaded window
  247. ["[W"] = function(win)
  248. win:prev({ pinned = false, focus = true })
  249. end,
  250. -- increase width
  251. ["<c-w>>"] = function(win)
  252. win:resize("width", 2)
  253. end,
  254. -- decrease width
  255. ["<c-w><lt>"] = function(win)
  256. win:resize("width", -2)
  257. end,
  258. -- increase height
  259. ["<c-w>+"] = function(win)
  260. win:resize("height", 2)
  261. end,
  262. -- decrease height
  263. ["<c-w>-"] = function(win)
  264. win:resize("height", -2)
  265. end,
  266. -- reset all custom sizing
  267. ["<c-w>="] = function(win)
  268. win.view.edgebar:equalize()
  269. end,
  270. },
  271. icons = {
  272. closed = " ",
  273. open = " ",
  274. },
  275. -- enable this on Neovim <= 0.10.0 to properly fold edgebar windows.
  276. -- Not needed on a nightly build >= June 5, 2023.
  277. fix_win_height = vim.fn.has("nvim-0.10.0") == 0,
  278. },
  279. },
  280. }