edgy.lua 5.4 KB

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