diff --git a/lua/ow/bootstrap.lua b/lua/ow/bootstrap.lua index 1bd8a04..133f358 100644 --- a/lua/ow/bootstrap.lua +++ b/lua/ow/bootstrap.lua @@ -2,7 +2,9 @@ local version = vim.version() if version.major == 0 then if version.minor < 11 then - error("Neovim version 0.11 or above is required with this configuration.") + error( + "Neovim version 0.11 or above is required with this configuration." + ) end end @@ -16,7 +18,7 @@ if not vim.uv.fs_stat(lazypath) then util.assert_installed("cc") end util.assert_installed("make") - util.assert_any_installed({ "curl", "wget", }) + util.assert_any_installed({ "curl", "wget" }) util.assert_installed("unzip") util.assert_installed("tar") util.assert_installed("gzip") diff --git a/lua/ow/core/autocommands.lua b/lua/ow/core/autocommands.lua index 43fd7ad..e0af452 100644 --- a/lua/ow/core/autocommands.lua +++ b/lua/ow/core/autocommands.lua @@ -63,7 +63,7 @@ vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("TermLeave", { desc = "Reload buffers when leaving terminal", pattern = "*", - callback = function () + callback = function() vim.cmd.checktime() - end + end, }) diff --git a/lua/ow/core/globals.lua b/lua/ow/core/globals.lua index 7749418..7289eb5 100644 --- a/lua/ow/core/globals.lua +++ b/lua/ow/core/globals.lua @@ -2,15 +2,15 @@ vim.g.mapleader = " " vim.g.vimsyn_embed = "lpP" vim.g.netrw_banner = 0 vim.g.netrw_liststyle = 1 -vim.g.netrw_list_hide = '\\.venv/,\\.git/' +vim.g.netrw_list_hide = "\\.venv/,\\.git/" vim.g.netrw_maxfilenamelen = 47 vim.g.netrw_mousemaps = 0 -vim.g.netrw_sizestyle = 'H' -vim.g.netrw_sort_by = 'name' -vim.g.netrw_sort_options = 'i' -vim.g.netrw_sort_sequence = '[\\/]\\s*,*' +vim.g.netrw_sizestyle = "H" +vim.g.netrw_sort_by = "name" +vim.g.netrw_sort_options = "i" +vim.g.netrw_sort_sequence = "[\\/]\\s*,*" vim.g.netrw_special_syntax = 1 -vim.g.netrw_timefmt = '%d-%m-%Y %H:%M' +vim.g.netrw_timefmt = "%d-%m-%Y %H:%M" vim.g.c_syntax_for_h = 1 vim.g.python_indent = { open_paren = "shiftwidth()", diff --git a/lua/ow/core/mappings.lua b/lua/ow/core/mappings.lua index d905840..4feb6a0 100644 --- a/lua/ow/core/mappings.lua +++ b/lua/ow/core/mappings.lua @@ -3,18 +3,18 @@ vim.keymap.set("n", "tn", vim.cmd.tabnew) vim.keymap.set("n", "tq", vim.cmd.tabclose) -- Clipboard -if vim.env.TMUX and vim.fn.executable('tmux') then +if vim.env.TMUX and vim.fn.executable("tmux") then vim.keymap.set( { "n", "x" }, "y", "\"+y:call system('tmux load-buffer -w -', @+)" ) else - vim.keymap.set({ "n", "x", }, "y", '"+y') + vim.keymap.set({ "n", "x" }, "y", '"+y') end -vim.keymap.set({ "n", "x", }, "p", '"+p') -vim.keymap.set({ "n", "x", }, "P", '"+P') -vim.keymap.set({ "n", "x", }, "+", ":call setreg('+', @\")") +vim.keymap.set({ "n", "x" }, "p", '"+p') +vim.keymap.set({ "n", "x" }, "P", '"+P') +vim.keymap.set({ "n", "x" }, "+", ":call setreg('+', @\")") -- Allow exiting insert mode in terminal by hitting vim.keymap.set("t", "", "") @@ -29,8 +29,8 @@ vim.keymap.set("t", "", function() end) -- Use :diffput/get instead of normal one to allow staging visual selection -vim.keymap.set({"n", "x"}, "dp", ":diffput") -vim.keymap.set({"n", "x"}, "do", ":diffget") +vim.keymap.set({ "n", "x" }, "dp", ":diffput") +vim.keymap.set({ "n", "x" }, "do", ":diffget") local close_pum = function() if vim.fn.pumvisible() ~= 0 then @@ -51,52 +51,52 @@ end, { expr = true }) vim.keymap.set("n", "q", ":bp | bd#") -- Allow (de)indenting without deselecting -vim.keymap.set({"x"}, "<", "", ">gv") +vim.keymap.set({ "x" }, "<", "", ">gv") -- Remove default mappings vim.keymap.set("", "", "") -vim.keymap.set('n', 'K', function() - if vim.bo.filetype == 'vim' or vim.bo.filetype == 'help' then - vim.cmd('help ' .. vim.fn.expand('')) +vim.keymap.set("n", "K", function() + if vim.bo.filetype == "vim" or vim.bo.filetype == "help" then + vim.cmd("help " .. vim.fn.expand("")) else - vim.cmd('Man ' .. vim.fn.expand('')) + vim.cmd("Man " .. vim.fn.expand("")) end end) -- Remove right-click menu items -vim.cmd.aunmenu({ "PopUp.-1-", }) -vim.cmd.aunmenu({ "PopUp.How-to\\ disable\\ mouse", }) +vim.cmd.aunmenu({ "PopUp.-1-" }) +vim.cmd.aunmenu({ "PopUp.How-to\\ disable\\ mouse" }) -- Insert-mode Emacs bindings -vim.keymap.set('i', '', '') -vim.keymap.set('i', '', '') -vim.keymap.set('i', '', '^') -vim.keymap.set('i', '', '$') +vim.keymap.set("i", "", "") +vim.keymap.set("i", "", "") +vim.keymap.set("i", "", "^") +vim.keymap.set("i", "", "$") -- vim.keymap.set('i', '', 'x') -- Overrides de-indent -vim.keymap.set('i', '', 'w') -vim.keymap.set('i', '', 'b') -vim.keymap.set('i', '', 'dw') -vim.keymap.set('i', '', 'db') +vim.keymap.set("i", "", "w") +vim.keymap.set("i", "", "b") +vim.keymap.set("i", "", "dw") +vim.keymap.set("i", "", "db") -- Command-mode Emacs bindings -vim.keymap.set('c', '', '') -vim.keymap.set('c', '', '') -vim.keymap.set('c', '', '') -vim.keymap.set('c', '', '') -vim.keymap.set('c', '', '') -vim.keymap.set('c', '', '') -vim.keymap.set('c', '', '') -vim.keymap.set('c', '', '') -vim.keymap.set('c', '', '') -vim.keymap.set('c', '', '') -vim.keymap.set('c', '', '') +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") -vim.keymap.set('n', 've', function() - if vim.o.virtualedit == 'all' then - vim.o.virtualedit = 'block' +vim.keymap.set("n", "ve", function() + if vim.o.virtualedit == "all" then + vim.o.virtualedit = "block" else - vim.o.virtualedit = 'all' + vim.o.virtualedit = "all" end end) @@ -110,7 +110,7 @@ vim.keymap.set("n", "r", function() end) -- Removed bindings -vim.keymap.set('n', 'gr', '') +vim.keymap.set("n", "gr", "") -- Default bindings that are good to know: -- insert mode: diff --git a/lua/ow/core/options.lua b/lua/ow/core/options.lua index 4df287c..a01c5d9 100644 --- a/lua/ow/core/options.lua +++ b/lua/ow/core/options.lua @@ -34,7 +34,7 @@ vim.opt.completeopt:append({ "noselect", }) -- set nowrap -vim.opt.matchpairs:append({ "<:>", }) +vim.opt.matchpairs:append({ "<:>" }) -- Only relevant with wrap enabled (default) vim.opt.linebreak = true vim.opt.breakindent = true @@ -65,7 +65,7 @@ vim.opt.diffopt:append("closeoff") vim.opt.diffopt:append("internal") -- These make diffs easier to read, please see the following: -- https://vimways.org/2018/the-power-of-diff/ -vim.opt.diffopt:append({ "indent-heuristic", "algorithm:histogram", }) +vim.opt.diffopt:append({ "indent-heuristic", "algorithm:histogram" }) vim.opt.diffopt:append("linematch:40") vim.opt.hlsearch = true vim.opt.laststatus = 2 @@ -75,7 +75,7 @@ vim.opt.shortmess:append("a") vim.opt.autoread = true -- vim.opt.cmdheight = 0 -- To hide cmdline when not used. Disabled due to -- causing "Press ENTER to continue" messages for small messages. -vim.opt.jumpoptions = {'stack', 'view', 'clean'} +vim.opt.jumpoptions = { "stack", "view", "clean" } vim.opt.updatetime = 100 vim.opt.guicursor:append("a:Cursor") @@ -83,7 +83,7 @@ function _G._status_line_git() local status = vim.b.gitsigns_status_dict if not status then - return '' + return "" end local added = status.added or 0 @@ -93,15 +93,24 @@ function _G._status_line_git() local parts = {} if added > 0 then - table.insert(parts, string.format("%%#GitSignsAdd#+%d%%*", status.added)) + table.insert( + parts, + string.format("%%#GitSignsAdd#+%d%%*", status.added) + ) end if changed > 0 then - table.insert(parts, string.format('%%#GitSignsChange#~%d%%*', status.changed)) + table.insert( + parts, + string.format("%%#GitSignsChange#~%d%%*", status.changed) + ) end if removed > 0 then - table.insert(parts, string.format('%%#GitSignsDelete#-%d%%*', status.removed)) + table.insert( + parts, + string.format("%%#GitSignsDelete#-%d%%*", status.removed) + ) end return table.concat(parts, " ") @@ -120,24 +129,24 @@ function _G._status_line_diagnostics() end if warn > 0 then - table.insert(parts, string.format('%%#DiagnosticWarn#W%d%%*', warn)) + table.insert(parts, string.format("%%#DiagnosticWarn#W%d%%*", warn)) end if hint > 0 then - table.insert(parts, string.format('%%#DiagnosticHint#H%d%%*', hint)) + table.insert(parts, string.format("%%#DiagnosticHint#H%d%%*", hint)) end if info > 0 then - table.insert(parts, string.format('%%#DiagnosticInfo#I%d%%*', info)) + table.insert(parts, string.format("%%#DiagnosticInfo#I%d%%*", info)) end return table.concat(parts, " ") end vim.opt.statusline = " %{expand('%:.')}%4( %m%) %{%v:lua._status_line_git()%} %=" - .. " %{%v:lua._status_line_diagnostics()%} " - .. " %{&filetype} %-6.6{&fileencoding}" - .. " %-4.4{&fileformat} %4.4(%p%%%)%6.6l:%-3.3v" + .. " %{%v:lua._status_line_diagnostics()%} " + .. " %{&filetype} %-6.6{&fileencoding}" + .. " %-4.4{&fileformat} %4.4(%p%%%)%6.6l:%-3.3v" vim.cmd("syntax on") vim.cmd("filetype plugin indent on") diff --git a/lua/ow/log.lua b/lua/ow/log.lua index e41d012..7d90d0e 100644 --- a/lua/ow/log.lua +++ b/lua/ow/log.lua @@ -4,41 +4,28 @@ local M = {} ---@param fmt string ---@param ... any function M.error(fmt, ...) - vim.notify( - fmt:format(...), - vim.log.levels.ERROR - ) + vim.notify(fmt:format(...), vim.log.levels.ERROR) end --- Log warning message ---@param fmt string ---@param ... any function M.warning(fmt, ...) - vim.notify( - fmt:format(...), - vim.log.levels.WARN - ) + vim.notify(fmt:format(...), vim.log.levels.WARN) end --- Log info message ---@param fmt string ---@param ... any function M.info(fmt, ...) - vim.notify( - fmt:format(...), - vim.log.levels.INFO - ) + vim.notify(fmt:format(...), vim.log.levels.INFO) end --- Log debug message ---@param fmt string ---@param ... any function M.debug(fmt, ...) - vim.notify( - fmt:format(...), - vim.log.levels.DEBUG - ) + vim.notify(fmt:format(...), vim.log.levels.DEBUG) end return M - diff --git a/lua/ow/lsp/keymap.lua b/lua/ow/lsp/keymap.lua index 388b334..2f2d3e8 100644 --- a/lua/ow/lsp/keymap.lua +++ b/lua/ow/lsp/keymap.lua @@ -52,7 +52,10 @@ function M.set_defaults(bufnr) mode = { "n", "i" }, lhs = "", rhs = function() - vim.lsp.buf.signature_help({ border = "rounded", max_width = 80 }) + vim.lsp.buf.signature_help({ + border = "rounded", + max_width = 80, + }) end, }, { @@ -86,7 +89,7 @@ function M.set_defaults(bufnr) if telescope then vim.list_extend(keymaps, { { mode = "n", lhs = "dl", rhs = telescope.diagnostics }, - { mode = "n", lhs = "grt", rhs = telescope.lsp_type_definitions, }, + { mode = "n", lhs = "grt", rhs = telescope.lsp_type_definitions }, { mode = "n", lhs = "gd", rhs = telescope.lsp_definitions }, { mode = "n", lhs = "gri", rhs = telescope.lsp_implementations }, { mode = "n", lhs = "grr", rhs = telescope.lsp_references }, @@ -94,7 +97,7 @@ function M.set_defaults(bufnr) else vim.list_extend(keymaps, { { mode = "n", lhs = "dl", rhs = vim.diagnostic.setloclist }, - { mode = "n", lhs = "grt", rhs = vim.lsp.buf.type_definition, }, + { mode = "n", lhs = "grt", rhs = vim.lsp.buf.type_definition }, { mode = "n", lhs = "gd", rhs = vim.lsp.buf.definition }, }) end diff --git a/lua/ow/meta/uv.lua b/lua/ow/meta/uv.lua index f2928bf..3c4d6a7 100644 --- a/lua/ow/meta/uv.lua +++ b/lua/ow/meta/uv.lua @@ -2450,7 +2450,13 @@ uv_udp_t.getpeername = uv.udp_getpeername ---@param interface_addr string|nil ---@param membership uv.aliases.udp_membership ---@return 0|nil success, string? err_name, string? err_msg -function uv.udp_set_membership(udp, multicast_addr, interface_addr, membership) end +function uv.udp_set_membership( + udp, + multicast_addr, + interface_addr, + membership +) +end uv_udp_t.set_membership = uv.udp_set_membership --- @@ -2464,7 +2470,14 @@ uv_udp_t.set_membership = uv.udp_set_membership ---@param source_addr string ---@param membership uv.aliases.udp_membership ---@return 0|nil success, string? err_name, string? err_msg -function uv.udp_set_source_membership(udp, multicast_addr, interface_addr, source_addr, membership) end +function uv.udp_set_source_membership( + udp, + multicast_addr, + interface_addr, + source_addr, + membership +) +end uv_udp_t.set_source_membership = uv.udp_set_source_membership --- @@ -4141,4 +4154,3 @@ function uv.metrics_idle_time() end uv.constants = {} return uv - diff --git a/lua/ow/plugins/dap.lua b/lua/ow/plugins/dap.lua index 0782b4c..5578088 100644 --- a/lua/ow/plugins/dap.lua +++ b/lua/ow/plugins/dap.lua @@ -2,85 +2,89 @@ ---@type LazyPluginSpec return { - "mfussenegger/nvim-dap", - keys = { - { - "db", - function() - require("dap").toggle_breakpoint() - end, - }, - { - "", - function() - require("dap.ui.widgets").hover() - end, - }, - { - "", - function() - require("dap").step_into() - end, - }, - { - "", - function() - require("dap").step_over() - end, - }, - { - "", - function() - require("dap").step_out() - end, - }, - { - "", - function() - require("dap").continue() - end, - }, - { - "", - function() - local widgets = require("dap.ui.widgets") - widgets.centered_float(widgets.scopes) - end, - }, - { - "", - function() - require("dap").terminate() - end, - }, - }, - config = function() - local dap = require("dap") + "mfussenegger/nvim-dap", + keys = { + { + "db", + function() + require("dap").toggle_breakpoint() + end, + }, + { + "", + function() + require("dap.ui.widgets").hover() + end, + }, + { + "", + function() + require("dap").step_into() + end, + }, + { + "", + function() + require("dap").step_over() + end, + }, + { + "", + function() + require("dap").step_out() + end, + }, + { + "", + function() + require("dap").continue() + end, + }, + { + "", + function() + local widgets = require("dap.ui.widgets") + widgets.centered_float(widgets.scopes) + end, + }, + { + "", + function() + require("dap").terminate() + end, + }, + }, + config = function() + local dap = require("dap") - -- https://sourceware.org/gdb/current/onlinedocs/gdb#Debugger-Adapter-Protocol - dap.adapters.gdb = { - type = "executable", - command = "gdb", - args = { - "--interpreter=dap", - "--eval-command", - "set print pretty on", - "--eval-command", - "set startup-with-shell off", - }, - } + -- https://sourceware.org/gdb/current/onlinedocs/gdb#Debugger-Adapter-Protocol + dap.adapters.gdb = { + type = "executable", + command = "gdb", + args = { + "--interpreter=dap", + "--eval-command", + "set print pretty on", + "--eval-command", + "set startup-with-shell off", + }, + } - dap.configurations.cpp = { - { - name = "Launch", - type = "gdb", - request = "launch", - program = function() - return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") - end, - cwd = "${workspaceFolder}", - stopAtBeginningOfMainSubprogram = false, - }, - } - end, + dap.configurations.cpp = { + { + name = "Launch", + type = "gdb", + request = "launch", + program = function() + return vim.fn.input( + "Path to executable: ", + vim.fn.getcwd() .. "/", + "file" + ) + end, + cwd = "${workspaceFolder}", + stopAtBeginningOfMainSubprogram = false, + }, + } + end, } diff --git a/lua/ow/plugins/gitsigns.lua b/lua/ow/plugins/gitsigns.lua index 4a37ce4..a270c53 100644 --- a/lua/ow/plugins/gitsigns.lua +++ b/lua/ow/plugins/gitsigns.lua @@ -10,50 +10,54 @@ return { }, on_attach = function(bufnr) local gs = package.loaded.gitsigns - vim.keymap.set("n", "gv", gs.select_hunk, { buffer = bufnr }) - vim.keymap.set("n", "gs", gs.stage_hunk, { buffer = bufnr }) - vim.keymap.set( - "x", - "gs", - function() - gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) - end, - { buffer = bufnr } - ) - vim.keymap.set({ "n", "x" }, "gu", gs.undo_stage_hunk, { buffer = bufnr }) - vim.keymap.set("n", "gr", gs.reset_hunk, { buffer = bufnr }) - vim.keymap.set("x", "gr", ":Gitsigns reset_hunk", { buffer = bufnr }) - vim.keymap.set("n", "g?", gs.preview_hunk, { buffer = bufnr }) vim.keymap.set( "n", - "gb", - function() - gs.blame_line { full = true, ignore_whitespace = true } - end, + "gv", + gs.select_hunk, + { buffer = bufnr } + ) + vim.keymap.set("n", "gs", gs.stage_hunk, { buffer = bufnr }) + vim.keymap.set("x", "gs", function() + gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end, { buffer = bufnr }) + vim.keymap.set( + { "n", "x" }, + "gu", + gs.undo_stage_hunk, + { buffer = bufnr } + ) + vim.keymap.set("n", "gr", gs.reset_hunk, { buffer = bufnr }) + vim.keymap.set( + "x", + "gr", + ":Gitsigns reset_hunk", { buffer = bufnr } ) vim.keymap.set( - { "n", "x" }, - "]g", function() - gs.next_hunk({ - wrap = true, - navigation_message = true, - foldopen = true, - preview = true, - }) - end - ) - vim.keymap.set( - { "n", "x" }, - "[g", function() - gs.prev_hunk({ - wrap = true, - navigation_message = true, - foldopen = true, - preview = true, - }) - end + "n", + "g?", + gs.preview_hunk, + { buffer = bufnr } ) + vim.keymap.set("n", "gb", function() + gs.blame_line({ full = true, ignore_whitespace = true }) + end, { buffer = bufnr }) + vim.keymap.set({ "n", "x" }, "]g", function() + gs.next_hunk({ + wrap = true, + navigation_message = true, + foldopen = true, + preview = true, + }) + end) + vim.keymap.set({ "n", "x" }, "[g", function() + gs.prev_hunk({ + wrap = true, + navigation_message = true, + foldopen = true, + preview = true, + }) + end) end, attach_to_untracked = true, sign_priority = 100, diff --git a/lua/ow/plugins/nvim-treesitter-context.lua b/lua/ow/plugins/nvim-treesitter-context.lua index 164eb82..4111ff5 100644 --- a/lua/ow/plugins/nvim-treesitter-context.lua +++ b/lua/ow/plugins/nvim-treesitter-context.lua @@ -2,7 +2,7 @@ return { "nvim-treesitter/nvim-treesitter-context", opts = { - mode = 'topline', + mode = "topline", max_lines = 3, multiline_threshold = 1, multiwindow = true, diff --git a/lua/ow/plugins/orgmode.lua b/lua/ow/plugins/orgmode.lua index f132cbd..e7d6e1d 100644 --- a/lua/ow/plugins/orgmode.lua +++ b/lua/ow/plugins/orgmode.lua @@ -31,6 +31,5 @@ return { org_agenda_span = "week", org_agenda_skip_scheduled_if_done = true, org_agenda_skip_deadline_if_done = true, - }, } diff --git a/lua/ow/plugins/telescope.lua b/lua/ow/plugins/telescope.lua index a6d57a4..5c30c40 100644 --- a/lua/ow/plugins/telescope.lua +++ b/lua/ow/plugins/telescope.lua @@ -28,7 +28,7 @@ return { }, file_ignore_patterns = { "^%.git/", - } + }, }, extensions = { undo = {