edgy.lua 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. --@diagnostic disable: undefined-doc-name
  2. return {
  3. "folke/edgy.nvim",
  4. event = "VeryLazy",
  5. init = function()
  6. vim.opt.laststatus = 3
  7. vim.opt.splitkeep = "screen"
  8. end,
  9. opts = {
  10. bottom = {
  11. -- toggleterm / lazyterm at the bottom with a height of 40% of the screen
  12. {
  13. ft = "toggleterm",
  14. size = { height = 0.4 },
  15. -- exclude floating windows
  16. filter = function(buf, win)
  17. return vim.api.nvim_win_get_config(win).relative == ""
  18. end,
  19. },
  20. {
  21. ft = "lazyterm",
  22. title = "LazyTerm",
  23. size = { height = 0.4 },
  24. filter = function(buf)
  25. return not vim.b[buf].lazyterm_cmd
  26. end,
  27. },
  28. "Trouble",
  29. { ft = "qf", title = "QuickFix" },
  30. {
  31. ft = "help",
  32. size = { height = 20 },
  33. -- only show help buffers
  34. filter = function(buf)
  35. return vim.bo[buf].buftype == "help"
  36. end,
  37. },
  38. { ft = "spectre_panel", size = { height = 0.4 } },
  39. },
  40. left = {
  41. -- Neo-tree filesystem always takes half the screen height
  42. {
  43. title = "Neo-Tree",
  44. ft = "neo-tree",
  45. filter = function(buf)
  46. return vim.b[buf].neo_tree_source == "filesystem"
  47. end,
  48. pinned = true,
  49. collapsed = false, -- show window as closed/collapsed on start
  50. open = "Neotree position=left filesystem",
  51. size = { height = 0.7 },
  52. },
  53. {
  54. title = "Neo-Tree Git",
  55. ft = "neo-tree",
  56. filter = function(buf)
  57. return vim.b[buf].neo_tree_source == "git_status"
  58. end,
  59. pinned = true,
  60. collapsed = false, -- show window as closed/collapsed on start
  61. open = "Neotree position=left git_status",
  62. size = { height = 0.3 },
  63. },
  64. -- {
  65. -- title = "Neo-Tree Buffers",
  66. -- ft = "neo-tree",
  67. -- filter = function(buf)
  68. -- return vim.b[buf].neo_tree_source == "buffers"
  69. -- end,
  70. -- pinned = true,
  71. -- collapsed = true, -- show window as closed/collapsed on start
  72. -- open = "Neotree position=top buffers",
  73. -- },
  74. -- {
  75. -- title = function()
  76. -- local buf_name = vim.api.nvim_buf_get_name(0) or "[No Name]"
  77. -- return vim.fn.fnamemodify(buf_name, ":t")
  78. -- end,
  79. -- ft = "Outline",
  80. -- pinned = true,
  81. -- open = "SymbolsOutlineOpen",
  82. --
  83. -- },
  84. -- any other neo-tree windows
  85. },
  86. options = {
  87. left = { size = 25 },
  88. bottom = { size = 10 },
  89. right = { size = 30 },
  90. top = { size = 10 },
  91. },
  92. -- edgebar animations
  93. animate = {
  94. enabled = true,
  95. fps = 100, -- frames per second
  96. cps = 120, -- cells per second
  97. on_begin = function()
  98. vim.g.minianimate_disable = true
  99. end,
  100. on_end = function()
  101. vim.g.minianimate_disable = false
  102. end,
  103. -- Spinner for pinned views that are loading.
  104. -- if you have noice.nvim installed, you can use any spinner from it, like:
  105. -- spinner = require("noice.util.spinners").spinners.circleFull,
  106. spinner = {
  107. frames = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" },
  108. interval = 80,
  109. },
  110. },
  111. -- enable this to exit Neovim when only edgy windows are left
  112. exit_when_last = false,
  113. -- close edgy when all windows are hidden instead of opening one of them
  114. -- disable to always keep at least one edgy split visible in each open section
  115. close_when_all_hidden = true,
  116. -- global window options for edgebar windows
  117. ---@type vim.wo
  118. wo = {
  119. -- Setting to `true`, will add an edgy winbar.
  120. -- Setting to `false`, won't set any winbar.
  121. -- Setting to a string, will set the winbar to that string.
  122. winbar = true,
  123. winfixwidth = true,
  124. winfixheight = false,
  125. winhighlight = "WinBar:EdgyWinBar,Normal:EdgyNormal",
  126. spell = false,
  127. signcolumn = "no",
  128. },
  129. -- buffer-local keymaps to be added to edgebar buffers.
  130. -- Existing buffer-local keymaps will never be overridden.
  131. -- Set to false to disable a builtin.
  132. ---@type table<string, fun(win:Edgy.Window)|false>
  133. keys = {
  134. -- close window
  135. ["q"] = function(win)
  136. win:close()
  137. end,
  138. -- hide window
  139. ["<c-q>"] = function(win)
  140. win:hide()
  141. end,
  142. -- close sidebar
  143. ["Q"] = function(win)
  144. win.view.edgebar:close()
  145. end,
  146. -- next open window
  147. ["]w"] = function(win)
  148. win:next({ visible = true, focus = true })
  149. end,
  150. -- previous open window
  151. ["[w"] = function(win)
  152. win:prev({ visible = true, focus = true })
  153. end,
  154. -- next loaded window
  155. ["]W"] = function(win)
  156. win:next({ pinned = false, focus = true })
  157. end,
  158. -- prev loaded window
  159. ["[W"] = function(win)
  160. win:prev({ pinned = false, focus = true })
  161. end,
  162. -- increase width
  163. ["<c-w>>"] = function(win)
  164. win:resize("width", 2)
  165. end,
  166. -- decrease width
  167. ["<c-w><lt>"] = function(win)
  168. win:resize("width", -2)
  169. end,
  170. -- increase height
  171. ["<c-w>+"] = function(win)
  172. win:resize("height", 2)
  173. end,
  174. -- decrease height
  175. ["<c-w>-"] = function(win)
  176. win:resize("height", -2)
  177. end,
  178. -- reset all custom sizing
  179. ["<c-w>="] = function(win)
  180. win.view.edgebar:equalize()
  181. end,
  182. },
  183. icons = {
  184. closed = " ",
  185. open = " ",
  186. },
  187. -- enable this on Neovim <= 0.10.0 to properly fold edgebar windows.
  188. -- Not needed on a nightly build >= June 5, 2023.
  189. fix_win_height = vim.fn.has("nvim-0.10.0") == 0,
  190. },
  191. }