Skip to content

Commit 309fe9c

Browse files
Latest
edgy settings neovide font tokyonight cmake & cargo everything except for neovide sucks
1 parent f192235 commit 309fe9c

File tree

7 files changed

+243
-5
lines changed

7 files changed

+243
-5
lines changed

init.lua

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
-- bootstrap lazy.nvim, LazyVim and your plugins
22
require("config.lazy")
3+
4+
vim.o.guifont = "JetBrainsMono Nerd Font:h11" -- text below applies for VimScript
5+
vim.g.neovide_transparency = 0.9

lazyvim.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
{
22
"extras": [
3-
"lazyvim.plugins.extras.coding.copilot",
4-
"lazyvim.plugins.extras.coding.copilot-chat",
3+
"lazyvim.plugins.extras.ai.copilot",
4+
"lazyvim.plugins.extras.ai.copilot-chat",
55
"lazyvim.plugins.extras.coding.mini-surround",
66
"lazyvim.plugins.extras.dap.core",
77
"lazyvim.plugins.extras.lang.git",
88
"lazyvim.plugins.extras.lang.json",
99
"lazyvim.plugins.extras.lang.markdown",
1010
"lazyvim.plugins.extras.lang.rust",
11+
"lazyvim.plugins.extras.lang.toml",
1112
"lazyvim.plugins.extras.ui.edgy"
1213
],
1314
"news": {
14-
"NEWS.md": "6520"
15+
"NEWS.md": "7429"
1516
},
16-
"version": 6
17+
"version": 7
1718
}

lua/config/keymaps.lua

+6
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@ map({ "n" }, "<leader>ccq", function()
1515
require("CopilotChat").ask(input, { selection = require("CopilotChat.select").buffer })
1616
end
1717
end, { desc = "CopilotChat - Quick chat", silent = true })
18+
19+
if vim.g.neovide then
20+
vim.keymap.set({ "n", "v" }, "<C-+>", ":lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor + 0.1<CR>")
21+
vim.keymap.set({ "n", "v" }, "<C-->", ":lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor - 0.1<CR>")
22+
vim.keymap.set({ "n", "v" }, "<C-0>", ":lua vim.g.neovide_scale_factor = 1<CR>")
23+
end

lua/plugins/cargorun.lua

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
local function cargo_run()
2+
local term_buf = vim.api.nvim_create_buf(false, true) -- Create a new scratch buffer
3+
local term_win = vim.api.nvim_open_win(term_buf, true, {
4+
relative = "editor",
5+
width = math.floor(vim.o.columns * 0.8), -- 80% width of the editor
6+
height = math.floor(vim.o.lines * 0.3), -- 30% height of the editor
7+
row = math.floor(vim.o.lines * 0.7), -- Bottom 30% of the screen
8+
col = math.floor(vim.o.columns * 0.1), -- Center horizontally
9+
style = "minimal",
10+
})
11+
12+
-- Run `cargo run` in the terminal
13+
vim.fn.termopen("cargo run", {
14+
on_exit = function(_, exit_code)
15+
vim.api.nvim_buf_delete(term_buf, { force = true })
16+
end,
17+
})
18+
19+
-- Auto-close the terminal window on exit
20+
vim.api.nvim_buf_set_option(term_buf, "bufhidden", "wipe")
21+
vim.api.nvim_win_set_option(term_win, "winhighlight", "Normal:NormalFloat")
22+
end
23+
24+
-- Set the keymap in a way LazyVim recognizes it
25+
vim.keymap.set("n", "<leader>cr", cargo_run, { noremap = true, silent = true })

lua/plugins/cmake-tool.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ return {
4242
position = "belowright",
4343
size = 10,
4444
encoding = "utf-8",
45-
auto_close_when_success = true,
45+
auto_close_when_success = false,
4646
},
4747
toggleterm = {
4848
direction = "float",

lua/plugins/edgy.lua

+193
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
return {
2+
-- edgy
3+
{
4+
"folke/edgy.nvim",
5+
event = "VeryLazy",
6+
keys = {
7+
{
8+
"<leader>ue",
9+
function()
10+
require("edgy").toggle()
11+
end,
12+
desc = "Edgy Toggle",
13+
},
14+
-- stylua: ignore
15+
{ "<leader>uE", function() require("edgy").select() end, desc = "Edgy Select Window" },
16+
},
17+
opts = function()
18+
local opts = {
19+
bottom = {
20+
{
21+
ft = "toggleterm",
22+
size = { height = 0.25 },
23+
title = "Terminal",
24+
pinned = true, -- Ensures the terminal stays in the same window
25+
filter = function(buf, win)
26+
return vim.api.nvim_win_get_config(win).relative == ""
27+
end,
28+
},
29+
{
30+
ft = "noice",
31+
size = { height = 0.25 },
32+
filter = function(buf, win)
33+
return vim.api.nvim_win_get_config(win).relative == ""
34+
end,
35+
},
36+
"Trouble",
37+
{ ft = "qf", title = "QuickFix" },
38+
{
39+
ft = "help",
40+
size = { height = 20 },
41+
-- don't open help files in edgy that we're editing
42+
filter = function(buf)
43+
return vim.bo[buf].buftype == "help"
44+
end,
45+
},
46+
{ title = "Spectre", ft = "spectre_panel", size = { height = 0.4 } },
47+
{ title = "Neotest Output", ft = "neotest-output-panel", size = { height = 15 } },
48+
},
49+
left = {
50+
{ title = "Neotest Summary", ft = "neotest-summary" },
51+
-- "neo-tree",
52+
},
53+
right = {
54+
{ title = "Grug Far", ft = "grug-far", size = { width = 0.4 } },
55+
},
56+
keys = {
57+
-- increase width
58+
["<c-Right>"] = function(win)
59+
win:resize("width", 2)
60+
end,
61+
-- decrease width
62+
["<c-Left>"] = function(win)
63+
win:resize("width", -2)
64+
end,
65+
-- increase height
66+
["<c-Up>"] = function(win)
67+
win:resize("height", 2)
68+
end,
69+
-- decrease height
70+
["<c-Down>"] = function(win)
71+
win:resize("height", -2)
72+
end,
73+
},
74+
}
75+
76+
if LazyVim.has("neo-tree.nvim") then
77+
local pos = {
78+
filesystem = "left",
79+
buffers = "top",
80+
git_status = "right",
81+
document_symbols = "bottom",
82+
diagnostics = "bottom",
83+
}
84+
local sources = LazyVim.opts("neo-tree.nvim").sources or {}
85+
for i, v in ipairs(sources) do
86+
table.insert(opts.left, i, {
87+
title = "Neo-Tree " .. v:gsub("_", " "):gsub("^%l", string.upper),
88+
ft = "neo-tree",
89+
filter = function(buf)
90+
return vim.b[buf].neo_tree_source == v
91+
end,
92+
pinned = true,
93+
open = function()
94+
vim.cmd(("Neotree show position=%s %s dir=%s"):format(pos[v] or "bottom", v, LazyVim.root()))
95+
end,
96+
})
97+
end
98+
end
99+
100+
-- trouble
101+
for _, pos in ipairs({ "top", "bottom", "left", "right" }) do
102+
opts[pos] = opts[pos] or {}
103+
table.insert(opts[pos], {
104+
ft = "trouble",
105+
filter = function(_buf, win)
106+
return vim.w[win].trouble
107+
and vim.w[win].trouble.position == pos
108+
and vim.w[win].trouble.type == "split"
109+
and vim.w[win].trouble.relative == "editor"
110+
and not vim.w[win].trouble_preview
111+
end,
112+
})
113+
end
114+
115+
-- snacks terminal
116+
for _, pos in ipairs({ "top", "bottom", "left", "right" }) do
117+
opts[pos] = opts[pos] or {}
118+
table.insert(opts[pos], {
119+
ft = "snacks_terminal",
120+
size = { height = 0.4 },
121+
title = "%{b:snacks_terminal.id}: %{b:term_title}",
122+
filter = function(_buf, win)
123+
return vim.w[win].snacks_win
124+
and vim.w[win].snacks_win.position == pos
125+
and vim.w[win].snacks_win.relative == "editor"
126+
and not vim.w[win].trouble_preview
127+
end,
128+
})
129+
end
130+
return opts
131+
end,
132+
},
133+
134+
-- use edgy's selection window
135+
{
136+
"nvim-telescope/telescope.nvim",
137+
optional = true,
138+
opts = {
139+
defaults = {
140+
get_selection_window = function()
141+
require("edgy").goto_main()
142+
return 0
143+
end,
144+
},
145+
},
146+
},
147+
148+
-- prevent neo-tree from opening files in edgy windows
149+
{
150+
"nvim-neo-tree/neo-tree.nvim",
151+
optional = true,
152+
opts = function(_, opts)
153+
opts.open_files_do_not_replace_types = opts.open_files_do_not_replace_types
154+
or { "terminal", "Trouble", "qf", "Outline", "trouble" }
155+
table.insert(opts.open_files_do_not_replace_types, "edgy")
156+
end,
157+
},
158+
159+
-- Fix bufferline offsets when edgy is loaded
160+
{
161+
"akinsho/bufferline.nvim",
162+
optional = true,
163+
opts = function()
164+
local Offset = require("bufferline.offset")
165+
if not Offset.edgy then
166+
local get = Offset.get
167+
Offset.get = function()
168+
if package.loaded.edgy then
169+
local old_offset = get()
170+
local layout = require("edgy.config").layout
171+
local ret = { left = "", left_size = 0, right = "", right_size = 0 }
172+
for _, pos in ipairs({ "left", "right" }) do
173+
local sb = layout[pos]
174+
local title = " Sidebar" .. string.rep(" ", sb.bounds.width - 8)
175+
if sb and #sb.wins > 0 then
176+
ret[pos] = old_offset[pos .. "_size"] > 0 and old_offset[pos]
177+
or pos == "left" and ("%#Bold#" .. title .. "%*" .. "%#BufferLineOffsetSeparator#│%*")
178+
or pos == "right" and ("%#BufferLineOffsetSeparator#│%*" .. "%#Bold#" .. title .. "%*")
179+
ret[pos .. "_size"] = old_offset[pos .. "_size"] > 0 and old_offset[pos .. "_size"] or sb.bounds.width
180+
end
181+
end
182+
ret.total_size = ret.left_size + ret.right_size
183+
if ret.total_size > 0 then
184+
return ret
185+
end
186+
end
187+
return get()
188+
end
189+
Offset.edgy = true
190+
end
191+
end,
192+
},
193+
}

lua/plugins/tokynight.lua

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
return {
2+
"folke/tokyonight.nvim",
3+
opts = {
4+
transparent = true,
5+
styles = {
6+
sidebars = "transparent",
7+
floats = "transparent",
8+
},
9+
},
10+
}

0 commit comments

Comments
 (0)