From 7c3289fded1f75f6e060f56bd06edc2a327744d9 Mon Sep 17 00:00:00 2001 From: Squibid Date: Tue, 6 May 2025 16:51:24 -0500 Subject: kitchen sink again :( --- lua/conf/autos.lua | 34 +++++------ lua/conf/binds.lua | 48 +++++++-------- lua/conf/context.lua | 20 ------- lua/conf/opts.lua | 74 +++++++++++++++-------- lua/conf/plugins/cmp.lua | 66 ++++++++++----------- lua/conf/plugins/comment.lua | 6 +- lua/conf/plugins/dap.lua | 46 +++++++-------- lua/conf/plugins/dressing.lua | 19 ------ lua/conf/plugins/fidget.lua | 4 +- lua/conf/plugins/gitsigns.lua | 64 ++++++++++---------- lua/conf/plugins/harpoon.lua | 10 ++-- lua/conf/plugins/headlines.lua | 21 ------- lua/conf/plugins/helpful.lua | 1 + lua/conf/plugins/hml.lua | 5 ++ lua/conf/plugins/instant.lua | 2 +- lua/conf/plugins/jdtls.lua | 81 +++++++++++++------------- lua/conf/plugins/leetcode.lua | 14 ++--- lua/conf/plugins/lsp_lines.lua | 4 +- lua/conf/plugins/luasnip.lua | 14 ++--- lua/conf/plugins/mason-lspconfig.lua | 34 +++++------ lua/conf/plugins/mason.lua | 6 +- lua/conf/plugins/mellow.lua | 16 ++--- lua/conf/plugins/mini-clue.lua | 52 ----------------- lua/conf/plugins/neogen.lua | 12 ++-- lua/conf/plugins/neorg.lua | 42 ++++++------- lua/conf/plugins/nvim-colorizer.lua | 4 +- lua/conf/plugins/nyooom.lua | 6 +- lua/conf/plugins/oil.lua | 110 +++++++++++++++++++++++++++++------ lua/conf/plugins/project.lua | 18 ------ lua/conf/plugins/telescope.lua | 79 ++++++++++++------------- lua/conf/plugins/todo-comments.lua | 6 +- lua/conf/plugins/treesitter.lua | 8 +-- lua/conf/plugins/treesj.lua | 10 ++-- lua/conf/plugins/ts-autotag.lua | 9 +-- lua/conf/plugins/undotree.lua | 4 +- lua/conf/plugins/vimtex.lua | 2 +- 36 files changed, 461 insertions(+), 490 deletions(-) delete mode 100644 lua/conf/context.lua delete mode 100644 lua/conf/plugins/dressing.lua delete mode 100644 lua/conf/plugins/headlines.lua create mode 100644 lua/conf/plugins/helpful.lua create mode 100644 lua/conf/plugins/hml.lua delete mode 100644 lua/conf/plugins/mini-clue.lua delete mode 100644 lua/conf/plugins/project.lua (limited to 'lua/conf') diff --git a/lua/conf/autos.lua b/lua/conf/autos.lua index b23d26e..c00745b 100644 --- a/lua/conf/autos.lua +++ b/lua/conf/autos.lua @@ -1,37 +1,37 @@ -local misc = require('core.misc') +local misc = require("core.misc") local auto, augroup = misc.auto, misc.augroup -- auto commands which interact with bufferes without modifying them -local bufcheck = augroup('bufcheck') +local bufcheck = augroup("bufcheck") -- auto commands which modify things on the filesystem -local fsmod = augroup('fsmod') +local fsmod = augroup("fsmod") -auto('FocusGained', { +auto("FocusGained", { group = bufcheck, - desc = 'Update contents of file.', - command = 'checktime' + desc = "Update contents of file.", + command = "checktime" }) -auto('TextYankPost', { +auto("TextYankPost", { group = bufcheck, - desc = 'Highlight on yank.', + desc = "Highlight on yank.", callback = function() vim.highlight.on_yank { timeout = 250 } end }) -auto('BufRead', { +auto("BufRead", { group = bufcheck, - desc = 'Return to the last place the buffer was closed in.', + desc = "Return to the last place the buffer was closed in.", callback = function() - vim.fn.setpos('.', vim.fn.getpos("'\"")) + vim.fn.setpos(".", vim.fn.getpos("'\"")) vim.cmd("norm! zz") end }) -auto('BufWritePre', { +auto("BufWritePre", { group = fsmod, - desc = 'remove trailing spaces on file save', + desc = "remove trailing spaces on file save", callback = function() local pos = vim.api.nvim_win_get_cursor(0) vim.cmd([[%s/\s\+$//e]]) @@ -39,12 +39,12 @@ auto('BufWritePre', { end }) -auto('BufWritePre', { +auto("BufWritePre", { group = fsmod, - desc = 'Basically mkdir -p.', + desc = "Basically mkdir -p.", callback = function(ctx) if ctx.match:match("^%w%w+://") then return end - local dir = vim.fn.fnamemodify(ctx.file, ':p:h') - vim.fn.mkdir(dir, 'p') + local dir = vim.fn.fnamemodify(ctx.file, ":p:h") + vim.fn.mkdir(dir, "p") end }) diff --git a/lua/conf/binds.lua b/lua/conf/binds.lua index 8f3c05e..9a9a7d6 100644 --- a/lua/conf/binds.lua +++ b/lua/conf/binds.lua @@ -1,23 +1,25 @@ -local misc = require('core.misc') +local misc = require("core.misc") local map = misc.map -- vim binds -vim.g.mapleader = ' ' -- set leader key +vim.g.mapleader = " " -- set leader key -map('x', 'p', [["_dP]], { desc = 'Greatest remap of all time.' }) -map('n', '', ':nohlsearch:echo', { desc = 'Clear search.' }) +map("x", "p", [["_dP]], { desc = "Greatest remap of all time." }) +map("n", "", ":nohlsearch:echo", { desc = "Clear search." }) -- move selected text up/down -map('v', '', ":m '<-2gv=gv", { desc = 'Move selected text up.' }) -map('v', '', ":m '>+1gv=gv", { desc = 'Move selected text down.' }) +map("v", "", ":m '<-2gv=gv", { desc = "Move selected text up." }) +map("v", "", ":m '>+1gv=gv", { desc = "Move selected text down." }) -- the cursor STAYS IN THE MIDDLE -map('n', '', 'mzJ`zdelm z') -- when combining lines -map('n', 'n', 'nzzzv') -- when searching -map('n', 'N', 'Nzzzv') -map('n', '', 'zzzv') -- half page jumping -map('n', '', 'zzzv') +map("n", "", "mzJ`zdelm z") -- when combining lines +map("n", "n", "nzzzv") -- when searching +map("n", "N", "Nzzzv") +map("n", "", "zzzv") -- half page jumping +map("n", "", "zzzv") -map('n', 'x', function() -- execute order 111 +map({ "n", "i" }, "", "") + +map("n", "x", function() -- execute order 111 local fn = vim.fn.expand("%:p") if vim.fn.getftype(fn) == "file" then local perm = vim.fn.getfperm(fn) @@ -31,14 +33,14 @@ map('n', 'x', function() -- execute order 111 else vim.notify("File doesn't exist", vim.log.levels.INFO, { title = misc.appid }) end -end, { desc = 'toggle executable flag of the file' }) +end, { desc = "toggle executable flag of the file" }) -- good spell suggestion ui -- (stolen from https://github.com/neovim/neovim/pull/25833) -vim.keymap.set('n', 'z=', function() +vim.keymap.set("n", "z=", function() local spell_on_choice = vim.schedule_wrap(function(_, idx) - if type(idx) == 'number' then - vim.cmd('normal! '..idx..'z=') + if type(idx) == "number" then + vim.cmd("normal! "..idx.."z=") end end) @@ -46,15 +48,15 @@ vim.keymap.set('n', 'z=', function() spell_on_choice(nil, vim.v.count) return end - local cword = vim.fn.expand('') - local prompt = 'Change '..vim.inspect(cword)..' to:' + local cword = vim.fn.expand("") + local prompt = "Change "..vim.inspect(cword).." to:" vim.ui.select(vim.fn.spellsuggest(cword, vim.o.lines), { prompt = prompt }, spell_on_choice) -end, { desc = 'Shows spelling suggestions' }) +end, { desc = "Shows spelling suggestions" }) -- quickfix -map('n', '', 'cnext') -map('n', '', 'cprev') -map('n', '', 'cclose') +map("n", "", "cnext") +map("n", "", "cprev") +map("n", "", "cclose") -- man pages -map('n', '', 'Man') +map("n", "", "Man") diff --git a/lua/conf/context.lua b/lua/conf/context.lua deleted file mode 100644 index b685afe..0000000 --- a/lua/conf/context.lua +++ /dev/null @@ -1,20 +0,0 @@ --- clear menu -vim.cmd([[:aunmenu PopUp]]) - --- add menu items -vim.cmd([[:amenu PopUp.Save\ Buffer :w]]) -vim.cmd([[:amenu PopUp.Save\ All\ Buffers :wa]]) -vim.cmd([[:nmenu PopUp.Select\ All ggVG]]) -vim.cmd([[:nmenu PopUp.Undo u]]) -vim.cmd([[:nmenu PopUp.Redo ]]) -vim.cmd([[:nmenu PopUp.Inspect Inspect]]) -vim.cmd([[:amenu PopUp.-1- ]]) -- dividers -vim.cmd([[:nmenu PopUp.Copy\ Line yy]]) -vim.cmd([[:vmenu PopUp.Copy\ Selection y]]) -vim.cmd([[:amenu PopUp.Paste p]]) -vim.cmd([[:vmenu PopUp.Cut d]]) -vim.cmd([[:nmenu PopUp.Cut dd]]) -vim.cmd([[:vmenu PopUp.-2- ]]) -- dividers -vim.cmd([[:nmenu PopUp.-2- ]]) -- dividers -vim.cmd([[:vmenu PopUp.Format\ Selection =]]) -vim.cmd([[:nmenu PopUp.Format\ Line ==]]) diff --git a/lua/conf/opts.lua b/lua/conf/opts.lua index 5d8a24f..e412389 100644 --- a/lua/conf/opts.lua +++ b/lua/conf/opts.lua @@ -1,4 +1,4 @@ -local misc = require('core.misc') +local misc = require("core.misc") local auto = misc.auto -- color stuff @@ -17,6 +17,7 @@ vim.opt.scrolloff = 5 vim.opt.wrap = true -- wraping lines vim.opt.linebreak = true -- fix where line is wraped vim.opt.cursorline = true +vim.opt.colorcolumn = { 80 } -- indents + tabs local tabwidth = 2 @@ -31,7 +32,7 @@ vim.opt.softtabstop = tabwidth -- Schedule the setting after `UiEnter` because it can increase startup-time. -- (yoinked from kickstart.nvim) vim.schedule(function() - vim.opt.clipboard = 'unnamedplus' -- system clipboard + vim.opt.clipboard = "unnamedplus" -- system clipboard end) vim.opt.updatetime = 200 @@ -49,12 +50,12 @@ vim.opt.showmatch = true vim.opt.incsearch = true -- wild menus -vim.opt.wildoptions = 'pum' +vim.opt.wildoptions = "pum" vim.opt.pumblend = 3 vim.opt.pumheight = 20 vim.opt.wildignorecase = true -vim.opt.wildignore = '*.o' +vim.opt.wildignore = "*.o" -- netrw vim.g.netrw_banner = 0 @@ -63,26 +64,31 @@ vim.g.netrw_liststyle = 1 vim.g.netrw_sizestyle = "H" vim.g.netrw_hide = 1 +-- border (this doesn"t actually do anything within vim, I"m just setting it +-- here so it"s easy to find) +vim.g.border_style = "solid" + -- folding auto("FileType", { callback = function() + -- FIXME: it causes errors every once in a while -- support lsp folding - if vim.fn.has("nvim-0.11") then - auto('LspAttach', { - callback = function(args) - local client = vim.lsp.get_client_by_id(args.data.client_id) - if not client then - return - end - - if client:supports_method('textDocument/foldingRange') then - local win = vim.api.nvim_get_current_win() - vim.wo[win][0].foldmethod = "expr" - vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()' - end - end, - }) - end + -- if vim.fn.has("nvim-0.11") then + -- auto("LspAttach", { + -- callback = function(args) + -- local client = vim.lsp.get_client_by_id(args.data.client_id) + -- if not client then + -- return + -- end + + -- if client:supports_method("textDocument/foldingRange") then + -- local win = vim.api.nvim_get_current_win() + -- vim.wo[win][0].foldmethod = "expr" + -- vim.wo[win][0].foldexpr = "v:lua.vim.lsp.foldexpr()" + -- end + -- end, + -- }) + -- end -- or just rely on treesitter if require("nvim-treesitter.parsers").has_parser() then @@ -96,7 +102,7 @@ auto("FileType", { -- lsp folding: vim.o.foldexpr = "v:lua.vim.lsp.foldexpr()" -- waiting on https://github.com/neovim/neovim/pull/31311 to hit a release -require('core.lsp.functions').add_capabilities({ +require("core.lsp.functions").add_capabilities({ textDocument = { foldingRange = { dynamicRegistration = false, @@ -108,13 +114,29 @@ require('core.lsp.functions').add_capabilities({ vim.opt.foldlevelstart = 99 vim.opt.foldlevel = 99 vim.opt.foldenable = true -vim.o.fillchars = 'fold: ' +vim.o.fillchars = "fold: " -_G.Fold_text = require('core.folding') -vim.opt.foldtext = 'v:lua.Fold_text()' +_G.Fold_text = require("core.folding") +vim.opt.foldtext = "v:lua.Fold_text()" -- statusline function _G.Status() + local function percentage() + local percent, line, lines + + line = vim.api.nvim_win_get_cursor(0)[1] + lines = vim.api.nvim_buf_line_count(0) + + percent = math.floor((line / lines) * 100) + if percent == 0 then + return "Top" + elseif percent == 100 then + return "Bot" + end + + return percent.."%%" + end + return table.concat { "%t", -- file name " %h", -- help buffer tag @@ -125,8 +147,10 @@ function _G.Status() -- print out the number of lsp clients attached "λ"..#vim.lsp.get_clients({ bufnr = 0 }).." ", + "%<", -- we can start truncating here (I want to keep the file name) "%l,%c%V", -- line, column-virtual column - " %P" -- percentage through display window + "%<", -- we can start truncating here + " "..percentage() -- percentage through the buffer } end vim.o.statusline="%!v:lua.Status()" diff --git a/lua/conf/plugins/cmp.lua b/lua/conf/plugins/cmp.lua index d6d7766..c83a2c9 100644 --- a/lua/conf/plugins/cmp.lua +++ b/lua/conf/plugins/cmp.lua @@ -1,38 +1,38 @@ -local lsp = require('core.lsp.functions') +local lsp = require("core.lsp.functions") -return { 'hrsh7th/nvim-cmp', +return { "hrsh7th/nvim-cmp", requires = { - 'nvim-treesitter/nvim-treesitter', - 'lukas-reineke/cmp-under-comparator', -- better results - 'xzbdmw/colorful-menu.nvim' -- fancy colors + "nvim-treesitter/nvim-treesitter", + "lukas-reineke/cmp-under-comparator", -- better results + "xzbdmw/colorful-menu.nvim" -- fancy colors }, -- suppliers for completions (they require nvim-cmp to be loaded before they are) deps = { - 'hrsh7th/cmp-buffer', -- buffers - 'FelipeLema/cmp-async-path', -- path - { 'hrsh7th/cmp-nvim-lsp', + "hrsh7th/cmp-buffer", -- buffers + "FelipeLema/cmp-async-path", -- path + { "hrsh7th/cmp-nvim-lsp", function() -- add lsp capabilities - lsp.add_capabilities(require('cmp_nvim_lsp').default_capabilities()) + lsp.add_capabilities(require("cmp_nvim_lsp").default_capabilities()) end }, -- lsp - 'hrsh7th/cmp-nvim-lsp-signature-help', -- completion information - { 'L3MON4D3/cmp-luasnip-choice', -- luasnip - requires = 'L3MON4D3/LuaSnip' + "hrsh7th/cmp-nvim-lsp-signature-help", -- completion information + { "L3MON4D3/cmp-luasnip-choice", -- luasnip + requires = "L3MON4D3/LuaSnip" } }, function() - local cmp = require('cmp') - local luasnip = require('luasnip') + local cmp = require("cmp") + local luasnip = require("luasnip") -- setup cmp cmp.setup { -- disable when in comments enabled = function() - local context = require('cmp.config.context') - if vim.api.nvim_get_mode().mode == 'c' then + local context = require("cmp.config.context") + if vim.api.nvim_get_mode().mode == "c" then return true else return not context.in_treesitter_capture("comment") @@ -42,12 +42,12 @@ return { 'hrsh7th/nvim-cmp', -- completion sources sources = cmp.config.sources { - { name = 'nvim_lsp', priority = 999 }, - { name = 'luasnip_choice', priority = 750 }, - { name = 'buffer', max_item_count = 3 }, - { name = 'async_path', max_item_count = 5 }, - { name = 'neorg' }, - { name = 'nvim_lsp_signature_help' } + { name = "nvim_lsp", priority = 999 }, + { name = "luasnip_choice", priority = 750 }, + { name = "buffer", max_item_count = 3 }, + { name = "async_path", max_item_count = 5 }, + { name = "neorg" }, + { name = "nvim_lsp_signature_help" } }, -- how to sort results @@ -56,7 +56,7 @@ return { 'hrsh7th/nvim-cmp', cmp.config.compare.exact, cmp.config.compare.offset, cmp.config.compare.score, - require('cmp-under-comparator').under, + require("cmp-under-comparator").under, cmp.config.compare.kind, cmp.config.compare.sort_text, cmp.config.compare.length, @@ -68,11 +68,11 @@ return { 'hrsh7th/nvim-cmp', window = { completion = { scrollbar = false, - border = 'solid', + border = vim.g.border_style, winhighlight = "Normal:WinBarNC,FloatBorder:WinBarNC,Search:WinBarNC", }, documentation = { - border = 'solid', + border = vim.g.border_style, winhighlight = "Normal:WinBarNC,FloatBorder:WinBarNC,Search:WinBarNC", } }, @@ -80,22 +80,22 @@ return { 'hrsh7th/nvim-cmp', -- position of window view = { entries = { - name = 'custom', - selection_order = 'near_cursor' + name = "custom", + selection_order = "near_cursor" } }, -- formatting of content formatting = { - fields = { 'menu', 'abbr', 'kind' }, + fields = { "menu", "abbr", "kind" }, format = function(entry, item) local hl_info = require("colorful-menu").cmp_highlights(entry) local menu_icon = { - nvim_lsp = 'λ', - luasnip = '%', - buffer = '@', - path = '#', - async_path = '#' + nvim_lsp = "λ", + luasnip = "%", + buffer = "@", + path = "#", + async_path = "#" } -- add a little icon diff --git a/lua/conf/plugins/comment.lua b/lua/conf/plugins/comment.lua index 9a6373d..b91cf4f 100644 --- a/lua/conf/plugins/comment.lua +++ b/lua/conf/plugins/comment.lua @@ -1,7 +1,7 @@ -return { 'numToStr/Comment.nvim', +return { "numToStr/Comment.nvim", function() - require('Comment').setup { - ignore = '^$' + require("Comment").setup { + ignore = "^$" } end } diff --git a/lua/conf/plugins/dap.lua b/lua/conf/plugins/dap.lua index 5fafd92..7cb4903 100644 --- a/lua/conf/plugins/dap.lua +++ b/lua/conf/plugins/dap.lua @@ -1,50 +1,50 @@ -local misc = require('core.misc') +local misc = require("core.misc") local map = misc.map -return { 'mfussenegger/nvim-dap', +return { "mfussenegger/nvim-dap", requires = { - 'williamboman/mason.nvim', - 'nvim-telescope/telescope.nvim', + "williamboman/mason.nvim", + "nvim-telescope/telescope.nvim", }, disable = not vim.fn.has("nvim-0.8.0"), - branch = '0.8.0', + branch = "0.8.0", function() local dap = require("dap") local codelldb_port = 13000 dap.adapters.codelldb = { - type = 'server', - host = '127.0.0.1', + type = "server", + host = "127.0.0.1", port = codelldb_port, executable = { - command = require('mason-registry').get_package('codelldb'):get_install_path()..'/codelldb', - args = { '--port', codelldb_port } + command = require("mason-registry").get_package("codelldb"):get_install_path().."/codelldb", + args = { "--port", codelldb_port } } } dap.configurations.c = { { - name = 'LLDB: Launch', - type = 'codelldb', - request = 'launch', + name = "LLDB: Launch", + type = "codelldb", + request = "launch", program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd()..'/', 'file') + return vim.fn.input("Path to executable: ", vim.fn.getcwd().."/", "file") end, - cwd = '${workspaceFolder}', + cwd = "${workspaceFolder}", stopOnEntry = false, args = {}, - console = 'integratedTerminal' + console = "integratedTerminal" } } - map('n', 'ec', dap.continue, { desc = "dap continue " }) - map('n', 'el', dap.run_last, { desc = "dap run last" }) - map('n', 'et', dap.terminate, { desc = "dap terminate " }) - map('n', 'eb', require("dap.breakpoints").toggle, { desc = "dap toggle breakpoint" }) - map('n', 'e]', dap.step_over, { desc = "dap step over" }) - map('n', 'e[', dap.step_back, { desc = "dap step back" }) - map('n', 'er', dap.repl.toggle, { desc = "dap repl toggle" }) - map('n', 'eR', dap.restart, { desc = "dap restart" }) + map("n", "ec", dap.continue, { desc = "dap continue " }) + map("n", "el", dap.run_last, { desc = "dap run last" }) + map("n", "et", dap.terminate, { desc = "dap terminate " }) + map("n", "eb", require("dap.breakpoints").toggle, { desc = "dap toggle breakpoint" }) + map("n", "e]", dap.step_over, { desc = "dap step over" }) + map("n", "e[", dap.step_back, { desc = "dap step back" }) + map("n", "er", dap.repl.toggle, { desc = "dap repl toggle" }) + map("n", "eR", dap.restart, { desc = "dap restart" }) end } diff --git a/lua/conf/plugins/dressing.lua b/lua/conf/plugins/dressing.lua deleted file mode 100644 index 75e4a44..0000000 --- a/lua/conf/plugins/dressing.lua +++ /dev/null @@ -1,19 +0,0 @@ -local branch = nil -if vim.fn.has("nvim-0.7.0") then - branch = 'nvim-0.7' -elseif vim.fn.has("nvim-0.5.0") then - branch = 'nvim-0.5' -end - -return { 'stevearc/dressing.nvim', - disable = true or not vim.fn.has("nvim-0.5.0"), - branch = branch, - requires = 'nvim-telescope/telescope.nvim', - function() - require('dressing').setup { - input = { - enabled = false - } - } - end -} diff --git a/lua/conf/plugins/fidget.lua b/lua/conf/plugins/fidget.lua index b4bfbac..02977ba 100644 --- a/lua/conf/plugins/fidget.lua +++ b/lua/conf/plugins/fidget.lua @@ -1,11 +1,11 @@ -return { 'j-hui/fidget.nvim', +return { "j-hui/fidget.nvim", disable = not vim.fn.has("nvim-0.9.0"), branch = "v1.5.0", function() local notification_defaults = require("fidget.notification").default_config notification_defaults["icon"] = "" - require('fidget').setup { + require("fidget").setup { progress = { display = { progress_icon = { diff --git a/lua/conf/plugins/gitsigns.lua b/lua/conf/plugins/gitsigns.lua index a92264e..b420746 100644 --- a/lua/conf/plugins/gitsigns.lua +++ b/lua/conf/plugins/gitsigns.lua @@ -1,19 +1,19 @@ -local misc = require('core.misc') +local misc = require("core.misc") local map = misc.map -return { 'lewis6991/gitsigns.nvim', +return { "lewis6991/gitsigns.nvim", disable = not vim.fn.has("nvim-0.9.0"), function() local gs = require("gitsigns") gs.setup { signs = { - add = { text = '│' }, - change = { text = '│' }, - delete = { text = '-' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - untracked = { text = '┆' } + add = { text = "│" }, + change = { text = "│" }, + delete = { text = "-" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + untracked = { text = "┆" } }, signcolumn = true, @@ -27,51 +27,51 @@ return { 'lewis6991/gitsigns.nvim', }, attach_to_untracked = true, - current_line_blame_formatter = ', - ', + current_line_blame_formatter = ", - ", - preview_config = { border = 'solid' }, + preview_config = { border = vim.g.border_style }, on_attach = function(bufnr) local opts = { buffer = bufnr } -- Navigation - map('n', ']c', function() + map("n", "]c", function() if vim.wo.diff then - return ']c' + return "]c" end vim.schedule(function() gs.next_hunk() end) - return '' + return "" end, { expr = true, buffer = bufnr }) - map('n', '[c', function() + map("n", "[c", function() if vim.wo.diff then - return '[c' + return "[c" end vim.schedule(function() gs.prev_hunk() end) - return '' + return "" end, { expr = true, buffer = bufnr }) -- Actions - map('n', 'hs', gs.stage_hunk, opts) - map('n', 'hr', gs.reset_hunk, opts) - map('v', 'hs', function() - gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } + map("n", "hs", gs.stage_hunk, opts) + map("n", "hr", gs.reset_hunk, opts) + map("v", "hs", function() + gs.stage_hunk { vim.fn.line("."), vim.fn.line("v") } end, opts) - map('v', 'hr', function() - gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } + map("v", "hr", function() + gs.reset_hunk { vim.fn.line("."), vim.fn.line("v") } end, opts) - map('n', 'hS', gs.stage_buffer, opts) - map('n', 'hu', gs.undo_stage_hunk, opts) - map('n', 'hR', gs.reset_buffer, opts) - map('n', 'hp', gs.preview_hunk, opts) - map('n', 'hb', function() gs.blame_line { full=true } end, opts) - map('n', 'tb', gs.toggle_current_line_blame, opts) - map('n', 'hd', gs.diffthis, opts) - map('n', 'hD', function() gs.diffthis('~') end, opts) - map('n', 'td', gs.toggle_deleted, opts) + map("n", "hS", gs.stage_buffer, opts) + map("n", "hu", gs.undo_stage_hunk, opts) + map("n", "hR", gs.reset_buffer, opts) + map("n", "hp", gs.preview_hunk, opts) + map("n", "hb", function() gs.blame_line { full=true } end, opts) + map("n", "tb", gs.toggle_current_line_blame, opts) + map("n", "hd", gs.diffthis, opts) + map("n", "hD", function() gs.diffthis("~") end, opts) + map("n", "td", gs.toggle_deleted, opts) -- Text object - map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', opts) + map({ "o", "x" }, "ih", ":Gitsigns select_hunk", opts) end } end diff --git a/lua/conf/plugins/harpoon.lua b/lua/conf/plugins/harpoon.lua index c26964a..b4b2330 100644 --- a/lua/conf/plugins/harpoon.lua +++ b/lua/conf/plugins/harpoon.lua @@ -1,11 +1,11 @@ -local misc = require('core.misc') +local misc = require("core.misc") local map = misc.map -return { 'ThePrimeagen/harpoon', +return { "ThePrimeagen/harpoon", disable = not vim.fn.has("nvim-0.8.0"), - commit = 'e76cb03', - branch = 'harpoon2', - requires = 'nvim-lua/plenary.nvim', + commit = "e76cb03", + branch = "harpoon2", + requires = "nvim-lua/plenary.nvim", function() local harpoon = require("harpoon") diff --git a/lua/conf/plugins/headlines.lua b/lua/conf/plugins/headlines.lua deleted file mode 100644 index e2dedd6..0000000 --- a/lua/conf/plugins/headlines.lua +++ /dev/null @@ -1,21 +0,0 @@ -return { 'lukas-reineke/headlines.nvim', - requires = 'nvim-treesitter/nvim-treesitter', - function() - require('headlines').setup { - norg = { - headline_highlights = { - "@neorg.headings.1.title", - "@neorg.headings.2.title", - "@neorg.headings.3.title", - "@neorg.headings.4.title", - "@neorg.headings.5.title", - "@neorg.headings.6.title" - }, - bullets = { "", "", "", "" }, - }, - markdown = { - headline_highlights = false - } - } - end -} diff --git a/lua/conf/plugins/helpful.lua b/lua/conf/plugins/helpful.lua new file mode 100644 index 0000000..5d9b639 --- /dev/null +++ b/lua/conf/plugins/helpful.lua @@ -0,0 +1 @@ +return { "tweekmonster/helpful.vim" } diff --git a/lua/conf/plugins/hml.lua b/lua/conf/plugins/hml.lua new file mode 100644 index 0000000..8c605c4 --- /dev/null +++ b/lua/conf/plugins/hml.lua @@ -0,0 +1,5 @@ +return { "mawkler/hml.nvim", + function() + require("hml").setup {} + end +} diff --git a/lua/conf/plugins/instant.lua b/lua/conf/plugins/instant.lua index 6866e71..d8dd9eb 100644 --- a/lua/conf/plugins/instant.lua +++ b/lua/conf/plugins/instant.lua @@ -1,4 +1,4 @@ -return { 'jbyuki/instant.nvim', +return { "jbyuki/instant.nvim", function() vim.g.instant_username = "squibid" end diff --git a/lua/conf/plugins/jdtls.lua b/lua/conf/plugins/jdtls.lua index b6dbd72..463fb23 100644 --- a/lua/conf/plugins/jdtls.lua +++ b/lua/conf/plugins/jdtls.lua @@ -1,64 +1,64 @@ -local misc = require('core.misc') -local lsp = require('core.lsp.functions') +local misc = require("core.misc") +local lsp = require("core.lsp.functions") local map, auto = misc.map, misc.auto -return { 'mfussenegger/nvim-jdtls', +return { "mfussenegger/nvim-jdtls", disable = not vim.fn.has("nvim-0.6.0"), - requires = 'mfussenegger/nvim-dap', + requires = "mfussenegger/nvim-dap", function() auto("FileType", { pattern = "java", callback = function() - local jdtls = require('jdtls') - local jdtls_install = require('mason-registry').get_package('jdtls'):get_install_path() + local jdtls = require("jdtls") + local jdtls_install = require("mason-registry").get_package("jdtls"):get_install_path() -- make sure to check if things with 💀 need updating local config = { cmd = { - 'java', -- 💀 - '-jar', vim.fn.glob(jdtls_install..'/plugins/org.eclipse.equinox.launcher_*.jar'), -- 💀 - '-configuration', jdtls_install..'/config_linux', - '-data', vim.fn.stdpath('cache')..'/nvim-jdtls', + "/usr/lib/jvm/openjdk21/bin/java", -- 💀 + "-jar", vim.fn.glob(jdtls_install.."/plugins/org.eclipse.equinox.launcher_*.jar"), -- 💀 + "-configuration", jdtls_install.."/config_linux", + "-data", vim.fn.stdpath("cache").."/nvim-jdtls", - '--add-modules=ALL-SYSTEM', - '--add-opens', 'java.base/java.lang=ALL-UNNAMED', - '--add-opens', 'java.base/java.util=ALL-UNNAMED', - '-Declipse.application=org.eclipse.jdt.ls.core.id1', - '-Declipse.product=org.eclipse.jdt.ls.core.product', - '-Dlog.level=ALL', - '-Dlog.protocol=true', - '-Dosgi.bundles.defaultStartLevel=4', - '-Xmx1G', + "--add-modules=ALL-SYSTEM", + "--add-opens", "java.base/java.lang=ALL-UNNAMED", + "--add-opens", "java.base/java.util=ALL-UNNAMED", + "-Declipse.application=org.eclipse.jdt.ls.core.id1", + "-Declipse.product=org.eclipse.jdt.ls.core.product", + "-Dlog.level=ALL", + "-Dlog.protocol=true", + "-Dosgi.bundles.defaultStartLevel=4", + "-Xmx1G", }, root_dir = vim.fs.dirname(vim.fs.find({ - 'gradlew', - '.git', - 'mvnw', - 'settings.gradle', -- Gradle (multi-project) - 'settings.gradle.kts', -- Gradle (multi-project) - 'build.xml', -- Ant - 'pom.xml', -- Maven + "gradlew", + ".git", + "mvnw", + "settings.gradle", -- Gradle (multi-project) + "settings.gradle.kts", -- Gradle (multi-project) + "build.xml", -- Ant + "pom.xml", -- Maven }, { upward = true })[1]), - -- don't print out status messages + -- don"t print out status messages handlers = { - ['language/status'] = function() end + ["language/status"] = function() end }, on_attach = function(_, bufnr) -- add some jdtls specific mappings local opts = { buffer = bufnr } - map('n', 'cri', jdtls.organize_imports, opts) - map('n', 'crv', jdtls.extract_variable, opts) - map('n', 'crc', jdtls.extract_constant, opts) - map('x', 'crv', function() jdtls.extract_variable(true) end, opts) - map('x', 'crc', function() jdtls.extract_constant(true) end, opts) - map('x', 'crm', function() jdtls.extract_method(true) end, opts) + map("n", "cri", jdtls.organize_imports, opts) + map("n", "crv", jdtls.extract_variable, opts) + map("n", "crc", jdtls.extract_constant, opts) + map("x", "crv", function() jdtls.extract_variable(true) end, opts) + map("x", "crc", function() jdtls.extract_constant(true) end, opts) + map("x", "crm", function() jdtls.extract_method(true) end, opts) pcall(vim.lsp.codelens.refresh) - auto('BufWritePost', { + auto("BufWritePost", { buffer = bufnr, - desc = 'refresh codelens', + desc = "refresh codelens", callback = function() pcall(vim.lsp.codelens.refresh) end @@ -88,7 +88,7 @@ return { 'mfussenegger/nvim-jdtls', end -- compile our code - vim.system({ 'javac', src_path, '-d', vim.fn.stdpath("cache") }, {}, function(out) + vim.system({ "javac", src_path, "-d", vim.fn.stdpath("cache") }, {}, function(out) if out.code ~= 0 then cache_path = nil end @@ -98,7 +98,7 @@ return { 'mfussenegger/nvim-jdtls', -- check if we have a compiled version of JavaVersion local f, _ = io.open(cache_path, "r") - if not f then -- if we don't have a cache + if not f then -- if we don"t have a cache build_cache() else io.close(f) @@ -118,12 +118,15 @@ return { 'mfussenegger/nvim-jdtls', on_exit = function(_, exit_code, _) local v = vim.version.parse(table.concat(buffer)) - -- if there's an error, no version info, or the java version is + -- if there"s an error, no version info, or the java version is -- less than 17 stop the lsp from starting if exit_code ~= 0 then vim.notify(string.format( "java version check failed: exit code %s", exit_code), vim.log.levels.ERROR, { title = misc.appid }) + vim.notify(string.format( + "%s", vim.inspect(buffer)), + vim.log.levels.ERROR, { title = misc.appid }) return elseif not v then vim.notify("no java version info found", vim.log.levels.ERROR, diff --git a/lua/conf/plugins/leetcode.lua b/lua/conf/plugins/leetcode.lua index 7619c84..9276295 100644 --- a/lua/conf/plugins/leetcode.lua +++ b/lua/conf/plugins/leetcode.lua @@ -1,16 +1,16 @@ -return { 'kawre/leetcode.nvim', +return { "kawre/leetcode.nvim", requires = { - 'nvim-lua/plenary.nvim', - 'nvim-telescope/telescope.nvim', - 'MunifTanjim/nui.nvim', - 'nvim-treesitter/nvim-treesitter' + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim", + "MunifTanjim/nui.nvim", + "nvim-treesitter/nvim-treesitter" }, config = function() - -- because we're using treesitter make sure to install the html parser + -- because we"re using treesitter make sure to install the html parser vim.cmd("TSUpdate html") end, function() - require('leetcode').setup { + require("leetcode").setup { lang = "java" } end diff --git a/lua/conf/plugins/lsp_lines.lua b/lua/conf/plugins/lsp_lines.lua index 9ccaa73..5a0a0ca 100644 --- a/lua/conf/plugins/lsp_lines.lua +++ b/lua/conf/plugins/lsp_lines.lua @@ -1,4 +1,4 @@ -return { 'whynothugo/lsp_lines', - url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim', +return { "whynothugo/lsp_lines", + url = "https://git.sr.ht/~whynothugo/lsp_lines.nvim", disable = not vim.fn.has("nvim-0.8.0") } diff --git a/lua/conf/plugins/luasnip.lua b/lua/conf/plugins/luasnip.lua index 169ec5d..e5d2a0b 100644 --- a/lua/conf/plugins/luasnip.lua +++ b/lua/conf/plugins/luasnip.lua @@ -1,14 +1,14 @@ -local misc = require('core.misc') +local misc = require("core.misc") local map = misc.map -return { 'L3MON4D3/LuaSnip', - branch = 'v2.3.0', +return { "L3MON4D3/LuaSnip", + branch = "v2.3.0", disable = not vim.fn.has("nvim-0.7.0"), config = function() - vim.cmd('make install_jsregexp') + vim.cmd("make install_jsregexp") end, function() - local luasnip = require('luasnip') + local luasnip = require("luasnip") local types = require("luasnip.util.types") luasnip.config.set_config { @@ -57,8 +57,8 @@ return { 'L3MON4D3/LuaSnip', -- load all snippets from snippet directory for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/snippets/*.lua", true)) do - local fn = file:gsub('^.*/', ''):gsub('%.lua$', '') - local ret = misc.include('snippets.'..fn) + local fn = file:gsub("^.*/", ""):gsub("%.lua$", "") + local ret = misc.include("snippets."..fn) if type(ret) ~= "boolean" then luasnip.add_snippets(fn, ret, { key = fn }) end diff --git a/lua/conf/plugins/mason-lspconfig.lua b/lua/conf/plugins/mason-lspconfig.lua index ceedb6c..c4e4684 100644 --- a/lua/conf/plugins/mason-lspconfig.lua +++ b/lua/conf/plugins/mason-lspconfig.lua @@ -1,11 +1,11 @@ -local misc = require('core.misc') -local lsp = require('core.lsp.functions') +local misc = require("core.misc") +local lsp = require("core.lsp.functions") local map = misc.map -return { 'williamboman/mason-lspconfig.nvim', +return { "williamboman/mason-lspconfig.nvim", requires = { - 'williamboman/mason.nvim', - { 'neovim/nvim-lspconfig', + "williamboman/mason.nvim", + { "neovim/nvim-lspconfig", disable = not vim.fn.has("nvim-0.8.0"), function() lsp.setup() @@ -13,15 +13,15 @@ return { 'williamboman/mason-lspconfig.nvim', }, -- these two update some lsp capabilities and therefore must be run first - -- 'hrsh7th/cmp-nvim-lsp', - -- 'kevinhwang91/nvim-ufo' + -- "hrsh7th/cmp-nvim-lsp", + -- "kevinhwang91/nvim-ufo" }, function() - local lspconfig = require('lspconfig') - local util = require('lspconfig.util') + local lspconfig = require("lspconfig") + local util = require("lspconfig.util") -- setup language servers - require('mason-lspconfig').setup { + require("mason-lspconfig").setup { ensure_installed = { "lua_ls", "clangd", @@ -42,9 +42,9 @@ return { 'williamboman/mason-lspconfig.nvim', -- setup luals ["lua_ls"] = function(server_name) - local root_files = { '.luarc.json', '.luarc.jsonc', '.luacheckrc', - '.stylua.toml', 'stylua.toml', 'selene.toml', 'selene.yml', - 'README.md' + local root_files = { ".luarc.json", ".luarc.jsonc", ".luacheckrc", + ".stylua.toml", "stylua.toml", "selene.toml", "selene.yml", + "README.md" } -- FIXME: luals seems to start up twice and sends back twice the @@ -53,10 +53,10 @@ return { 'williamboman/mason-lspconfig.nvim', settings = { Lua = { diagnostics = { - globals = { "vim", 'mp' } + globals = { "vim", "mp" } }, runtime = { - version = 'LuaJIT' + version = "LuaJIT" }, format = { enable = false @@ -76,7 +76,7 @@ return { 'williamboman/mason-lspconfig.nvim', return root end - root = util.root_pattern('lua/')(fname) + root = util.root_pattern("lua/")(fname) if root then return root end @@ -107,7 +107,7 @@ return { 'williamboman/mason-lspconfig.nvim', usePlaceholders = true, clangdFileStatus = true, fallback_flags = { - "-xc" -- makes clangd think we're using c instead of c++ + "-xc" -- makes clangd think we"re using c instead of c++ } } } diff --git a/lua/conf/plugins/mason.lua b/lua/conf/plugins/mason.lua index 87e66a9..78742e9 100644 --- a/lua/conf/plugins/mason.lua +++ b/lua/conf/plugins/mason.lua @@ -1,11 +1,11 @@ -return { 'williamboman/mason.nvim', +return { "williamboman/mason.nvim", disable = not vim.fn.has("nvim-0.7.0"), function() - local mason = require('mason') + local mason = require("mason") mason.setup { ui = { - border = "solid", + border = vim.g.border_style, width = 0.8, height = 0.9, diff --git a/lua/conf/plugins/mellow.lua b/lua/conf/plugins/mellow.lua index 02bf7fd..f0ebf82 100644 --- a/lua/conf/plugins/mellow.lua +++ b/lua/conf/plugins/mellow.lua @@ -1,6 +1,6 @@ -return { 'mellow-theme/mellow.nvim', +return { "mellow-theme/mellow.nvim", disable = not vim.fn.has("nvim-0.8.0"), - requires = 'nvim-treesitter/nvim-treesitter', + requires = "nvim-treesitter/nvim-treesitter", function() vim.g.mellow_variant = "dark" local c = require("mellow.colors")[vim.g.mellow_variant] @@ -10,26 +10,26 @@ return { 'mellow-theme/mellow.nvim', ["NormalNC"] = { link = "Normal" }, -- make floats darker - ["NormalFloat"] = { fg = c.fg, bg = c.bg_dark }, + ["NormalFloat"] = { fg = c.fg, bg = "#111111" }, ["FloatBorder"] = { link = "NormalFloat" }, -- neorg headings, looks extra good with lukas-reineke/headlines.nvim ["@neorg.headings.1.title"] = { fg = c.yellow, bg = "#2a211c" }, ["@neorg.headings.1.icon"] = { link = "@neorg.headings.1.title" }, - ["@neorg.headings.2.title"] = { fg = c.blue, bg = '#201e25' }, + ["@neorg.headings.2.title"] = { fg = c.blue, bg = "#201e25" }, ["@neorg.headings.2.icon"] = { link = "@neorg.headings.2.title" }, - ["@neorg.headings.3.title"] = { fg = c.cyan, bg = '#2b1b20' }, + ["@neorg.headings.3.title"] = { fg = c.cyan, bg = "#2b1b20" }, ["@neorg.headings.3.icon"] = { link = "@neorg.headings.3.title" }, - ["@neorg.headings.4.title"] = { fg = c.green, bg = '#1d201e' }, + ["@neorg.headings.4.title"] = { fg = c.green, bg = "#1d201e" }, ["@neorg.headings.4.icon"] = { link = "@neorg.headings.4.title" }, - ["@neorg.headings.5.title"] = { fg = c.magenta, bg = '#251a21' }, + ["@neorg.headings.5.title"] = { fg = c.magenta, bg = "#251a21" }, ["@neorg.headings.5.icon"] = { link = "@neorg.headings.5.title" }, - ["@neorg.headings.6.title"] = { fg = c.white, bg = '#212126' }, + ["@neorg.headings.6.title"] = { fg = c.white, bg = "#212126" }, ["@neorg.headings.6.icon"] = { link = "@neorg.headings.6.title" }, -- make blink actually look nice diff --git a/lua/conf/plugins/mini-clue.lua b/lua/conf/plugins/mini-clue.lua deleted file mode 100644 index e2c3fa0..0000000 --- a/lua/conf/plugins/mini-clue.lua +++ /dev/null @@ -1,52 +0,0 @@ -return { 'echasnovski/mini.clue', - disable = true, - -- disable = not vim.fn.has("nvim-0.9.0"), - branch = "stable", - function() - local miniclue = require('mini.clue') - miniclue.setup({ - triggers = { - -- Leader triggers - { mode = 'n', keys = '' }, - { mode = 'x', keys = '' }, - - -- Built-in completion - { mode = 'i', keys = '' }, - - -- `g` key - { mode = 'n', keys = 'g' }, - { mode = 'x', keys = 'g' }, - - -- Marks - { mode = 'n', keys = "'" }, - { mode = 'n', keys = '`' }, - { mode = 'x', keys = "'" }, - { mode = 'x', keys = '`' }, - - -- Registers - { mode = 'n', keys = '"' }, - { mode = 'x', keys = '"' }, - { mode = 'i', keys = '' }, - { mode = 'c', keys = '' }, - - -- Window commands - { mode = 'n', keys = '' }, - - -- `z` key - { mode = 'n', keys = 'z' }, - { mode = 'x', keys = 'z' }, - }, - - clues = { - -- Enhance this by adding descriptions for mapping groups - miniclue.gen_clues.builtin_completion(), - miniclue.gen_clues.g(), - miniclue.gen_clues.marks(), - miniclue.gen_clues.registers(), - miniclue.gen_clues.windows(), - miniclue.gen_clues.z(), - }, - }) - - end -} diff --git a/lua/conf/plugins/neogen.lua b/lua/conf/plugins/neogen.lua index 19c3422..1a670df 100644 --- a/lua/conf/plugins/neogen.lua +++ b/lua/conf/plugins/neogen.lua @@ -1,19 +1,19 @@ -local misc = require('core.misc') +local misc = require("core.misc") local map = misc.map -return { 'danymat/neogen', +return { "danymat/neogen", requires = { - 'nvim-treesitter/nvim-treesitter', - 'L3MON4D3/LuaSnip' + "nvim-treesitter/nvim-treesitter", + "L3MON4D3/LuaSnip" }, function() - local neogen = require('neogen') + local neogen = require("neogen") neogen.setup { enabled = true, input_after_comment = true, snippet_engine = "luasnip", } - map('n', 'd', neogen.generate) + map("n", "d", neogen.generate) end } diff --git a/lua/conf/plugins/neorg.lua b/lua/conf/plugins/neorg.lua index 84a0b79..9193a84 100644 --- a/lua/conf/plugins/neorg.lua +++ b/lua/conf/plugins/neorg.lua @@ -1,7 +1,7 @@ -- WARNING: neorg does some pretty stupid stuff when it comes to the plugins it --- wants (using luarocks), in order to get around all that bullshit I've --- manually added it's dependencies. Because I don't want this to randomly break --- I've also pinned neorg to the latest working version that I've messed around +-- wants (using luarocks), in order to get around all that bullshit I"ve +-- manually added it"s dependencies. Because I don"t want this to randomly break +-- I"ve also pinned neorg to the latest working version that I"ve messed around -- with. -- -- NOTE: for my future self to update this thingy while not breaking @@ -36,7 +36,7 @@ local function populate_workspaces(path, cache) if string.sub(n, 1, 1) == "." or (t ~= "directory" and t ~= "link") then goto continue end - -- make sure this still works if the last charachter in the path isn't a '/' + -- make sure this still works if the last charachter in the path isn"t a "/" workspaces[n] = (string.sub(path, #path, #path) == "/") and path..n or path.."/"..n ::continue:: end @@ -61,32 +61,32 @@ local function populate_workspaces(path, cache) return workspaces end -return { 'nvim-neorg/neorg', +return { "nvim-neorg/neorg", disable = not vim.fn.has("nvim-0.10.0"), - branch = 'v9.3.0', + branch = "v9.3.0", requires = { - 'nvim-lua/plenary.nvim', - 'nvim-treesitter/nvim-treesitter', - 'folke/zen-mode.nvim', - 'hrsh7th/nvim-cmp', - { 'nvim-neorg/neorg-telescope', - requires = 'nvim-telescope/telescope.nvim' + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + "folke/zen-mode.nvim", + "hrsh7th/nvim-cmp", + { "nvim-neorg/neorg-telescope", + requires = "nvim-telescope/telescope.nvim" }, -- NOTE: these are usually installed by neorg via luarocks, the versions -- were picked based on the neorg-scm-1.rockspec found in the root of the -- neorg repo - { 'nvim-neotest/nvim-nio', - branch = 'v1.7.0' + { "nvim-neotest/nvim-nio", + branch = "v1.7.0" }, - { 'nvim-neorg/lua-utils.nvim', - branch = 'v1.0.2' + { "nvim-neorg/lua-utils.nvim", + branch = "v1.0.2" }, - { 'MunifTanjim/nui.nvim', - branch = '0.3.0' + { "MunifTanjim/nui.nvim", + branch = "0.3.0" }, - { 'pysan3/pathlib.nvim', - branch = 'v2.2.2' + { "pysan3/pathlib.nvim", + branch = "v2.2.2" } }, @@ -94,7 +94,7 @@ return { 'nvim-neorg/neorg', local wsphome = (os.getenv("XDG_DOCUMENTS_DIR") or (os.getenv("HOME").."/Documents")).."/notes/" - require('neorg').setup { + require("neorg").setup { load = { -- not sure how to sort the modules so ima just put the empty ones first ["core.defaults"] = {}, diff --git a/lua/conf/plugins/nvim-colorizer.lua b/lua/conf/plugins/nvim-colorizer.lua index 91fac13..fce26d7 100644 --- a/lua/conf/plugins/nvim-colorizer.lua +++ b/lua/conf/plugins/nvim-colorizer.lua @@ -1,7 +1,7 @@ -return { 'norcalli/nvim-colorizer.lua', +return { "norcalli/nvim-colorizer.lua", disable = not vim.fn.has("nvim-0.4.0") and not vim.fn.has("termguicolors"), function() - require('colorizer').setup(nil, { + require("colorizer").setup(nil, { names = false, css = true }) diff --git a/lua/conf/plugins/nyooom.lua b/lua/conf/plugins/nyooom.lua index c6da17a..00de6ca 100644 --- a/lua/conf/plugins/nyooom.lua +++ b/lua/conf/plugins/nyooom.lua @@ -1,7 +1,7 @@ -return { 'squibid/nyooom', - url = 'https://git.squi.bid/nyooom', +return { "squibid/nyooom", + url = "https://git.squi.bid/nyooom", pin = true, function() - require('nyooom').setup {} + require("nyooom").setup {} end } diff --git a/lua/conf/plugins/oil.lua b/lua/conf/plugins/oil.lua index 5eeac4d..d985105 100644 --- a/lua/conf/plugins/oil.lua +++ b/lua/conf/plugins/oil.lua @@ -1,16 +1,85 @@ -local misc = require('core.misc') +local misc = require("core.misc") local map = misc.map +-- helper function to parse output +local function parse_output(proc) + local result = proc:wait() + local ret = {} + if result.code == 0 then + for line in vim.gsplit(result.stdout, "\n", { plain = true, trimempty = true }) do + -- Remove trailing slash + line = line:gsub("/$", "") + ret[line] = true + end + end + return ret +end + +-- build git status cache +local function new_git_status() + return setmetatable({}, { + __index = function(self, key) + local ignore_proc = vim.system( + { "git", "ls-files", "--ignored", "--exclude-standard", "--others", "--directory" }, + { + cwd = key, + text = true, + } + ) + local tracked_proc = vim.system({ "git", "ls-tree", "HEAD", "--name-only" }, { + cwd = key, + text = true, + }) + local ret = { + ignored = parse_output(ignore_proc), + tracked = parse_output(tracked_proc), + } + + rawset(self, key, ret) + return ret + end, + }) +end +local git_status = new_git_status() + local permission_hlgroups = { - ['-'] = 'NonText', - ['r'] = 'DiagnosticSignWarn', - ['w'] = 'DiagnosticSignHint', - ['x'] = 'DiagnosticSignOk', + ["-"] = "NonText", + ["r"] = "DiagnosticSignWarn", + ["w"] = "DiagnosticSignHint", + ["x"] = "DiagnosticSignOk", } -return { 'stevearc/oil.nvim', +return { "stevearc/oil.nvim", disable = not vim.fn.has("nvim-0.8.0"), + deps = { + { "refractalize/oil-git-status.nvim", + function() + require("oil-git-status").setup { + symbols = { -- customize the symbols that appear in the git status columns + index = { + ["A"] = "+", + ["D"] = "-", + ["M"] = "~", + }, + working_tree = { + ["A"] = "+", + ["D"] = "-", + ["M"] = "~", + } + } + } + end + } + }, function() + -- Clear git status cache on refresh + local refresh = require("oil.actions").refresh + local orig_refresh = refresh.callback + refresh.callback = function(...) + git_status = new_git_status() + orig_refresh(...) + end + require("oil").setup { -- ID is automatically added at the beginning, and name at the end -- See :help oil-columns @@ -26,7 +95,7 @@ return { 'stevearc/oil.nvim', return hls end, }, - { "size", highlight = '@number' } + { "size", highlight = "@number" } }, -- Window-local options to use for oil buffers @@ -34,7 +103,7 @@ return { 'stevearc/oil.nvim', number = false, relativenumber = false, wrap = false, - signcolumn = "no", + signcolumn = "yes:2", cursorcolumn = false, foldcolumn = "0", spell = false, @@ -100,11 +169,16 @@ return { 'stevearc/oil.nvim', -- This function defines what is considered a "hidden" file is_hidden_file = function(name, bufnr) - if name == ".." then -- show previous directory - return false + local dir = require("oil").get_current_dir(bufnr) + local is_dotfile = vim.startswith(name, ".") and name ~= ".." + -- if no local directory (e.g. for ssh connections), just hide dotfiles + if not dir then + return is_dotfile + end + -- dotfiles are considered hidden unless tracked + if is_dotfile then + return not git_status[dir].tracked[name] end - local m = name:match("^%.") - return m ~= nil end, -- This function defines what will never be shown, even when `show_hidden` is set @@ -134,27 +208,27 @@ return { 'stevearc/oil.nvim', -- Configuration for the floating window in oil.open_float float = { - border = "solid" + border = vim.g.border_style }, -- Configuration for the floating action confirmation window confirmation = { - border = "solid" + border = vim.g.border_style }, -- Configuration for the floating progress window progress = { - border = "solid" + border = vim.g.border_style }, -- Configuration for the floating SSH window ssh = { - border = "solid" + border = vim.g.border_style }, -- Configuration for the floating keymaps help window keymaps_help = { - border = "solid" + border = vim.g.border_style } } - map('n', '-', 'Oil') + map("n", "-", "Oil") end } diff --git a/lua/conf/plugins/project.lua b/lua/conf/plugins/project.lua deleted file mode 100644 index 1075e4c..0000000 --- a/lua/conf/plugins/project.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { 'ahmedkhalf/project.nvim', - disable = true, - -- disable = vim.fn.has("nvim-0.5.0"), - function() - require('project_nvim').setup { - patterns = { - ".git", - "Makefile", - "_darcs", - ".hg", - ".bzr", - ".svn", - "package.json", - "README.md" - } - } - end -} diff --git a/lua/conf/plugins/telescope.lua b/lua/conf/plugins/telescope.lua index b08d65d..66c098a 100644 --- a/lua/conf/plugins/telescope.lua +++ b/lua/conf/plugins/telescope.lua @@ -1,55 +1,48 @@ -local misc = require('core.misc') +local misc = require("core.misc") local map = misc.map -return { 'nvim-telescope/telescope.nvim', +return { "nvim-telescope/telescope.nvim", disable = not vim.fn.has("nvim-0.9.0"), requires = { - 'nvim-lua/plenary.nvim', - { 'nvim-telescope/telescope-fzf-native.nvim', + "nvim-lua/plenary.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", config = function() vim.cmd("make") end - } + }, + "mollerhoj/telescope-recent-files.nvim", + "nvim-telescope/telescope-ui-select.nvim" }, + function() local telescope = require("telescope") - local actions = require('telescope.actions') - local action_layout = require("telescope.actions.layout") - - local function telescopew() - if vim.o.columns <= 80 then - return vim.o.columns - else - return 0.8 - end - end + local actions = require("telescope.actions") telescope.setup { defaults = { borderchars = { - prompt = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, - results = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, - preview = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, + prompt = { " ", " ", " ", " ", " ", " ", " ", " " }, + results = { " ", " ", " ", " ", " ", " ", " ", " " }, + preview = { " ", " ", " ", " ", " ", " ", " ", " " }, }, winblend = 0, - layout_strategy = 'horizontal', - sorting_strategy = 'descending', - scroll_strategy = 'limit', + layout_strategy = "horizontal", + sorting_strategy = "descending", + scroll_strategy = "limit", layout_config = { horizontal = { - width = telescopew(), height = 20, - prompt_position = 'bottom', - anchor = 'N', + prompt_position = "bottom", + anchor = "N", } }, mappings = { i = { [""] = actions.close, - [''] = actions.move_selection_next, - [''] = actions.move_selection_previous, - [''] = actions.preview_scrolling_up, - [''] = actions.preview_scrolling_down, + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, } } }, @@ -59,29 +52,31 @@ return { 'nvim-telescope/telescope.nvim', } -- load in the fzf extension - telescope.load_extension('fzf') + telescope.load_extension("fzf") + telescope.load_extension("recent-files") + telescope.load_extension("ui-select") -- keymaps - local telebuilt = require('telescope.builtin') - map('n', 'f', function() - telebuilt.fd { follow = true } - end, { desc = 'Find files.' }) - map('n', 's', telebuilt.live_grep, { desc = 'Find string in project.' }) - map('n', 'b', telebuilt.current_buffer_fuzzy_find, { - desc = 'Find string in current buffer.', + local telebuilt = require("telescope.builtin") + map("n", "f", function() + telescope.extensions["recent-files"].recent_files { follow = true } + end, { desc = "Find files." }) + map("n", "s", telebuilt.live_grep, { desc = "Find string in project." }) + map("n", "b", telebuilt.current_buffer_fuzzy_find, { + desc = "Find string in current buffer.", }) - map('n', 'i', telebuilt.help_tags, { - desc = 'find help tags.', + map("n", "i", telebuilt.help_tags, { + desc = "find help tags.", }) -- find over specific directories - map('n', 'tc', function() - require('telescope.builtin').find_files { + map("n", "tc", function() + require("telescope.builtin").find_files { cwd = vim.fn.stdpath("config") } end, { desc = "find config files" }) - map('n', 'tp', function() - require('telescope.builtin').find_files { + map("n", "tp", function() + require("telescope.builtin").find_files { cwd = vim.fs.joinpath(vim.fn.stdpath("data"), "site/pack/deps/opt") } end, { desc = "find files in plugin directory" }) diff --git a/lua/conf/plugins/todo-comments.lua b/lua/conf/plugins/todo-comments.lua index ebf724d..24eccd0 100644 --- a/lua/conf/plugins/todo-comments.lua +++ b/lua/conf/plugins/todo-comments.lua @@ -1,8 +1,8 @@ -return { 'folke/todo-comments.nvim', - requires = 'nvim-lua/plenary.nvim', +return { "folke/todo-comments.nvim", + requires = "nvim-lua/plenary.nvim", disable = not vim.fn.has("nvim-0.8.0"), function() - require('todo-comments').setup { + require("todo-comments").setup { keywords = { FIX = { icon = "# ", diff --git a/lua/conf/plugins/treesitter.lua b/lua/conf/plugins/treesitter.lua index b18ae49..d9607e3 100644 --- a/lua/conf/plugins/treesitter.lua +++ b/lua/conf/plugins/treesitter.lua @@ -7,13 +7,13 @@ table.contains = function(self, string) return false end -return { 'nvim-treesitter/nvim-treesitter', +return { "nvim-treesitter/nvim-treesitter", disable = not vim.fn.has("nvim-0.10.0"), config = function() vim.cmd("TSUpdate") end, function() - require('nvim-treesitter.configs').setup { + require("nvim-treesitter.configs").setup { -- good default parsers ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown", "markdown_inline", "java", "bash", "css", "html", "luadoc", @@ -25,7 +25,7 @@ return { 'nvim-treesitter/nvim-treesitter', enable = true, disable = function(lang, _) - -- disable indenting in php (it's more broken with than without) + -- disable indenting in php (it"s more broken with than without) return table.contains(({ "php" }), lang) @@ -39,7 +39,7 @@ return { 'nvim-treesitter/nvim-treesitter', additional_vim_regex_highlighting = true, disable = function(lang, buf) - -- disable in some files where vim's builtin highlighting is better + -- disable in some files where vim"s builtin highlighting is better if table.contains(({ "diff", "tex" }), lang) then diff --git a/lua/conf/plugins/treesj.lua b/lua/conf/plugins/treesj.lua index 4b3bae1..424c677 100644 --- a/lua/conf/plugins/treesj.lua +++ b/lua/conf/plugins/treesj.lua @@ -1,14 +1,14 @@ -local misc = require('core.misc') +local misc = require("core.misc") local map = misc.map -return { 'Wansmer/treesj', +return { "Wansmer/treesj", disable = not vim.fn.has("nvim-0.9.0"), - requires = 'nvim-treesitter/nvim-treesitter', + requires = "nvim-treesitter/nvim-treesitter", function() - require('treesj').setup { + require("treesj").setup { use_default_keymaps = false, } - map('n', 'j', require('treesj').toggle, { desc = 'fold code' }) + map("n", "j", require("treesj").toggle, { desc = "fold code" }) end } diff --git a/lua/conf/plugins/ts-autotag.lua b/lua/conf/plugins/ts-autotag.lua index 915ddad..5391d90 100644 --- a/lua/conf/plugins/ts-autotag.lua +++ b/lua/conf/plugins/ts-autotag.lua @@ -1,11 +1,8 @@ -return { 'windwp/nvim-ts-autotag', - requires = { - 'nvim-telescope/telescope.nvim', - 'nvim-treesitter/nvim-treesitter' - }, +return { "windwp/nvim-ts-autotag", + requires = "nvim-treesitter/nvim-treesitter", disable = not vim.fn.has("nvim-0.9.5"), function() - require('nvim-ts-autotag').setup {} + require("nvim-ts-autotag").setup {} end } diff --git a/lua/conf/plugins/undotree.lua b/lua/conf/plugins/undotree.lua index 199ca06..fa57def 100644 --- a/lua/conf/plugins/undotree.lua +++ b/lua/conf/plugins/undotree.lua @@ -1,7 +1,7 @@ -local misc = require('core.misc') +local misc = require("core.misc") local map = misc.map -return { 'mbbill/undotree', +return { "mbbill/undotree", function() if vim.g.loaded_undotree then vim.g.undotree_DiffAutoOpen = 0 diff --git a/lua/conf/plugins/vimtex.lua b/lua/conf/plugins/vimtex.lua index c6514c2..660efda 100644 --- a/lua/conf/plugins/vimtex.lua +++ b/lua/conf/plugins/vimtex.lua @@ -1,4 +1,4 @@ -return { 'lervag/vimtex', +return { "lervag/vimtex", setup = function() vim.g.vimtex_view_method = "zathura" end -- cgit v1.2.1