diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..37c0dbe --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,79 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch package", + "type": "go", + "request": "launch", + "mode": "auto", + "remotePath": "", + "port": 38697, + "host": "127.0.0.1", + "program": "${workspaceFolder}", + "env": { + }, + "args": [], + "cwd": "${workspaceFolder}", + "envFile": "${workspaceFolder}/.env", + "buildFlags":"" + }, + { + "name": "Debug current package", + "type": "go", + "request": "launch", + "mode": "debug", + "remotePath": "", + "port": 38697, + "host": "127.0.0.1", + "program": "${fileDirname}", + "env": { + }, + "args": [], + "cwd": "${workspaceFolder}", + "envFile": "${workspaceFolder}/.env", + "buildFlags":"" + }, + { + "name": "Launch test function", + "type": "go", + "request": "launch", + "mode": "test", + "program": "${workspaceFolder}", + "args": [ + "-test.run", + "MyTestFunction" + ] + }, + { + "name": "Attach main", + "type": "go", + "request": "attach", + "mode": "debug", + "remotePath": "", + "port": 38697, + "host": "127.0.0.1", + "program": "${workspaceFolder}/main.go", + "env": { + }, + "args": [], + "cwd": "${workspaceFolder}", + "processId":"", + "envFile": "${workspaceFolder}/.env", + "buildFlags":"" + }, + { + "name": "Attach to Process", + "type": "go", + "request": "attach", + "mode": "local", + "processId": 0 + }, + { + "name": "Launch file", + "type": "go", + "request": "launch", + "mode": "debug", + "program": "${file}" + } + ] +} diff --git a/init.lua b/init.lua index 50f581a..931cf19 100644 --- a/init.lua +++ b/init.lua @@ -21,3 +21,94 @@ vim.api.nvim_create_autocmd("VimEnter", { end, desc = "Set git hooks path for Neovim config directory only", }) + +-- Define a highlight group for the floating filename +vim.api.nvim_create_autocmd("VimEnter", { + callback = function() + -- Create a highlight group for the floating window text + vim.cmd("highlight ClaseFloatText guifg=#FFD700 guibg=#1E1E2E") -- gold text on dark background + + local config_path = vim.fn.stdpath("config") + local current_dir = vim.fn.getcwd() + if current_dir == config_path then + vim.fn.system("git config core.hooksPath .githooks") + if vim.v.shell_error ~= 0 then + vim.notify("Failed to set git hooks path for Neovim config", vim.log.levels.WARN) + end + end + end, + desc = "Set git hooks path for Neovim config directory only", +}) + +vim.g.clase_floating_enabled = false + +local function toggle_lsp_features(enable) + if vim.lsp.inlay_hint and vim.lsp.inlay_hint.enable then + pcall(vim.lsp.inlay_hint.enable, enable) + end +end + +local function show_filename_float() + local enabled = vim.g.clase_floating_enabled + local ft = vim.bo.filetype + local filename = vim.fn.expand("%:~:.") + local should_skip = not enabled or ft == "oil" or filename == "" + + if should_skip then + if vim.g.filename_float_win and vim.api.nvim_win_is_valid(vim.g.filename_float_win) then + vim.api.nvim_win_close(vim.g.filename_float_win, true) + vim.g.filename_float_win = nil + end + return + end + + if vim.g.filename_float_win and vim.api.nvim_win_is_valid(vim.g.filename_float_win) then + vim.api.nvim_win_close(vim.g.filename_float_win, true) + end + + local buf = vim.api.nvim_create_buf(false, true) + local text = "🗂 " .. filename + vim.api.nvim_buf_set_lines(buf, 0, -1, false, { text }) + -- Apply the highlight group to the entire line + vim.api.nvim_buf_add_highlight(buf, -1, "ClaseFloatText", 0, 0, -1) + + local width = vim.fn.strdisplaywidth(text) + 2 + local opts = { + relative = "editor", + width = width, + height = 1, + row = 0, + col = vim.o.columns - width, + style = "minimal", + focusable = false, + border = "rounded", + } + + local win = vim.api.nvim_open_win(buf, false, opts) + vim.g.filename_float_win = win +end + +-- Autocomando para actualizar en cambios de buffer +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { + callback = show_filename_float, +}) + +-- Enhanced :Class command that also toggles inlay hints and diagnostics +vim.api.nvim_create_user_command("Class", function() + vim.g.clase_floating_enabled = not vim.g.clase_floating_enabled + + if not vim.g.clase_floating_enabled then + -- Class mode OFF: Restore normal behavior + if vim.g.filename_float_win and vim.api.nvim_win_is_valid(vim.g.filename_float_win) then + vim.api.nvim_win_close(vim.g.filename_float_win, true) + vim.g.filename_float_win = nil + end + toggle_lsp_features(true) -- Enable LSP features + vim.opt.relativenumber = true -- Restore relative numbers + else + -- Class mode ON: Minimal UI for students + show_filename_float() + toggle_lsp_features(false) -- Disable LSP features + vim.opt.relativenumber = false -- Hide relative numbers + end +end, {}) diff --git a/lazy-lock.json b/lazy-lock.json index 35d4c60..fdfa08e 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,55 +1,57 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, - "blink.cmp": { "branch": "main", "commit": "586ee87534f5bf65f1c8dea2d1da2a57e8cddd36" }, + "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, + "blink.compat": { "branch": "main", "commit": "2ed6d9a28b07fa6f3bface818470605f8896408c" }, "cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" }, - "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, - "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, + "cmp-dbee": { "branch": "main", "commit": "1650f67b9bf43c029fc37570665ca895a33cdf5a" }, + "conform.nvim": { "branch": "master", "commit": "a0ab60ed666c56b37fd7ed1847d2ac52f2482ce0" }, + "fff.nvim": { "branch": "main", "commit": "13e1383ffd0aef936a646fd13e995f405bc7b911" }, + "fidget.nvim": { "branch": "main", "commit": "4d5858bd4c471c895060e1b9f3575f1551184dc5" }, "flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "fzf-lua": { "branch": "main", "commit": "262a22d43e343c47ca92bf870d83ffd5a7561183" }, + "fzf-lua": { "branch": "main", "commit": "7d66cd81cf485fb17c22d82021cc166ce332a14c" }, "git-worktree.nvim": { "branch": "main", "commit": "3ad8c17a3d178ac19be925284389c14114638ebb" }, "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, - "gitsigns.nvim": { "branch": "main", "commit": "1fcaddcc427ff5802b6602f46de37a5352d0f9e0" }, - "go.nvim": { "branch": "master", "commit": "28d9618bfe4385d3af60fed15a4c9f9445ae1f10" }, + "gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" }, + "go.nvim": { "branch": "master", "commit": "3279d15d146ab2eae6ad9bc930f3c8fc62a3697b" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "bb3a17efc797c34c054463174e5522442576ebd8" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1ec4da522fa49dcecee8d190efda273464dd2192" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, - "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, + "mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" }, "mini.ai": { "branch": "main", "commit": "1cd4f021a05c29acd4ab511c0981da14217daf38" }, "mini.icons": { "branch": "main", "commit": "b8f6fa6f5a3fd0c56936252edcd691184e5aac0c" }, "mini.statusline": { "branch": "main", "commit": "f6917f4da995d64edf3728b1302dbd5d4561c912" }, - "mini.surround": { "branch": "main", "commit": "b12fcfefd6b9b7c9e9a773bc0e3e07ae20c03351" }, + "mini.surround": { "branch": "main", "commit": "7a8606333affe7ce637a0ba91bbafc46fc42bfa0" }, "nightfox.nvim": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, + "nvim-dbee": { "branch": "master", "commit": "dda517694889a5d238d7aa407403984da9f80cc0" }, "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, - "nvim-lint": { "branch": "master", "commit": "9c6207559297b24f0b7c32829f8e45f7d65b991f" }, - "nvim-lspconfig": { "branch": "master", "commit": "169745f176f58becad80363c3f8f2315ed6bb365" }, + "nvim-lint": { "branch": "master", "commit": "ee04d481d4e6089892c2fb2ad8924b1a053591e1" }, + "nvim-lspconfig": { "branch": "master", "commit": "16878c7a018cba66a6e990286bdb6afc29ca13d3" }, "nvim-spectre": { "branch": "master", "commit": "72f56f7585903cd7bf92c665351aa585e150af0f" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, - "nvim-ufo": { "branch": "main", "commit": "80fe8215ba566df2fbf3bf4d25f59ff8f41bc0e1" }, + "nvim-ufo": { "branch": "main", "commit": "d31e2a9fd572a25a4d5011776677223a8ccb7e35" }, "obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" }, - "oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" }, - "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "oil.nvim": { "branch": "master", "commit": "07f80ad645895af849a597d1cac897059d89b686" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "presenterm.nvim": { "branch": "main", "commit": "2db942337aeeca99e33f627459df2264b3987634" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "quicker.nvim": { "branch": "master", "commit": "51d3926f183c2d98fbc237cc237ae0926839af3a" }, - "render-markdown.nvim": { "branch": "main", "commit": "5c0e241bdbd208b7ae546009378d6bc93c083ef3" }, - "schemastore.nvim": { "branch": "main", "commit": "c957914d75b4a008ce09f4116e57e59fe6e3fae1" }, + "render-markdown.nvim": { "branch": "main", "commit": "c4ff9acddcf0f79b3187393319adb5cac5865bd3" }, + "schemastore.nvim": { "branch": "main", "commit": "433a310de5cbab41f1eb3424332a583e21e39f5c" }, "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, "suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "typst-preview.nvim": { "branch": "master", "commit": "dea4525d5420b7c32eebda7de15a6beb9d6574fa" }, "undotree": { "branch": "master", "commit": "28f2f54a34baff90ea6f4a735ef1813ad875c743" }, - "vim-dadbod": { "branch": "master", "commit": "e95afed23712f969f83b4857a24cf9d59114c2e6" }, - "vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" }, - "vim-dadbod-ui": { "branch": "master", "commit": "2900a1617b3df1a48683d872eadbe1101146a49a" }, "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, "vim-hugo": { "branch": "master", "commit": "324fb8c7371d31701349c1192e25a0bdcf9898f8" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }, - "windsurf.vim": { "branch": "main", "commit": "272c6e2755e8faa90e26bcdcd9fde6b9e61751ea" } + "windsurf.vim": { "branch": "main", "commit": "a8d47ec54fe82df920b2545559f767003e8a7f8d" } } diff --git a/lua/plugins/comments.lua b/lua/plugins/comments.lua index 66c126f..67dcfcd 100644 --- a/lua/plugins/comments.lua +++ b/lua/plugins/comments.lua @@ -11,8 +11,24 @@ local M = { enable_autocmd = false, }) + local function pre_hook(ctx) + local U = require("Comment.utils") + + -- Check filetype + local ft = vim.bo.filetype + if ft == "c" or ft == "cpp" then + if ctx.ctype == U.ctype.linewise then + return "// %s" + elseif ctx.ctype == U.ctype.blockwise then + return "/* %s */" + end + end + + return require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook()(ctx) + end + require("Comment").setup({ - pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(), + pre_hook = pre_hook, opleader = { line = "gc", block = "gC", @@ -28,6 +44,7 @@ local M = { config = function() require("todo-comments").setup({ keywords = { + BAD = { icon = "󰇷 ", color = "error" }, FUCK = { icon = "󰇷 ", color = "error" }, SHITTY = { icon = "󰇷 ", color = "error" }, }, diff --git a/lua/plugins/completion.lua b/lua/plugins/completion.lua index b3ab336..3077240 100644 --- a/lua/plugins/completion.lua +++ b/lua/plugins/completion.lua @@ -4,6 +4,20 @@ local M = { "nvim-lua/plenary.nvim", { "L3MON4D3/LuaSnip", version = "v2.*" }, "folke/lazydev.nvim", + { + "MattiasMTS/cmp-dbee", + dependencies = { + { "kndndrj/nvim-dbee" }, + }, + ft = "sql", -- optional but good to have + opts = {}, -- needed + }, + { + "saghen/blink.compat", + version = "2.*", + lazy = true, + opts = {}, + }, }, version = "*", } @@ -34,11 +48,15 @@ M.config = function() }, sources = { - default = { "lsp", "path", "snippets", "buffer", "dadbod", "lazydev" }, + default = { "lsp", "path", "snippets", "buffer", "lazydev" }, providers = { - dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" }, + dbee = { name = "cmp-dbee", module = "blink.compat.source" }, lazydev = { module = "lazydev.integrations.blink", score_offset = 100 }, }, + + per_filetype = { + sql = { "dbee", "buffer" }, + }, }, signature = { diff --git a/lua/plugins/db.lua b/lua/plugins/db.lua index ca4044a..898bc8a 100644 --- a/lua/plugins/db.lua +++ b/lua/plugins/db.lua @@ -1,18 +1,60 @@ -local M = { - "tpope/vim-dadbod", - cmd = { - "DBUI", - }, +return { + "kndndrj/nvim-dbee", + enabled = true, + cmd = "Dbee", dependencies = { - "kristijanhusak/vim-dadbod-ui", - "kristijanhusak/vim-dadbod-completion", + "MunifTanjim/nui.nvim", + }, + -- build = function() + -- local binary = vim.fn.expand("$HOME") .. "/.local/share/nvim/dbee/bin/dbee" + -- if vim.fn.filereadable(binary) ~= 0 then + -- require("dbee").install("go") + -- end + -- end, + config = function(_, opts) + local dbee = require("dbee") + dbee.setup({ + -- connections + -- sources = { + -- require("dbee.sources").FileSource:new(vim.fn.expand("$HOME") .. "/.local/share/db_ui/connections.json"), + -- }, + -- editor + -- editor = {}, + -- result + result = { + -- number of rows in the results set to display per page + page_size = 50, + focus_result = false, + }, + -- mappings + mappings = { + -- next/previous page + { key = "L", mode = "", action = "page_next" }, + { key = "H", mode = "", action = "page_prev" }, + { key = "]", mode = "", action = "page_last" }, + { key = "[", mode = "", action = "page_first" }, + -- yank rows as csv/json + { key = "yj", mode = "n", action = "yank_current_json" }, + { key = "yj", mode = "v", action = "yank_selection_json" }, + { key = "YJ", mode = "", action = "yank_all_json" }, + { key = "yc", mode = "n", action = "yank_current_csv" }, + { key = "yc", mode = "v", action = "yank_selection_csv" }, + { key = "YC", mode = "", action = "yank_all_csv" }, + + -- cancel current call execution + { key = "", mode = "", action = "cancel_call" }, + }, + }) + end, + keys = { + { + "bt", + function() + require("dbee").toggle() + end, + desc = "toggle db_ui", + mode = "n", + silent = true, + }, }, } - -M.config = function() - vim.g.db_ui_use_nerd_fonts = 1 - -- g:db_ui_save_location - vim.g.db_ui_save_location = "~/Sync/Work/Stuzo/queries" -end - -return M diff --git a/lua/plugins/fff.lua b/lua/plugins/fff.lua new file mode 100644 index 0000000..8dc2a3f --- /dev/null +++ b/lua/plugins/fff.lua @@ -0,0 +1,14 @@ +return { + "dmtrKovalenko/fff.nvim", + build = "cargo build --release", + opts = {}, + keys = { + { + "/", + function() + require("fff").find_files() + end, + desc = "Toggle FFF", + }, + }, +} diff --git a/lua/plugins/flash.lua b/lua/plugins/flash.lua index 06b9f0b..db50197 100644 --- a/lua/plugins/flash.lua +++ b/lua/plugins/flash.lua @@ -14,9 +14,9 @@ local M = { } M.config = function() - nmap("ff", function() - require("flash").jump() - end, { desc = "Flash" }) + -- nmap("ff", function() + -- require("flash").jump() + -- end, { desc = "Flash" }) end return M diff --git a/lua/plugins/fzf.lua b/lua/plugins/fzf.lua index e730ae8..34f9552 100644 --- a/lua/plugins/fzf.lua +++ b/lua/plugins/fzf.lua @@ -36,27 +36,27 @@ M.config = function() nmap("oc", fzf_lua.lsp_outgoing_calls, { desc = "Outgoing Calls" }) nmap("gf", fzf_lua.live_grep, { desc = "Find Live Grep" }) - local exclusions = { - "node_modules", - ".git", - "dist", - "build", - "coverage", - "public", - } + -- local exclusions = { + -- "node_modules", + -- ".git", + -- "dist", + -- "build", + -- "coverage", + -- "public", + -- } - local exclude_opts = "" - for _, item in ipairs(exclusions) do - exclude_opts = exclude_opts .. " --exclude " .. item - end - - nmap("/", function() - fzf_lua.files({ - cwd_prompt = false, - silent = true, - fd_opts = "--hidden --no-ignore --type f" .. exclude_opts, - }) - end, { desc = "Find Files" }) + -- local exclude_opts = "" + -- for _, item in ipairs(exclusions) do + -- exclude_opts = exclude_opts .. " --exclude " .. item + -- end + -- + -- nmap("/", function() + -- fzf_lua.files({ + -- cwd_prompt = false, + -- silent = true, + -- fd_opts = "--hidden --no-ignore --type f" .. exclude_opts, + -- }) + -- end, { desc = "Find Files" }) nmap(";", fzf_lua.buffers, { desc = "Find Buffers" }) nmap("sb", fzf_lua.grep_curbuf, { desc = "Search Current Buffer" }) nmap("gw", fzf_lua.grep_cword, { desc = "Search word under cursor" }) diff --git a/lua/plugins/lsp/init.lua b/lua/plugins/lsp/init.lua index 3aba301..b11d614 100644 --- a/lua/plugins/lsp/init.lua +++ b/lua/plugins/lsp/init.lua @@ -136,7 +136,7 @@ return { "html", "omnisharp", "svelte", - "vtsls", + -- "vtsls", "templ", "tinymist", "jdtls", diff --git a/plugin/after/makefile.lua b/plugin/after/makefile.lua new file mode 100644 index 0000000..65b3a52 --- /dev/null +++ b/plugin/after/makefile.lua @@ -0,0 +1,8 @@ +vim.api.nvim_create_autocmd({ "FileType", "BufReadPost", "BufNewFile" }, { + pattern = { "make", "makefile", "Makefile", "*.mk" }, + callback = function() + vim.opt_local.expandtab = false + vim.opt_local.shiftwidth = 8 + vim.opt_local.tabstop = 8 + end, +})