diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml index dd54af7..01500a1 100644 --- a/.config/alacritty/alacritty.toml +++ b/.config/alacritty/alacritty.toml @@ -1,5 +1,5 @@ [general] -import = ["~/.config/alacritty/onedarkpro_onedark.toml"] +import = ["~/.config/alacritty/kanagawa.toml"] [window] opacity = 1 diff --git a/.config/alacritty/kanagawa_wave.toml b/.config/alacritty/kanagawa_wave.toml new file mode 100644 index 0000000..7cd0bad --- /dev/null +++ b/.config/alacritty/kanagawa_wave.toml @@ -0,0 +1,37 @@ +# Kanagawa Wave Alacritty Colors + +[colors.primary] +background = '#1f1f28' +foreground = '#dcd7ba' + +[colors.normal] +black = '#090618' +red = '#c34043' +green = '#76946a' +yellow = '#c0a36e' +blue = '#7e9cd8' +magenta = '#957fb8' +cyan = '#6a9589' +white = '#c8c093' + +[colors.bright] +black = '#727169' +red = '#e82424' +green = '#98bb6c' +yellow = '#e6c384' +blue = '#7fb4ca' +magenta = '#938aa9' +cyan = '#7aa89f' +white = '#dcd7ba' + +[colors.selection] +background = '#2d4f67' +foreground = '#c8c093' + +[[colors.indexed_colors]] +index = 16 +color = '#ffa066' + +[[colors.indexed_colors]] +index = 17 +color = '#ff5d62' diff --git a/.config/nvim/.stylelua.toml b/.config/nvim/.stylelua.toml deleted file mode 100644 index 0aa4d33..0000000 --- a/.config/nvim/.stylelua.toml +++ /dev/null @@ -1,7 +0,0 @@ -column_width = 160 -line_endings = "Unix" -indent_type = "Spaces" -indent_width = 2 -quote_style = "ForceDouble" -no_call_parentheses = false -collapse_simple_statement = "Always" diff --git a/.config/nvim/after/queries/blade/highlights.scm b/.config/nvim/after/queries/blade/highlights.scm deleted file mode 100644 index 29bec30..0000000 --- a/.config/nvim/after/queries/blade/highlights.scm +++ /dev/null @@ -1,9 +0,0 @@ -(directive) @function -(directive_start) @function -(directive_end) @function -(comment) @comment -((parameter) @include (#set! "priority" 110)) -((php_only) @include (#set! "priority" 110)) -((bracket_start) @function (#set! "priority" 120)) -((bracket_end) @function (#set! "priority" 120)) -(keyword) @function diff --git a/.config/nvim/after/queries/blade/injections.scm b/.config/nvim/after/queries/blade/injections.scm deleted file mode 100644 index 8f7af78..0000000 --- a/.config/nvim/after/queries/blade/injections.scm +++ /dev/null @@ -1,4 +0,0 @@ -((text) @injection.content - (#not-has-ancestor? @injection.content "envoy") - (#set! injection.combined) - (#set! injection.language php)) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index b5847f7..10ed654 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,2 +1,6 @@ -require('core') -require('lazy-plugin-manager') +require('core.options') +require('core.remaps') +require('core.autocmd') +require('core.commands') + +require('plugins') diff --git a/.config/nvim/lua/core/autocmd.lua b/.config/nvim/lua/core/autocmd.lua index 05d51bf..99113b2 100644 --- a/.config/nvim/lua/core/autocmd.lua +++ b/.config/nvim/lua/core/autocmd.lua @@ -1,9 +1,7 @@ -vim.api.nvim_set_hl(0, "YankColor", { fg = "#C8C093", bg = "#000000", ctermfg = 59, ctermbg = 41 }) - -- Use double backslashes vim.api.nvim_set_hl(0, 'InvisibleChar', { bg = '#ff0000', fg = '#ffffff' }) -vim.api.nvim_create_autocmd({'BufEnter', 'BufWritePost', 'TextChanged', 'InsertLeave'}, { +vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'TextChanged', 'InsertLeave' }, { group = vim.api.nvim_create_augroup('InvisibleChars', { clear = true }), callback = function() vim.fn.clearmatches() @@ -11,117 +9,70 @@ vim.api.nvim_create_autocmd({'BufEnter', 'BufWritePost', 'TextChanged', 'InsertL end }) -local aucmd_dict = { - VimEnter = { - { - callback = function() - local function find_project_root() - local current_dir = vim.fn.getcwd() - - while current_dir ~= "/" do - if vim.fn.isdirectory(current_dir .. "/.git") == 1 or vim.fn.filereadable(current_dir .. "/.nvim.lua") then - return current_dir - end - current_dir = vim.fn.fnamemodify(current_dir, ":h") - end - - return vim.fn.getcwd() - end - - local project_root = find_project_root() - local project_specific_conf_file = project_root .. "/.nvim.lua" - - if vim.fn.filereadable(project_specific_conf_file) == 1 then - vim.cmd("source " .. project_specific_conf_file) - print("Sourced project specific config file: " .. project_specific_conf_file) - end - end - } - }, - - FileType = { - { - -- Set tabstop to 2 for Dart, Vue, JavaScript, TypeScript, and JSON files - pattern = "html,dart,vue,javascript,typescript,typescriptreact,json,markdown,css,sass", - callback = function() - vim.opt_local.tabstop = 2 - vim.opt_local.softtabstop = 2 - vim.opt_local.shiftwidth = 2 - end, - }, - { - pattern = 'dart', - callback = function() - vim.bo.commentstring = '// %s' - end - }, - }, - - BufWritePre = { - { - -- Remove trailing whitespace on save - command = [[%s/\s\+$//e]], - }, - }, +vim.api.nvim_create_autocmd({ 'FileType' }, { + group = vim.api.nvim_create_augroup('TabWidth', { clear = true }), + pattern = "html,dart,vue,javascript,typescript,typescriptreact,json,markdown,css,sass", + callback = function() + vim.opt_local.tabstop = 2 + vim.opt_local.softtabstop = 2 + vim.opt_local.shiftwidth = 2 + end, +}) - BufRead = { - { - -- Set syntax for Dockerfiles - pattern = { '*.docker' }, - callback = function() - vim.opt_local.syntax = 'dockerfile' - end - }, - }, +vim.api.nvim_create_autocmd({ 'FileType' }, { + group = vim.api.nvim_create_augroup('DartCommentString', { clear = true }), + pattern = 'dart', + callback = function() + vim.bo.commentstring = '// %s' + end +}) - BufReadPost = { - { - callback = function(event) - local exclude = { 'gitcommit', 'commit', 'gitrebase' } - local buf = event.buf - if - vim.tbl_contains(exclude, vim.bo[buf].filetype) - or vim.b[buf].lazyvim_last_loc - then - return - end - vim.b[buf].lazyvim_last_loc = true - local mark = vim.api.nvim_buf_get_mark(buf, '"') - local lcount = vim.api.nvim_buf_line_count(buf) - if mark[1] > 0 and mark[1] <= lcount then - pcall(vim.api.nvim_win_set_cursor, 0, mark) - end - end, - }, - }, +vim.api.nvim_create_autocmd({ 'FileType' }, { + group = vim.api.nvim_create_augroup('PhpIndent', { clear = true }), + pattern = 'php', + callback = function() + vim.opt_local.smartindent = false + vim.opt_local.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + end +}) - BufNewFile = { - { - -- Set syntax for Dockerfiles - pattern = { '*.docker' }, - callback = function() - vim.opt_local.syntax = 'dockerfile' - end - }, - }, +vim.api.nvim_create_autocmd({ 'BufWritePre' }, { + group = vim.api.nvim_create_augroup('RemoveTrailingWhitespace', { clear = true }), + command = [[%s/\s\+$//e]], +}) - TextYankPost = { - { - callback = function() - vim.hl.on_yank { higroup = "YankColor", timeout = 250 } - end - }, - }, +vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { + group = vim.api.nvim_create_augroup('DockerExtensionFiletype', { clear = true }), + pattern = { '*.docker' }, + callback = function() + vim.opt_local.syntax = 'dockerfile' + end +}) - VimResized = { - { - command="wincmd =" - }, - }, -} +vim.api.nvim_create_autocmd({ 'BufReadPost' }, { + group = vim.api.nvim_create_augroup('LastCursorPosition', { clear = true }), + callback = function(event) + local exclude = { 'gitcommit', 'commit', 'gitrebase' } + local buf = event.buf + if + vim.tbl_contains(exclude, vim.bo[buf].filetype) + or vim.b[buf].last_loc + then + return + end + vim.b[buf].last_loc = true + local mark = vim.api.nvim_buf_get_mark(buf, '"') + local lcount = vim.api.nvim_buf_line_count(buf) + if mark[1] > 0 and mark[1] <= lcount then + pcall(vim.api.nvim_win_set_cursor, 0, mark) + end + end, +}) -for event, opt_tbls in pairs(aucmd_dict) do - for _, opt_tbl in pairs(opt_tbls) do - vim.api.nvim_create_autocmd(event, opt_tbl) +vim.api.nvim_create_autocmd({ 'TextYankPost' }, { + group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }), + callback = function() + vim.hl.on_yank { higroup = "YankColor", timeout = 250 } end -end +}) + diff --git a/.config/nvim/lua/core/commands.lua b/.config/nvim/lua/core/commands.lua index 345481e..06530aa 100644 --- a/.config/nvim/lua/core/commands.lua +++ b/.config/nvim/lua/core/commands.lua @@ -1,35 +1,50 @@ -local function ToggleTabs() - local options = { "tabstop", "softtabstop", "shiftwidth" } - - for _, option in ipairs(options) do - local current_value = vim.opt[option]:get() - vim.opt[option] = (current_value == 4) and 2 or 4 - end -end - -vim.api.nvim_create_user_command("ToggleTabs", ToggleTabs, { nargs = 0 }) - -vim.api.nvim_create_user_command("ToggleDiagnostics", function() - if vim.g.diagnostics_enable == nil or vim.g.diagnostics_enable then - vim.g.diagnostics_enable = false - vim.diagnostic.enable(false) - return - end - - vim.g.diagnostics_enable = true - vim.diagnostic.enable(true) -end, {}) - -vim.api.nvim_create_user_command("ClearBuffers", function() - vim.cmd('%bd|e#|bd#') -end, {}) - -vim.api.nvim_create_user_command("CopyFilename", function() - vim.cmd('let @+ = expand("%")') -end, {}) - -vim.api.nvim_create_user_command("SnakeToCamel", function() - vim.cmd([[%s#\%($\%(\k\+\)\)\@<=_\(\k\)#\u\1#g]]) -end, {}) - - +vim.api.nvim_create_user_command( + "ToggleTabs", + function() + local options = { "tabstop", "softtabstop", "shiftwidth" } + + for _, option in ipairs(options) do + local current_value = vim.opt[option]:get() + vim.opt[option] = (current_value == 4) and 2 or 4 + end + end, + { nargs = 0 } +) + +vim.api.nvim_create_user_command( + "ToggleDiagnostics", + function() + if vim.g.diagnostics_enable == nil or vim.g.diagnostics_enable then + vim.g.diagnostics_enable = false + vim.diagnostic.enable(false) + return + end + + vim.g.diagnostics_enable = true + vim.diagnostic.enable(true) + end, +{}) + +vim.api.nvim_create_user_command( + "ClearBuffers", + function() + vim.cmd('%bd|e#|bd#') + end, + {} +) + +vim.api.nvim_create_user_command( + "CopyFilename", + function() + vim.cmd('let @+ = expand("%")') + end, + {} +) + +vim.api.nvim_create_user_command( + "SnakeToCamel", + function() + vim.cmd([[%s#\%($\%(\k\+\)\)\@<=_\(\k\)#\u\1#g]]) + end, + {} +) diff --git a/.config/nvim/lua/core/init.lua b/.config/nvim/lua/core/init.lua deleted file mode 100644 index 83da743..0000000 --- a/.config/nvim/lua/core/init.lua +++ /dev/null @@ -1,4 +0,0 @@ -require('core.options') -require('core.remaps') -require('core.autocmd') -require('core.commands') diff --git a/.config/nvim/lua/core/options.lua b/.config/nvim/lua/core/options.lua index bbbb800..7a950eb 100644 --- a/.config/nvim/lua/core/options.lua +++ b/.config/nvim/lua/core/options.lua @@ -1,28 +1,33 @@ -vim.g.mapleader = ' ' +-- Set Leader Key +vim.g.mapleader = " " -vim.opt.clipboard = 'unnamedplus' +-- Use system clipboard +vim.opt.clipboard = "unnamedplus" + +-- Set rounded border +vim.opt.winborder = "rounded" -- Search Configuration -vim.opt.hlsearch = false -- Don't highlight search results after searching +vim.opt.hlsearch = false -- Don"t highlight search results after searching vim.opt.incsearch = true -- Show search matches as you type vim.opt.ignorecase = true -- Ignore case when searching vim.opt.smartcase = true -- Override ignorecase if search contains uppercase letters -- Mouse Configuration -vim.opt.mouse = 'nv' -- Enable mouse in normal and visual modes only +vim.opt.mouse = "nv" -- Enable mouse in normal and visual modes only -- Text Formatting vim.opt.linebreak = true -- Break lines at word boundaries when wrapping vim.opt.smartindent = true -- Automatically indent new lines intelligently -- File Management -vim.opt.swapfile = false -- Don't create swap files -vim.opt.backup = false -- Don't create backup files -vim.opt.undodir = vim.fn.expand('~/.cache/nvim/undodir') -- Directory for undo files +vim.opt.swapfile = false -- Don"t create swap files +vim.opt.backup = false -- Don"t create backup files +vim.opt.undodir = vim.fn.expand("~/.cache/nvim/undodir") -- Directory for undo files vim.opt.undofile = true -- Save undo history to file for persistence -- Character Encoding -vim.opt.encoding = 'utf-8' -- Set file encoding to UTF-8 +vim.opt.encoding = "utf-8" -- Set file encoding to UTF-8 -- Line Numbers vim.opt.number = true -- Show absolute line numbers @@ -37,13 +42,14 @@ vim.opt.smarttab = true -- Use shiftwidth for tabs at beginning of line -- Scrolling and Display vim.opt.scrolloff = 8 -- Keep 8 lines visible above/below cursor when scrolling -vim.opt.signcolumn = 'yes' -- Always show the sign column (for git, lsp, etc.) +vim.opt.signcolumn = "yes" -- Always show the sign column (for git, lsp, etc.) -- File Name Handling -vim.opt.isfname:append('@-@') -- Include @ and - characters in file names +vim.opt.isfname:append("@-@") -- Include @ and - characters in file names -- Completion Menu vim.opt.pumheight = 10 -- Limit popup menu height to 10 items +vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } -- Performance vim.opt.updatetime = 50 -- Faster completion and CursorHold events (milliseconds) @@ -53,14 +59,14 @@ vim.opt.colorcolumn = "80" -- Show vertical line at column 80 vim.opt.cursorline = false -- Highlight the current line -- Text Formatting Options -vim.opt.formatoptions = 'tqj' -- t: auto-wrap text, q: format comments, j: remove comment leader when joining lines +vim.opt.formatoptions = "tqj" -- t: auto-wrap text, q: format comments, j: remove comment leader when joining lines -- Window Splitting vim.opt.splitbelow = true -- Open horizontal splits below current window vim.opt.splitright = true -- Open vertical splits to the right of current window -- Diff Mode -vim.opt.diffopt:append('vertical') -- Show diffs in vertical splits +vim.opt.diffopt:append("vertical") -- Show diffs in vertical splits -- Colors vim.opt.termguicolors = true -- Enable 24-bit RGB colors in terminal diff --git a/.config/nvim/lua/core/remaps.lua b/.config/nvim/lua/core/remaps.lua index a106857..6b45734 100644 --- a/.config/nvim/lua/core/remaps.lua +++ b/.config/nvim/lua/core/remaps.lua @@ -1,4 +1,7 @@ + +-- Remap jk to escape vim.keymap.set("i", "jk", "", {}) + -- Don't copy "c" changes to primary register vim.keymap.set("n", "c", '"_c', { desc = "Prevent copying to primary register" }) @@ -58,23 +61,64 @@ vim.keymap.set("t", "", "", { silent = true }) vim.keymap.set("n", "e", function() vim.cmd("edit notes.ignore.md") end) vim.keymap.set("n", ".a", function() vim.cmd("edit app/api/.env") end) vim.keymap.set("n", ".f", function() vim.cmd("edit app/frontend/.env.development.local") end) +vim.keymap.set("i", "jk", "", {}) + +-- Don't copy "c" changes to primary register +vim.keymap.set("n", "c", '"_c', { desc = "Prevent copying to primary register" }) + +-- Move lines up and down +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +-- Easily open splits +vim.keymap.set("n", "bs", "split", { desc = "Open horizontal spilt" }) +vim.keymap.set("n", "vs", "vsplit", { desc = "Open vertical spilt" }) + +-- Spell-check +vim.keymap.set("n", "o", function() + vim.cmd("setlocal spell! spelllang=en_au") +end, { desc = "Toggle spell check" }) + +-- Map Q to run q macro +vim.keymap.set("n", "Q", "@q", { desc = "Remap Q to run @q macro" }) +vim.keymap.set("x", "Q", ":norm @q", { desc = "Remap Q to run @q macro" }) + +-- Keep highlight when indenting +vim.keymap.set("v", "<", "", ">gv", { desc = "Keep highlight when indenting" }) + +vim.keymap.set("n", "tN", "tabnew", { desc = "New tab" }) +vim.keymap.set("n", "tn", "tabnext", { desc = "Next tab" }) +vim.keymap.set("n", "tp", "tabprevious", { desc = "Previous tab" }) --- Delete a buffer, without closing the window, see https://stackoverflow.com/q/4465095/6064933 -vim.keymap.set("n", [[\d]], "bprevious bdelete #", { - silent = true, - desc = "delete current buffer", -}) - -vim.keymap.set("n", [[\D]], function() - local buf_ids = vim.api.nvim_list_bufs() - local cur_buf = vim.api.nvim_win_get_buf(0) - - for _, buf_id in pairs(buf_ids) do - -- do not Delete unlisted buffers, which may lead to unexpected errors - if vim.api.nvim_get_option_value("buflisted", { buf = buf_id }) and buf_id ~= cur_buf then - vim.api.nvim_buf_delete(buf_id, { force = true }) - end - end -end, { - desc = "delete other buffers", -}) +vim.keymap.set("x", "p", '"_dP', { desc = "Delete into black hole register" }) +vim.keymap.set("n", "d", '"_d', { desc = "Delete into black hole register" }) +vim.keymap.set("v", "d", '"_d', { desc = "Delete into black hole register" }) + +-- Keep page scroll centered +vim.keymap.set("n", "", "zz", { desc = "Scroll down half page" }) +vim.keymap.set("n", "", "zz", { desc = "Scroll up half page" }) + +-- Keep cursor centered when jumping through quickfix list +vim.keymap.set("n", "N", "cprevzz", { desc = "Previous item in quickfix list" }) +vim.keymap.set("n", "n", "cnextzz", { desc = "Next item in quickfix list" }) + +-- Resize window +vim.keymap.set("n", "", "5<") +vim.keymap.set("n", "", "5>") +vim.keymap.set("n", "", "5+") +vim.keymap.set("n", "", "5-") + +-- Easily run global search and replace +vim.keymap.set( + "n", + "rr", + [[:%s/\<\>//gI]], + { desc = "Search and replace for word under cursor" } +) + +vim.keymap.set("t", "", "", { silent = true }) + +vim.keymap.set("n", "e", function() vim.cmd("edit notes.ignore.md") end) +vim.keymap.set("n", ".a", function() vim.cmd("edit app/api/.env") end) +vim.keymap.set("n", ".f", function() vim.cmd("edit app/frontend/.env.development.local") end) diff --git a/.config/nvim/lua/lazy-plugin-manager.lua b/.config/nvim/lua/lazy-plugin-manager.lua deleted file mode 100644 index aebdc74..0000000 --- a/.config/nvim/lua/lazy-plugin-manager.lua +++ /dev/null @@ -1,25 +0,0 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) - -require("lazy").setup({ - { import = "plugins" }, -}, { - checker = { - enabled = true, - notify = false, - }, - change_detection = { - notify = false, - }, - colorscheme = "cyberdream", -}) diff --git a/.config/nvim/lua/lsp/servers/gopls.lua b/.config/nvim/lua/lsp/servers/gopls.lua index 017e5f8..b87048e 100644 --- a/.config/nvim/lua/lsp/servers/gopls.lua +++ b/.config/nvim/lua/lsp/servers/gopls.lua @@ -1,5 +1,3 @@ -local util = require("lspconfig.util") - return { cmd = { "gopls" }, filetypes = { "go", "gomod", "gowork", "gotmpl" }, diff --git a/.config/nvim/lua/lsp/servers/intelephense.lua b/.config/nvim/lua/lsp/servers/intelephense.lua index 7456f6c..071f5b3 100644 --- a/.config/nvim/lua/lsp/servers/intelephense.lua +++ b/.config/nvim/lua/lsp/servers/intelephense.lua @@ -1,9 +1,6 @@ -local util = require("lspconfig.util") -local utils = require("lsp.utils") - -- Only setup if license file exists local license_path = vim.fn.expand("$HOME/.local/share/nvim/intelephense-licence.txt") -if not utils.file_exists(license_path) then +if vim.fn.filereadable(license_path) ~= 1 then vim.notify("Intelephense license not found at: " .. license_path, vim.log.levels.WARN) end diff --git a/.config/nvim/lua/lsp/servers/tsserver.lua b/.config/nvim/lua/lsp/servers/tsserver.lua index 16d4ad7..45fc103 100644 --- a/.config/nvim/lua/lsp/servers/tsserver.lua +++ b/.config/nvim/lua/lsp/servers/tsserver.lua @@ -1,8 +1,24 @@ local util = require("lspconfig.util") -local utils = require("lsp.utils") + +local function find_node_modules_path() + local paths = { + "/usr/lib/node_modules", + "/usr/local/lib/node_modules", + "/opt/homebrew/lib/node_modules" + } + + for _, path in ipairs(paths) do + if vim.loop.fs_stat(path) then + return path + end + end + + return nil +end + -- Determine base path for node_modules -local base_path = utils.find_node_modules_path() +local base_path = find_node_modules_path() if not base_path then vim.notify("No global node_modules found for TypeScript server", vim.log.levels.WARN) diff --git a/.config/nvim/lua/lsp/utils.lua b/.config/nvim/lua/lsp/utils.lua deleted file mode 100644 index d55d7dd..0000000 --- a/.config/nvim/lua/lsp/utils.lua +++ /dev/null @@ -1,78 +0,0 @@ -local M = {} - --- Find global node_modules path -function M.find_node_modules_path() - local paths = { - "/usr/lib/node_modules", - "/usr/local/lib/node_modules", - "/opt/homebrew/lib/node_modules" - } - - for _, path in ipairs(paths) do - if vim.loop.fs_stat(path) then - return path - end - end - - return nil -end - --- Check if a file exists -function M.file_exists(path) - return vim.fn.filereadable(path) == 1 -end - --- Check if a directory exists -function M.dir_exists(path) - return vim.fn.isdirectory(path) == 1 -end - --- Get project root directory -function M.get_project_root() - return vim.loop.cwd() -end - --- Setup common LSP keymaps (you can move the keymap logic here if desired) -function M.setup_lsp_keymaps(bufnr) - local keymap = vim.keymap - local function map(mode, lhs, rhs, desc) - keymap.set(mode, lhs, rhs, { - buffer = bufnr, - noremap = true, - silent = true, - desc = desc - }) - end - - -- Navigation (using Snacks.nvim picker) - map("n", "gr", function() Snacks.picker.lsp_references() end, "Show LSP references") - map("n", "gD", vim.lsp.buf.declaration, "Go to declaration") - map("n", "gd", function() Snacks.picker.lsp_definitions() end, "Show LSP definitions") - map("n", "gi", function() Snacks.picker.lsp_implementations() end, "Show LSP implementations") - map("n", "gt", function() Snacks.picker.lsp_type_definitions() end, "Show LSP type definitions") - - -- Actions - map({ "n", "v" }, "ca", vim.lsp.buf.code_action, "See available code actions") - map("n", "rn", vim.lsp.buf.rename, "Smart rename") - - -- Diagnostics - map("n", "D", function() Snacks.picker.diagnostics({ buf = 0 }) end, "Show buffer diagnostics") - map("n", "d", vim.diagnostic.open_float, "Show line diagnostics") - map("n", "[d", function() - vim.diagnostic.jump({ count = -1 }) - end, "Go to previous diagnostic") - map("n", "]d", function() - vim.diagnostic.jump({ count = 1 }) - end, "Go to next diagnostic") - map("n", "[e", function() - vim.diagnostic.jump({ count = -1, severity = vim.diagnostic.severity.ERROR }) - end, "Go to previous diagnostic (error only)") - map("n", "]e", function() - vim.diagnostic.jump({ count = 1, severity = vim.diagnostic.severity.ERROR }) - end, "Go to next diagnostic (error only)") - - -- Documentation - map("n", "K", vim.lsp.buf.hover, "Show documentation for what is under cursor") -end - -return M diff --git a/.config/nvim/lua/plugins/blink.lua b/.config/nvim/lua/plugins/blink.lua deleted file mode 100644 index 8dbe780..0000000 --- a/.config/nvim/lua/plugins/blink.lua +++ /dev/null @@ -1,163 +0,0 @@ -return { - 'saghen/blink.cmp', - event = { "InsertEnter", "CmdlineEnter" }, - dependencies = { - { 'rafamadriz/friendly-snippets' }, - { 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, - { 'saghen/blink.compat', version = '2.*', lazy = true, opts = {} }, - }, - - version = '1.*', - opts = { - completion = { - accept = { - auto_brackets = { - enabled = true, - }, - }, - menu = { - auto_show = true, - winblend = vim.o.pumblend, - scrollbar = true, - border = 'single', - draw = { - columns = { - { "label", "label_description", gap = 1 }, - { "kind_icon", "kind", gap = 1 } - }, - components = { - kind_icon = { - ellipsis = false, - text = function(ctx) - return ctx.kind_icon .. ctx.icon_gap - end, - highlight = function(ctx) - return 'BlinkCmpKind' .. ctx.kind - end, - } - }, - treesitter = { "lsp" } - } - }, - - documentation = { - auto_show = true, - auto_show_delay_ms = 200, - update_delay_ms = 50, - window = { - border = 'single', - winblend = vim.o.pumblend, - max_width = 80, - max_height = 20, - } - }, - - ghost_text = { - enabled = vim.g.ai_cmp or false, - }, - }, - - appearance = { - use_nvim_cmp_as_default = true, - nerd_font_variant = 'mono' - }, - - sources = { - default = { - 'lsp', - 'path', - 'snippets', - 'buffer', - 'dadbod', - 'laravel', - }, - - providers = { - dadbod = { - name = "Dadbod", - module = "vim_dadbod_completion.blink", - score_offset = 85, - }, - laravel = { - name = "laravel", - module = "blink.compat.source", - score_offset = 80, - }, - lsp = { - name = "LSP", - module = "blink.cmp.sources.lsp", - score_offset = 90, - }, - path = { - name = "Path", - module = "blink.cmp.sources.path", - score_offset = 3, - opts = { - trailing_slash = false, - label_trailing_slash = true, - get_cwd = function(context) return vim.fn.getcwd() end, - show_hidden_files_by_default = true, - } - }, - snippets = { - name = "Snippets", - module = "blink.cmp.sources.snippets", - score_offset = 85, - opts = { - friendly_snippets = true, - search_paths = { vim.fn.stdpath("config") .. "/snippets" }, - global_snippets = { "all" }, - extended_filetypes = {}, - ignored_filetypes = {}, - } - }, - buffer = { - name = "Buffer", - module = "blink.cmp.sources.buffer", - opts = { - max_items = 5, - keyword_length = 2, - } - }, - cmdline = { - name = "Cmdline", - module = "blink.cmp.sources.cmdline", - }, - }, - }, - - cmdline = { - sources = function() - local type = vim.fn.getcmdtype() - if type == "/" or type == "?" then - return { 'buffer' } - end - if type == ":" then - return { 'cmdline' } - end - return {} - end, - }, - - signature = { - enabled = true, - window = { - border = 'single', - winblend = vim.o.pumblend, - }, - }, - }, - opts_extend = { "sources.default" }, - config = function(_, opts) - require('blink.cmp').setup(opts) - - -- Optional: Set up highlights - vim.api.nvim_set_hl(0, 'BlinkCmpMenu', { link = 'Pmenu' }) - vim.api.nvim_set_hl(0, 'BlinkCmpMenuBorder', { link = 'Pmenu' }) - vim.api.nvim_set_hl(0, 'BlinkCmpMenuSelection', { link = 'PmenuSel' }) - vim.api.nvim_set_hl(0, 'BlinkCmpDoc', { link = 'NormalFloat' }) - vim.api.nvim_set_hl(0, 'BlinkCmpDocBorder', { link = 'FloatBorder' }) - vim.api.nvim_set_hl(0, 'BlinkCmpSignatureHelp', { link = 'NormalFloat' }) - vim.api.nvim_set_hl(0, 'BlinkCmpSignatureHelpBorder', { link = 'FloatBorder' }) - end -} diff --git a/.config/nvim/lua/plugins/colorizer.lua b/.config/nvim/lua/plugins/colorizer.lua deleted file mode 100644 index f8cfa97..0000000 --- a/.config/nvim/lua/plugins/colorizer.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - "NvChad/nvim-colorizer.lua", - event = { "BufReadPre", "BufNewFile" }, - config = true, -} diff --git a/.config/nvim/lua/plugins/colorscheme.lua b/.config/nvim/lua/plugins/colorscheme.lua deleted file mode 100644 index 41dfcdf..0000000 --- a/.config/nvim/lua/plugins/colorscheme.lua +++ /dev/null @@ -1,134 +0,0 @@ -return { - { - "rebelot/kanagawa.nvim", - enabled = false, - priority = 1000, - config = function() - -- Default options: - require("kanagawa").setup({ - compile = false, -- enable compiling the colorscheme - undercurl = true, -- enable undercurls - commentStyle = { italic = true }, - functionStyle = {}, - keywordStyle = { italic = true }, - statementStyle = { bold = true }, - typeStyle = {}, - transparent = true, -- do not set background color - dimInactive = false, -- dim inactive window `:h hl-NormalNC` - terminalColors = true, -- define vim.g.terminal_color_{0,17} - colors = { -- add/modify theme and palette colors - palette = {}, - theme = { wave = {}, lotus = {}, dragon = {}, all = {} }, - }, - overrides = function(colors) -- add/modify highlights - return {} - end, - theme = "wave", -- Load "wave" theme when 'background' option is not set - background = { -- map the value of 'background' option to a theme - dark = "wave", -- try "dragon" ! - light = "lotus", - }, - }) - - -- setup must be called before loading - require("kanagawa").load("wave") - end, - }, - { - "scottmckendry/cyberdream.nvim", - lazy = false, - priority = 1000, - enabled = false, - config = function() - require("cyberdream").setup({ - variant = "default", - transparent = true, - saturation = 1, -- accepts a value between 0 and 1. 0 will be fully desaturated (greyscale) and 1 will be the full color (default) - italic_comments = false, - hide_fillchars = false, - borderless_pickers = false, - terminal_colors = true, - cache = true, - - -- Override highlight groups with your own colour values - highlights = { - -- Highlight groups to override, adding new groups is also possible - -- See `:h highlight-groups` for a list of highlight groups or run `:hi` to see all groups and their current values - - -- Example: - Comment = { fg = "#696969", bg = "NONE", italic = true }, - - -- More examples can be found in `lua/cyberdream/extensions/*.lua` - }, - - -- Override a highlight group entirely using the built-in colour palette - -- overrides = function(colors) -- NOTE: This function nullifies the `highlights` option - -- -- Example: - -- return { - -- Comment = { fg = colors.green, bg = "NONE", italic = true }, - -- ["@property"] = { fg = colors.magenta, bold = true }, - -- } - -- end, - - -- Disable or enable colorscheme extensions - extensions = { - mini = true, - }, - }) - vim.cmd("colorscheme cyberdream") - end - }, - { - "EdenEast/nightfox.nvim", - lazy = false, - enabled = false, - priority = 1000, - opts = { - options = { - compile_path = vim.fn.stdpath("cache") .. "/nightfox", - compile_file_suffix = "_compiled", - transparent = false, - terminal_colors = true, - dim_inactive = false, - module_default = true, - colorblind = { - enable = false, - simulate_only = false, - severity = { - protan = 0, - deutan = 0, - tritan = 0, - }, - }, - styles = { - comments = "italic", - conditionals = "NONE", - constants = "NONE", - functions = "NONE", - keywords = "NONE", - numbers = "NONE", - operators = "NONE", - strings = "NONE", - types = "NONE", - variables = "NONE", - }, - inverse = { - match_paren = false, - visual = false, - search = false, - }, - } - }, - config = function(_, opts) - require("nightfox").setup(opts) - vim.cmd("colorscheme carbonfox") - end - }, - { - "olimorris/onedarkpro.nvim", - priority = 1000, -- Ensure it loads first - config = function() - vim.cmd("colorscheme onedark") - end, - } -} diff --git a/.config/nvim/lua/plugins/conform.lua b/.config/nvim/lua/plugins/conform.lua deleted file mode 100644 index c56b811..0000000 --- a/.config/nvim/lua/plugins/conform.lua +++ /dev/null @@ -1,54 +0,0 @@ -return { - "stevearc/conform.nvim", - event = { "BufReadPre", "BufNewFile" }, - config = function() - local conform = require("conform") - - conform.setup({ - formatters_by_ft = { - lua = { "stylua" }, - go = { "goimports", "gofmt" }, - javascript = { "prettierd" }, - typescript = { "prettierd" }, - typescriptreact = { "prettierd" }, - vue = { "prettierd" }, - css = { "prettierd" }, - html = { "prettierd" }, - markdown = { "prettierd" }, - json = { "fixjson" }, - rust = { "rustfmt" }, - shell = { "shfmt", "shellcheck" }, - python = { "isort", "black" }, - php = { "phpcbf", "php_cs_fixer" }, - blade = { "blade-formatter" } - }, - log_level = vim.log.levels.WARN, - notify_on_error = false, - }) - - vim.keymap.set({ "n", "v" }, "F", function() - conform.format({ - lsp_fallback = true, - async = false, - timeout_ms = 500, - }) - end) - - vim.fn.mkdir(vim.fn.expand("~/.cache/php-cs-fixer"), "p") - - conform.formatters.php_cs_fixer = { - prepend_args = { - "--config=" .. vim.fn.expand("~/.config/php-cs-fixer.php"), - "--cache-file=" .. vim.fn.expand("~/.cache/php-cs-fixer/cache"), - }, - env = { - PHP_CS_FIXER_IGNORE_ENV = "1", - }, - } - - conform.formatters.phpcbf = { - prepend_args = { "--standard=~/.config/phpcs.xml" }, - - } - end, -} diff --git a/.config/nvim/lua/plugins/csvview.lua b/.config/nvim/lua/plugins/csvview.lua deleted file mode 100644 index 7220ac9..0000000 --- a/.config/nvim/lua/plugins/csvview.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - 'hat0uma/csvview.nvim', - event = { "BufReadPre", "BufNewFile" }, - config = function() - require('csvview').setup() - end -} diff --git a/.config/nvim/lua/plugins/dadbod.lua b/.config/nvim/lua/plugins/dadbod.lua deleted file mode 100644 index b21a8e1..0000000 --- a/.config/nvim/lua/plugins/dadbod.lua +++ /dev/null @@ -1,40 +0,0 @@ -return { - 'kristijanhusak/vim-dadbod-ui', - dependencies = { - { 'tpope/vim-dadbod', lazy = true }, - { 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, -- Optional - }, - cmd = { - 'DBUI', - 'DBUIToggle', - 'DBUIAddConnection', - 'DBUIFindBuffer', - }, - init = function() - -- Your DBUI configuration - vim.g.db_ui_use_nerd_fonts = 1 - vim.g.db_ui_auto_execute_table_helpers = 1 - - vim.g.dbs = { - dev = 'mysql://jack:secret@localhost:33061/jack?protocol=tcp', - dev_prod_dump = 'mysql://root:secret@localhost:33061/jac_prod?protocol=tcp', - } - - vim.api.nvim_create_user_command('DBUITab', function() - vim.cmd('tabnew') - vim.cmd('DBUI') - end, { desc = 'Open DBUI in a new tab' }) - - vim.keymap.set('n', 'db', function () - vim.cmd('tabnew') - vim.cmd('DBUI') - end, { desc = 'Open DBUI in a new tab' }) - - vim.api.nvim_create_autocmd("FileType", { - pattern = {"dbout", "dbui"}, - callback = function() - vim.opt_local.foldenable = false - end, - }) - end, -} diff --git a/.config/nvim/lua/plugins/demicolon.lua b/.config/nvim/lua/plugins/demicolon.lua deleted file mode 100644 index bf5197e..0000000 --- a/.config/nvim/lua/plugins/demicolon.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - 'mawkler/demicolon.nvim', - dependencies = { - 'nvim-treesitter/nvim-treesitter', - 'nvim-treesitter/nvim-treesitter-textobjects', - }, - opts = {} -} diff --git a/.config/nvim/lua/plugins/diffview.lua b/.config/nvim/lua/plugins/diffview.lua index a6a9f92..5a0f6b5 100644 --- a/.config/nvim/lua/plugins/diffview.lua +++ b/.config/nvim/lua/plugins/diffview.lua @@ -1,11 +1,16 @@ -return { - "sindrets/diffview.nvim", - opts = { +local M = {} + +M.install = { src = "https://github.com/sindrets/diffview.nvim" } + +M.setup = function() + require("diffview").setup({ enhanced_diff_hl = true, view = { merge_tool = { - layout = "diff3_mixed", -- or "diff3_horizontal" + layout = "diff3_mixed", -- or "diff3_horizontal" }, }, - }, -} + }) +end + +return M diff --git a/.config/nvim/lua/plugins/flash.lua b/.config/nvim/lua/plugins/flash.lua deleted file mode 100644 index d8d4f10..0000000 --- a/.config/nvim/lua/plugins/flash.lua +++ /dev/null @@ -1,53 +0,0 @@ -return { - "folke/flash.nvim", - event = "VeryLazy", - opts = { - modes = { - char = { - enabled = false, - }, - }, - }, - keys = { - { - "s", - mode = { "n", "x", "o" }, - function() - require("flash").jump() - end, - desc = "Flash", - }, - { - "S", - mode = { "n", "x", "o" }, - function() - require("flash").treesitter() - end, - desc = "Flash Treesitter", - }, - { - "r", - mode = "o", - function() - require("flash").remote() - end, - desc = "Remote Flash", - }, - { - "R", - mode = { "o", "x" }, - function() - require("flash").treesitter_search() - end, - desc = "Treesitter Search", - }, - { - "", - mode = { "c" }, - function() - require("flash").toggle() - end, - desc = "Toggle Flash Search", - }, - }, -} diff --git a/.config/nvim/lua/plugins/flutter-tools.lua b/.config/nvim/lua/plugins/flutter-tools.lua deleted file mode 100644 index 8790556..0000000 --- a/.config/nvim/lua/plugins/flutter-tools.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - 'akinsho/flutter-tools.nvim', - lazy = false, - dependencies = { - 'nvim-lua/plenary.nvim', - }, -} diff --git a/.config/nvim/lua/plugins/fugitive.lua b/.config/nvim/lua/plugins/fugitive.lua index 6d86765..c84cbd0 100644 --- a/.config/nvim/lua/plugins/fugitive.lua +++ b/.config/nvim/lua/plugins/fugitive.lua @@ -1,179 +1,168 @@ -return { - { - "tpope/vim-fugitive", - event = "VeryLazy", - dependencies = { - "shumphrey/fugitive-gitlab.vim", - }, - config = function() - -- Git diff settings - vim.opt.diffopt:append("vertical") - vim.opt.display:append("lastline") - - -- Helper function for consistent keymap creation - local function map(mode, lhs, rhs, desc, opts) - opts = opts or {} - opts.desc = desc - opts.noremap = true - opts.silent = true - vim.keymap.set(mode, lhs, rhs, opts) - end - - -- Buffer-local mappings for fugitive buffers - local function set_fugitive_buffer_mappings() - local buf_opts = { buffer = 0, noremap = true, silent = true } - - -- Git operations - map("n", "gp", "Git push", "Git push", buf_opts) - map("n", "gP", "Git pull", "Git pull", buf_opts) - map("n", "gc", "Git commit", "Git commit", buf_opts) - - -- Additional useful fugitive buffer mappings - map("n", "q", "close", "Close fugitive buffer", buf_opts) - map("n", "gd", "Gvdiffsplit", "Git diff split", buf_opts) - end - - -- Auto-command for fugitive buffer mappings - local fugitive_augroup = vim.api.nvim_create_augroup("fugitive_mappings", { clear = true }) - vim.api.nvim_create_autocmd("FileType", { - group = fugitive_augroup, - pattern = "fugitive", - callback = set_fugitive_buffer_mappings, - desc = "Set fugitive buffer-local mappings", - }) - - -- Enhanced line-based git log function - local function git_log_range() - local mode = vim.fn.mode() - local start_line, end_line - - if mode == 'V' or mode == 'v' then - -- Visual mode - get selected range - local start_pos = vim.fn.getpos("'<") - local end_pos = vim.fn.getpos("'>") - start_line = start_pos[2] - end_line = end_pos[2] - else - -- Normal mode - use current line - start_line = vim.fn.line(".") - end_line = start_line - end - - -- Validate line numbers - if start_line <= 0 or end_line <= 0 then - vim.notify("Invalid line range selected", vim.log.levels.WARN) - return - end - - local filepath = vim.fn.expand("%:.") - if filepath == "" then - vim.notify("No file in current buffer", vim.log.levels.WARN) - return - end - - -- Ensure proper order - if start_line > end_line then - start_line, end_line = end_line, start_line - end - - local cmd = string.format("Git log -L %d,%d:%s", start_line, end_line, filepath) - vim.cmd(cmd) - end - - -- Global git mappings - map("n", "gg", function() - vim.cmd("Git") - end, "Open git status") - - map("n", "gl", function() - vim.cmd("Git log --oneline -20") - end, "Git log (last 20)") - - map("n", "gL", function() - vim.cmd("Git log") - end, "Git log (detailed)") - - map({ "n", "v" }, "gr", git_log_range, "Git log for range/line") - - map("n", "gs", function() - vim.cmd("Git status") - end, "Git status") - - map("n", "gd", function() - vim.cmd("Gvdiffsplit") - end, "Git diff split") - - map("n", "gb", function() - vim.cmd("Git blame") - end, "Git blame") - - map("n", "ga", function() - vim.cmd("Git add %") - end, "Git add current file") - - map("n", "gA", function() - vim.cmd("Git add .") - end, "Git add all") - - -- Git stash operations - map("n", "gss", function() - vim.cmd("Git stash") - end, "Git stash") - - map("n", "gsp", function() - vim.cmd("Git stash pop") - end, "Git stash pop") - - map("n", "gsl", function() - vim.cmd("Git stash list") - end, "Git stash list") - - -- Branch operations - map("n", "gco", function() - local branch = vim.fn.input("Branch name: ") - if branch ~= "" then - vim.cmd("Git checkout " .. branch) - end - end, "Git checkout branch") - - map("n", "gcb", function() - local branch = vim.fn.input("New branch name: ") - if branch ~= "" then - vim.cmd("Git checkout -b " .. branch) - end - end, "Git create and checkout branch") - - -- Additional autocmds for better fugitive experience - vim.api.nvim_create_autocmd("FileType", { - group = fugitive_augroup, - pattern = "gitcommit", - callback = function() - -- Enable spell checking for commit messages - vim.opt_local.spell = true - vim.opt_local.spelllang = "en_us" - -- Position cursor at the beginning - vim.cmd("startinsert") - end, - desc = "Git commit buffer settings", - }) - - -- Auto-close fugitive buffers when done - vim.api.nvim_create_autocmd("BufReadPost", { - group = fugitive_augroup, - pattern = "fugitive:*", - callback = function() - vim.opt_local.bufhidden = "delete" - end, - desc = "Auto-delete fugitive buffers", - }) +local M = {} + +M.install = { src = "https://github.com/tpope/vim-fugitive" } + +M.setup = function() + -- Git diff settings + vim.opt.diffopt:append("vertical") + vim.opt.display:append("lastline") + + -- Helper function for consistent keymap creation + local function map(mode, lhs, rhs, desc, opts) + opts = opts or {} + opts.desc = desc + opts.noremap = true + opts.silent = true + vim.keymap.set(mode, lhs, rhs, opts) + end + + -- Buffer-local mappings for fugitive buffers + local function set_fugitive_buffer_mappings() + local buf_opts = { buffer = 0, noremap = true, silent = true } + + -- Git operations + map("n", "gp", "Git push", "Git push", buf_opts) + map("n", "gP", "Git pull", "Git pull", buf_opts) + map("n", "gc", "Git commit", "Git commit", buf_opts) + + -- Additional useful fugitive buffer mappings + map("n", "q", "close", "Close fugitive buffer", buf_opts) + map("n", "gd", "Gvdiffsplit", "Git diff split", buf_opts) + end + + -- Auto-command for fugitive buffer mappings + local fugitive_augroup = vim.api.nvim_create_augroup("fugitive_mappings", { clear = true }) + vim.api.nvim_create_autocmd("FileType", { + group = fugitive_augroup, + pattern = "fugitive", + callback = set_fugitive_buffer_mappings, + desc = "Set fugitive buffer-local mappings", + }) + + -- Enhanced line-based git log function + local function git_log_range() + local mode = vim.fn.mode() + local start_line, end_line + + if mode == 'V' or mode == 'v' then + -- Visual mode - get selected range + local start_pos = vim.fn.getpos("'<") + local end_pos = vim.fn.getpos("'>") + start_line = start_pos[2] + end_line = end_pos[2] + else + -- Normal mode - use current line + start_line = vim.fn.line(".") + end_line = start_line + end + + -- Validate line numbers + if start_line <= 0 or end_line <= 0 then + vim.notify("Invalid line range selected", vim.log.levels.WARN) + return + end + + local filepath = vim.fn.expand("%:.") + if filepath == "" then + vim.notify("No file in current buffer", vim.log.levels.WARN) + return + end + + -- Ensure proper order + if start_line > end_line then + start_line, end_line = end_line, start_line + end + + local cmd = string.format("Git log -L %d,%d:%s", start_line, end_line, filepath) + vim.cmd(cmd) + end + + -- Global git mappings + map("n", "gg", function() + vim.cmd("Git") + end, "Open git status") + + map("n", "gl", function() + vim.cmd("Git log --oneline -20") + end, "Git log (last 20)") + + map("n", "gL", function() + vim.cmd("Git log") + end, "Git log (detailed)") + + map({ "n", "v" }, "gr", git_log_range, "Git log for range/line") + + map("n", "gs", function() + vim.cmd("Git status") + end, "Git status") + + map("n", "gd", function() + vim.cmd("Gvdiffsplit") + end, "Git diff split") + + map("n", "gb", function() + vim.cmd("Git blame") + end, "Git blame") + + map("n", "ga", function() + vim.cmd("Git add %") + end, "Git add current file") + + map("n", "gA", function() + vim.cmd("Git add .") + end, "Git add all") + + -- Git stash operations + map("n", "gss", function() + vim.cmd("Git stash") + end, "Git stash") + + map("n", "gsp", function() + vim.cmd("Git stash pop") + end, "Git stash pop") + + map("n", "gsl", function() + vim.cmd("Git stash list") + end, "Git stash list") + + -- Branch operations + map("n", "gco", function() + local branch = vim.fn.input("Branch name: ") + if branch ~= "" then + vim.cmd("Git checkout " .. branch) + end + end, "Git checkout branch") + + map("n", "gcb", function() + local branch = vim.fn.input("New branch name: ") + if branch ~= "" then + vim.cmd("Git checkout -b " .. branch) + end + end, "Git create and checkout branch") + + -- Additional autocmds for better fugitive experience + vim.api.nvim_create_autocmd("FileType", { + group = fugitive_augroup, + pattern = "gitcommit", + callback = function() + -- Enable spell checking for commit messages + vim.opt_local.spell = true + vim.opt_local.spelllang = "en_us" + -- Position cursor at the beginning + vim.cmd("startinsert") end, - }, - { - "rbong/vim-flog", - lazy = true, - cmd = { "Flog", "Flogsplit", "Floggit" }, - dependencies = { - "tpope/vim-fugitive", - }, - }, -} + desc = "Git commit buffer settings", + }) + + -- Auto-close fugitive buffers when done + vim.api.nvim_create_autocmd("BufReadPost", { + group = fugitive_augroup, + pattern = "fugitive:*", + callback = function() + vim.opt_local.bufhidden = "delete" + end, + desc = "Auto-delete fugitive buffers", + }) +end + +return M diff --git a/.config/nvim/lua/plugins/gitlab-merge-requests.lua b/.config/nvim/lua/plugins/gitlab-merge-requests.lua deleted file mode 100644 index 1a3fc72..0000000 --- a/.config/nvim/lua/plugins/gitlab-merge-requests.lua +++ /dev/null @@ -1,22 +0,0 @@ -return { - "harrisoncramer/gitlab.nvim", - dependencies = { - "MunifTanjim/nui.nvim", - "nvim-lua/plenary.nvim", - "sindrets/diffview.nvim", - "stevearc/dressing.nvim", -- Recommended but not required. Better UI for pickers. - "nvim-tree/nvim-web-devicons", -- Recommended but not required. Icons in discussion tree. - }, - build = function() require("gitlab.server").build(true) end, -- Builds the Go binary - config = function() - require("gitlab").setup() - - vim.api.nvim_create_user_command("GChoose", function() - require("gitlab").choose_merge_request() - end, { desc = "Choose a GitLab merge request" }) - - vim.api.nvim_create_user_command("GReview", function() - require("gitlab").review() - end, { desc = "Start GitLab review" }) - end, -} diff --git a/.config/nvim/lua/plugins/gitsigns.lua b/.config/nvim/lua/plugins/gitsigns.lua index 3cebbd9..5559eb9 100644 --- a/.config/nvim/lua/plugins/gitsigns.lua +++ b/.config/nvim/lua/plugins/gitsigns.lua @@ -1,46 +1,19 @@ -return { - "lewis6991/gitsigns.nvim", - event = { "BufReadPre", "BufNewFile" }, - config = function() - require("gitsigns").setup({ - signs = { - add = { text = "┃" }, - change = { text = "┃" }, - delete = { text = "_" }, - topdelete = { text = "‾" }, - changedelete = { text = "~" }, - untracked = { text = "┆" }, - }, - signcolumn = true, - numhl = false, - linehl = false, - word_diff = false, - watch_gitdir = { - follow_files = true, - }, - auto_attach = true, - attach_to_untracked = false, - current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = "eol", - delay = 0, - ignore_whitespace = false, - virt_text_priority = 100, - }, - current_line_blame_formatter = ", - ", - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, -- Disable if file is longer than this (in lines) - preview_config = { - -- Options passed to nvim_open_win - border = "single", - style = "minimal", - relative = "cursor", - row = 0, - col = 1, - }, - }) - end, -} +local M = {} + +M.install = { src = "https://github.com/lewis6991/gitsigns.nvim" } + +M.setup = function() + require("gitsigns").setup({ + current_line_blame = true, + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", + delay = 0, + ignore_whitespace = false, + virt_text_priority = 100, + }, + current_line_blame_formatter = ", - ", + }) +end + +return M diff --git a/.config/nvim/lua/plugins/harpoon.lua b/.config/nvim/lua/plugins/harpoon.lua index 9a5f0a0..d4bb05d 100644 --- a/.config/nvim/lua/plugins/harpoon.lua +++ b/.config/nvim/lua/plugins/harpoon.lua @@ -1,68 +1,71 @@ -return { - "ThePrimeagen/harpoon", - event = "VeryLazy", - branch = "harpoon2", - dependencies = { - "nvim-lua/plenary.nvim", - }, - config = function() - local harpoon = require("harpoon") +local M = {} - -- REQUIRED - harpoon:setup() - -- REQUIRED +M.install = { src = "https://github.com/ThePrimeagen/harpoon", version = "harpoon2" } - local keymap = vim.keymap +M.dependencies = { + { src = "https://github.com/nvim-lua/plenary.nvim" }, +} - keymap.set("n", "a", function() - harpoon:list():add() - end, { desc = "Mark file with harpoon" }) - keymap.set("n", "", function() - harpoon.ui:toggle_quick_menu(harpoon:list()) - end, { desc = "Toggle quick menu for harpoon" }) +M.setup = function() + local harpoon = require("harpoon") - keymap.set("n", "1", function() - harpoon:list():select(1) - end, { desc = "Go to first harpoon file" }) + -- REQUIRED + harpoon:setup() + -- REQUIRED - keymap.set("n", "h", function() - harpoon:list():select(1) - end, { desc = "Go to first harpoon file" }) + local keymap = vim.keymap + keymap.set("n", "a", function() + harpoon:list():add() + end, { desc = "Mark file with harpoon" }) - keymap.set("n", "2", function() - harpoon:list():select(2) - end, { desc = "Go to second harpoon file" }) + keymap.set("n", "", function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, { desc = "Toggle quick menu for harpoon" }) - keymap.set("n", "j", function() - harpoon:list():select(2) - end, { desc = "Go to second harpoon file" }) + keymap.set("n", "1", function() + harpoon:list():select(1) + end, { desc = "Go to first harpoon file" }) + keymap.set("n", "h", function() + harpoon:list():select(1) + end, { desc = "Go to first harpoon file" }) - keymap.set("n", "3", function() - harpoon:list():select(3) - end, { desc = "Go to third harpoon file" }) - keymap.set("n", "k", function() - harpoon:list():select(3) - end, { desc = "Go to third harpoon file" }) + keymap.set("n", "2", function() + harpoon:list():select(2) + end, { desc = "Go to second harpoon file" }) + keymap.set("n", "j", function() + harpoon:list():select(2) + end, { desc = "Go to second harpoon file" }) - keymap.set("n", "4", function() - harpoon:list():select(4) - end, { desc = "Go to fourth harpoon file" }) - keymap.set("n", "l", function() - harpoon:list():select(4) - end, { desc = "Go to fourth harpoon file" }) + keymap.set("n", "3", function() + harpoon:list():select(3) + end, { desc = "Go to third harpoon file" }) + keymap.set("n", "k", function() + harpoon:list():select(3) + end, { desc = "Go to third harpoon file" }) - keymap.set("n", "", function() - harpoon:list():prev() - end) - keymap.set("n", "", function() - harpoon:list():next() - end) - end, -} + + keymap.set("n", "4", function() + harpoon:list():select(4) + end, { desc = "Go to fourth harpoon file" }) + + keymap.set("n", "l", function() + harpoon:list():select(4) + end, { desc = "Go to fourth harpoon file" }) + + + keymap.set("n", "", function() + harpoon:list():prev() + end) + keymap.set("n", "", function() + harpoon:list():next() + end) +end + +return M diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..d4573fa --- /dev/null +++ b/.config/nvim/lua/plugins/init.lua @@ -0,0 +1,49 @@ +local plugins_dir = vim.fn.stdpath('config') .. '/lua/plugins' +local plugin_files = vim.fn.globpath(plugins_dir, '*.lua', false, true) + +local plugins_to_add = {} +local plugins_to_setup = {} + +-- Collect all plugin configs (excluding init.lua) +for _, file in ipairs(plugin_files) do + local filename = vim.fn.fnamemodify(file, ':t:r') + + if filename ~= 'init' then + local ok, plugin = pcall(require, 'plugins.' .. filename) + + if ok and type(plugin) == 'table' then + if not plugin.disabled then + if plugin.install then + table.insert(plugins_to_add, plugin.install) + end + + if plugin.dependencies then + vim.list_extend( + plugins_to_add, + plugin.dependencies + ) + end + + if plugin.setup and type(plugin.setup) == 'function' then + table.insert(plugins_to_setup, { + name = filename, + setup = plugin.setup + }) + end + end + else + vim.notify('Failed to load plugin: ' .. filename .. ': ' .. tostring(plugin), vim.log.levels.WARN) + end + end +end + +-- Add all plugins +vim.pack.add(plugins_to_add) + +-- Run all setup functions +for _, plugin in ipairs(plugins_to_setup) do + local ok, err = pcall(plugin.setup) + if not ok then + vim.notify('Failed to setup plugin ' .. plugin.name .. ': ' .. tostring(err), vim.log.levels.ERROR) + end +end diff --git a/.config/nvim/lua/plugins/kanagawa.lua b/.config/nvim/lua/plugins/kanagawa.lua new file mode 100644 index 0000000..aaca2cd --- /dev/null +++ b/.config/nvim/lua/plugins/kanagawa.lua @@ -0,0 +1,11 @@ +local M = {} + +M.disabled = false + +M.install = { src = "https://github.com/rebelot/kanagawa.nvim" } + +M.setup = function() + vim.cmd("colorscheme kanagawa") +end + +return M diff --git a/.config/nvim/lua/plugins/laravel.lua b/.config/nvim/lua/plugins/laravel.lua deleted file mode 100644 index dfde800..0000000 --- a/.config/nvim/lua/plugins/laravel.lua +++ /dev/null @@ -1,42 +0,0 @@ -return { - dir = "~/Projects/laravel.nvim", - dependencies = { - "tpope/vim-dotenv", - "MunifTanjim/nui.nvim", - "kevinhwang91/promise-async", - }, - cmd = { "Laravel" }, - keys = {}, - event = { "VeryLazy" }, - opts = { - lsp_server = "intelephense", - artisan_path = "app/api/artisan", - environments = { - default = "docker-compose", - auto_discover = false, - definitions = { - { - name = "docker-compose", - condition = { - file_exists = { "docker-compose.yml" }, - executable = { "docker" }, - }, - commands = { - compose = { "docker", "compose" }, - { - commands = { "php", "composer", "npm" }, - docker = { - container = { - env = "APP_SERVICE", - default = "app-fpm", - }, - exec = { "docker", "compose", "exec", "-it" }, - }, - }, - }, - }, - }, - }, - }, - config = true, -} diff --git a/.config/nvim/lua/plugins/linting.lua b/.config/nvim/lua/plugins/linting.lua deleted file mode 100644 index 262aba3..0000000 --- a/.config/nvim/lua/plugins/linting.lua +++ /dev/null @@ -1,113 +0,0 @@ -return { - "mfussenegger/nvim-lint", - event = { "BufReadPre", "BufNewFile" }, - config = function() - local lint = require("lint") - - local severities = { - ERROR = vim.diagnostic.severity.ERROR, - WARNING = vim.diagnostic.severity.WARN, - } - - lint.linters.phpcs = { - name = "phpcs", - cmd = "phpcs", - stdin = true, - args = { - "-q", - "--report=json", - "--standard=~/.config/phpcs.xml", - "-", -- need `-` at the end for stdin support - }, - ignore_exitcode = true, - parser = function(output, _) - if vim.trim(output) == "" or output == nil then - return {} - end - - if not vim.startswith(output, "{") then - vim.notify(output) - return {} - end - - local decoded = vim.json.decode(output) - local diagnostics = {} - local messages = decoded["files"]["STDIN"]["messages"] - - for _, msg in ipairs(messages or {}) do - table.insert(diagnostics, { - lnum = msg.line - 1, - end_lnum = msg.line - 1, - col = msg.column - 1, - end_col = msg.column - 1, - message = msg.message, - code = msg.source, - source = "phpcs", - severity = assert(severities[msg.type], "missing mapping for severity " .. msg.type), - }) - end - - return diagnostics - end, - } - - lint.linters_by_ft = { - javascript = { "eslint" }, - typescript = { "eslint" }, - typescriptreact = { "eslint" }, - vue = { "eslint" }, - json = { "jsonlint" }, - markdown = { "markdownlint" }, - php = { "phpcs" }, - golang = { "gospell", "golangci-lint" }, - python = { "pylint" }, - dockerfile = { "hadolint" }, - blade = { "phpcs" }, - html = { "curlylint" }, - } - - local lint_augroup = vim.api.nvim_create_augroup("lint", { - clear = true, - }) - - - local function find_nearest_node_modules_dir() - -- current buffer dir - local current_dir = vim.fn.expand('%:p:h') .. "./frontend" - while current_dir ~= "/" do - if vim.fn.isdirectory(current_dir .. "/node_modules") == 1 then - return current_dir - end - current_dir = vim.fn.fnamemodify(current_dir, ":h") - end - return nil - end - - vim.api.nvim_create_autocmd({ - "BufEnter", - "BufWritePost", - "InsertLeave", - }, { - group = lint_augroup, - callback = function() - local ft = vim.bo.filetype - local js_types = { "javascript", "typescript", "javascriptreact", "typescriptreact", "vue" } - if not vim.tbl_contains(js_types, ft) then - lint.try_lint() - return - end - local original_cwd = vim.fn.getcwd() - local node_modules_dir = find_nearest_node_modules_dir() - if node_modules_dir then - vim.cmd("cd " .. node_modules_dir) - end - lint.try_lint() - vim.cmd("cd " .. original_cwd) - end, - }) - - -- vim.keymap.set("n", "ll", function() - -- lint.try_lint() - -- end) - end, -} diff --git a/.config/nvim/lua/plugins/lspconfig.lua b/.config/nvim/lua/plugins/lspconfig.lua index 8f39380..d491928 100644 --- a/.config/nvim/lua/plugins/lspconfig.lua +++ b/.config/nvim/lua/plugins/lspconfig.lua @@ -1,78 +1,172 @@ -return { - "neovim/nvim-lspconfig", - -- event = { "BufReadPre", "BufNewFile" }, - dependencies = { - { "saghen/blink.cmp" }, - { "antosha417/nvim-lsp-file-operations", config = true }, - { "williamboman/mason.nvim", config = true }, - { "williamboman/mason-lspconfig.nvim" }, - { "WhoIsSethDaniel/mason-tool-installer.nvim" }, - { "j-hui/fidget.nvim", opts = {} }, - { "folke/neodev.nvim", opts = {} }, - { 'dmmulroy/ts-error-translator.nvim', opts = {} }, - { 'mawkler/refjump.nvim', opts = {}, event = 'LspAttach', }, - }, - config = function() - local utils = require("lsp.utils") - - vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }), - callback = function(event) - -- Use the utility function to setup keymaps - utils.setup_lsp_keymaps(event.buf) - - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client.server_capabilities.documentHighlightProvider then - vim.api.nvim_create_autocmd("LspDetach", { - group = vim.api.nvim_create_augroup("lsp-detach", { clear = true }), - callback = function() - vim.lsp.buf.clear_references() - end, - }) - end - end, - }) - - vim.diagnostic.config({ - virtual_text = false, - float = { - border = "rounded", - }, - signs = true, - underline = true, - update_in_insert = true, - severity_sort = true, - }) - - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = vim.tbl_deep_extend( - "force", - capabilities, - require('blink.cmp').get_lsp_capabilities() - ) - - -- Load server configurations from separate files - local servers_path = vim.fn.stdpath("config") .. "/lua/lsp/servers" - local server_files = vim.fn.glob(servers_path .. "/*.lua", false, true) - - local servers = {} - for _, file in ipairs(server_files) do - local server_name = vim.fn.fnamemodify(file, ":t:r") - local ok, server_config = pcall(require, "lsp.servers." .. server_name) - if ok then - servers[server_name] = server_config - else - vim.notify("Failed to load server config: " .. server_name, vim.log.levels.WARN) +local M = {} + +M.install = { src = "https://github.com/neovim/nvim-lspconfig" } + +M.setup = function() + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("LspAttach", { clear = true }), + callback = function(event) + vim.keymap.set("n", "gr", function() + vim.lsp.buf.references() + end, { desc = "LSP References" }) + + vim.keymap.set("n", "gd", function() + vim.lsp.buf.definition() + end, { desc = "LSP Definition" }) + + -- LSP implementations + vim.keymap.set('n', 'gi', function() + vim.lsp.buf.implementation() + end, { desc = 'LSP implementation' }) + + -- LSP type definitions + vim.keymap.set('n', 'gt', function() + vim.lsp.buf.type_definition() + end, { desc = 'LSP type definition' }) + + -- LSP document symbols + vim.keymap.set('n', 'gs', function() + vim.lsp.buf.document_symbol() + end, { desc = 'LSP document symbols' }) + + -- LSP workspace symbols + vim.keymap.set('n', 'gS', function() + vim.lsp.buf.workspace_symbol() + end, { desc = 'LSP workspace symbols' }) + + -- LSP Declaration + vim.keymap.set("n", "gD", function() + vim.lsp.buf.declaration() + end, { desc = "Go to declaration" }) + + -- LSP Code Actions + vim.keymap.set({ "n", "v" }, "ca", function() + vim.lsp.buf.code_action() + end, { desc = "LSP Code Actions" }) + + -- LSP Rename + vim.keymap.set("n", "rn", function() + vim.lsp.buf.rename() + end, { desc = "LSP Rename" }) + + -- LSP diagnostics for current buffer + vim.keymap.set('n', 'd', function() + vim.diagnostic.setloclist() + end, { desc = 'Buffer diagnostics' }) + + -- LSP Format + vim.keymap.set("n", "F", function() + vim.lsp.buf.format() + end, { desc = "LSP Format" }) + + -- LSP diagnostics for entire workspace + vim.keymap.set('n', 'D', function() + vim.diagnostic.setqflist() + end, { desc = 'Workspace diagnostics' }) + + vim.keymap.set("n", "[d", function() + vim.diagnostic.jump({ + count = -1, + on_jump = function() + vim.diagnostic.open_float() + end + }) + end, { desc = "Go to previous diagnostic" }) + + vim.keymap.set("n", "]d", function() + vim.diagnostic.jump({ + count = 1, + on_jump = function() + vim.diagnostic.open_float() + end + }) + end, { desc = "Go to next diagnostic" }) + + vim.keymap.set("n", "[e", function() + vim.diagnostic.jump({ + count = -1, + severity = vim.diagnostic.severity.ERROR, + on_jump = function() + vim.diagnostic.open_float() + end + }) + end, { desc = "Go to previous diagnostic (error only)" }) + + vim.keymap.set("n", "]e", function() + vim.diagnostic.jump({ + count = 1, + severity = vim.diagnostic.severity.ERROR, + on_jump = function() + vim.diagnostic.open_float() + end + }) + end, { desc = "Go to next diagnostic (error only)" }) + + vim.keymap.set("n", "df", function() + vim.diagnostic.open_float() + end, { desc = "Show diagnostic in floating window" }) + + local client = vim.lsp.get_client_by_id(event.data.client_id) + + if client and client:supports_method('textDocument/completion') then + -- Optional: trigger autocompletion on EVERY keypress. May be slow! + local chars = {}; for i = 32, 126 do table.insert(chars, string.char(i)) end + client.server_capabilities.completionProvider.triggerCharacters = chars + vim.lsp.completion.enable(true, client.id, event.buf, { + autotrigger = true, + -- Prevent auto-selection of first item + autocomplete = false + }) + + -- Map Ctrl+y to select first item and accept completion + vim.keymap.set('i', '', function() + if vim.fn.pumvisible() == 1 then + -- If completion menu is visible, select first item if nothing selected, then accept + local selected = vim.fn.complete_info({'selected'}).selected + if selected == -1 then + -- Nothing selected, select first item then accept + return '' + else + -- Something already selected, just accept + return '' + end + else + return '' + end + end, { expr = true, buffer = event.buf, desc = 'Accept completion' }) end - end - -- Setup all servers using the new vim.lsp.config and vim.lsp.enable APIs - for server_name, server in pairs(servers) do - -- Merge capabilities - server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {}) + if client and client.server_capabilities.documentHighlightProvider then + vim.api.nvim_create_autocmd("LspDetach", { + group = vim.api.nvim_create_augroup("LspDetach", { clear = true }), + callback = function() + vim.lsp.buf.clear_references() + end, + }) + end + end, + }) + + -- Load server configurations from separate files + local servers_path = vim.fn.stdpath("config") .. "/lua/lsp/servers" + local server_files = vim.fn.glob(servers_path .. "/*.lua", false, true) - vim.lsp.config(server_name, server) - vim.lsp.enable(server_name) + local servers = {} + for _, file in ipairs(server_files) do + local server_name = vim.fn.fnamemodify(file, ":t:r") + local ok, server_config = pcall(require, "lsp.servers." .. server_name) + if ok then + servers[server_name] = server_config + else + vim.notify("Failed to load server config: " .. server_name, vim.log.levels.WARN) end - end, -} + end + + -- Setup all servers using the new vim.lsp.config and vim.lsp.enable APIs + for server_name, server in pairs(servers) do + vim.lsp.config(server_name, server or {}) + vim.lsp.enable(server_name) + end +end + +return M diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua deleted file mode 100644 index 86f5909..0000000 --- a/.config/nvim/lua/plugins/lualine.lua +++ /dev/null @@ -1,110 +0,0 @@ -return { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - dependencies = { - "nvim-tree/nvim-web-devicons", - "letieu/harpoon-lualine", - }, - config = function() - local lualine = require("lualine") - local lazy_status = require("lazy.status") - - -- Custom components - local function macro_recording() - local recording_register = vim.fn.reg_recording() - if recording_register == "" then - return "" - else - return "Recording @" .. recording_register - end - end - - local function buffer_count() - local buffers = vim.fn.getbufinfo({ buflisted = 1 }) - return "Buffers: " .. #buffers - end - - - lualine.setup({ - options = { - theme = "auto", - component_separators = { left = "", right = "" }, - section_separators = { left = "", right = "" }, - globalstatus = true, - refresh = { - statusline = 1000, -- Refresh every second for macro recording - }, - }, - extensions = { - "fugitive", - "oil", - "quickfix", - "trouble", -- Add if you use trouble.nvim - "mason", -- Add if you use mason.nvim - }, - sections = { - lualine_a = { - { "mode", fmt = function(str) return str:sub(1,1) end }, -- Shorter mode display - }, - lualine_b = { - { "branch", icon = "" }, - { - "diff", - colored = true, - symbols = { added = " ", modified = " ", removed = " " } - }, - { - "diagnostics", - sources = { "nvim_lsp" }, - symbols = { error = " ", warn = " ", info = " ", hint = " " } - }, - }, - lualine_c = { - { - "filename", - file_status = true, - path = 1, -- Show relative path - shorting_target = 40, -- Shorten long paths - symbols = { - modified = "", - readonly = "", - unnamed = "[No Name]", - newfile = "[New]", - } - }, - { "harpoon2" }, - { - macro_recording, - color = { fg = "#ff9e64", gui = "bold" }, - separator = { left = "" } - }, - { buffer_count, color = { fg = "#7aa2f7" } }, - }, - lualine_x = { - { - lazy_status.updates, - cond = lazy_status.has_updates, - color = { fg = "#ff9e64" }, - }, - -- Remove fileformat unless you really need it - -- { "fileformat" }, - { "filetype", colored = true }, - }, - lualine_y = { - { "progress" }, - }, - lualine_z = { - { "location" }, - }, - }, - inactive_sections = { - lualine_c = { - { "filename", file_status = true, path = 1 } - }, - lualine_x = { - { "filetype" } - }, - }, - }) - end, -} diff --git a/.config/nvim/lua/plugins/mason.lua b/.config/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..5adce31 --- /dev/null +++ b/.config/nvim/lua/plugins/mason.lua @@ -0,0 +1,9 @@ +local M = {} + +M.install = { src = "https://github.com/mason-org/mason.nvim" } + +M.setup = function() + require("mason").setup() +end + +return M diff --git a/.config/nvim/lua/plugins/mini_pick.lua b/.config/nvim/lua/plugins/mini_pick.lua new file mode 100644 index 0000000..69164dd --- /dev/null +++ b/.config/nvim/lua/plugins/mini_pick.lua @@ -0,0 +1,107 @@ +local M = {} + +M.install = { src = "https://github.com/nvim-mini/mini.pick" } + +M.setup = function() + local pick = require('mini.pick') + + pick.setup({ + mappings = { + paste_from_clipboard = { + char = '', + func = function() + local clipboard = vim.fn.getreg('+') + local current_query = pick.get_picker_query() or {} + -- Query is an array of strings, join and append clipboard + local query_text = type(current_query) == 'table' and table.concat(current_query, '') or current_query + local new_query = query_text .. clipboard + -- Convert back to array of characters + local query_array = {} + for char in new_query:gmatch('.') do + table.insert(query_array, char) + end + pick.set_picker_query(query_array) + end, + }, + send_to_qflist = { + char = '', + func = function() + local items = pick.get_picker_items() + if not items or #items == 0 then + return + end + + local qf_items = {} + for _, item in ipairs(items) do + if type(item) == 'string' then + -- Mini.pick uses null bytes (\0) as separators + local parts = vim.split(item, '\0', { plain = true }) + + if #parts >= 3 then + -- Format: path\0lnum\0col\0text + local path = parts[1] + local lnum = tonumber(parts[2]) or 1 + local col = tonumber(parts[3]) or 1 + local text = parts[4] or '' + + table.insert(qf_items, { + filename = path, + lnum = lnum, + col = col, + text = text, + }) + else + -- Just a file path + table.insert(qf_items, { + filename = item, + lnum = 1, + col = 1, + text = '', + }) + end + end + end + + if #qf_items > 0 then + vim.fn.setqflist(qf_items) + vim.cmd('copen') + end + pick.stop() + end, + }, + }, + window = { + config = function() + local height = math.floor(0.618 * vim.o.lines) + local width = math.floor(0.618 * vim.o.columns) + return { + anchor = 'NW', + height = height, + width = width, + row = math.floor(0.5 * (vim.o.lines - height)), + col = math.floor(0.5 * (vim.o.columns - width)), + } + end, + }, + }) + + -- Keybind for git files + vim.keymap.set('n', 'p', function() + pick.builtin.files({ tool = 'git' }) + end, { desc = 'Pick Git Files' }) + + -- Keybind for git files + vim.keymap.set('n', 'P', function() + pick.builtin.files() + end, { desc = 'Pick Files' }) + + vim.keymap.set('n', 'f', function() + pick.builtin.grep_live() + end, { desc = 'Pick Search' }) + + vim.keymap.set('n', 'H', function() + pick.builtin.help() + end, { desc = 'Pick Help' }) +end + +return M diff --git a/.config/nvim/lua/plugins/neotest.lua b/.config/nvim/lua/plugins/neotest.lua index 15c910f..e525477 100644 --- a/.config/nvim/lua/plugins/neotest.lua +++ b/.config/nvim/lua/plugins/neotest.lua @@ -1,148 +1,152 @@ -return { - "nvim-neotest/neotest", - event = "VeryLazy", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-treesitter/nvim-treesitter", - "antoinemadec/FixCursorHold.nvim", - "nvim-neotest/nvim-nio", - -- Adapters - "olimorris/neotest-phpunit", - "praem90/neotest-docker-phpunit.nvim", - "nvim-neotest/neotest-go", - }, - config = function() - local neotest = require("neotest") - local keymap = vim.keymap - - -- Environment setup - vim.env.PROJECT_ROOT = vim.fn.getcwd() .. "/backend/" - vim.env.ENV_PATH = vim.fn.getcwd() .. "/backend/.env" - - -- Container toggle state - local current_container = "app-fpm" - - -- Test running keymaps - keymap.set("n", "tr", function() - neotest.run.run() - end, { desc = "Run nearest test" }) - - keymap.set("n", "tf", function() - neotest.run.run(vim.fn.expand("%")) - end, { desc = "Run all tests in file" }) - - keymap.set("n", "tR", function() - neotest.run.run_last() - end, { desc = "Run last test" }) - - keymap.set("n", "tS", function() - neotest.run.stop() - end, { desc = "Stop running tests" }) - - keymap.set("n", "ta", function() - neotest.run.attach() - end, { desc = "Attach to running test" }) - - -- Watch mode - keymap.set("n", "tw", function() - neotest.watch.toggle(vim.fn.expand("%")) - end, { desc = "Toggle watch mode for file" }) - - -- Output keymaps - keymap.set("n", "to", function() - neotest.output.open({ enter = true, short = false }) - end, { desc = "Open test output" }) - - keymap.set("n", "tO", function() - neotest.output_panel.toggle() - end, { desc = "Toggle output panel" }) - - -- UI keymaps - keymap.set("n", "ts", function() - neotest.summary.toggle() - end, { desc = "Toggle summary pane" }) - - -- Navigation keymaps - keymap.set("n", "[t", function() - neotest.jump.prev({ status = "failed" }) - end, { desc = "Jump to previous failed test" }) - - keymap.set("n", "]t", function() - neotest.jump.next({ status = "failed" }) - end, { desc = "Jump to next failed test" }) - - -- Setup neotest function - local cwd = vim.fn.getcwd() - local app_path = cwd .. "/app/api" - local subscription_path = cwd .. "/subscription/api" - - -- Config table that we can modify - local docker_config = { - default = { - container = current_container, - volume = (current_container == "subscription-fpm" and subscription_path or app_path) .. ":/var/www", - standalone = false, +local M = {} + +M.install = { src = "https://github.com/nvim-neotest/neotest" } + +M.dependencies = { + { src = "https://github.com/nvim-lua/plenary.nvim" }, + { src = "https://github.com/nvim-treesitter/nvim-treesitter" }, + { src = "https://github.com/antoinemadec/FixCursorHold.nvim" }, + { src = "https://github.com/nvim-neotest/nvim-nio" }, + -- Adapters + { src = "https://github.com/olimorris/neotest-phpunit" }, + { src = "https://github.com/praem90/neotest-docker-phpunit.nvim" }, + { src = "https://github.com/nvim-neotest/neotest-go" }, +} + +M.setup = function() + local neotest = require("neotest") + local keymap = vim.keymap + + -- Environment setup + vim.env.PROJECT_ROOT = vim.fn.getcwd() .. "/backend/" + vim.env.ENV_PATH = vim.fn.getcwd() .. "/backend/.env" + + -- Container toggle state + local current_container = "app-fpm" + + -- Test running keymaps + keymap.set("n", "tr", function() + neotest.run.run() + end, { desc = "Run nearest test" }) + + keymap.set("n", "tf", function() + neotest.run.run(vim.fn.expand("%")) + end, { desc = "Run all tests in file" }) + + keymap.set("n", "tR", function() + neotest.run.run_last() + end, { desc = "Run last test" }) + + keymap.set("n", "tS", function() + neotest.run.stop() + end, { desc = "Stop running tests" }) + + keymap.set("n", "ta", function() + neotest.run.attach() + end, { desc = "Attach to running test" }) + + -- Watch mode + keymap.set("n", "tw", function() + neotest.watch.toggle(vim.fn.expand("%")) + end, { desc = "Toggle watch mode for file" }) + + -- Output keymaps + keymap.set("n", "to", function() + neotest.output.open({ enter = true, short = false }) + end, { desc = "Open test output" }) + + keymap.set("n", "tO", function() + neotest.output_panel.toggle() + end, { desc = "Toggle output panel" }) + + -- UI keymaps + keymap.set("n", "ts", function() + neotest.summary.toggle() + end, { desc = "Toggle summary pane" }) + + -- Navigation keymaps + keymap.set("n", "[t", function() + neotest.jump.prev({ status = "failed" }) + end, { desc = "Jump to previous failed test" }) + + keymap.set("n", "]t", function() + neotest.jump.next({ status = "failed" }) + end, { desc = "Jump to next failed test" }) + + -- Setup neotest function + local cwd = vim.fn.getcwd() + local app_path = cwd .. "/app/api" + local subscription_path = cwd .. "/subscription/api" + + -- Config table that we can modify + local docker_config = { + default = { + container = current_container, + volume = (current_container == "subscription-fpm" and subscription_path or app_path) .. ":/var/www", + standalone = false, + }, + } + + local function setup_neotest() + neotest.setup({ + adapters = { + require("neotest-docker-phpunit").setup({ + phpunit_cmd = "neotest-docker-phpunit", + docker_phpunit = docker_config, + }), + require("neotest-go")({ + root = function() + return './backend' + end, + experimental = { + test_table = true, + }, + args = { "-count=1", "-timeout=60s" }, + }), + }, + output = { + enabled = true, + open_on_run = false, + }, + output_panel = { + enabled = true, + open = "botright split | resize 15", + }, + quickfix = { + enabled = true, + open = false, }, - } - - local function setup_neotest() - neotest.setup({ - adapters = { - require("neotest-docker-phpunit").setup({ - phpunit_cmd = "neotest-docker-phpunit", - docker_phpunit = docker_config, - }), - require("neotest-go")({ - root = function() - return './backend' - end, - experimental = { - test_table = true, - }, - args = { "-count=1", "-timeout=60s" }, - }), - }, - output = { - enabled = true, - open_on_run = false, - }, - output_panel = { - enabled = true, - open = "botright split | resize 15", - }, - quickfix = { - enabled = true, - open = false, - }, - status = { - enabled = true, - virtual_text = true, - signs = true, - }, - floating = { - border = "rounded", - max_height = 0.8, - max_width = 0.9, - }, - }) + status = { + enabled = true, + virtual_text = true, + signs = true, + }, + floating = { + border = "rounded", + max_height = 0.8, + max_width = 0.9, + }, + }) + end + + -- Initial setup + setup_neotest() + + -- Container toggle keybind + keymap.set("n", "tc", function() + if current_container == "app-fpm" then + current_container = "subscription-fpm" + else + current_container = "app-fpm" end - -- Initial setup - setup_neotest() + -- Update the config table directly + docker_config.default.container = current_container + docker_config.default.volume = (current_container == "subscription-fpm" and subscription_path or app_path) .. + ":/var/www" - -- Container toggle keybind - keymap.set("n", "tc", function() - if current_container == "app-fpm" then - current_container = "subscription-fpm" - else - current_container = "app-fpm" - end + vim.notify("Switched to container: " .. current_container, vim.log.levels.INFO) + end, { desc = "Toggle container (app/subscription)" }) +end - -- Update the config table directly - docker_config.default.container = current_container - docker_config.default.volume = (current_container == "subscription-fpm" and subscription_path or app_path) .. ":/var/www" - - vim.notify("Switched to container: " .. current_container, vim.log.levels.INFO) - end, { desc = "Toggle container (app/subscription)" }) - end, -} +return M diff --git a/.config/nvim/lua/plugins/nvim-go.lua b/.config/nvim/lua/plugins/nvim-go.lua deleted file mode 100644 index efc86ee..0000000 --- a/.config/nvim/lua/plugins/nvim-go.lua +++ /dev/null @@ -1,23 +0,0 @@ -return { - "ray-x/go.nvim", - dependencies = { - "ray-x/guihua.lua", - "neovim/nvim-lspconfig", - "nvim-treesitter/nvim-treesitter", - }, - event = "VeryLazy", - ft = { "go", 'gomod' }, - build = ':lua require("go.install").update_all_sync()', - config = function() - require("go").setup() - - local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {}) - vim.api.nvim_create_autocmd("BufWritePre", { - pattern = "*.go", - callback = function() - require('go.format').goimports() - end, - group = format_sync_grp, - }) - end -} diff --git a/.config/nvim/lua/plugins/nvim-lint.lua b/.config/nvim/lua/plugins/nvim-lint.lua new file mode 100644 index 0000000..df80d7a --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-lint.lua @@ -0,0 +1,115 @@ +local M = {} + +M.install = { src = "https://github.com/mfussenegger/nvim-lint" } + +M.setup = function() + local lint = require("lint") + + local severities = { + ERROR = vim.diagnostic.severity.ERROR, + WARNING = vim.diagnostic.severity.WARN, + } + + lint.linters.phpcs = { + name = "phpcs", + cmd = "phpcs", + stdin = true, + args = { + "-q", + "--report=json", + "--standard=~/.config/phpcs.xml", + "-", -- need `-` at the end for stdin support + }, + ignore_exitcode = true, + parser = function(output, _) + if vim.trim(output) == "" or output == nil then + return {} + end + + if not vim.startswith(output, "{") then + vim.notify(output) + return {} + end + + local decoded = vim.json.decode(output) + local diagnostics = {} + local messages = decoded["files"]["STDIN"]["messages"] + + for _, msg in ipairs(messages or {}) do + table.insert(diagnostics, { + lnum = msg.line - 1, + end_lnum = msg.line - 1, + col = msg.column - 1, + end_col = msg.column - 1, + message = msg.message, + code = msg.source, + source = "phpcs", + severity = assert(severities[msg.type], "missing mapping for severity " .. msg.type), + }) + end + + return diagnostics + end, + } + + lint.linters_by_ft = { + javascript = { "eslint" }, + typescript = { "eslint" }, + typescriptreact = { "eslint" }, + vue = { "eslint" }, + json = { "jsonlint" }, + markdown = { "markdownlint" }, + php = { "phpcs" }, + golang = { "gospell", "golangci-lint" }, + python = { "pylint" }, + dockerfile = { "hadolint" }, + blade = { "phpcs" }, + html = { "curlylint" }, + } + + local lint_augroup = vim.api.nvim_create_augroup("lint", { + clear = true, + }) + + + local function find_nearest_node_modules_dir() + -- current buffer dir + local current_dir = vim.fn.expand('%:p:h') .. "./frontend" + while current_dir ~= "/" do + if vim.fn.isdirectory(current_dir .. "/node_modules") == 1 then + return current_dir + end + current_dir = vim.fn.fnamemodify(current_dir, ":h") + end + return nil + end + + vim.api.nvim_create_autocmd({ + "BufEnter", + "BufWritePost", + "InsertLeave", + }, { + group = lint_augroup, + callback = function() + local ft = vim.bo.filetype + local js_types = { "javascript", "typescript", "javascriptreact", "typescriptreact", "vue" } + if not vim.tbl_contains(js_types, ft) then + lint.try_lint() + return + end + local original_cwd = vim.fn.getcwd() + local node_modules_dir = find_nearest_node_modules_dir() + if node_modules_dir then + vim.cmd("cd " .. node_modules_dir) + end + lint.try_lint() + vim.cmd("cd " .. original_cwd) + end, + }) + + -- vim.keymap.set("n", "ll", function() + -- lint.try_lint() + -- end) +end + +return M diff --git a/.config/nvim/lua/plugins/nvim-treesitter.lua b/.config/nvim/lua/plugins/nvim-treesitter.lua deleted file mode 100644 index 3fa2b64..0000000 --- a/.config/nvim/lua/plugins/nvim-treesitter.lua +++ /dev/null @@ -1,143 +0,0 @@ -return { - { - "nvim-treesitter/nvim-treesitter", - event = { "BufReadPre", "BufNewFile" }, - build = ":TSUpdate", - dependencies = { - { "nvim-treesitter/nvim-treesitter-textobjects" }, - }, - config = function() - ---@class ParserConfig - ---@field install_info table - ---@field filetype string - local parser_config = require("nvim-treesitter.parsers").get_parser_configs() - - parser_config.blade = { - install_info = { - url = "https://github.com/EmranMR/tree-sitter-blade", - files = { "src/parser.c" }, - branch = "main", - }, - filetype = "blade", - } - - vim.filetype.add({ - extension = { blade = "blade" }, - pattern = { - ['.*%.blade%.php'] = 'blade', - }, - }) - - --- - ---:TSEditQuery highlights blade - --- - ---(directive) @function - ---(directive_start) @function - ---(directive_end) @function - ---(comment) @comment - ---((parameter) @include (#set! "priority" 110)) - ---((php_only) @include (#set! "priority" 110)) - ---((bracket_start) @function (#set! "priority" 120)) - ---((bracket_end) @function (#set! "priority" 120)) - ---(keyword) @function - --- - - --- - ---:TSEditQuery injections blade - ---((text) @injection.content - --- (#not-has-ancestor? @injection.content "envoy") - --- (#set! injection.combined) - --- (#set! injection.language php)) - --- - - -- import nvim-treesitter plugin - local treesitter = require("nvim-treesitter.configs") - - -- configure treesitter - treesitter.setup({ - -- ensure these language parsers are installed - ensure_installed = { - "json", - "javascript", - "typescript", - "tsx", - "yaml", - "html", - "css", - "markdown", - "markdown_inline", - "bash", - "lua", - "vim", - "dockerfile", - "gitignore", - "php", - "latex", - "blade", - }, - ignore_install = {}, - modules = {}, - sync_install = true, - auto_install = true, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - disable = { "latex" }, - }, - conceal = false, - indent = { enable = true }, - autotag = { enable = true }, - textobjects = { - select = { - enable = true, - lookahead = true, - keymaps = { - ["af"] = "@function.outer", - ["if"] = "@function.inner", - ["ac"] = "@conditional.outer", - ["ic"] = "@conditional.inner", - ["al"] = "@loop.outer", - ["il"] = "@loop.inner", - }, - selection_modes = { - ["@parameter.outer"] = "v", -- charwise - ["@function.outer"] = "V", -- linewise - ["@class.outer"] = "", -- blockwise - }, - include_surrounding_whitespace = false, - }, - move = { - enable = true, - set_jumps = true, - goto_next_start = { - ["]f"] = "@function.outer", - ["]c"] = "@conditional.outer", - ["]o"] = "@loop.outer", - }, - goto_next_end = { - ["]F"] = "@function.outer", - ["]C"] = "@conditional.outer", - ["]O"] = "@loop.outer", - }, - goto_previous_start = { - ["[f"] = "@function.outer", - ["[c"] = "@conditional.outer", - ["[o"] = "@loop.outer", - }, - goto_previous_end = { - ["[F"] = "@function.outer", - ["[C"] = "@conditional.outer", - ["[O"] = "@loop.outer", - }, - goto_next = { - ["]b"] = "@block.outer", - }, - goto_previous = { - ["[b"] = "@block.outer", - }, - }, - }, - }) - end, - }, -} diff --git a/.config/nvim/lua/plugins/nvim-ts-context-commentstring.lua b/.config/nvim/lua/plugins/nvim-ts-context-commentstring.lua deleted file mode 100644 index 2c3a932..0000000 --- a/.config/nvim/lua/plugins/nvim-ts-context-commentstring.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - "JoosepAlviste/nvim-ts-context-commentstring", - event = { "BufRead", "BufNewFile" }, - config = true, -} diff --git a/.config/nvim/lua/plugins/oil.lua b/.config/nvim/lua/plugins/oil.lua index 130cc82..01b8d7f 100644 --- a/.config/nvim/lua/plugins/oil.lua +++ b/.config/nvim/lua/plugins/oil.lua @@ -1,89 +1,89 @@ -return { - "stevearc/oil.nvim", - opts = {}, - -- Optional dependencies - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - require("oil").setup({ - default_file_explorer = true, - buf_options = { - buflisted = false, - bufhidden = "hide", - }, - win_options = { - wrap = false, - signcolumn = "no", - cursorcolumn = false, - foldcolumn = "0", - spell = false, - list = false, - conceallevel = 3, - concealcursor = "nvic", - }, - delete_to_trash = false, - skip_confirm_for_simple_edits = false, - prompt_save_on_select_new_entry = true, - cleanup_delay_ms = 2000, - keymaps = { - ["g?"] = "actions.show_help", - [""] = "actions.select", - [""] = "actions.select_vsplit", - [""] = false, - [""] = "actions.select_tab", - [""] = "actions.preview", - [""] = "actions.close", - [""] = false, - ["-"] = "actions.parent", - ["_"] = "actions.open_cwd", - ["`"] = "actions.cd", - ["~"] = "actions.tcd", - ["gs"] = "actions.change_sort", - ["gx"] = "actions.open_external", - ["g."] = "actions.toggle_hidden", - }, - use_default_keymaps = false, - view_options = { - show_hidden = true, - is_hidden_file = function(name, _) - return vim.startswith(name, ".") - end, - is_always_hidden = function(_, _) - return false - end, - sort = { - { "type", "asc" }, - { "name", "asc" }, - }, - }, - preview = { - max_width = 0.9, - min_width = { 40, 0.4 }, - width = nil, - max_height = 0.9, - min_height = { 5, 0.1 }, - height = nil, - border = "rounded", - win_options = { - winblend = 0, - }, - }, - progress = { - max_width = 0.9, - min_width = { 40, 0.4 }, - width = nil, - max_height = { 10, 0.9 }, - min_height = { 5, 0.1 }, - height = nil, - border = "rounded", - minimized_border = "none", - win_options = { - winblend = 0, - }, - }, - }) +local M = {} - vim.keymap.set("n", "-", function() - vim.cmd("Oil") - end, { desc = "Open parent directory" }) - end, -} +M.install = { src = "https://github.com/stevearc/oil.nvim" } + +M.setup = function() + require("oil").setup({ + default_file_explorer = true, + buf_options = { + buflisted = false, + bufhidden = "hide", + }, + win_options = { + wrap = false, + signcolumn = "no", + cursorcolumn = false, + foldcolumn = "0", + spell = false, + list = false, + conceallevel = 3, + concealcursor = "nvic", + }, + delete_to_trash = false, + skip_confirm_for_simple_edits = false, + prompt_save_on_select_new_entry = true, + cleanup_delay_ms = 2000, + keymaps = { + ["g?"] = "actions.show_help", + [""] = "actions.select", + [""] = "actions.select_vsplit", + [""] = false, + [""] = "actions.select_tab", + [""] = "actions.preview", + [""] = "actions.close", + [""] = false, + ["-"] = "actions.parent", + ["_"] = "actions.open_cwd", + ["`"] = "actions.cd", + ["~"] = "actions.tcd", + ["gs"] = "actions.change_sort", + ["gx"] = "actions.open_external", + ["g."] = "actions.toggle_hidden", + }, + use_default_keymaps = false, + view_options = { + show_hidden = true, + is_hidden_file = function(name, _) + return vim.startswith(name, ".") + end, + is_always_hidden = function(_, _) + return false + end, + sort = { + { "type", "asc" }, + { "name", "asc" }, + }, + }, + preview = { + max_width = 0.9, + min_width = { 40, 0.4 }, + width = nil, + max_height = 0.9, + min_height = { 5, 0.1 }, + height = nil, + border = "rounded", + win_options = { + winblend = 0, + }, + }, + progress = { + max_width = 0.9, + min_width = { 40, 0.4 }, + width = nil, + max_height = { 10, 0.9 }, + min_height = { 5, 0.1 }, + height = nil, + border = "rounded", + minimized_border = "none", + win_options = { + winblend = 0, + }, + }, + }) + + vim.keymap.set("n", "-", function() + vim.cmd("Oil") + end, { desc = "Open parent directory" }) +end + +return M diff --git a/.config/nvim/lua/plugins/snacks.lua b/.config/nvim/lua/plugins/snacks.lua deleted file mode 100644 index 957064d..0000000 --- a/.config/nvim/lua/plugins/snacks.lua +++ /dev/null @@ -1,270 +0,0 @@ -return { - "folke/snacks.nvim", - priority = 1000, - lazy = false, - opts = { - -- Dashboard/Starter - dashboard = { enabled = false }, - - -- Notification system (replaces nvim-notify) - notifier = { - enabled = true, - timeout = 5000, - width = { min = 50, max = 0.4 }, - height = { min = 1, max = 0.6 }, - margin = { top = 0, right = 1, bottom = 0 }, - padding = true, - sort = { "level", "added" }, - level = vim.log.levels.INFO, - icons = { - error = " ", - warn = " ", - info = " ", - debug = " ", - trace = "✎ ", - }, - style = "compact", - }, - - -- File picker (replaces telescope) - picker = { - enabled = true, - -- Performance optimizations - show_delay = 0, -- Show picker immediately (default is 5000ms) - limit_live = 5000, -- Reduce live search limit for better performance - matcher = { - frecency = false, -- Disable frecency for faster startup (enable if you want recency scoring) - cwd_bonus = false, -- Disable for better performance - history_bonus = false, -- Disable for better performance - }, - formatters = { - file = { - filename_first = true, - }, - }, - win = { - input = { - keys = { - [""] = { "list_down", mode = { "i", "n" } }, - [""] = { "list_up", mode = { "i", "n" } }, - [""] = { "history_next", mode = { "i", "n" } }, - [""] = { "history_prev", mode = { "i", "n" } }, - [""] = { "qflist", mode = { "i", "n" } }, - [""] = { "close", mode = { "i", "n" } }, - }, - }, - }, - sources = { - files = { - hidden = true, - follow = true, - -- Let snacks auto-detect fd (fastest) or fallback to rg/find - }, - grep = { - hidden = true, - follow = true, - }, - }, - }, - - -- Quickfile (fast file operations) - quickfile = { enabled = true }, - - -- Statuscolumn enhancements - statuscolumn = { - enabled = true, - left = { "mark", "sign" }, -- priority of signs on the left (high to low) - right = { "fold", "git" }, -- priority of signs on the right (high to low) - folds = { - open = false, -- show open fold icons - git_hl = false, -- use Git Signs hl for fold icons - }, - git = { - -- patterns to match Git signs - patterns = { "GitSign", "MiniDiffSign" }, - }, - refresh = 50, -- refresh at most every 50ms - }, - - -- Word highlighting - words = { enabled = true }, - - -- Styling for inputs - input = { enabled = true }, - - -- Scrolling - scroll = { enabled = false }, - - -- Indent guides - indent = { enabled = false }, - - -- Scope highlighting - scope = { enabled = true }, - - -- Git integration with blame - git = { - enabled = true, - }, - gitbrowse = { - enabled = true, - }, - - -- Rename with LSP - rename = { enabled = true }, - - -- Terminal - terminal = { enabled = true }, - - -- Zen mode - zen = { enabled = false }, - - -- Dim inactive windows - dim = { enabled = false }, - - -- Better quickfix - quickfix = { enabled = true }, - - -- Scratch buffer - scratch = { enabled = true }, - - -- Toggle options - toggle = { enabled = true }, - - -- Profiler - profiler = { enabled = false }, - - -- Debugging helpers - debug = { enabled = false }, - - -- Treesitter scope - treesitter = { enabled = true }, - }, - keys = { - -- File navigation (replacing telescope keybindings) - { "p", function() Snacks.picker.smart() end, desc = "Find project files" }, - { "ff", function() Snacks.picker.grep() end, desc = "Live grep" }, - { "fg", function() Snacks.picker.grep() end, desc = "Live grep" }, - { "fr", function() Snacks.picker.resume() end, desc = "Resume last picker" }, - { "fb", function() Snacks.picker.buffers() end, desc = "Find buffers" }, - { "fo", function() Snacks.picker.recent() end, desc = "Find recent files" }, - { "fc", function() Snacks.picker.commands() end, desc = "Find commands" }, - - -- Search - { - "fw", - function() - Snacks.picker.grep_word() - end, - desc = "Grep word under cursor" - }, - - { - "fW", - function() - local word = vim.fn.expand("") - Snacks.picker.grep({ search = word }) - end, - desc = "Grep WORD under cursor" - }, - - { - "fw", - function() - local mode = vim.fn.mode() - if mode == 'v' or mode == 'V' then - vim.cmd('noau normal! "vy"') - local text = vim.fn.getreg('v') - vim.fn.setreg('v', {}) - text = string.gsub(text, "\n", "") - if #text > 0 then - Snacks.picker.grep({ search = text }) - else - Snacks.picker.grep() - end - end - end, - mode = "v", - desc = "Grep selection" - }, - - { - "fF", - function() - local word = vim.fn.expand("") - Snacks.picker.files({ search = word }) - end, - desc = "Find file with name under cursor" - }, - - -- Git - { "gb", function() Snacks.picker.git_branches() end, desc = "Git branches" }, - { "gc", function() Snacks.picker.git_log() end, desc = "Git commits" }, - { "gs", function() Snacks.picker.git_status() end, desc = "Git status" }, - { "gbl", function() Snacks.git.blame_line() end, desc = "Git blame line" }, - - -- LSP - { "ds", function() Snacks.picker.lsp_symbols() end, desc = "Document symbols" }, - { "ws", function() Snacks.picker.lsp_symbols({ symbols = "workspace" }) end, desc = "Workspace symbols" }, - { "dws", function() Snacks.picker.lsp_symbols({ symbols = "workspace" }) end, desc = "Dynamic workspace symbols" }, - { "gd", function() Snacks.picker.lsp_definitions() end, desc = "Go to definition" }, - { "gr", function() Snacks.picker.lsp_references() end, desc = "Go to references" }, - { "gI", function() Snacks.picker.lsp_implementations() end, desc = "Go to implementation" }, - - -- Utilities - { "fs", function() Snacks.picker.spelling() end, desc = "Spell suggestions" }, - { "fm", function() Snacks.picker.marks() end, desc = "Marks" }, - { "fh", function() Snacks.picker.command_history() end, desc = "Command history" }, - { "fH", function() Snacks.picker.help() end, desc = "Help tags" }, - { "fk", function() Snacks.picker.keymaps() end, desc = "Keymaps" }, - { ":", function() Snacks.picker.commands() end, desc = "Commands" }, - - -- Quickfix - { "fq", function() Snacks.picker.qflist() end, desc = "Quickfix list" }, - { "fl", function() Snacks.picker.loclist() end, desc = "Location list" }, - - -- Diagnostics - { "fd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" }, - - -- Additional snacks features - { "gg", function() Snacks.lazygit() end, desc = "Lazygit" }, - { "gf", function() Snacks.lazygit.log_file() end, desc = "Lazygit log (current file)" }, - { "gl", function() Snacks.lazygit.log() end, desc = "Lazygit log" }, - { "un", function() Snacks.notifier.hide() end, desc = "Dismiss notifications" }, - { "nh", function() Snacks.notifier.show_history() end, desc = "Notification history" }, - { "", function() Snacks.terminal() end, desc = "Toggle terminal", mode = { "n", "t" } }, - { "", function() Snacks.terminal() end, desc = "Toggle terminal (which_key)", mode = { "n", "t" } }, - { "]]", function() Snacks.words.jump(vim.v.count1) end, desc = "Next reference", mode = { "n", "t" } }, - { "[[", function() Snacks.words.jump(-vim.v.count1) end, desc = "Prev reference", mode = { "n", "t" } }, - { "N", function() Snacks.notifier.show_history() end, desc = "Notification history" }, - { "bd", function() Snacks.bufdelete() end, desc = "Delete buffer" }, - { "cR", function() Snacks.rename.rename_file() end, desc = "Rename file" }, - { "gB", function() Snacks.gitbrowse() end, desc = "Git browse" }, - { "S", function() Snacks.profiler.scratch() end, desc = "Profiler scratch buffer" }, - }, - init = function() - -- Setup notification handler immediately - vim.notify = function(msg, level, opts) - return Snacks.notifier.notify(msg, level, opts) - end - - vim.api.nvim_create_autocmd("User", { - pattern = "VeryLazy", - callback = function() - -- Create some toggle keymaps - Snacks.toggle.option("spell", { name = "Spelling" }):map("us") - Snacks.toggle.option("wrap", { name = "Wrap" }):map("uw") - Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("uL") - Snacks.toggle.diagnostics():map("ud") - Snacks.toggle.line_number():map("ul") - Snacks.toggle.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }) - :map("uc") - Snacks.toggle.treesitter():map("uT") - Snacks.toggle.option("background", { off = "light", on = "dark", name = "Dark Background" }):map( - "ub") - Snacks.toggle.inlay_hints():map("uh") - Snacks.toggle.indent():map("ug") - Snacks.toggle.dim():map("uD") - end, - }) - end, -} diff --git a/.config/nvim/lua/plugins/tiny-inline-diagnostic.lua b/.config/nvim/lua/plugins/tiny-inline-diagnostic.lua deleted file mode 100644 index 1911b48..0000000 --- a/.config/nvim/lua/plugins/tiny-inline-diagnostic.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - "rachartier/tiny-inline-diagnostic.nvim", - event = "VeryLazy", - priority = 1000, - config = function() - require("tiny-inline-diagnostic").setup() - vim.diagnostic.config({ virtual_text = false }) -- Disable Neovim's default virtual text diagnostics - end, -} diff --git a/.config/nvim/lua/plugins/tmux.lua b/.config/nvim/lua/plugins/tmux.lua index e0cc9ff..ac12f14 100644 --- a/.config/nvim/lua/plugins/tmux.lua +++ b/.config/nvim/lua/plugins/tmux.lua @@ -1,20 +1,22 @@ -return { - "aserowy/tmux.nvim", - event = "VeryLazy", - config = function() - require("tmux").setup({ - copy_sync = { - enable = false, - }, - navigation = { - cycle_navigation = true, - enable_default_keybindings = true, - persist_zoom = true, - }, - resize = { - -- enables default keybindings (A-hjkl) for normal mode - enable_default_keybindings = false, - }, - }) - end, -} +local M = {} + +M.install = { src = "https://github.com/aserowy/tmux.nvim" } + +M.setup = function () + require("tmux").setup({ + copy_sync = { + enable = false, + }, + navigation = { + cycle_navigation = true, + enable_default_keybindings = true, + persist_zoom = true, + }, + resize = { + -- enables default keybindings (A-hjkl) for normal mode + enable_default_keybindings = false, + }, + }) +end + +return M diff --git a/.config/nvim/lua/plugins/todo-comments.lua b/.config/nvim/lua/plugins/todo-comments.lua deleted file mode 100644 index 0270602..0000000 --- a/.config/nvim/lua/plugins/todo-comments.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - "folke/todo-comments.nvim", - event = "VeryLazy", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - require("todo-comments").setup() - - vim.keymap.set("n", "tt", function() - require("todo-comments.fzf").todo() - end, {}) - - vim.keymap.set("n", "tq", function() - vim.cmd("TodoQuickFix") - end, {}) - end, -} diff --git a/.config/nvim/lua/plugins/treesitter-textobjects.lua b/.config/nvim/lua/plugins/treesitter-textobjects.lua new file mode 100644 index 0000000..48dca84 --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter-textobjects.lua @@ -0,0 +1,80 @@ +local M = {} + +M.install = { src = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects", version = "main" } + +M.setup = function() + -- configuration + require("nvim-treesitter-textobjects").setup { + select = { + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + -- You can choose the select mode (default is charwise 'v') + -- + -- Can also be a function which gets passed a table with the keys + -- * query_string: eg '@function.inner' + -- * method: eg 'v' or 'o' + -- and should return the mode ('v', 'V', or '') or a table + -- mapping query_strings to modes. + selection_modes = { + ['@parameter.outer'] = 'v', -- charwise + ['@function.outer'] = 'V', -- linewise + -- ['@class.outer'] = '', -- blockwise + }, + -- If you set this to `true` (default is `false`) then any textobject is + -- extended to include preceding or succeeding whitespace. Succeeding + -- whitespace has priority in order to act similarly to eg the built-in + -- `ap`. + -- + -- Can also be a function which gets passed a table with the keys + -- * query_string: eg '@function.inner' + -- * selection_mode: eg 'v' + -- and should return true of false + include_surrounding_whitespace = false, + }, + move = { + -- whether to set jumps in the jumplist + set_jumps = true, + }, + } + -- Select textobjects + local select = require('nvim-treesitter-textobjects.select') + vim.keymap.set({'n', 'x', 'o'}, 'af', function() select.select_textobject('@function.outer', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, 'if', function() select.select_textobject('@function.inner', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, 'ac', function() select.select_textobject('@conditional.outer', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, 'ic', function() select.select_textobject('@conditional.inner', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, 'al', function() select.select_textobject('@loop.outer', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, 'il', function() select.select_textobject('@loop.inner', 'textobjects') end) + + -- Move textobjects + local move = require('nvim-treesitter-textobjects.move') + vim.keymap.set({'n', 'x', 'o'}, ']f', function() move.goto_next_start('@function.outer', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, ']c', function() move.goto_next_start('@conditional.outer', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, ']o', function() move.goto_next_start('@loop.outer', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, ']b', function() move.goto_next_start('@block.outer', 'textobjects') end) + + vim.keymap.set({'n', 'x', 'o'}, ']F', function() move.goto_next_end('@function.outer', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, ']C', function() move.goto_next_end('@conditional.outer', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, ']O', function() move.goto_next_end('@loop.outer', 'textobjects') end) + + vim.keymap.set({'n', 'x', 'o'}, '[f', function() move.goto_previous_start('@function.outer', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, '[c', function() move.goto_previous_start('@conditional.outer', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, '[o', function() move.goto_previous_start('@loop.outer', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, '[b', function() move.goto_previous_start('@block.outer', 'textobjects') end) + + vim.keymap.set({'n', 'x', 'o'}, '[F', function() move.goto_previous_end('@function.outer', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, '[C', function() move.goto_previous_end('@conditional.outer', 'textobjects') end) + vim.keymap.set({'n', 'x', 'o'}, '[O', function() move.goto_previous_end('@loop.outer', 'textobjects') end) + + -- Make movements repeatable with ; and , + local ts_repeat_move = require('nvim-treesitter-textobjects.repeatable_move') + vim.keymap.set({'n', 'x', 'o'}, ';', ts_repeat_move.repeat_last_move_next) + vim.keymap.set({'n', 'x', 'o'}, ',', ts_repeat_move.repeat_last_move_previous) + + -- Make builtin f, F, t, T also repeatable + vim.keymap.set({'n', 'x', 'o'}, 'f', ts_repeat_move.builtin_f_expr, { expr = true }) + vim.keymap.set({'n', 'x', 'o'}, 'F', ts_repeat_move.builtin_F_expr, { expr = true }) + vim.keymap.set({'n', 'x', 'o'}, 't', ts_repeat_move.builtin_t_expr, { expr = true }) + vim.keymap.set({'n', 'x', 'o'}, 'T', ts_repeat_move.builtin_T_expr, { expr = true }) +end + +return M diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..3f74c55 --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,44 @@ +local M = {} + +M.install = { src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "main" } + +M.setup = function() + require("nvim-treesitter").setup { + install_dir = vim.fn.stdpath('data') .. '/site', + indent = { + enable = true, + }, + } + + -- Install parsers + require('nvim-treesitter').install({ + 'json', + 'javascript', + 'typescript', + 'tsx', + 'yaml', + 'html', + 'css', + 'markdown', + 'markdown_inline', + 'bash', + 'lua', + 'vim', + 'dockerfile', + 'gitignore', + 'php', + 'latex', + 'blade' + }) + + vim.api.nvim_create_autocmd('FileType', { + pattern = { + 'php', + 'ts', + 'vue', + }, + callback = function() vim.treesitter.start() end, + }) +end + +return M diff --git a/.config/nvim/nvim-pack-lock.json b/.config/nvim/nvim-pack-lock.json new file mode 100644 index 0000000..85e1d08 --- /dev/null +++ b/.config/nvim/nvim-pack-lock.json @@ -0,0 +1,87 @@ +{ + "plugins": { + "FixCursorHold.nvim": { + "rev": "1900f89dc17c603eec29960f57c00bd9ae696495", + "src": "https://github.com/antoinemadec/FixCursorHold.nvim" + }, + "diffview.nvim": { + "rev": "4516612fe98ff56ae0415a259ff6361a89419b0a", + "src": "https://github.com/sindrets/diffview.nvim" + }, + "gitsigns.nvim": { + "rev": "130beacf8a51f00aede9c31064c749136679a321", + "src": "https://github.com/lewis6991/gitsigns.nvim" + }, + "harpoon": { + "rev": "87b1a3506211538f460786c23f98ec63ad9af4e5", + "src": "https://github.com/ThePrimeagen/harpoon", + "version": "'harpoon2'" + }, + "kanagawa.nvim": { + "rev": "aef7f5cec0a40dbe7f3304214850c472e2264b10", + "src": "https://github.com/rebelot/kanagawa.nvim" + }, + "mason.nvim": { + "rev": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800", + "src": "https://github.com/mason-org/mason.nvim" + }, + "mini.pick": { + "rev": "0c56dc3ef9b15e9659ce09331fdc82449349701b", + "src": "https://github.com/nvim-mini/mini.pick" + }, + "neotest": { + "rev": "deadfb1af5ce458742671ad3a013acb9a6b41178", + "src": "https://github.com/nvim-neotest/neotest" + }, + "neotest-docker-phpunit.nvim": { + "rev": "1da5ab0eac5684bdfdc8dc248e4bc357a58d7d91", + "src": "https://github.com/praem90/neotest-docker-phpunit.nvim" + }, + "neotest-go": { + "rev": "59b50505053f9c45a9febb79e11a56206c3e3901", + "src": "https://github.com/nvim-neotest/neotest-go" + }, + "neotest-phpunit": { + "rev": "2761ae9e9a385e491a9731f8c52824e1be64a68f", + "src": "https://github.com/olimorris/neotest-phpunit" + }, + "nvim-lint": { + "rev": "1f19dacd945a7b1a57f29f32b2d7168384df3d36", + "src": "https://github.com/mfussenegger/nvim-lint" + }, + "nvim-lspconfig": { + "rev": "d696e36d5792daf828f8c8e8d4b9aa90c1a10c2a", + "src": "https://github.com/neovim/nvim-lspconfig" + }, + "nvim-nio": { + "rev": "21f5324bfac14e22ba26553caf69ec76ae8a7662", + "src": "https://github.com/nvim-neotest/nvim-nio" + }, + "nvim-treesitter": { + "rev": "36fcb4a4238928f0b627e1ab84ade0acc1facc2c", + "src": "https://github.com/nvim-treesitter/nvim-treesitter", + "version": "'main'" + }, + "nvim-treesitter-textobjects": { + "rev": "ecd03f5811eb5c66d2fa420b79121b866feecd82", + "src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects", + "version": "'main'" + }, + "oil.nvim": { + "rev": "756dec855b4811f2d27f067a3aca477f368d99f5", + "src": "https://github.com/stevearc/oil.nvim" + }, + "plenary.nvim": { + "rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509", + "src": "https://github.com/nvim-lua/plenary.nvim" + }, + "tmux.nvim": { + "rev": "2c1c3be0ef287073cef963f2aefa31a15c8b9cd8", + "src": "https://github.com/aserowy/tmux.nvim" + }, + "vim-fugitive": { + "rev": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4", + "src": "https://github.com/tpope/vim-fugitive" + } + } +} \ No newline at end of file diff --git a/.config/nvim/snippets/package.json b/.config/nvim/snippets/package.json deleted file mode 100644 index 6357e29..0000000 --- a/.config/nvim/snippets/package.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"my-snippets","contributes":{"snippets":[{"path":".\/vue.json","language":["vue"]}]},"description":"This package.json has been generated by nvim-scissors."} \ No newline at end of file diff --git a/.config/nvim/snippets/vue.json b/.config/nvim/snippets/vue.json deleted file mode 100644 index 2be3552..0000000 --- a/.config/nvim/snippets/vue.json +++ /dev/null @@ -1 +0,0 @@ -{"t + $t":{"prefix":["t","$t"],"body":"{{ $t('${1}') }}"},"this.t + this.$t":{"prefix":["this.t","this.$t"],"body":"this.$t('${1}')"}} \ No newline at end of file diff --git a/.config/river/init b/.config/river/init index ed85c79..7757c9b 100755 --- a/.config/river/init +++ b/.config/river/init @@ -3,7 +3,7 @@ riverctl map normal Super+Shift Return spawn alacritty riverctl map normal Super P spawn "wofi --show drun" -riverctl map normal Super T spawn ~/.config/river/scripts/toggle-caps-esc.sh +riverctl map normal Super T spawn ~/.config/river/scripts/toggle-caps-esc riverctl map normal Super+Shift S spawn 'grim -g "$(slurp)" - | wl-copy' diff --git a/.config/river/scripts/toggle-caps-esc b/.config/river/scripts/toggle-caps-esc new file mode 100755 index 0000000..d7c2bf9 --- /dev/null +++ b/.config/river/scripts/toggle-caps-esc @@ -0,0 +1,20 @@ +#!/bin/bash + +# File to store the current state +STATE_FILE="$HOME/.caps_esc_swap_state" + +# Default layout - change this to match your keyboard layout (us, au, etc.) +LAYOUT="${RIVER_KEYBOARD_LAYOUT:-us}" + +# Check current state +if [ -f "$STATE_FILE" ]; then + # Currently swapped, so swap back to normal + riverctl keyboard-layout "$LAYOUT" + rm "$STATE_FILE" + echo "Restored CapsLock and Escape to normal" +else + # Not swapped, so swap them + riverctl keyboard-layout -options "caps:swapescape" "$LAYOUT" + touch "$STATE_FILE" + echo "Swapped CapsLock and Escape" +fi diff --git a/.config/river/scripts/toggle-caps-esc.sh b/.config/river/scripts/toggle-caps-esc.sh deleted file mode 100755 index 1c78e57..0000000 --- a/.config/river/scripts/toggle-caps-esc.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# Check if keyd is using the swapped config -if pgrep -f "keyd.*default.conf" > /dev/null && keyd list | grep -q "capslock = esc"; then - # Currently swapped, switch to normal config - sudo cp ~/.config/keyd/normal.conf ~/.config/keyd/default.conf - sudo keyd reload - notify-send "Keyboard Layout" "Caps Lock and Escape returned to normal" -i input-keyboard -else - # Not swapped, switch to swapped config - sudo cp ~/.config/keyd/swapped.conf ~/.config/keyd/default.conf - sudo keyd reload - notify-send "Keyboard Layout" "Caps Lock and Escape swapped" -i input-keyboard -fi diff --git a/.local/bin/git-fucked b/.local/bin/git-fucked deleted file mode 100755 index 2e20231..0000000 --- a/.local/bin/git-fucked +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -echo "You fucking bozo" diff --git a/.local/bin/hyprland-monitor-switcher.sh b/.local/bin/hyprland-monitor-switcher.sh deleted file mode 100755 index a8eb8cc..0000000 --- a/.local/bin/hyprland-monitor-switcher.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -# Hyprland Monitor Management Script -# Disables eDP-1 when both DP-5 and DP-6 are connected - -# Function to check if a monitor is connected -check_monitor_connected() { - local monitor_name="$1" - hyprctl monitors -j | jq -r ".[].name" | grep -q "^${monitor_name}$" -} - -# Function to check if a monitor is disabled -check_monitor_disabled() { - local monitor_name="$1" - hyprctl monitors -j | jq -r ".[] | select(.name == \"${monitor_name}\") | .disabled" 2>/dev/null -} - -# Function to disable a monitor -disable_monitor() { - local monitor_name="$1" - echo "Disabling monitor: $monitor_name" - hyprctl keyword monitor "$monitor_name,disable" -} - -# Function to enable a monitor (you might want to customize the resolution/position) -enable_monitor() { - local monitor_name="$1" - echo "Enabling monitor: $monitor_name" - # Adjust the resolution and position as needed for your eDP-1 - hyprctl keyword monitor "$monitor_name,preferred,auto,1" -} - -# Main logic -main() { - # Check if both external monitors are connected - if check_monitor_connected "DP-5" && check_monitor_connected "DP-6"; then - echo "Both DP-5 and DP-6 are connected" - - # Check if eDP-1 is currently enabled - if check_monitor_connected "eDP-1"; then - local edp_disabled=$(check_monitor_disabled "eDP-1") - if [[ "$edp_disabled" == "false" ]]; then - echo "eDP-1 is enabled, disabling it..." - disable_monitor "eDP-1" - else - echo "eDP-1 is already disabled" - fi - else - echo "eDP-1 is not detected" - fi - - else - echo "Not both external monitors are connected" - - # Check if eDP-1 exists and is disabled, then enable it - if check_monitor_connected "eDP-1"; then - local edp_disabled=$(check_monitor_disabled "eDP-1") - if [[ "$edp_disabled" == "true" ]]; then - echo "eDP-1 is disabled, enabling it..." - enable_monitor "eDP-1" - else - echo "eDP-1 is already enabled" - fi - else - echo "eDP-1 is not detected" - fi - fi -} - -# Run the main function -main "$@" diff --git a/.local/bin/scale-external-display.sh b/.local/bin/scale-external-display.sh deleted file mode 100755 index 0c71e19..0000000 --- a/.local/bin/scale-external-display.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -xrandr --output HDMI-1 --scale 1.5x1.5 diff --git a/.local/bin/toggle-swapescape-hyprland b/.local/bin/toggle-swapescape-hyprland deleted file mode 100755 index 5c35c2a..0000000 --- a/.local/bin/toggle-swapescape-hyprland +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# Script to toggle caps:swapescape setting in Hyprland -# Save this as ~/.config/hypr/scripts/toggle-caps-escape.sh - -# Check current state -current_setting=$(hyprctl getoption input:kb_options | grep -o "caps:swapescape" || echo "") - -if [ -n "$current_setting" ]; then - # Currently swapped, disable it - hyprctl keyword input:kb_options "" - notify-send "Keyboard Layout" "Caps Lock and Escape returned to normal" -i input-keyboard -else - # Not swapped, enable it - hyprctl keyword input:kb_options "caps:swapescape" - notify-send "Keyboard Layout" "Caps Lock and Escape swapped" -i input-keyboard -fi diff --git a/.tmux.conf b/.tmux.conf index f0edffc..e8cf919 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -90,36 +90,7 @@ bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer" bind-key -r m run-shell "~/.local/bin/tmux-music" -set -g mode-style "fg=#98c379,bg=#3d4350" - -set -g message-style "fg=#98c379,bg=#3d4350" -set -g message-command-style "fg=#98c379,bg=#3d4350" - -set -g pane-border-style "fg=#3d4350" -set -g pane-active-border-style "fg=#98c379" - -set -g status "on" -set -g status-justify "left" - -set -g status-style "fg=#98c379,bg=#22262d" - -set -g status-left-length "100" -set -g status-right-length "100" - -set -g status-left-style NONE -set -g status-right-style NONE - -set -g status-left "#[fg=#282c34,bg=#98c379,bold] #S #[fg=#98c379,bg=#22262d,nobold,nounderscore,noitalics]" -set -g status-right "#[fg=#22262d,bg=#22262d,nobold,nounderscore,noitalics]#[fg=#98c379,bg=#22262d] #{prefix_highlight} #[fg=#3d4350,bg=#22262d,bold,nounderscore,noitalics]#[fg=#98c379,bg=#3d4350] %Y-%m-%d  %I:%M %p #[fg=#98c379,bg=#3d4350,nobold,nounderscore,noitalics]#[fg=#282c34,bg=#98c379,bold] #h " -if-shell '[ "$(tmux show-option -gqv "clock-mode-style")" == "24" ]' { - set -g status-right "#[fg=#22262d,bg=#22262d,nobold,nounderscore,noitalics]#[fg=#98c379,bg=#22262d] #{prefix_highlight} #[fg=#3d4350,bg=#22262d,bold,nounderscore,noitalics]#[fg=#98c379,bg=#3d4350] %Y-%m-%d  %H:%M #[fg=#98c379,bg=#3d4350,nobold,nounderscore,noitalics]#[fg=#282c34,bg=#98c379,bold] #h " -} - -setw -g window-status-activity-style "underscore,fg=#98c379,bg=#22262d" -setw -g window-status-separator "" -setw -g window-status-style "NONE,fg=#98c379,bg=#22262d" -setw -g window-status-format "#[fg=#22262d,bg=#22262d,nobold,nounderscore,noitalics]#[default] #I  #W #F #[fg=#22262d,bg=#22262d,nobold,nounderscore,noitalics]" -setw -g window-status-current-format "#[fg=#22262d,bg=#3d4350,nobold,nounderscore,noitalics]#[fg=#98c379,bg=#3d4350,bold] #I  #W #F #[fg=#3d4350,bg=#22262d,nobold,nounderscore,noitalics]" +set -g @plugin 'Nybkox/tmux-kanagawa' # Requires tmux-plugins/tmux-prefix-highlight set -g @prefix_highlight_output_prefix "#[fg=#61afef]#[bg=#22262d]#[fg=#22262d]#[bg=#61afef]"