edgy.lua 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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("right", 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 = { "Files", "Git" } },
  34. -- { icon = "", titles = { "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 = true, -- 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 = "Files",
  100. ft = "neo-tree",
  101. filter = function(buf)
  102. return vim.b[buf].neo_tree_source == "filesystem"
  103. end,
  104. size = { height = 0.8 },
  105. open = "Neotree position=left filesystem",
  106. },
  107. {
  108. title = "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 = "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. right = {
  125. -- {
  126. -- ft = "Outline",
  127. -- open = ,
  128. -- },
  129. },
  130. -- left = {
  131. -- -- Neo-tree filesystem always takes half the screen height
  132. -- {
  133. -- title = "Neo-Tree",
  134. -- ft = "neo-tree",
  135. -- filter = function(buf)
  136. -- return vim.b[buf].neo_tree_source == "filesystem"
  137. -- end,
  138. -- pinned = true,
  139. -- collapsed = false, -- show window as closed/collapsed on start
  140. -- open = "Neotree position=left filesystem",
  141. -- size = { height = 0.7 },
  142. -- },
  143. -- {
  144. -- title = "Neo-Tree Git",
  145. -- ft = "neo-tree",
  146. -- filter = function(buf)
  147. -- return vim.b[buf].neo_tree_source == "git_status"
  148. -- end,
  149. -- pinned = true,
  150. -- collapsed = false, -- show window as closed/collapsed on start
  151. -- open = "Neotree position=left git_status",
  152. -- size = { height = 0.3 },
  153. -- },
  154. -- {
  155. -- title = "Neo-Tree Buffers",
  156. -- ft = "neo-tree",
  157. -- filter = function(buf)
  158. -- return vim.b[buf].neo_tree_source == "buffers"
  159. -- end,
  160. -- pinned = true,
  161. -- collapsed = true, -- show window as closed/collapsed on start
  162. -- open = "Neotree position=top buffers",
  163. -- },
  164. -- {
  165. -- title = function()
  166. -- local buf_name = vim.api.nvim_buf_get_name(0) or "[No Name]"
  167. -- return vim.fn.fnamemodify(buf_name, ":t")
  168. -- end,
  169. -- ft = "Outline",
  170. -- pinned = true,
  171. -- open = "SymbolsOutlineOpen",
  172. --
  173. -- },
  174. -- any other neo-tree windows
  175. -- },
  176. options = {
  177. left = { size = 25 },
  178. bottom = { size = 10 },
  179. right = { size = 30 },
  180. top = { size = 10 },
  181. },
  182. -- edgebar animations
  183. animate = {
  184. enabled = true,
  185. fps = 100, -- frames per second
  186. cps = 120, -- cells per second
  187. on_begin = function()
  188. vim.g.minianimate_disable = true
  189. end,
  190. on_end = function()
  191. vim.g.minianimate_disable = false
  192. end,
  193. -- Spinner for pinned views that are loading.
  194. -- if you have noice.nvim installed, you can use any spinner from it, like:
  195. -- spinner = require("noice.util.spinners").spinners.circleFull,
  196. spinner = {
  197. frames = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" },
  198. interval = 80,
  199. },
  200. },
  201. -- enable this to exit Neovim when only edgy windows are left
  202. exit_when_last = false,
  203. -- close edgy when all windows are hidden instead of opening one of them
  204. -- disable to always keep at least one edgy split visible in each open section
  205. close_when_all_hidden = true,
  206. -- global window options for edgebar windows
  207. ---@type vim.wo
  208. wo = {
  209. -- Setting to `true`, will add an edgy winbar.
  210. -- Setting to `false`, won't set any winbar.
  211. -- Setting to a string, will set the winbar to that string.
  212. winbar = false,
  213. winfixwidth = true,
  214. winfixheight = false,
  215. winhighlight = "WinBar:EdgyWinBar,Normal:EdgyNormal",
  216. spell = false,
  217. signcolumn = "no",
  218. },
  219. -- buffer-local keymaps to be added to edgebar buffers.
  220. -- Existing buffer-local keymaps will never be overridden.
  221. -- Set to false to disable a builtin.
  222. ---@type table<string, fun(win:Edgy.Window)|false>
  223. keys = {
  224. -- close window
  225. ["q"] = function(win)
  226. win:close()
  227. end,
  228. -- hide window
  229. ["<c-q>"] = function(win)
  230. win:hide()
  231. end,
  232. -- close sidebar
  233. ["Q"] = function(win)
  234. win.view.edgebar:close()
  235. end,
  236. -- next open window
  237. ["]w"] = function(win)
  238. win:next({ visible = true, focus = true })
  239. end,
  240. -- previous open window
  241. ["[w"] = function(win)
  242. win:prev({ visible = true, focus = true })
  243. end,
  244. -- next loaded window
  245. ["]W"] = function(win)
  246. win:next({ pinned = false, focus = true })
  247. end,
  248. -- prev loaded window
  249. ["[W"] = function(win)
  250. win:prev({ pinned = false, focus = true })
  251. end,
  252. -- increase width
  253. ["<c-w>>"] = function(win)
  254. win:resize("width", 2)
  255. end,
  256. -- decrease width
  257. ["<c-w><lt>"] = function(win)
  258. win:resize("width", -2)
  259. end,
  260. -- increase height
  261. ["<c-w>+"] = function(win)
  262. win:resize("height", 2)
  263. end,
  264. -- decrease height
  265. ["<c-w>-"] = function(win)
  266. win:resize("height", -2)
  267. end,
  268. -- reset all custom sizing
  269. ["<c-w>="] = function(win)
  270. win.view.edgebar:equalize()
  271. end,
  272. },
  273. icons = {
  274. closed = " ",
  275. open = " ",
  276. },
  277. -- enable this on Neovim <= 0.10.0 to properly fold edgebar windows.
  278. -- Not needed on a nightly build >= June 5, 2023.
  279. fix_win_height = vim.fn.has("nvim-0.10.0") == 0,
  280. },
  281. },
  282. }