Skip to content

Commit df1f13a

Browse files
committed
feat(ui): combine outline and filetree to save space
1 parent b5018c1 commit df1f13a

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed

lua/keymap/tool.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ local mappings = {
3636
["n|gpl"] = map_cr("G pull"):with_noremap():with_silent():with_desc("git: Pull"),
3737
["n|<leader>gG"] = map_cu("Git"):with_noremap():with_silent():with_desc("git: Open git-fugitive"),
3838

39+
-- Plugin: edgy
40+
["n|<C-n>"] = map_callback(function()
41+
require("edgy").toggle("left")
42+
end)
43+
:with_noremap()
44+
:with_silent()
45+
:with_desc("filetree: Toggle"),
46+
3947
-- Plugin: nvim-tree
4048
["n|<C-n>"] = map_cu("NvimTreeToggle"):with_noremap():with_silent():with_desc("filetree: Toggle"),
4149
["n|<leader>nf"] = map_cr("NvimTreeFindFile"):with_noremap():with_silent():with_desc("filetree: Find file"),

lua/modules/configs/ui/edgy.lua

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
return function()
2+
local trouble_filter = function(position)
3+
return function(_, win)
4+
return vim.w[win].trouble
5+
and vim.w[win].trouble.position == position
6+
and vim.w[win].trouble.type == "split"
7+
and vim.w[win].trouble.relative == "editor"
8+
and not vim.w[win].trouble_preview
9+
end
10+
end
11+
12+
require("modules.utils").load_plugin("edgy", {
13+
close_when_all_hidden = true,
14+
exit_when_last = true,
15+
wo = { winbar = false },
16+
keys = {
17+
["q"] = false,
18+
["Q"] = false,
19+
["<C-q>"] = false,
20+
["<A-j>"] = function(win)
21+
win:resize("height", -2)
22+
end,
23+
["<A-k>"] = function(win)
24+
win:resize("height", 2)
25+
end,
26+
["<A-h>"] = function(win)
27+
win:resize("width", -2)
28+
end,
29+
["<A-l>"] = function(win)
30+
win:resize("width", 2)
31+
end,
32+
},
33+
left = {
34+
{
35+
ft = "NvimTree",
36+
pinned = true,
37+
collapsed = false,
38+
size = { height = 0.6, width = 40 },
39+
open = "NvimTreeOpen",
40+
},
41+
{
42+
ft = "trouble",
43+
pinned = true,
44+
collapsed = false,
45+
size = { height = 0.4, width = 40 },
46+
open = "Trouble symbols toggle win.position=right",
47+
filter = trouble_filter("right"),
48+
},
49+
},
50+
bottom = {
51+
{ ft = "qf", size = { height = 0.3 } },
52+
{
53+
ft = "toggleterm",
54+
size = { height = 0.3 },
55+
filter = function(_, win)
56+
local not_floating = vim.api.nvim_win_get_config(win).relative == ""
57+
local term = require("toggleterm.terminal").get(1)
58+
return not_floating and term.direction == "horizontal"
59+
end,
60+
},
61+
{
62+
ft = "help",
63+
size = { height = 0.3 },
64+
filter = function(buf)
65+
return vim.bo[buf].buftype == "help"
66+
end,
67+
},
68+
},
69+
})
70+
end

lua/modules/plugins/ui.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,10 @@ ui["dstein64/nvim-scrollview"] = {
7171
event = { "BufReadPost", "BufAdd", "BufNewFile" },
7272
config = require("ui.scrollview"),
7373
}
74+
ui["folke/edgy.nvim"] = {
75+
lazy = true,
76+
event = { "VeryLazy" },
77+
config = require("ui.edgy"),
78+
}
7479

7580
return ui

0 commit comments

Comments
 (0)