refactor + feat: replaced nvim-cmp w/ coq_nvim and refactored everything

This commit is contained in:
devaine 2025-09-03 12:50:00 -05:00
commit 7a906314d8
Signed by untrusted user who does not match committer: devaine
GPG key ID: 954B1DCAC6FF84EE
19 changed files with 435 additions and 311 deletions

View file

@ -1,48 +0,0 @@
-- https://github.com/hrsh7th/nvim-cmp
-- Basically a completion plugin for neovim
return {
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
{
"L3MON4D3/LuaSnip",
build = "make install_jsregexp"
},
"saadparwaiz1/cmp_luasnip", -- luasnip autocompletion
"hrsh7th/cmp-path" -- Path finder
},
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end
},
mapping = cmp.mapping.preset.insert({
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<Tab>'] = cmp.mapping.select_next_item(),
['<S-Tab>'] = cmp.mapping.select_prev_item(),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name= 'path' }
}),
formatting = {
format = require("nvim-highlight-colors").format
}
})
end
},
{
"windwp/nvim-autopairs",
event = "InsertEnter",
config = true
}
}

View file

@ -1,6 +0,0 @@
return {
"windwp/nvim-ts-autotag",
config = function ()
require("nvim-ts-autotag").setup({})
end
}

View file

@ -1,3 +1,9 @@
-- Homepage: https://github.com/rebelot/kanagawa.nvim
-- What is it?
-- Basically makes neovim look nicer,
-- a.k.a colorscheme for neovim's UI.
return {
"rebelot/kanagawa.nvim",
lazy = false,

View file

@ -1,8 +0,0 @@
return {
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function ()
-- Initializes todo setup
require("todo-comments").setup()
end
}

View file

@ -0,0 +1,78 @@
return {
-- Autopairs
-- Homepage: https://github.com/windwp/nvim-autopairs
-- What is it?
-- Basically just create another pair of ' " ( or more so it makes programming slightly easier.
{
"windwp/nvim-autopairs",
event = "InsertEnter",
config = true,
},
-- Autotag
-- Homepage: https://github.com/windwp/nvim-ts-autotag
-- What is it?
-- Helps with automatically adding a ending tag
-- NOTE: Test it out using HTML or JSON. (E.g <div>something</div>)
{
"windwp/nvim-ts-autotag",
config = function()
require("nvim-ts-autotag").setup({})
end,
},
-- todo-comments.nvim
-- Homepage: https://github.com/folke/todo-comments.nvim
-- What is it?
-- Basically helps indicate developer notes.
-- Test:
-- NOTE: This is a notes
-- WARN: This is warning note.
-- TODO: This is a to-do note.
-- FIX: This is a fix note.
-- PERF: This is a performance note.
{
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
-- Initializes todo setup
require("todo-comments").setup()
end,
},
-- nvim-highlight-colors
-- Homepage: https://github.com/brenoprata10/nvim-highlight-colors
-- What is it?
-- Makes it easier to see RGB colors via their hexadecimal number.
-- Test: #FFFFFF
{
"brenoprata10/nvim-highlight-colors",
config = function()
require("nvim-highlight-colors").setup({})
end,
},
-- indent-blankline
-- Homepage: https://github.com/lukas-reineke/indent-blankline.nvim
-- What is it?
-- Shows the line of indentation so you know how much indentation you are using.
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
---@module "ibl"
---@type ibl.config opts = {},
},
}

View file

@ -1,3 +1,7 @@
-- Homepage: https://github.com/vyfor/cord.nvim
-- What is it?
-- Just Rich Presence for Neovim, neat huh?
return {
'vyfor/cord.nvim',
build = ':Cord update',
@ -7,6 +11,7 @@ return {
flavor = "dark"
},
text = {
default = 'programming most likely',
workspace = ''
}
}

View file

@ -0,0 +1,30 @@
-- Homepage: https://github.com/nvim-neo-tree/neo-tree.nvim
-- What is it?
-- A File Explorer
-- For more information on this plugin: https://github.com/nvim-neo-tree/neo-tree.nvim?tab=readme-ov-file#quickstart
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
{ "3rd/image.nvim", opts = {} },
},
lazy = false,
---@module "neo-tree"
---@type neotree.Config?
opts = {
window = {
mappings = {
["P"] = "toggle_preview",
}
}
},
vim.keymap.set("n", "<leader>mm", "<Cmd>Neotree toggle<CR>"),
vim.keymap.set("n", "<leader>jj", "<Cmd>Neotree action=focus<CR>")
}

View file

@ -1,26 +1,41 @@
-- Using formatter.nvim: https://github.com/mhartington/formatter.nvim
-- Homepage: https://github.com/mhartington/formatter.nvim
-- What is it?
-- Formatter plugin, helps with formatting code on saving the file.
return {
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
-- This will provide type hinting with LuaLS
---@module "conform"
---@type conform.setupOpts
---@module "conform"
---@type conform.setupOpts
opts = {
formatters_by_ft = {
lua = { "stylua" },
python = { "black" },
javascript = { "prettier" } -- add stop_after_first if you want more than 1
javascript = { "prettier" }, -- add stop_after_first for n > 1
typescript = { "prettier" },
sh = { "shfmt", "shellcheck" },
bash = { "shfmt", "shellcheck" },
},
formatters = {
prettier = {
prepend_args = function()
return { "" }
end,
},
},
-- Set default options
default_format_opts = {
lsp_format = "fallback"
lsp_format = "fallback",
},
format_on_save = {
timeout_ms = 500,
},
format_on_save = { timeout_ms = 500 },
},
init = function ()
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
end
}
init = function()
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
end,
}

View file

@ -0,0 +1,20 @@
-- Homepage: https://github.com/nvim-telescope/telescope.nvim
-- What is this?
-- A `fuzzy finder` over lists.
-- Purpose?
-- Makes it easier to find files, variables, & code by using keywords.
return {
'nvim-telescope/telescope.nvim',
tag = '0.1.8',
dependencies = { 'nvim-lua/plenary.nvim' },
cmd = "Telescope",
keys = {
{ "<leader>pp", "<cmd>Telescope find_files<cr>", desc = "File Picker" },
{ "<leader>;;", "<cmd>Telescope buffers<cr>", desc = "Buffer Picker" },
{ "<leader>..", "<cmd>Telescope treesitter<cr>", desc = "Find Symbols" },
{ "<leader>[[", "<cmd>Telescope live_grep<cr>", desc = "Live Grep" },
}
}

View file

@ -1,8 +0,0 @@
-- For more information: https://github.com/brenoprata10/nvim-highlight-colors
return {
"brenoprata10/nvim-highlight-colors",
config = function ()
require("nvim-highlight-colors").setup({})
end
}

View file

@ -1,7 +0,0 @@
return {
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
---@module "ibl"
---@type ibl.config
opts = {},
}

View file

@ -1,39 +1,156 @@
return {
-- Java
-- For checksums: https://github.com/mfussenegger/nvim-jdtls/discussions/249#discussioncomment-3159367
-- It's here first because it needs to have load before lspconfig apparently
{
"nvim-java/nvim-java",
dependencies = {
"neovim/nvim-lspconfig",
},
config = function()
require("java").setup()
require("lspconfig").jdtls.setup({})
end
},
--
-- What is this?
-- Homepage: https://github.com/ms-jpq/coq_nvim
-- https://github.com/williamboman/mason.nvim?tab=readme-ov-file#configuration for more information
-- https://github.com/williamboman/mason-lspconfig.nvim?tab=readme-ov-file#setup for more info
-- Basically a completion plugin for neovim.
-- More specifically it just helps with autocorrecting variables, by using
-- text you have typed down or just by using libraries. LSP relies on this.
-- What is this?
-- LSP = Language Server Protocol => A protocol that provides code-completion,
-- syntax highlighting, marking of errors and more.
-- Homepages:
-- mason = https://github.com/mason-org/mason.nvim
-- mason-lspconfig = https://github.com/mason-org/mason-lspconfig.nvim
-- nvim-lspconfig = https://github.com/neovim/nvim-lspconfig
-- Recommended MasonInstall list (mostly formatters):
-- CMD: MasonInstall stylua prettier shfmt shellcheck
-- Homepage: https://github.com/windwp/nvim-ts-autotag
-- What is it?
-- Helps with automatically adding a ending tag
-- NOTE: Test it out using HTML or JSON. (E.g <div>something</div>)
return {
{
"williamboman/mason.nvim",
"neovim/nvim-lspconfig",
lazy = false,
dependencies = {
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig", -- https://github.com/neovim/nvim-lspconfig for more information
},
opts = function()
require("mason").setup({
registries = {
"github:nvim-java/mason-registry",
"github:mason-org/mason-registry"
}
{ "ms-jpq/coq_nvim", branch = "coq" },
{ "ms-jpq/coq.artifacts", branch = "artifacts" },
{ "ms-jpq/coq.thirdparty", branch = "3p" },
},
init = function()
local remap = vim.api.nvim_set_keymap
local npairs = require("nvim-autopairs")
-- Prevents going to newline after an autocomplete.
npairs.setup({ map_bs = false })
vim.g.coq_settings = {
auto_start = "shut-up",
keymap = {
recommended = false,
},
completion = {
skip_after = { "\t", "{" },
},
}
require("coq_3p")({
{ src = "nvimlua", short_name = "nLUA" },
{ src = "bc", short_name = "MATH", precision = 6 },
{ src = "builtin/css" },
{ src = "builtin/js" },
{ src = "builtin/c" },
{ src = "builtin/html" },
{ src = "builtin/xml" },
{ src = "repl", sh = "bash", unsafe = { "rm", "poweroff", "reboot", "mv" } },
})
remap("i", "<esc>", [[pumvisible() ? "<c-e><esc>" : "<esc>"]], { expr = true, noremap = true })
remap("i", "<c-c>", [[pumvisible() ? "<c-e><c-c>" : "<c-c>"]], { expr = true, noremap = true })
remap("i", "<tab>", [[pumvisible() ? "<c-n>" : "<tab>"]], { expr = true, noremap = true })
remap("i", "<s-tab>", [[pumvisible() ? "<c-p>" : "<bs>"]], { expr = true, noremap = true })
-- Prevents completion for everytime you press Enter
remap(
"i",
"<CR>",
[[pumvisible() ? (complete_info(['selected']).selected == -1 ? '<c-e><cr>' : '<c-y>') : '<cr>']],
{ expr = true, noremap = false }
)
end,
config = function()
local config = require("lspconfig")
local coq = require("coq")
config.lua_ls.setup(coq.lsp_ensure_capabilities({
settings = {
Lua = {
format = {
enable = false,
},
diagnostics = {
globals = { "vim" },
},
},
},
}))
config.pylsp.setup(coq.lsp_ensure_capabilities({}))
config.bashls.setup(coq.lsp_ensure_capabilities({}))
config.ts_ls.setup(coq.lsp_ensure_capabilities({
init_options = { preferences = { disableSuggestions = false } },
}))
config.eslint.setup(coq.lsp_ensure_capabilities({
settings = { autoFixOnSave = true },
}))
config.html.setup(coq.lsp_ensure_capabilities({}))
config.cssls.setup(coq.lsp_ensure_capabilities({
settings = {
css = {
lint = {
unknownAtRules = "ignore",
},
},
scss = {
lint = {
unknownAtRules = "ignore",
},
},
},
}))
config.tailwindcss.setup(coq.lsp_ensure_capabilities({}))
config.clangd.setup(coq.lsp_ensure_capabilities({
cmd = {
"clangd",
"--background-index",
"--clang-tidy",
"--log=verbose",
"--query-driver=/usr/bin/c++",
"--suggest-missing-includes",
"--all-scopes-completion",
"--completion-style=detailed",
},
init_options = {
fallback_flags = { "-std=c++17" },
},
}))
end,
},
{
"mason-org/mason.nvim",
dependencies = {
"mason-org/mason-lspconfig.nvim",
},
opts = function()
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = {
-- Language Servers
"lua_ls",
"pylsp",
"clangd",
"bashls",
"ts_ls",
@ -41,75 +158,9 @@ return {
"cssls",
"html",
"tailwindcss",
-- Formatters
"prettier",
"stylua",
"black"
}
})
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local config = require("lspconfig")
-- LSP Servers
config.lua_ls.setup {
capabilities = capabilities
}
-- FOR bashls
-- Make sure to install 'shellcheck', :MasonInstall shellcheck
-- Make sure to install 'shfmt', :MasonInstall shfmt
config.bashls.setup {
capabilities = capabilities
}
config.pylsp.setup {
capabilities = capabilities
}
config.clangd.setup {
cmd = { "clangd", "--background-index", "--clang-tidy", "--log=verbose", "--query-driver=/usr/bin/c++", "--suggest-missing-includes", "--all-scopes-completion", "--completion-style=detailed" },
init_options = {
fallback_flags = { "-std=c++17" },
"pylsp",
},
capabilities = capabilities
}
config.ts_ls.setup {
capabilities = capabilities,
init_options = { preferences = { disableSuggestions = false } },
}
config.eslint.setup {
capabilities = capabilities,
settings = { autoFixOnSave = true }
}
config.html.setup {
capabilities = capabilities,
}
config.cssls.setup {
capabilities = capabilities,
settings = {
css = {
lint = {
unknownAtRules = "ignore"
}
},
scss = {
lint = {
unknownAtRules = "ignore"
}
}
}
}
config.tailwindcss.setup { }
end
})
end,
},
}

View file

@ -1,14 +0,0 @@
-- https://github.com/nvim-tree/nvim-tree.lua?tab=readme-ov-file For more information
-- File Explorer
return {
"nvim-tree/nvim-tree.lua",
version = "*",
lazy = false,
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
require("nvim-tree").setup {}
end,
keys = { { "<leader>mm", "<cmd>NvimTreeToggle<cr>", desc = "Toggle Tree"} }
}

View file

@ -0,0 +1,50 @@
-- Homepage: https://github.com/nvim-treesitter/nvim-treesitter
-- What is this?
-- Basically helps making use of `tree-sitter` (parser-generating tool) and
-- provides highlighting
-- Based on language parsers, queries, and modules to work.
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = "BufRead",
config = function()
local configs = require("nvim-treesitter.configs")
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"
},
sync_install = true,
auto_intsall = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false
},
ident = { enable = true },
autopairs = {
enable = true
}
})
end
}

View file

@ -1,8 +1,16 @@
-- Homepage: https://github.com/mistweaverco/kulala.nvim
-- What is this?
-- A fully-featured REST client interface for neovim.
-- Purpose?
-- Usually for backend testing on HTTP requests.
return {
'mistweaverco/kulala.nvim',
opts = {},
keys = {
{ "<leader>uu", "<cmd>lua require('kulala').run()<cr>", desc = "run current" },
{ "<leader>yy", "<cmd>lua require('kulala').toggle_view()<cr>", desc = "run current" },
opts = {},
keys = {
{ "<leader>uu", "<cmd>lua require('kulala').run()<cr>", desc = "run current" },
{ "<leader>yy", "<cmd>lua require('kulala').toggle_view()<cr>", desc = "run current" },
}
}

View file

@ -1,14 +0,0 @@
-- For more information on the arguements, visit: https://www.lazyvim.org/extras/editor/telescope#telescopenvim OR for more information on telescope, visit: https://github.com/nvim-telescope/telescope.nvim
return {
'nvim-telescope/telescope.nvim', tag = '0.1.8',
dependencies = { 'nvim-lua/plenary.nvim' },
cmd = "Telescope",
keys = {
{ "<leader>//", "<cmd>Telescope<cr>", desc = "Start" },
{ "<leader>pp", "<cmd>Telescope find_files<cr>", desc = "File Picker" },
{ "<leader>;;", "<cmd>Telescope buffers<cr>", desc = "Buffer Picker" },
{ "<leader>..", "<cmd>Telescope treesitter<cr>", desc = "Treesitter" },
{ "<leader>[[", "<cmd>Telescope live_grep<cr>", desc = "Grep" },
}
}

View file

@ -1,47 +0,0 @@
-- https://github.com/nvim-treesitter/nvim-treesitter?tab=readme-ov-file#language-parsers for language parsers
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = "BufRead",
config = function()
local configs = require("nvim-treesitter.configs")
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"
},
sync_install = true,
auto_intsall = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false
},
ident = { enable = true },
autopairs = {
enable = true
}
})
end
}