Compare commits
12
Commits
f58e5d0f7e
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a12d268f01
|
||
|
|
1db1e9fcf9
|
||
|
|
2eeef49853
|
||
|
|
b0447e387e
|
||
|
|
0946f49859
|
||
|
|
6ddecc4dd7
|
||
|
|
94cace0f0c
|
||
|
|
c21b5968d5
|
||
|
|
c33fafffd8
|
||
|
|
c671d4c6fc
|
||
|
|
ad30ff195f
|
||
|
|
446ddf4887
|
+3
-3
@@ -64,8 +64,8 @@ env = HYPRCURSOR_SIZE,24
|
|||||||
|
|
||||||
# https://wiki.hypr.land/Configuring/Variables/#general
|
# https://wiki.hypr.land/Configuring/Variables/#general
|
||||||
general {
|
general {
|
||||||
gaps_in = 8
|
gaps_in = 0
|
||||||
gaps_out = 8
|
gaps_out = 0
|
||||||
|
|
||||||
border_size = 1
|
border_size = 1
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ general {
|
|||||||
|
|
||||||
# https://wiki.hypr.land/Configuring/Variables/#decoration
|
# https://wiki.hypr.land/Configuring/Variables/#decoration
|
||||||
decoration {
|
decoration {
|
||||||
rounding = 10
|
rounding = 0
|
||||||
|
|
||||||
# Change transparency of focused and unfocused windows
|
# Change transparency of focused and unfocused windows
|
||||||
active_opacity = 1.0
|
active_opacity = 1.0
|
||||||
|
|||||||
@@ -0,0 +1,241 @@
|
|||||||
|
-- See https://wiki.hypr.land/Configuring/Start/
|
||||||
|
|
||||||
|
local function read_hostname()
|
||||||
|
local f = io.open("/etc/hostname", "r")
|
||||||
|
if not f then return "" end
|
||||||
|
local name = f:read("*l") or ""
|
||||||
|
f:close()
|
||||||
|
return name
|
||||||
|
end
|
||||||
|
|
||||||
|
local hostname = read_hostname()
|
||||||
|
|
||||||
|
------------------
|
||||||
|
---- MONITORS ----
|
||||||
|
------------------
|
||||||
|
|
||||||
|
-- Per-machine monitors, rules and autostart live in monitors-<hostname>.lua
|
||||||
|
require("monitors-" .. hostname)
|
||||||
|
|
||||||
|
---------------------
|
||||||
|
---- MY PROGRAMS ----
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
local terminal = "kitty"
|
||||||
|
local fileManager = "dolphin"
|
||||||
|
local menu = "rofi -show drun"
|
||||||
|
local screenshot = "screenshot-upload"
|
||||||
|
local calc = "rofi -show calc -modi calc -no-show-match -no-sort"
|
||||||
|
|
||||||
|
-------------------
|
||||||
|
---- AUTOSTART ----
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
hl.on("hyprland.start", function()
|
||||||
|
hl.exec_cmd("awww-daemon")
|
||||||
|
hl.exec_cmd("mako")
|
||||||
|
|
||||||
|
-- Don't want waybar on Berlin
|
||||||
|
if hostname ~= "berlin" then
|
||||||
|
hl.exec_cmd("~/.config/scripts/launch.sh")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-------------------------------
|
||||||
|
---- ENVIRONMENT VARIABLES ----
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
|
hl.env("XCURSOR_SIZE", "24")
|
||||||
|
hl.env("HYPRCURSOR_SIZE", "24")
|
||||||
|
|
||||||
|
-----------------------
|
||||||
|
---- LOOK AND FEEL ----
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
-- Refer to https://wiki.hypr.land/Configuring/Basics/Variables/
|
||||||
|
hl.config({
|
||||||
|
general = {
|
||||||
|
gaps_in = 0,
|
||||||
|
gaps_out = 0,
|
||||||
|
|
||||||
|
border_size = 1,
|
||||||
|
|
||||||
|
col = {
|
||||||
|
active_border = "rgba(b794f4ff)",
|
||||||
|
inactive_border = "rgba(595959aa)",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Set to true enable resizing windows by clicking and dragging on borders and gaps
|
||||||
|
resize_on_border = false,
|
||||||
|
|
||||||
|
-- Please see https://wiki.hypr.land/Configuring/Advanced-and-Cool/Tearing/ before you turn this on
|
||||||
|
allow_tearing = false,
|
||||||
|
|
||||||
|
layout = "dwindle",
|
||||||
|
},
|
||||||
|
|
||||||
|
decoration = {
|
||||||
|
rounding = 0,
|
||||||
|
|
||||||
|
-- Change transparency of focused and unfocused windows
|
||||||
|
active_opacity = 1.0,
|
||||||
|
inactive_opacity = 1.0,
|
||||||
|
|
||||||
|
shadow = {
|
||||||
|
enabled = false,
|
||||||
|
range = 4,
|
||||||
|
render_power = 3,
|
||||||
|
color = 0xee1a1a1a,
|
||||||
|
},
|
||||||
|
|
||||||
|
blur = {
|
||||||
|
enabled = true,
|
||||||
|
size = 3,
|
||||||
|
passes = 1,
|
||||||
|
vibrancy = 0.1696,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
animations = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
dwindle = {
|
||||||
|
preserve_split = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
master = {
|
||||||
|
new_status = "master",
|
||||||
|
},
|
||||||
|
|
||||||
|
misc = {
|
||||||
|
force_default_wallpaper = -1, -- Set to 0 or 1 to disable the anime mascot wallpapers
|
||||||
|
disable_hyprland_logo = false, -- If true disables the random hyprland logo / anime girl background. :(
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- See https://wiki.hypr.land/Configuring/Advanced-and-Cool/Animations/
|
||||||
|
hl.curve("easeOutQuint", { type = "bezier", points = { {0.23, 1}, {0.32, 1} } })
|
||||||
|
hl.curve("easeInOutCubic", { type = "bezier", points = { {0.65, 0.05}, {0.36, 1} } })
|
||||||
|
hl.curve("linear", { type = "bezier", points = { {0, 0}, {1, 1} } })
|
||||||
|
hl.curve("almostLinear", { type = "bezier", points = { {0.5, 0.5}, {0.75, 1} } })
|
||||||
|
hl.curve("quick", { type = "bezier", points = { {0.15, 0}, {0.1, 1} } })
|
||||||
|
|
||||||
|
hl.animation({ leaf = "global", enabled = true, speed = 10, bezier = "default" })
|
||||||
|
hl.animation({ leaf = "border", enabled = true, speed = 5.39, bezier = "easeOutQuint" })
|
||||||
|
hl.animation({ leaf = "windows", enabled = true, speed = 4.79, bezier = "easeOutQuint" })
|
||||||
|
hl.animation({ leaf = "windowsIn", enabled = true, speed = 4.1, bezier = "easeOutQuint", style = "popin 87%" })
|
||||||
|
hl.animation({ leaf = "windowsOut", enabled = true, speed = 1.49, bezier = "linear", style = "popin 87%" })
|
||||||
|
hl.animation({ leaf = "fadeIn", enabled = true, speed = 1.73, bezier = "almostLinear" })
|
||||||
|
hl.animation({ leaf = "fadeOut", enabled = true, speed = 1.46, bezier = "almostLinear" })
|
||||||
|
hl.animation({ leaf = "fade", enabled = true, speed = 3.03, bezier = "quick" })
|
||||||
|
hl.animation({ leaf = "layers", enabled = true, speed = 3.81, bezier = "easeOutQuint" })
|
||||||
|
hl.animation({ leaf = "layersIn", enabled = true, speed = 4, bezier = "easeOutQuint", style = "fade" })
|
||||||
|
hl.animation({ leaf = "layersOut", enabled = true, speed = 1.5, bezier = "linear", style = "fade" })
|
||||||
|
hl.animation({ leaf = "fadeLayersIn", enabled = true, speed = 1.79, bezier = "almostLinear" })
|
||||||
|
hl.animation({ leaf = "fadeLayersOut", enabled = true, speed = 1.39, bezier = "almostLinear" })
|
||||||
|
hl.animation({ leaf = "workspaces", enabled = false, speed = 1.94, bezier = "almostLinear", style = "fade" })
|
||||||
|
hl.animation({ leaf = "workspacesIn", enabled = false, speed = 1.21, bezier = "almostLinear", style = "fade" })
|
||||||
|
hl.animation({ leaf = "workspacesOut", enabled = false, speed = 1.94, bezier = "almostLinear", style = "fade" })
|
||||||
|
hl.animation({ leaf = "zoomFactor", enabled = true, speed = 7, bezier = "quick" })
|
||||||
|
|
||||||
|
---------------
|
||||||
|
---- INPUT ----
|
||||||
|
---------------
|
||||||
|
|
||||||
|
hl.config({
|
||||||
|
input = {
|
||||||
|
kb_layout = "us",
|
||||||
|
kb_variant = "",
|
||||||
|
kb_model = "",
|
||||||
|
kb_options = "",
|
||||||
|
kb_rules = "",
|
||||||
|
|
||||||
|
follow_mouse = 1,
|
||||||
|
|
||||||
|
sensitivity = 0, -- -1.0 - 1.0, 0 means no modification.
|
||||||
|
|
||||||
|
touchpad = {
|
||||||
|
natural_scroll = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
hl.gesture({
|
||||||
|
fingers = 3,
|
||||||
|
direction = "horizontal",
|
||||||
|
action = "workspace",
|
||||||
|
})
|
||||||
|
|
||||||
|
hl.device({
|
||||||
|
name = "epic-mouse-v1",
|
||||||
|
sensitivity = -0.5,
|
||||||
|
})
|
||||||
|
|
||||||
|
---------------------
|
||||||
|
---- KEYBINDINGS ----
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
-- See https://wiki.hypr.land/Configuring/Basics/Binds/
|
||||||
|
local mainMod = "SUPER" -- Sets "Windows" key as main modifier
|
||||||
|
|
||||||
|
-- Screenshots
|
||||||
|
hl.bind("SUPER + SHIFT + S", hl.dsp.exec_cmd(screenshot))
|
||||||
|
|
||||||
|
-- Resize mode
|
||||||
|
hl.bind(mainMod .. " + R", hl.dsp.submap("resize"))
|
||||||
|
hl.define_submap("resize", function()
|
||||||
|
hl.bind("l", hl.dsp.window.resize({ x = 80, y = 0, relative = true }), { repeating = true })
|
||||||
|
hl.bind("h", hl.dsp.window.resize({ x = -80, y = 0, relative = true }), { repeating = true })
|
||||||
|
hl.bind("k", hl.dsp.window.resize({ x = 0, y = -80, relative = true }), { repeating = true })
|
||||||
|
hl.bind("j", hl.dsp.window.resize({ x = 0, y = 80, relative = true }), { repeating = true })
|
||||||
|
hl.bind("escape", hl.dsp.submap("reset"))
|
||||||
|
end)
|
||||||
|
|
||||||
|
hl.bind("SUPER + SHIFT + h", hl.dsp.window.swap({ direction = "left" }))
|
||||||
|
hl.bind("SUPER + SHIFT + l", hl.dsp.window.swap({ direction = "right" }))
|
||||||
|
hl.bind("SUPER + SHIFT + k", hl.dsp.window.move({ direction = "up" }))
|
||||||
|
hl.bind("SUPER + SHIFT + j", hl.dsp.window.move({ direction = "down" }))
|
||||||
|
|
||||||
|
hl.bind(mainMod .. " + RETURN", hl.dsp.exec_cmd(terminal))
|
||||||
|
hl.bind("SUPER + SHIFT + Q", hl.dsp.window.close())
|
||||||
|
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fileManager))
|
||||||
|
hl.bind(mainMod .. " + F", hl.dsp.window.float({ action = "toggle" }))
|
||||||
|
hl.bind(mainMod .. " + D", hl.dsp.exec_cmd(menu))
|
||||||
|
hl.bind(mainMod .. " + C", hl.dsp.exec_cmd(calc))
|
||||||
|
|
||||||
|
-- Move focus with mainMod + hjkl
|
||||||
|
hl.bind(mainMod .. " + h", hl.dsp.focus({ direction = "left" }))
|
||||||
|
hl.bind(mainMod .. " + l", hl.dsp.focus({ direction = "right" }))
|
||||||
|
hl.bind(mainMod .. " + k", hl.dsp.focus({ direction = "up" }))
|
||||||
|
hl.bind(mainMod .. " + j", hl.dsp.focus({ direction = "down" }))
|
||||||
|
|
||||||
|
-- Switch workspaces with mainMod + [0-9]
|
||||||
|
-- Move active window to a workspace with mainMod + SHIFT + [0-9]
|
||||||
|
for i = 1, 10 do
|
||||||
|
local key = i % 10 -- 10 maps to key 0
|
||||||
|
hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i }))
|
||||||
|
hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i }))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Scroll through existing workspaces with mainMod + scroll
|
||||||
|
hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
|
||||||
|
hl.bind(mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }))
|
||||||
|
|
||||||
|
-- Move/resize windows with mainMod + LMB/RMB and dragging
|
||||||
|
hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
|
||||||
|
hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
|
||||||
|
|
||||||
|
-- Laptop multimedia keys for volume and LCD brightness
|
||||||
|
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), { locked = true, repeating = true })
|
||||||
|
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), { locked = true, repeating = true })
|
||||||
|
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { locked = true, repeating = true })
|
||||||
|
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true, repeating = true })
|
||||||
|
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"), { locked = true, repeating = true })
|
||||||
|
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"), { locked = true, repeating = true })
|
||||||
|
|
||||||
|
-- Requires playerctl
|
||||||
|
hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true })
|
||||||
|
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
|
||||||
|
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
|
||||||
|
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true })
|
||||||
@@ -2,5 +2,6 @@ monitor=,3440x1440@100,0x0,1
|
|||||||
windowrule = float on, match:class ^(.*)$, match:title ^(cfi)$
|
windowrule = float on, match:class ^(.*)$, match:title ^(cfi)$
|
||||||
windowrule = float on, match:class ^(.*)$, match:title ^(Tanks Reborn)$
|
windowrule = float on, match:class ^(.*)$, match:title ^(Tanks Reborn)$
|
||||||
windowrule = float on, match:class ^(.*)$, match:title ^(Rogue PT)$
|
windowrule = float on, match:class ^(.*)$, match:title ^(Rogue PT)$
|
||||||
|
windowrule = float on, match:class ^(.*)$, match:title ^(Rockets in Space)$
|
||||||
|
|
||||||
exec-once = awww img /home/caio/wallpapers/shuttle.png
|
exec-once = awww img /home/caio/wallpapers/shuttle.png
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
hl.monitor({
|
||||||
|
output = "",
|
||||||
|
mode = "3440x1440@100",
|
||||||
|
position = "0x0",
|
||||||
|
scale = 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
for _, title in ipairs({ "cfi", "Tanks Reborn", "Rogue PT", "Rockets in Space" }) do
|
||||||
|
hl.window_rule({
|
||||||
|
name = "float-" .. title,
|
||||||
|
match = { class = "^(.*)$", title = "^(" .. title .. ")$" },
|
||||||
|
float = true,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
hl.on("hyprland.start", function()
|
||||||
|
hl.exec_cmd("awww img /home/caio/wallpapers/shuttle.png")
|
||||||
|
end)
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
hl.monitor({
|
||||||
|
output = "",
|
||||||
|
mode = "1920x1080@60",
|
||||||
|
position = "0x0",
|
||||||
|
scale = 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
hl.window_rule({
|
||||||
|
name = "float-cfi",
|
||||||
|
match = { class = "^(.*)$", title = "^(cfi)$" },
|
||||||
|
float = true,
|
||||||
|
})
|
||||||
+7
-1
@@ -1,8 +1,14 @@
|
|||||||
background_opacity 0.8
|
background_opacity 1.0
|
||||||
hide_window_decorations yes
|
hide_window_decorations yes
|
||||||
|
|
||||||
|
map ctrl+q goto_tab 1
|
||||||
|
map ctrl+e goto_tab 2
|
||||||
|
|
||||||
|
tab_bar_style hidden
|
||||||
|
|
||||||
# BEGIN_KITTY_THEME
|
# BEGIN_KITTY_THEME
|
||||||
# bl1nk
|
# bl1nk
|
||||||
include current-theme.conf
|
include current-theme.conf
|
||||||
# END_KITTY_THEME
|
# END_KITTY_THEME
|
||||||
|
|
||||||
|
remember_window_size no
|
||||||
|
|||||||
@@ -13,10 +13,12 @@ local function make_transparent()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
vim.api.nvim_create_autocmd({ "ColorScheme", "VimEnter" }, {
|
vim.api.nvim_create_autocmd({ "ColorScheme", "VimEnter" }, {
|
||||||
callback = make_transparent,
|
callback = make_transparent,
|
||||||
desc = "Force transparent background after any colorscheme loads",
|
desc = "Force transparent background after any colorscheme loads",
|
||||||
})
|
})
|
||||||
|
]]
|
||||||
|
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
@@ -40,13 +42,14 @@ vim.filetype.add({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
require("config.opts")
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>qs", function() require("persistence").load() end, { desc = "Restore Session" })
|
vim.keymap.set("n", "<leader>qs", function() require("persistence").load() end, { desc = "Restore Session" })
|
||||||
vim.keymap.set("n", "<leader>ql", function() require("persistence").load({ last = true }) end, { desc = "Restore Last Session" })
|
vim.keymap.set("n", "<leader>ql", function() require("persistence").load({ last = true }) end, { desc = "Restore Last Session" })
|
||||||
vim.keymap.set("n", "<leader>qd", function() require("persistence").stop() end, { desc = "Don't Save Current Session" })
|
vim.keymap.set("n", "<leader>qd", function() require("persistence").stop() end, { desc = "Don't Save Current Session" })
|
||||||
vim.keymap.set("n", "<leader>qq", "<cmd>wqa<cr>", { desc = "Save All and Quit Neovim" })
|
vim.keymap.set("n", "<leader>qq", "<cmd>wqa<cr>", { desc = "Save All and Quit Neovim" })
|
||||||
vim.keymap.set("n", "<leader>qQ", "<cmd>qa!<cr>", { desc = "Force Quit All (No Save)" })
|
vim.keymap.set("n", "<leader>qQ", "<cmd>qa!<cr>", { desc = "Force Quit All (No Save)" })
|
||||||
|
|
||||||
require("config.opts")
|
|
||||||
|
|
||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
spec = {
|
spec = {
|
||||||
|
|||||||
+35
-9
@@ -31,14 +31,6 @@ vim.filetype.add({
|
|||||||
cuh = "cuda",
|
cuh = "cuda",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
-- clangd
|
|
||||||
vim.lsp.config("clangd", {
|
|
||||||
cmd = { "clangd", "--compile-commands-dir=build", "--experimental-modules-support" },
|
|
||||||
capabilities = caps,
|
|
||||||
on_attach = on_attach,
|
|
||||||
filetypes = { "c", "cpp", "cc", "cxx", "c++", "ixx", "cu", "cuh", "cuda" },
|
|
||||||
})
|
|
||||||
vim.lsp.enable("clangd")
|
|
||||||
|
|
||||||
-- rust-analyzer
|
-- rust-analyzer
|
||||||
vim.lsp.config("rust_analyzer", {
|
vim.lsp.config("rust_analyzer", {
|
||||||
@@ -80,15 +72,49 @@ vim.lsp.enable("gopls")
|
|||||||
-- pyright
|
-- pyright
|
||||||
vim.lsp.config("pyright", {
|
vim.lsp.config("pyright", {
|
||||||
capabilities = caps,
|
capabilities = caps,
|
||||||
|
on_attach = on_attach,
|
||||||
})
|
})
|
||||||
|
vim.lsp.enable("pyright")
|
||||||
|
|
||||||
|
-- ruff (linting + formatting)
|
||||||
|
vim.lsp.config("ruff", {
|
||||||
|
capabilities = caps,
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
-- leave hover to pyright
|
||||||
|
client.server_capabilities.hoverProvider = false
|
||||||
|
on_attach(client, bufnr)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
vim.lsp.enable("ruff")
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
group = vim.api.nvim_create_augroup("AutoFormatOnSave", { clear = true }),
|
group = vim.api.nvim_create_augroup("AutoFormatOnSave", { clear = true }),
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
callback = function()
|
callback = function()
|
||||||
|
local ext = vim.fn.expand("%:e")
|
||||||
|
local cpp_exts = { cpp = true, cxx = true, hpp = true, ixx = true }
|
||||||
|
|
||||||
|
if cpp_exts[ext] then
|
||||||
|
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
||||||
|
local input = table.concat(lines, "\n")
|
||||||
|
|
||||||
|
-- pass buffer content via stdin, get formatted output back
|
||||||
|
local result = vim.fn.systemlist(
|
||||||
|
{ "clang-format", "--assume-filename=" .. vim.fn.expand("%:t") },
|
||||||
|
input
|
||||||
|
)
|
||||||
|
|
||||||
|
if vim.v.shell_error == 0 then
|
||||||
|
vim.api.nvim_buf_set_lines(0, 0, -1, false, result)
|
||||||
|
else
|
||||||
|
vim.notify("clang-format failed: " .. table.concat(result, "\n"), vim.log.levels.WARN)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
|
for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
|
||||||
if client.supports_method("textDocument/formatting") then
|
if client.supports_method("textDocument/formatting") then
|
||||||
vim.lsp.buf.format({ async = true, timeout_ms=5000 })
|
vim.lsp.buf.format({ async = false, timeout_ms = 5000 })
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
tag = "0.1.8",
|
branch = "master",
|
||||||
dependencies = { "nvim-lua/plenary.nvim" },
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
config = function()
|
config = function()
|
||||||
local function get_ignore_patterns()
|
local function get_ignore_patterns()
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ alias ll='ls -lh'
|
|||||||
alias la='ls -lha'
|
alias la='ls -lha'
|
||||||
alias gs='git status'
|
alias gs='git status'
|
||||||
alias v='nvim'
|
alias v='nvim'
|
||||||
|
alias exit-desktop="hyprctl dispatch 'hl.dsp.exit()'"
|
||||||
|
|
||||||
export CC=/usr/bin/clang
|
export CC=/usr/bin/clang
|
||||||
export CXX=/usr/bin/clang++
|
export CXX=/usr/bin/clang++
|
||||||
@@ -28,3 +29,4 @@ eval "$(starship init zsh)"
|
|||||||
[ -f /etc/profile.d/vulkan-sdk.sh ] && source /etc/profile.d/vulkan-sdk.sh
|
[ -f /etc/profile.d/vulkan-sdk.sh ] && source /etc/profile.d/vulkan-sdk.sh
|
||||||
|
|
||||||
export PATH="/home/caio/.pixi/bin:$PATH"
|
export PATH="/home/caio/.pixi/bin:$PATH"
|
||||||
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
|
|||||||
Reference in New Issue
Block a user