From bd2f808931404c7552bd648b744a418ff1075f8a Mon Sep 17 00:00:00 2001 From: devaine Date: Sun, 16 Aug 2026 20:36:12 -0500 Subject: [PATCH] feat(keybinds, lua func, cmp): QOL changes basically - removed hindering material like nvim adding more comments upon pressing `Enter` - removed snippets, not needed + disrupted commenting - added more keybinds (telescope.nvim, wrap around pairs, venv selection) - added QOL changes like venv-selector + ecolog.nvim w/ - added blink.cmp provders (ecolog + convential commits) --- init.lua | 0 lazy-lock.json | 45 ++++++------ lua/config/lazy.lua | 0 lua/config/vim.lua | 44 +++++++++--- lua/plugins/completion.lua | 29 +++++--- lua/plugins/dev-utils.lua | 128 +++++++++++++++++++++++----------- lua/plugins/discord.lua | 0 lua/plugins/file-explorer.lua | 3 +- lua/plugins/formatter.lua | 13 +--- lua/plugins/lsp.lua | 46 ++++++++---- lua/plugins/remote.lua | 0 lua/plugins/search.lua | 7 ++ lua/plugins/ui.lua | 0 13 files changed, 206 insertions(+), 109 deletions(-) mode change 100644 => 100755 init.lua mode change 100644 => 100755 lazy-lock.json mode change 100644 => 100755 lua/config/lazy.lua mode change 100644 => 100755 lua/config/vim.lua mode change 100644 => 100755 lua/plugins/completion.lua mode change 100644 => 100755 lua/plugins/dev-utils.lua mode change 100644 => 100755 lua/plugins/discord.lua mode change 100644 => 100755 lua/plugins/file-explorer.lua mode change 100644 => 100755 lua/plugins/formatter.lua mode change 100644 => 100755 lua/plugins/lsp.lua mode change 100644 => 100755 lua/plugins/remote.lua create mode 100755 lua/plugins/search.lua mode change 100644 => 100755 lua/plugins/ui.lua diff --git a/init.lua b/init.lua old mode 100644 new mode 100755 diff --git a/lazy-lock.json b/lazy-lock.json old mode 100644 new mode 100755 index 5d60ac4..eff2566 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,26 +1,27 @@ { - "FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" }, - "blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" }, - "conform.nvim": { "branch": "master", "commit": "8314f4c9e205e7f30b62147069729f9a1227d8bf" }, - "cord.nvim": { "branch": "master", "commit": "7483e9ce335d22a9e52f83804134d621094b5fe7" }, - "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, - "kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" }, + "blink-cmp-conventional-commits": { "branch": "main", "commit": "28f46593ef5e03ba7525bdf6075be0c56c6ceb55" }, + "blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" }, + "conform.nvim": { "branch": "master", "commit": "016802de402556da54c36bd7359b441266b01cdd" }, + "cord.nvim": { "branch": "master", "commit": "85f295e43550bc968b66d95d8bfd6e12bb17df08" }, + "ecolog.nvim": { "branch": "v1", "commit": "0053fb4f597d4f734b0ce0f84edc2e7a288bfc57" }, + "indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" }, + "kanagawa.nvim": { "branch": "master", "commit": "bb85e4bfc8d89b0e62c8fa53ccdd13d12e2f77b3" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "4cfe411526a7a99c18281135e8b4765ae6330d15" }, - "mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" }, - "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, - "nvim-autopairs": { "branch": "master", "commit": "c2a0dd0d931d0fb07665e1fedb1ea688da3b80b4" }, - "nvim-eslint": { "branch": "main", "commit": "491deac6d89a5c51013fa71b63c3cc093db15dde" }, - "nvim-highlight-colors": { "branch": "main", "commit": "e0c4a58ec8c3ca7c92d3ee4eb3bc1dd0f7be317e" }, - "nvim-jdtls": { "branch": "master", "commit": "f73731b543f5971e0da9665eb1d7ceffe1fde71f" }, - "nvim-lspconfig": { "branch": "master", "commit": "ac04ec3c2af08e9821b4eb64ede86072b9b213bf" }, - "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" }, - "nvim-web-devicons": { "branch": "master", "commit": "6788013bb9cb784e606ada44206b0e755e4323d7" }, - "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "9d28935aa95fa6c1dc7c4d6747f101a72a8a4bec" }, + "mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "ebd66767191714e008ce73b769518a763ff31bdc" }, + "nui.nvim": { "branch": "main", "commit": "a25dd472316d806eb38a5dd667c2e40da5570c75" }, + "nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" }, + "nvim-highlight-colors": { "branch": "main", "commit": "e4c7af0211866162d999ce0bdd6a029302e19139" }, + "nvim-jdtls": { "branch": "master", "commit": "6e9d953f0b82bccdb834cfde0e893f3119c22592" }, + "nvim-lspconfig": { "branch": "master", "commit": "51dbf5359da86721662c87ca10eb73add973737b" }, + "nvim-treesitter": { "branch": "main", "commit": "074aa4422bf029908338e855d0c0f71470a971bb" }, + "nvim-ts-autotag": { "branch": "main", "commit": "88c1453db4ba7dd24131086fe51fdf74e587d275" }, + "nvim-web-devicons": { "branch": "master", "commit": "2ae6958df7ced50baac5035cec0c15799eedfbf7" }, + "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, "remote-nvim.nvim": { "branch": "main", "commit": "9992c2fb8bf4f11aca2c8be8db286b506f92efcb" }, - "telescope.nvim": { "branch": "master", "commit": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179" }, - "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" } + "telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" }, + "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, + "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, + "venv-selector.nvim": { "branch": "main", "commit": "cc4bb3975de8835291f9bb45889e96c6b2795fc4" } } diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua old mode 100644 new mode 100755 diff --git a/lua/config/vim.lua b/lua/config/vim.lua old mode 100644 new mode 100755 index cd5a233..f6fda8d --- a/lua/config/vim.lua +++ b/lua/config/vim.lua @@ -1,6 +1,3 @@ --- set the leader -vim.g.mapleader = " " - -- neovim/vim variables local opt = vim.opt local keybind = vim.keymap.set @@ -23,8 +20,19 @@ opt.incsearch = true -- mapleader vim.g.mapleader = " " +-- custom lua functions +local function toggle_diagnostics() + local qf = vim.fn.getqflist({ winid = 0 }) + + if qf.winid ~= 0 then + vim.cmd("cclose") + else + vim.diagnostic.setqflist({ open = true }) + end +end + -- keybinds -keybind("n", "hh", "lua vim.diagnostic.setqflist()", { desc = "LSP Diagonistics" }) +keybind("n", "hh", toggle_diagnostics, { desc = "LSP Diagonistics" }) -- buffer keybinds keybind("n", "bb", "bprevious", { desc = "Switch to previous buffer" }) @@ -42,16 +50,26 @@ keybind("v", "", ":m '>+1gv", { desc = "Move selection down" }) keybind("i", "jk", "", { desc = "Keybind set for Justin" }) -- file explorer -keybind("n", "mm", "Neotree toggle", { desc = "Toggle File Explorer" }) +keybind("n", "mm", "Neotree toggle filesystem dir=%:p:h", { desc = "Toggle File Explorer" }) keybind("n", "jj", "Neotree action=focus", { desc = "Focus on file explorer" }) --- open floating terminal --- to see toggling, see dev-utils.lua for closing function -keybind('n', '', 'lua require("FTerm").open()') +-- telescope.nvim (search.lua) +keybind("n", "ff", "Telescope find_files", { desc = "Find Files" }) +keybind("n", "fg", "Telescope live_grep", { desc = "Live Grep" }) +keybind("n", "fb", "Telescope buffers", { desc = "Show Buffers" }) +keybind("n", "fh", "Telescope help_tags", { desc = "Help Tags" }) + +-- venv select +keybind("n", ",v", "VenvSelect", { desc = "Finds the python venv" }) -- remote connection -keybind('n', ';;', 'RemoteStart') +keybind("n", ";;", "RemoteStart") +-- open floating terminal +-- to see toggling, see: dev-utils.lua under toggleterm.nvim + +-- wrap around pairs +-- see: dev-utils.lua under nvim-autopairs -- file handling opt.backup = false @@ -60,3 +78,11 @@ opt.swapfile = false opt.undofile = true opt.undodir = vim.fn.expand("~/.nvim/undodir") opt.autoread = true + +-- custom functions +-- disable automatic commenting upon using +vim.api.nvim_create_autocmd("FileType", { + callback = function() + vim.opt_local.formatoptions:remove("r") + end, +}) diff --git a/lua/plugins/completion.lua b/lua/plugins/completion.lua old mode 100644 new mode 100755 index 03773c9..3b19da3 --- a/lua/plugins/completion.lua +++ b/lua/plugins/completion.lua @@ -2,13 +2,9 @@ return { { "saghen/blink.cmp", dependencies = { - { "rafamadriz/friendly-snippets" }, + { "disrupted/blink-cmp-conventional-commits" } }, version = "1.*", - - ---@module 'blink.cmp' - ---@type blink.cmp.Config - opts = { keymap = { preset = "none", @@ -34,12 +30,12 @@ return { }, [""] = { "select_prev", "fallback" }, [""] = { "select_and_accept", "fallback" }, - [""] = { "hide", "fallback" }, + [""] = { "show", "hide", "fallback" }, }, completion = { trigger = { - show_on_x_blocked_trigger_characters = { "." }, + show_on_x_blocked_trigger_characters = { ".", "[", "]", "(", ")", "/", '"' }, }, documentation = { auto_show = true, @@ -50,8 +46,25 @@ return { }, sources = { - default = { "lsp", "path", "snippets", "buffer" }, + default = { "lsp", "path", "ecolog", "conventional_commits" }, min_keyword_length = 0, + + providers = { + ecolog = { + name = "ecolog", + module = "ecolog.integrations.cmp.blink_cmp" + }, + + conventional_commits = { + name = 'Conventional Commits', + module = 'blink-cmp-conventional-commits', + enabled = function() + return vim.bo.filetype == 'gitcommit' + end, + opts = { + }, + } + } }, signature = { enabled = true }, diff --git a/lua/plugins/dev-utils.lua b/lua/plugins/dev-utils.lua old mode 100644 new mode 100755 index 3f1ac2d..393bf3e --- a/lua/plugins/dev-utils.lua +++ b/lua/plugins/dev-utils.lua @@ -1,37 +1,40 @@ return { -- Parser that does syntax highlighting + -- Make sure tree-sitter-cli is up-to-date! { "nvim-treesitter/nvim-treesitter", - branch = 'master', lazy = false, + branch = "main", build = ":TSUpdate", config = function() - require("nvim-treesitter.configs").setup({ - ensure_installed = { - "lua", - "cpp", - "java", - "javascript", - "bash", - "python", - "typescript", - "css", - "html", - "jsdoc", - "http", - "sql", - "ssh_config", - "json", - "tsx", - "xml", - "yaml", - "nginx", - "gitcommit", - "gitignore", - "cmake" - }, - indent = { enable = true }, - highlight = { enable = true } + require("nvim-treesitter").install({ + "lua", + "cpp", + "java", + "javascript", + "bash", + "python", + "typescript", + "css", + "html", + "jsdoc", + "http", + "sql", + "ssh_config", + "json", + "tsx", + "xml", + "yaml", + "nginx", + "gitcommit", + "gitignore", + "cmake" + }) + + vim.api.nvim_create_autocmd("FileType", { + callback = function(args) + pcall(vim.treesitter.start, args.buf) + end }) end }, @@ -41,7 +44,15 @@ return { "windwp/nvim-autopairs", event = "InsertEnter", config = true, - opts = {} + opts = function() + local npairs = require('nvim-autopairs') + npairs.setup({ + fast_wrap = { + map = "", + chars = { '{', '[', '(', '"', "'" }, + } + }) + end }, -- Allows automatic tagging on HTML or JSON (E.g:
test
) @@ -84,23 +95,56 @@ return { -- Floating terminal { - "numToStr/FTerm.nvim", + "akinsho/toggleterm.nvim", + version = "*", config = function() - -- truly toggle floating terminal (auto closes floating terminal) - -- thank you: https://github.com/numToStr/FTerm.nvim/issues/78#issuecomment-1432326116 - local function create_autocmd(pattern, key, term) - vim.api.nvim_create_autocmd("FileType", { - pattern = pattern, - callback = function(event) - local t = term - vim.keymap.set("t", key, function() t:close() end, { buffer = event.buf, silent = true }) - end, - }) + local Terminal = require("toggleterm.terminal").Terminal + local newTerm = Terminal:new({ + direction = "float", + on_open = function(term) + vim.cmd("startinsert!") + vim.api.nvim_buf_set_keymap(term.bufnr, "t", "", "close", { noremap = true, silent = true }) + end, + on_close = function() + vim.cmd("startinsert!") + end, + }) + + function _Term_toggle() + newTerm:toggle() end - local fterm = require("FTerm") - fterm.setup({}) - create_autocmd("FTerm", "", fterm) + vim.api.nvim_set_keymap("n", "", "lua _Term_toggle()", { noremap = true, silent = true }) end + }, + + -- Helps with finding environmental variables + { + "philosofonusus/ecolog.nvim", + branch = "v1", + lazy = false, + keys = { + { 'ge', 'EcologGoto', desc = 'Go to env file' }, + { 'ep', 'EcologPeek', desc = 'Ecolog peek variable' }, + { 'es', 'EcologSelect', desc = 'Switch env file' }, + }, + opts = { + integrations = { + blink_cmp = true + } + } + }, + + + -- For Python mainly + -- Allows + { + "linux-cultist/venv-selector.nvim", + ft = "python", + opts = { + options = {}, + search = {} + }, } + } diff --git a/lua/plugins/discord.lua b/lua/plugins/discord.lua old mode 100644 new mode 100755 diff --git a/lua/plugins/file-explorer.lua b/lua/plugins/file-explorer.lua old mode 100644 new mode 100755 index 4f2494d..a69681b --- a/lua/plugins/file-explorer.lua +++ b/lua/plugins/file-explorer.lua @@ -10,9 +10,8 @@ return { opts = { window = { mappings = { - ["P"] = "toggle_preview", + ["p"] = "toggle_preview", } } }, } - diff --git a/lua/plugins/formatter.lua b/lua/plugins/formatter.lua old mode 100644 new mode 100755 index fc6139a..71480f2 --- a/lua/plugins/formatter.lua +++ b/lua/plugins/formatter.lua @@ -5,9 +5,6 @@ return { event = { "BufWritePre" }, cmd = { "ConformInfo" }, - -- This will provide type hinting with LuaLS - ---@module "conform" - ---@type conform.setupOpts opts = { formatters_by_ft = { lua = { "stylua" }, @@ -17,19 +14,13 @@ return { sh = { "shfmt", "shellcheck" }, bash = { "shfmt", "shellcheck" }, }, - formatters = { - prettier = { - prepend_args = function() - return { "" } - end, - }, - }, default_format_opts = { lsp_format = "fallback", }, format_on_save = { timeout_ms = 500, - }, + lsp_format = "fallback" + } }, init = function() diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua old mode 100644 new mode 100755 index b825a59..6589528 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -52,6 +52,33 @@ return { init_options = { preferences = { disableSuggestions = false } }, }) + vim.lsp.config("pylsp", { + settings = { + pylsp = { + plugins = { + pycodestyle = { + ignore = { "E501", "W503", "E265" }, + }, + }, + }, + }, + }) + + local base_on_attach = vim.lsp.config.eslint.on_attach + vim.lsp.config("pylsp", { + on_attach = function(client, bufnr) + if not base_on_attach then + return + end + + base_on_attach(client, bufnr) + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = bufnr, + command = "LspEslintFixAll", + }) + end, + }) + vim.lsp.enable({ "lua_ls", "clangd", @@ -61,19 +88,8 @@ return { "html", "tailwindcss", "pylsp", - }) - end, - }, - - { - "esmuellert/nvim-eslint", - config = function() - require("nvim-eslint").setup({ - settings = { - workingDirectory = function(bufnr) - return { directory = vim.fs.root(bufnr, { "package.json" }) } - end, - }, + "eslint-lsp", + "pyright", }) end, }, @@ -89,6 +105,6 @@ return { }, }) vim.lsp.enable("jdtls") - end - } + end, + }, } diff --git a/lua/plugins/remote.lua b/lua/plugins/remote.lua old mode 100644 new mode 100755 diff --git a/lua/plugins/search.lua b/lua/plugins/search.lua new file mode 100755 index 0000000..c103f66 --- /dev/null +++ b/lua/plugins/search.lua @@ -0,0 +1,7 @@ +return { + 'nvim-telescope/telescope.nvim', + version = '*', + dependencies = { + 'nvim-lua/plenary.nvim', + } +} diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua old mode 100644 new mode 100755