Compare commits
20 Commits
85c810e65c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 03a85c3b29 | |||
| 28643cd8a8 | |||
|
3220c8729c
|
|||
|
c09e9843dc
|
|||
|
eb50b528a4
|
|||
|
7ff4724ab4
|
|||
|
2416c68f1e
|
|||
|
78c2913c61
|
|||
|
4a0aaac043
|
|||
|
e5a08226b7
|
|||
| 92b3bd1af3 | |||
| 33b2570b4e | |||
| 704422d374 | |||
| 20de5fe8f1 | |||
| a5c62aa8b2 | |||
| 345044a61a | |||
| 31992214c8 | |||
| 0f393df44e | |||
| d4ebee1c9b | |||
| 2335f83255 |
@@ -148,4 +148,8 @@ automatically-unhide-macos-hidden-apps = false
|
||||
down = 'volume down'
|
||||
up = 'volume up'
|
||||
shift-down = ['volume set 0', 'mode main']
|
||||
|
||||
|
||||
[[on-window-detected]]
|
||||
if.app-name-regex-substring = 'QEMU'
|
||||
check-further-callbacks = true
|
||||
run = ['layout floating']
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
source = ~/.config/hypr/monitors.conf
|
||||
|
||||
# See https://wiki.hypr.land/Configuring/Keywords/
|
||||
$terminal = wezterm
|
||||
$terminal = kitty
|
||||
$fileManager = dolphin
|
||||
$menu = rofi -show drun
|
||||
$screenshot = grim -g "$(slurp)" - | swappy -f -
|
||||
$screenshot = screenshot-upload
|
||||
$calc = rofi -show calc -modi calc -no-show-match -no-sort
|
||||
|
||||
#################
|
||||
### AUTOSTART ###
|
||||
@@ -23,6 +24,8 @@ $screenshot = grim -g "$(slurp)" - | swappy -f -
|
||||
# exec-once = waybar & hyprpaper & firefox
|
||||
exec-once = swww-daemon & disown
|
||||
|
||||
exec-once = mako
|
||||
|
||||
# Don't want waybar on Berlin
|
||||
exec-once = sh -c '[ "$(hostname)" != "berlin" ] && ~/.config/scripts/launch.sh'
|
||||
|
||||
@@ -228,6 +231,7 @@ bind = SUPER_SHIFT, Q, killactive,
|
||||
bind = $mainMod, E, exec, $fileManager
|
||||
bind = $mainMod, F, togglefloating,
|
||||
bind = $mainMod, D, exec, $menu
|
||||
bind = $mainMod, C, exec, $calc
|
||||
|
||||
# Move focus with mainMod + arrow keys
|
||||
bind = $mainMod, h, movefocus, l
|
||||
|
||||
@@ -41,8 +41,16 @@ end
|
||||
|
||||
function M.configure_cmake(build_type)
|
||||
vim.fn.mkdir("build", "p")
|
||||
|
||||
local cmake_args = {
|
||||
"-GNinja",
|
||||
"-DCMAKE_BUILD_TYPE=" .. build_type,
|
||||
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
|
||||
".."
|
||||
}
|
||||
|
||||
float_term(
|
||||
{ M.find_cmake(), "-DCMAKE_BUILD_TYPE=" .. build_type, "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON", ".." },
|
||||
{ M.find_cmake(), unpack(cmake_args) },
|
||||
{ cwd = "build" }
|
||||
)
|
||||
end
|
||||
@@ -56,7 +64,7 @@ vim.api.nvim_create_user_command("Build", function(opts)
|
||||
local t = opts.args
|
||||
if t == "" then print("Usage: :Build <target>"); return end
|
||||
float_term(
|
||||
{ CMAKE, "--build", "build", "--parallel", "20", "--target", t },
|
||||
{ M.find_cmake(), "--build", "build", "--parallel", "20", "--target", t },
|
||||
{ height_ratio = 0.8, width_ratio = 0.8, border = "single" }
|
||||
)
|
||||
end, { nargs = 1 })
|
||||
|
||||
85
nvim/lua/config/dap.lua
Normal file
85
nvim/lua/config/dap.lua
Normal file
@@ -0,0 +1,85 @@
|
||||
local dap = require('dap')
|
||||
|
||||
dap.adapters.codelldb = {
|
||||
type = "executable",
|
||||
command = "/Users/caiowakamatsu/install/codelldb/extension/adapter/codelldb",
|
||||
}
|
||||
|
||||
vim.api.nvim_create_user_command('Debug', function(opts)
|
||||
local args = vim.split(opts.args, " ")
|
||||
|
||||
if #args < 1 then
|
||||
print("Usage: :Debug <executable> [<working_dir>] [<args>...]")
|
||||
return
|
||||
end
|
||||
|
||||
local executable = args[1]
|
||||
local working_dir = (#args >= 2 and args[2] ~= "") and args[2] or vim.fn.getcwd()
|
||||
local program_args = {}
|
||||
if #args > 2 then
|
||||
for i = 3, #args do
|
||||
table.insert(program_args, args[i])
|
||||
end
|
||||
end
|
||||
|
||||
dap.run({
|
||||
type = 'codelldb',
|
||||
request = 'launch',
|
||||
name = 'Custom Debug',
|
||||
program = executable,
|
||||
cwd = working_dir,
|
||||
args = program_args,
|
||||
stopOnEntry = false,
|
||||
})
|
||||
end, {
|
||||
nargs = '+',
|
||||
complete = 'file',
|
||||
desc = 'Launch a debugger session with custom executable and args',
|
||||
})
|
||||
|
||||
require("dapui").setup({
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
{ id = "scopes", size = 0.8 },
|
||||
{ id = "watches", size = 0.2 },
|
||||
},
|
||||
size = 40,
|
||||
position = "left",
|
||||
},
|
||||
{
|
||||
elements = {
|
||||
"repl",
|
||||
"console",
|
||||
},
|
||||
size = 0.25,
|
||||
position = "bottom",
|
||||
},
|
||||
},
|
||||
controls = {
|
||||
enabled = true,
|
||||
},
|
||||
floating = {
|
||||
max_height = nil,
|
||||
max_width = nil,
|
||||
border = "rounded",
|
||||
mappings = {
|
||||
close = { "q", "<Esc>" },
|
||||
},
|
||||
},
|
||||
windows = { indent = 1 },
|
||||
})
|
||||
local dap, dapui = require("dap"), require("dapui")
|
||||
dap.listeners.before.attach.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.launch.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
@@ -34,6 +34,12 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
ixx = "cpp",
|
||||
},
|
||||
})
|
||||
|
||||
require("config.opts")
|
||||
|
||||
require("lazy").setup({
|
||||
@@ -41,12 +47,16 @@ require("lazy").setup({
|
||||
{ import = "plugins.coding" },
|
||||
{ import = "plugins.colors" },
|
||||
{ import = "plugins.ui" },
|
||||
{ import = "plugins.debugging" },
|
||||
},
|
||||
install = { colorscheme = { "habamax" } },
|
||||
checker = { enabled = true },
|
||||
})
|
||||
|
||||
require("config.cmake")
|
||||
require("config.make")
|
||||
require("config.lsp")
|
||||
require("config.dap")
|
||||
|
||||
require("notify").setup({
|
||||
background_colour = "#000000",
|
||||
|
||||
@@ -27,9 +27,10 @@ end
|
||||
|
||||
-- clangd
|
||||
vim.lsp.config("clangd", {
|
||||
cmd = { "clangd", "--compile-commands-dir=build" },
|
||||
cmd = { "clangd", "--compile-commands-dir=build", "--experimental-modules-support" },
|
||||
capabilities = caps,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "c", "cpp", "cc", "cxx", "c++", "ixx" },
|
||||
})
|
||||
vim.lsp.enable("clangd")
|
||||
|
||||
|
||||
16
nvim/lua/config/make.lua
Normal file
16
nvim/lua/config/make.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
local M = {}
|
||||
|
||||
local float_term = require("util.float").float_terminal
|
||||
|
||||
vim.api.nvim_create_user_command("Make", function(opts)
|
||||
if opts.args == "" then
|
||||
print("Usage: :Make <targets>")
|
||||
return
|
||||
end
|
||||
local args = vim.split(opts.args, "%s+")
|
||||
float_term(
|
||||
vim.list_extend({ "make" }, args),
|
||||
{ height_ratio = 0.8, width_ratio = 0.8, border = "single" }
|
||||
)
|
||||
end, { nargs = "*" })
|
||||
|
||||
64
nvim/lua/plugins/debugging.lua
Normal file
64
nvim/lua/plugins/debugging.lua
Normal file
@@ -0,0 +1,64 @@
|
||||
return {
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
keys = {
|
||||
{
|
||||
"<leader>db",
|
||||
function() require("dap").toggle_breakpoint() end,
|
||||
desc = "Toggle Breakpoint"
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>dc",
|
||||
function() require("dap").continue() end,
|
||||
desc = "Continue"
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>dC",
|
||||
function() require("dap").run_to_cursor() end,
|
||||
desc = "Run to Cursor"
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>dT",
|
||||
function() require("dap").terminate() end,
|
||||
desc = "Terminate"
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
---@type MasonNvimDapSettings
|
||||
opts = {
|
||||
-- This line is essential to making automatic installation work
|
||||
-- :exploding-brain
|
||||
handlers = {},
|
||||
automatic_installation = {
|
||||
-- These will be configured by separate plugins.
|
||||
exclude = {
|
||||
"delve",
|
||||
"python",
|
||||
},
|
||||
},
|
||||
-- DAP servers: Mason will be invoked to install these if necessary.
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"codelldb",
|
||||
"php",
|
||||
"python",
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
"williamboman/mason.nvim",
|
||||
},
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
"nvim-neotest/nvim-nio"
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
return {
|
||||
{
|
||||
"sphamba/smear-cursor.nvim",
|
||||
opts = {},
|
||||
},
|
||||
--{
|
||||
--"sphamba/smear-cursor.nvim",
|
||||
--opts = {},
|
||||
--},
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
|
||||
@@ -7,19 +7,44 @@ function M.float_terminal(cmd, opts)
|
||||
local height = math.floor(vim.o.lines * (opts.height_ratio or 0.5))
|
||||
local row = math.floor((vim.o.lines - height) / 2)
|
||||
local col = math.floor((vim.o.columns - width) / 2)
|
||||
vim.api.nvim_open_win(buf, true, {
|
||||
|
||||
-- FIX 1: 'buf' is the first argument, not in the options table.
|
||||
vim.api.nvim_open_win(buf, true, {
|
||||
style = "minimal", relative = "editor",
|
||||
width = width, height = height, row = row, col = col,
|
||||
border = opts.border or "rounded",
|
||||
})
|
||||
|
||||
local function scroll_bottom()
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
vim.api.nvim_win_set_cursor(win, {vim.api.nvim_buf_line_count(0), 0})
|
||||
-- Format the command as a string for display
|
||||
local cmd_display
|
||||
if type(cmd) == 'table' then
|
||||
cmd_display = table.concat(cmd, " ")
|
||||
else
|
||||
cmd_display = cmd
|
||||
end
|
||||
|
||||
-- Write the command string to the top of the buffer
|
||||
vim.api.nvim_buf_set_lines(buf, 0, 0, false, {
|
||||
"--- RUNNING COMMAND: " .. cmd_display .. " ---",
|
||||
"", -- Add an empty line for separation
|
||||
})
|
||||
|
||||
-- FIX 2: Clear the 'modified' flag so termopen can proceed.
|
||||
vim.api.nvim_buf_set_option(buf, 'modified', false)
|
||||
|
||||
local function scroll_bottom()
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
-- Get the line count of the current buffer (which should be 'buf' at this point)
|
||||
vim.api.nvim_win_set_cursor(win, {vim.api.nvim_buf_line_count(buf), 0})
|
||||
end
|
||||
|
||||
-- We need to ensure the terminal starts in the correct buffer
|
||||
vim.api.nvim_set_current_buf(buf)
|
||||
|
||||
local job = vim.fn.termopen(cmd, {
|
||||
cwd = opts.cwd, -- <= important
|
||||
cwd = opts.cwd,
|
||||
-- NOTE: You may want to use vim.api.nvim_win_set_cursor on the specific win handle
|
||||
-- instead of getting the current win inside the callback for more reliability.
|
||||
on_stdout = function(...) scroll_bottom() end,
|
||||
on_stderr = function(...) scroll_bottom() end,
|
||||
on_exit = function(_, code, _)
|
||||
@@ -27,7 +52,7 @@ function M.float_terminal(cmd, opts)
|
||||
vim.notify(("command exited %d"):format(code), code == 0 and vim.log.levels.INFO or vim.log.levels.ERROR)
|
||||
end)
|
||||
end,
|
||||
env = opts.env, -- e.g. env = { PATH = os.getenv("PATH") }
|
||||
env = opts.env,
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "q", "<cmd>bd!<CR>", { buffer = buf, silent = true })
|
||||
|
||||
28
scripts/screenshot-upload.sh
Executable file
28
scripts/screenshot-upload.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
set -a
|
||||
source ~/.config/imgshare.env
|
||||
set +a
|
||||
|
||||
TOKEN="${IMGSHARE_TOKEN:?IMGSHARE_TOKEN not set}"
|
||||
ENDPOINT="https://share.caio.wakamatsu.cc/upload"
|
||||
|
||||
tmp=$(mktemp --suffix=.png)
|
||||
|
||||
grim -g "$(slurp)" "$tmp"
|
||||
swappy -f "$tmp" -o "$tmp"
|
||||
|
||||
resp=$(curl -s "$ENDPOINT" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-F "file=@$tmp")
|
||||
|
||||
url=$(echo "$resp" | jq -r '.url // empty')
|
||||
|
||||
if [[ -n "$url" ]]; then
|
||||
echo "https://share.caio.wakamatsu.cc$url" | wl-copy
|
||||
notify-send "Uploaded Image"
|
||||
fi
|
||||
|
||||
rm "$tmp"
|
||||
|
||||
Reference in New Issue
Block a user