droped none-ls

This commit is contained in:
sankalp committed 2024-08-26 08:30:21 +05:45
1 parent c3d41436a1
commit 847238c1bc
17 files changed
+590 -604

No files matched your search

+81 -87
View File
@@ -1,90 +1,84 @@
local cmp = require('cmp')
local luasnip = require('luasnip')
require('luasnip/loaders/from_vscode').lazy_load()
local cmp = require("cmp")
local luasnip = require("luasnip")
local lspkind = require("lspkind")
require("luasnip/loaders/from_vscode").lazy_load()
cmp.setup({
completion = {
keyword_length = 1,
completeopt = 'menu,menuone',
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
fields = { 'kind', 'abbr', 'menu' },
format = function(entry, vim_item)
local kind = require('lspkind').cmp_format({ mode = 'symbol_text', maxwidth = 50 })(entry, vim_item)
local strings = vim.split(kind.kind, '%s', { trimempty = true })
kind.kind = ' ' .. (strings[1] or '') .. ' '
kind.menu = ' (' .. (strings[2] or '') .. ')'
return kind
end,
},
snippet = { -- configure how nvim-cmp interacts with snippet engine
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = {
['<C-k>'] = cmp.mapping.select_prev_item(),
['<C-j>'] = cmp.mapping.select_next_item(),
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-1), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(1), { 'i', 'c' }),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4),
['<C-y>'] = cmp.config.disable,
['<C-c>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
}),
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'cmdline' },
},
}),
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' },
},
}),
-- sources for autocompletion
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' }, -- snippets
{ name = 'buffer' }, -- text within current buffer
{ name = 'path' }, -- file system paths
{ name = 'codeium' }, -- AI for autocompletion
-- { name = "nvim_lsp_signature_help" },
-- { name = "calc" }, --for maths calculations
},
completion = {
completeopt = "menu,menuone,preview,noselect",
},
window = { -- making ui stuff for completion bordered
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
-- configure lspkind for vs-code like pictograms in completion menu
formatting = {
format = lspkind.cmp_format({
maxwidth = 50,
ellipsis_char = "...",
}),
},
snippet = { -- configure how nvim-cmp interacts with snippet engine
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = {
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
["<C-y>"] = cmp.config.disable,
["<C-c>"] = cmp.mapping({ -- close completion window
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "cmdline" },
},
}),
-- cmp.setup.cmdline("/", {
-- mapping = cmp.mapping.preset.cmdline(),
-- sources = {
-- { name = "buffer" },
-- },
-- }),
-- sources for autocompletion
sources = {
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" }, -- parameter hints
{ name = "luasnip" }, -- snippets
{ name = "buffer" }, -- text within current buffer
{ name = "path" }, -- file system paths
{ name = "codeium" }, -- AI for autocompletion
-- { name = "calc" }, --for maths calculations
},
})
+55 -106
View File
@@ -1,7 +1,8 @@
local lspconfig = require("lspconfig")
-- import cmp-nvim-lsp plugin
local cmp_nvim_lsp = require("cmp_nvim_lsp")
-- import mason_lspconfig plugin
local mason_lspconfig = require("mason-lspconfig")
local keymap = vim.keymap -- for conciseness
vim.api.nvim_create_autocmd("LspAttach", {
@@ -18,6 +19,14 @@ vim.api.nvim_create_autocmd("LspAttach", {
opts.desc = "Go to declaration"
keymap.set("n", "lD", vim.lsp.buf.declaration, opts) -- go to declaration
opts.desc = "Inlay hint"
keymap.set(
"n",
"<leader>lh",
"<cmd>lua vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())<CR>",
opts
)
opts.desc = "Show LSP definitions"
keymap.set("n", "ld", "<cmd>Telescope lsp_definitions<CR>", opts) -- show lsp definitions
@@ -28,10 +37,10 @@ vim.api.nvim_create_autocmd("LspAttach", {
keymap.set("n", "lt", "<cmd>Telescope lsp_type_definitions<CR>", opts) -- show lsp type definitions
opts.desc = "See available code actions"
keymap.set({ "n", "v" }, "<leader>la", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection
opts.desc = "Smart rename"
keymap.set("n", "<leader>mr", vim.lsp.buf.rename, opts) -- smart rename
keymap.set("n", "<leader>mR", vim.lsp.buf.rename, opts) -- smart rename
opts.desc = "Show buffer diagnostics"
keymap.set("n", "<leader>lD", "<cmd>Telescope diagnostics bufnr=0<CR>", opts) -- show diagnostics for file
@@ -50,111 +59,51 @@ vim.api.nvim_create_autocmd("LspAttach", {
-- used to enable autocompletion (assign to every lsp server config)
local capabilities = cmp_nvim_lsp.default_capabilities()
-- configure matlab server
lspconfig["clangd"].setup({
capabilities = capabilities,
})
-- configure bash server
lspconfig["bashls"].setup({
capabilities = capabilities,
})
-- configure html server
lspconfig["html"].setup({
capabilities = capabilities,
})
-- configure typescript server with plugin
lspconfig["tsserver"].setup({
capabilities = capabilities,
})
-- Change the Diagnostic symbols in the sign column (gutter)
local signs = { Error = "", Warn = "", Hint = "󰠠 ", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
-- configure css server
lspconfig["cssls"].setup({
capabilities = capabilities,
})
mason_lspconfig.setup_handlers({
-- default handler for installed servers
function(server_name)
lspconfig[server_name].setup({
capabilities = capabilities,
})
end,
-- configure tailwindcss server
lspconfig["tailwindcss"].setup({
capabilities = capabilities,
})
-- configure svelte server
lspconfig["svelte"].setup({
capabilities = capabilities,
on_attach = function(client, bufnr)
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = { "*.js", "*.ts" },
callback = function(ctx)
if client.name == "svelte" then
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.file })
end
end,
["lua_ls"] = function()
-- configure lua server (with special settings)
lspconfig["lua_ls"].setup({
capabilities = capabilities,
settings = {
Lua = {
-- make the language server recognize "vim" global
diagnostics = {
globals = { "vim" },
},
hint = { enable = true },
completion = {
callSnippet = "Replace",
},
},
},
})
end,
["basedpyright"] = function()
-- configure pyright server (with special settings)
lspconfig["basedpyright"].setup({
capabilities = capabilities,
settings = {
python = {
hint = { enable = true },
},
},
handlers = {
["textDocument/publishDiagnostics"] = function() end,
},
})
end,
})
-- configure prisma orm server
lspconfig["prismals"].setup({
capabilities = capabilities,
})
-- configure emmet language server
lspconfig["emmet_ls"].setup({
capabilities = capabilities,
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
})
-- configure python server
lspconfig["pyright"].setup({
capabilities = capabilities,
})
-- configure lua server (with special settings)
lspconfig["lua_ls"].setup({
capabilities = capabilities,
settings = { -- custom settings for lua
Lua = {
-- make the language server recognize "vim" global
diagnostics = {
globals = { "vim" },
},
workspace = {
-- make language server aware of runtime files
library = {
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
[vim.fn.stdpath("config") .. "/lua"] = true,
},
},
},
},
})
local x = vim.diagnostic.severity
local config = {
-- Enable virtual text
virtual_text = { -- or false for disable
prefix = "", -- ■  󰊠
suffix = "",
format = function(diagnostic)
local prefix = "󰊠 "
local suffix = " "
-- return full message with custom prefix & suffix
return prefix .. diagnostic.message .. suffix
end,
},
update_in_insert = true,
signs = { text = { [x.ERROR] = "", [x.WARN] = "", [x.HINT] = "󰌵", [x.INFO] = "" } },
underline = false,
severity_sort = true,
float = {
focusable = false,
style = "minimal",
border = "rounded",
source = "always",
header = "",
prefix = "",
},
}
vim.diagnostic.config(config)
-- add borders to lsp info window
require("lspconfig.ui.windows").default_options.border = "single"
+32 -38
View File
@@ -1,48 +1,42 @@
local mason = require("mason")
local mason_lspconfig = require("mason-lspconfig")
local mason_tool_installer = require("mason-tool-installer")
local mason = require('mason')
local mason_lspconfig = require('mason-lspconfig')
local mason_tool_installer = require('mason-tool-installer')
-- enable mason and configure icons
mason.setup({
automatic_installation = true,
ui = {
border = "rounded",
icons = {
package_installed = "✓",
package_pending = "➜",
package_uninstalled = "✗",
},
},
automatic_installation = true,
ui = {
border = 'rounded',
icons = {
package_installed = '✓',
package_pending = '➜',
package_uninstalled = '✗',
},
},
})
mason_lspconfig.setup({
-- list of servers for mason to install
ensure_installed = {
"tsserver",
"html",
"cssls",
"tailwindcss",
"svelte",
"lua_ls",
"pyright",
"jdtls",
"bashls",
"jsonls",
"clangd",
"emmet_ls",
"prismals",
},
-- list of servers for mason to install
ensure_installed = {
'tsserver',
'lua_ls',
'basedpyright',
'jdtls',
'bashls',
'jsonls',
'clangd',
},
})
mason_tool_installer.setup({
ensure_installed = {
"prettier", -- prettier formatter
"biome", -- js formatter
"stylua", -- lua formatter
"black", -- python formatter
"isort", -- python formatter
"clang-format", -- c/c++ formatter
"pylint",
"eslint_d",
},
ensure_installed = {
'prettier', -- prettier formatter
'stylua', -- lua formatter
'black', -- python formatter
'isort', -- python formatter
'clang-format', -- c/c++ formatter
'ruff', -- python linter
'mypy', -- type checking
'eslint_d', --js linter
},
})
+49 -48
View File
@@ -1,63 +1,64 @@
local mason_null_ls = require("mason-null-ls")
local mason_null_ls = require('mason-null-ls')
local null_ls = require("null-ls")
local null_ls = require('null-ls')
local null_ls_utils = require("null-ls.utils")
local null_ls_utils = require('null-ls.utils')
mason_null_ls.setup({
ensure_installed = {
"prettier", -- prettier formatter
"biome", -- js formatter
"clang-format", -- c/c++ formatter
"stylua", -- lua formatter
"black", -- python formatter
"pylint", -- python linter
"google-java-format", -- java formatter
-- "eslint_d", -- js linter
},
ensure_installed = {
'prettier', -- prettier formatter
'clang-format', -- c/c++ formatter
'stylua', -- lua formatter
'black', -- python formatter
'pylint', -- python linter
'google-java-format', -- java formatter
-- "eslint_d", -- js linter
},
})
-- for conciseness
local formatting = null_ls.builtins.formatting -- to setup formatters
local diagnostics = null_ls.builtins.diagnostics -- to setup linters
local hover = null_ls.builtins.hover
-- to setup format on save
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local augroup = vim.api.nvim_create_augroup('LspFormatting', {})
-- configure null_ls
null_ls.setup({
root_dir = null_ls_utils.root_pattern(".null-ls-root", "Makefile", ".git", "package.json"),
sources = {
formatting.prettier, -- js/ts formatter
formatting.stylua, -- lua formatter
formatting.isort,
formatting.black,
formatting.clang_format,
formatting.google_java_format,
diagnostics.pylint,
-- diagnostics.eslint_d.with({ -- js/ts linter
-- condition = function(utils)
-- return utils.root_has_file({ ".eslintrc.js", ".eslintrc.cjs" }) -- only enable if root has .eslintrc.js or .eslintrc.cjs
-- end,
-- }),
},
-- configure format on save
on_attach = function(current_client, bufnr)
if current_client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({
filter = function(client)
-- only use null-ls for formatting instead of lsp server
return client.name == "null-ls"
end,
bufnr = bufnr,
})
end,
})
end
end,
root_dir = null_ls_utils.root_pattern('.null-ls-root', 'Makefile', '.git', 'package.json'),
sources = {
formatting.prettier, -- js/ts formatter
formatting.stylua, -- lua formatter
formatting.isort,
formatting.black,
formatting.clang_format,
formatting.google_java_format,
diagnostics.pylint,
hover.printenv,
-- diagnostics.eslint_d.with({ -- js/ts linter
-- condition = function(utils)
-- return utils.root_has_file({ ".eslintrc.js", ".eslintrc.cjs" }) -- only enable if root has .eslintrc.js or .eslintrc.cjs
-- end,
-- }),
},
-- configure format on save
on_attach = function(current_client, bufnr)
if current_client.supports_method('textDocument/formatting') then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd('BufWritePre', {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({
filter = function(client)
-- only use null-ls for formatting instead of lsp server
return client.name == 'null-ls'
end,
bufnr = bufnr,
})
end,
})
end
end,
})
+1 -1
View File
@@ -8,7 +8,7 @@ vim.api.nvim_create_autocmd({ "BufWritePre" }, {
pattern = { "*" },
callback = function()
vim.cmd([[ %s/\s\+$//e ]])
end,
end,
})
-- Check if we need to reload the file when it changed
+6 -4
View File
@@ -6,12 +6,14 @@
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"code_runner.nvim": { "branch": "main", "commit": "6c5bfe44a6c7523350cd706e6b3b8101166eed99" },
"codeium.vim": { "branch": "main", "commit": "8bed5fb5708c94cd69f418d1381d6fbf07cb0313" },
"comment-box.nvim": { "branch": "main", "commit": "06bb771690bc9df0763d14769b779062d8f12bc5" },
"conform.nvim": { "branch": "master", "commit": "62eba813b7501b39612146cbf29cd07f1d4ac29c" },
"dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" },
"dotfyle-metadata.nvim": { "branch": "main", "commit": "342ef8f3f98f3ccc451c9cf2be74e95149ced05d" },
"dressing.nvim": { "branch": "master", "commit": "c5775a888adbc50652cb370073fcfec963eca93e" },
@@ -29,12 +31,11 @@
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lock.nvim": { "branch": "main", "commit": "86614f76c3442fba1c5c8d79aa1efcb3ad69de1c" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "482350b050bd413931c2cdd4857443c3da7d57cb" },
"mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.files": { "branch": "main", "commit": "7ed15315247775b4c5fcfaf4c8fe45d3a0dde9ad" },
"mini.icons": { "branch": "main", "commit": "12e7b5d47bfc1b4c5ba4278fb49ec9100138df14" },
"mini.nvim": { "branch": "main", "commit": "3cf9265bbde75d1358d126701eb6055034491df6" },
"mini.nvim": { "branch": "main", "commit": "2c55015a518e11ea9d49bb96078f5ede51f5d2af" },
"modes.nvim": { "branch": "main", "commit": "3188692abf02a8838ec75e59d68c2ce3e4323f5c" },
"neo-tree.nvim": { "branch": "main", "commit": "206241e451c12f78969ff5ae53af45616ffc9b72" },
"neotest": { "branch": "master", "commit": "32ff2ac21135a372a42b38ae131e531e64833bd3" },
@@ -43,19 +44,19 @@
"neotest-rspec": { "branch": "main", "commit": "53fc108a06ae43d7f873d42ee5189c2301e33623" },
"nerdy.nvim": { "branch": "main", "commit": "b467d6609b78d6a5f1e12cbc08fcc1ac87af20f5" },
"noice.nvim": { "branch": "main", "commit": "448bb9c524a7601035449210838e374a30153172" },
"none-ls.nvim": { "branch": "main", "commit": "3cc6c6ae11c89a6963f0b5a25ad2ce211039faf2" },
"nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" },
"numb.nvim": { "branch": "master", "commit": "3f7d4a74bd456e747a1278ea1672b26116e0824d" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-dap": { "branch": "master", "commit": "281a2e4cd1e7a17cea7ecb1745d84a8ab1249925" },
"nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" },
"nvim-lint": { "branch": "master", "commit": "debabca63c0905b59ce596a55a8e33eafdf66342" },
"nvim-lsp-file-operations": { "branch": "master", "commit": "92a673de7ecaa157dd230d0128def10beb56d103" },
"nvim-lspconfig": { "branch": "master", "commit": "911167921d49cd5c1c9b2436031d0da3945e787f" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
"nvim-recorder": { "branch": "main", "commit": "ce96792c1ff750977fc3affc56f0561b0c20a7e2" },
"nvim-spectre": { "branch": "master", "commit": "ba7fb777edff6c1fbbeffd343e113af64c04e90a" },
"nvim-treesitter": { "branch": "master", "commit": "e085c614fcd716eedb8e2e55bae2ccad4becd40d" },
"nvim-treesitter": { "branch": "master", "commit": "397982d197768ebdefc0e2db396d95c4d371ca86" },
"nvim-treesitter-context": { "branch": "master", "commit": "0f3332788e0bd37716fbd25f39120dcfd557c90f" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "41e3abf6bfd9a9a681eb1f788bdeba91c9004b2b" },
"nvim-ts-autotag": { "branch": "main", "commit": "0cb76eea80e9c73b88880f0ca78fbd04c5bdcac7" },
@@ -82,6 +83,7 @@
"vim-dadbod-completion": { "branch": "master", "commit": "880f7e9f2959e567c718d52550f9fae1aa07aa81" },
"vim-dadbod-ui": { "branch": "master", "commit": "2f344874918a3ab6bbe68fb866b3f003a639a5d2" },
"vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" },
"vim-visual-multi": { "branch": "master", "commit": "38b0e8d94a5499ccc17d6159763d32c79f53417b" },
"vim-wakatime": { "branch": "master", "commit": "53bba6bb8342de9cbdafc82142a9b5e82008d858" },
"which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" },
"yanky.nvim": { "branch": "main", "commit": "73215b77d22ebb179cef98e7e1235825431d10e4" },
+66 -13
View File
@@ -14,6 +14,64 @@ return {
end,
},
},
{
"mg979/vim-visual-multi",
event = "BufReadPre",
keys = {
{
"<C-S-Down>",
":call vm#commands#add_cursor_down(0, v:count1)<cr>",
desc = "Add Cursor Down",
mode = { "n" },
noremap = true,
silent = true,
},
{
"<C-S-Up>",
":call vm#commands#add_cursor_up(0, v:count1)<cr>",
desc = "Add Cursor Up",
mode = { "n" },
noremap = true,
silent = true,
},
{
"<M-S-j>",
":call vm#commands#add_cursor_down(0, v:count1)<cr>",
desc = "Add Cursor Down",
mode = { "n" },
noremap = true,
silent = true,
},
{
"<M-S-k>",
":call vm#commands#add_cursor_up(0, v:count1)<cr>",
desc = "Add Cursor Down",
mode = { "n" },
noremap = true,
silent = true,
},
{
"<M-d>",
":call vm#commands#ctrln(v:count1)<cr>",
desc = "Multi Edit Next",
mode = { "n" },
noremap = true,
silent = true,
},
},
config = function()
vim.g.VM_default_mappings = 0
vim.g.VM_silent_exit = 1
vim.g.VM_set_statusline = 0
vim.g.VM_maps = {
["Find Under"] = "",
}
vim.g.VM_maps["I BS"] = ""
vim.g.VM_maps["I CtrlC"] = ""
vim.g.VM_maps["I CtrlN"] = ""
end,
},
{
"CRAG666/code_runner.nvim",
config = true,
@@ -65,23 +123,18 @@ return {
},
{
"hrsh7th/nvim-cmp",
event = { "InsertEnter" },
event = { "InsertEnter", "CmdlineEnter" },
dependencies = {
-- autocomplete plugins
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer", -- source for text in buffer
"hrsh7th/cmp-path", -- source for file system paths
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua",
"saadparwaiz1/cmp_luasnip",
-- "hrsh7th/cmp-nvim-lsp-signature-help",
-- "hrsh7th/cmp-calc",
-- vscode like icons to autocomplete list
"onsails/lspkind.nvim",
-- snippet plugin
{ "L3MON4D3/LuaSnip", event = { "BufReadPost", "BufNewFile" } },
{ "rafamadriz/friendly-snippets", event = { "BufReadPost", "BufNewFile" } },
"saadparwaiz1/cmp_luasnip", --for autocomplete
"hrsh7th/cmp-nvim-lsp-signature-help",
"onsails/lspkind.nvim", -- vs-code like pictograms
"L3MON4D3/LuaSnip", -- snippets
"rafamadriz/friendly-snippets", -- useful snippets
},
config = function()
require("configs.cmp")
+174
View File
@@ -0,0 +1,174 @@
return {
{
'ThePrimeagen/refactoring.nvim',
config = function()
require('refactoring').setup()
-- vim.keymap.set("x", "<leader>re", ":Refactor extract ")
-- vim.keymap.set("x", "<leader>rf", ":Refactor extract_to_file ")
-- vim.keymap.set("x", "<leader>rv", ":Refactor extract_var ")
-- vim.keymap.set({ "n", "x" }, "<leader>ri", ":Refactor inline_var")
-- vim.keymap.set("n", "<leader>rI", ":Refactor inline_func")
-- vim.keymap.set("n", "<leader>rb", ":Refactor extract_block")
-- vim.keymap.set("n", "<leader>rbf", ":Refactor extract_block_to_file")
-- load refactoring Telescope extension
require('telescope').load_extension('refactoring')
vim.keymap.set({ 'n', 'x' }, '<leader>rr', function()
require('telescope').extensions.refactoring.refactors()
end, { desc = 'Refactor' })
end,
},
{
'zapling/mason-lock.nvim',
cmd = { 'MasonLock', 'MasonLockRestore' },
opts = {},
},
{
'2kabhishek/nerdy.nvim',
dependencies = { 'stevearc/dressing.nvim' },
cmd = 'Nerdy',
},
{
'folke/persistence.nvim',
event = 'BufReadPre',
opts = { options = vim.opt.sessionoptions:get() },
keys = {
{
'<leader>ms',
function()
require('persistence').load()
end,
desc = 'Restore Session',
},
{
'<leader>ml',
function()
require('persistence').load({ last = true })
end,
desc = 'Restore Last Session',
},
{
'<leader>md',
function()
require('persistence').stop()
end,
desc = "Don't Save Current Session",
},
},
},
{
'nvim-lua/plenary.nvim',
lazy = true,
},
{
'iamcco/markdown-preview.nvim',
build = 'cd app && yarn install',
ft = { 'markdown' },
keys = {
{
'<leader>cm',
'<cmd>MarkdownPreviewToggle<CR>',
desc = 'toggle markdown preview',
},
},
},
{
'nvim-pack/nvim-spectre',
build = false,
cmd = 'Spectre',
opts = { open_cmd = 'noswapfile vnew' },
keys = {
{
'<leader>mr',
function()
require('spectre').open()
end,
desc = 'Replace in Files (Spectre)',
},
},
},
{
'szw/vim-maximizer',
keys = {
{ '<leader>mm', '<cmd>MaximizerToggle<CR>', desc = 'Maximize/minimize a split' },
},
},
{
'folke/zen-mode.nvim',
cmd = { 'ZenMode' },
opts = {},
keys = {
{ '<leader>wz', '<cmd>ZenMode<cr>', desc = 'Toggle zen mode' },
},
},
{
'creativenull/dotfyle-metadata.nvim',
cmd = { 'DotfyleGenerate', 'DotfyleOpen' },
},
{
'willothy/flatten.nvim',
priority = 1001,
opts = {
window = {
open = 'alternate',
},
},
},
{
'wakatime/vim-wakatime',
event = { 'VimEnter' },
lazy = false,
},
{
'mvllow/modes.nvim',
event = { 'BufReadPost', 'BufNewFile' },
tag = 'v0.2.0',
config = function()
require('modes').setup({
colors = {
visual = '#f5c359',
delete = '#c75c6a',
copy = '#78ccc5',
insert = '#c5739a',
},
line_opacity = 0.15,
set_cursor = true,
set_cursorline = true,
set_number = true,
ignore_filetypes = { 'NvimTree', 'TelescopePrompt' },
})
end,
},
{
'LunarVim/bigfile.nvim',
event = { 'BufEnter', 'WinEnter' },
opts = {
-- Disables LSP/treesitter, etc for files above 5000 lives (even if they have really long lines)
pattern = function(bufnr, filesize_mib)
if filesize_mib >= 2 then
return true
end
-- you can't use `nvim_buf_line_count` because this runs on BufReadPre
local file_contents = vim.fn.readfile(vim.api.nvim_buf_get_name(bufnr))
local file_length = #file_contents
if file_length > 5000 then
return true
end
return false
end,
},
},
{
'm4xshen/hardtime.nvim',
config = function()
require('hardtime').setup({ enabled = true })
end,
cmd = 'Hardtime',
init = function()
vim.keymap.set('n', '<leader>ch', '<cmd>HardtimeToggle<cr>', { desc = 'Toggle Hardtime' })
end,
},
}
+61 -57
View File
@@ -1,63 +1,67 @@
return {
"stevearc/conform.nvim",
enabled = false,
event = { "BufReadPre", "BufNewFile" },
config = function()
local conform = require("conform")
'stevearc/conform.nvim',
enabled = true,
event = { 'BufReadPre', 'BufNewFile' },
config = function()
local conform = require('conform')
conform.setup({
formatters_by_ft = {
cpp = { "clang-format" },
c = { "clang-format" },
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier", "biome" },
typescriptreact = { "prettier" },
css = { "prettier" },
html = { "prettier" },
json = { "prettier" },
markdown = { "markdownlint", "prettier" },
lua = { "stylua" },
python = { "isort", "black" },
php = { "php-cs-fixer" },
java = { "google-java-formatter", "trivy" },
graphql = { "prettier" },
},
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return {
lsp_fallback = true,
async = false,
timeout_ms = 500,
}
end,
})
conform.setup({
formatters_by_ft = {
cpp = { 'clang-format' },
c = { 'clang-format' },
javascript = { 'prettier' },
typescript = { 'prettier' },
javascriptreact = { 'prettier' },
typescriptreact = { 'prettier' },
css = { 'prettier' },
html = { 'prettier' },
json = { 'prettier' },
yaml = { 'prettier' },
markdown = { 'prettier' },
lua = { 'stylua' },
python = { 'isort', 'black' },
php = { 'php-cs-fixer' },
java = { 'google-java-formatter' },
graphql = { 'prettier' },
liquid = { 'prettier' },
bash = { 'shfmt' },
sh = { 'shfmt' },
},
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return {
lsp_fallback = true,
async = false,
timeout_ms = 500,
}
end,
})
vim.keymap.set({ "n", "v" }, "<leader>cf", function()
conform.format({
lsp_fallback = true,
async = true,
timeout_ms = 1000,
})
end, { desc = "Format file or range (in visual mode)" })
vim.keymap.set({ 'n', 'v' }, '<leader>cff', function()
conform.format({
lsp_fallback = true,
async = true,
timeout_ms = 1000,
})
end, { desc = 'Format file or range (in visual mode)' })
vim.keymap.set({ "n" }, "<leader>cfb", function()
vim.b.disable_autoformat = not vim.b.disable_autoformat
vim.notify(
"Buffer auto-format on-save: " .. (vim.b.disable_autoformat and "OFF" or "ON"),
vim.log.levels.INFO
)
end, { desc = "Toggle auto-format on-save for buffer." })
vim.keymap.set({ 'n' }, '<leader>cfb', function()
vim.b.disable_autoformat = not vim.b.disable_autoformat
vim.notify(
'Buffer auto-format on-save: ' .. (vim.b.disable_autoformat and 'OFF' or 'ON'),
vim.log.levels.INFO
)
end, { desc = 'Toggle auto-format on-save for buffer.' })
vim.keymap.set({ "n" }, "<leader>ftg", function()
vim.g.disable_autoformat = not vim.g.disable_autoformat
vim.notify(
"Global auto-format on-save: " .. (vim.g.disable_autoformat and "OFF" or "ON"),
vim.log.levels.INFO
)
end, { desc = "Toggle auto-format on-save globally." })
end,
vim.keymap.set({ 'n' }, '<leader>cft', function()
vim.g.disable_autoformat = not vim.g.disable_autoformat
vim.notify(
'Global auto-format on-save: ' .. (vim.g.disable_autoformat and 'OFF' or 'ON'),
vim.log.levels.INFO
)
end, { desc = 'Toggle auto-format on-save globally.' })
end,
}
+32 -25
View File
@@ -1,27 +1,34 @@
return {
"mfussenegger/nvim-lint",
enabled = false,
event = { "BufReadPre", "BufNewFile" },
opts = {
linters_by_ft = {
lua = { "selene" },
cpp = { "cpplint" },
c = { "cpplint" },
javascript = { "eslint_d" },
typescript = { "eslint_d" },
javascriptreact = { "eslint_d" },
typescriptreact = { "eslint_d" },
python = { "pylint" },
markdown = { "markdownlint" },
java = { "trivy" },
php = { "phpcs" },
},
},
config = function()
local lint = require("lint")
-- TODO create auto command ran after Buffer Wrote
vim.keymap.set("n", "<leader>cl", function()
lint.try_lint()
end, { desc = "Trigger linting for current file" })
end,
'mfussenegger/nvim-lint',
event = { 'BufReadPre', 'BufNewFile' },
opts = {
linters_by_ft = {
lua = { 'selene' },
cpp = { 'cpplint' },
c = { 'cpplint' },
javascript = { 'eslint_d' },
typescript = { 'eslint_d' },
javascriptreact = { 'eslint_d' },
typescriptreact = { 'eslint_d' },
python = { 'ruff', 'mypy' },
markdown = { 'markdownlint' },
java = { 'trivy' },
php = { 'phpcs' },
},
},
config = function()
local lint = require('lint')
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
vim.keymap.set('n', '<leader>cl', function()
lint.try_lint()
end, { desc = 'Trigger linting for current file' })
end,
}
-24
View File
@@ -1,24 +0,0 @@
return {
{
"williamboman/mason.nvim",
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUpdate" },
dependencies = {
{ "williamboman/mason-lspconfig.nvim", event = { "BufReadPre", "BufNewFile" } },
{ "WhoIsSethDaniel/mason-tool-installer.nvim" },
{ "zapling/mason-lock.nvim", cmd = { "MasonLock", "MasonLockRestore" }, opts = {} },
},
config = function()
require("mason").setup()
end,
},
{
"nvimtools/none-ls.nvim", -- configure formatters & linters
event = { "BufRead", "FileType" },
dependencies = {
"jay-babu/mason-null-ls.nvim",
},
config = function()
require("configs.none-ls")
end,
},
}
+21
View File
@@ -10,4 +10,25 @@ return {
require('configs.lsp')
end,
},
{
'williamboman/mason.nvim',
cmd = { 'Mason', 'MasonInstall', 'MasonInstallAll', 'MasonUpdate' },
dependencies = {
'williamboman/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
},
config = function()
require('mason').setup()
end,
},
-- {
-- "nvimtools/none-ls.nvim", -- configure formatters & linters
-- event = { "BufRead", "FileType" },
-- dependencies = {
-- "jay-babu/mason-null-ls.nvim",
-- },
-- config = function()
-- require("configs.none-ls")
-- end,
-- },
}
-199
View File
@@ -1,199 +0,0 @@
return {
{
"ThePrimeagen/refactoring.nvim",
config = function()
require("refactoring").setup()
-- vim.keymap.set("x", "<leader>re", ":Refactor extract ")
-- vim.keymap.set("x", "<leader>rf", ":Refactor extract_to_file ")
--
-- vim.keymap.set("x", "<leader>rv", ":Refactor extract_var ")
--
-- vim.keymap.set({ "n", "x" }, "<leader>ri", ":Refactor inline_var")
--
-- vim.keymap.set("n", "<leader>rI", ":Refactor inline_func")
--
-- vim.keymap.set("n", "<leader>rb", ":Refactor extract_block")
-- vim.keymap.set("n", "<leader>rbf", ":Refactor extract_block_to_file")
-- load refactoring Telescope extension
require("telescope").load_extension("refactoring")
vim.keymap.set({ "n", "x" }, "<leader>rr", function()
require("telescope").extensions.refactoring.refactors()
end, { desc = "Refactor" })
end,
},
{
"2kabhishek/nerdy.nvim",
dependencies = { "stevearc/dressing.nvim" },
cmd = "Nerdy",
},
{
"folke/persistence.nvim",
event = "BufReadPre",
opts = { options = vim.opt.sessionoptions:get() },
keys = {
{
"<leader>ms",
function()
require("persistence").load()
end,
desc = "Restore Session",
},
{
"<leader>ml",
function()
require("persistence").load({ last = true })
end,
desc = "Restore Last Session",
},
{
"<leader>md",
function()
require("persistence").stop()
end,
desc = "Don't Save Current Session",
},
},
},
{
"nvim-lua/plenary.nvim",
lazy = true,
},
{
"iamcco/markdown-preview.nvim",
build = "cd app && yarn install",
ft = { "markdown" },
keys = {
{
"<leader>cm",
"<cmd>MarkdownPreviewToggle<CR>",
desc = "toggle markdown preview",
},
},
},
{
"nvim-pack/nvim-spectre",
build = false,
cmd = "Spectre",
opts = { open_cmd = "noswapfile vnew" },
keys = {
{
"<leader>mr",
function()
require("spectre").open()
end,
desc = "Replace in Files (Spectre)",
},
},
},
{
"szw/vim-maximizer",
keys = {
{ "<leader>mm", "<cmd>MaximizerToggle<CR>", desc = "Maximize/minimize a split" },
},
},
{
"folke/zen-mode.nvim",
cmd = { "ZenMode" },
opts = {},
keys = {
{ "<leader>wz", "<cmd>ZenMode<cr>", desc = "Toggle zen mode" },
},
},
{
"chrisgrieser/nvim-recorder",
dependencies = { "rcarriga/nvim-notify" },
event = "VeryLazy",
vscode = true,
keys = {
{ "q", desc = "Start Recording" },
{ "Q", desc = "Play Recording" },
{ "<C-q>", desc = "Switch Slot" },
{ "cq", desc = "Edit Macro" },
{ "yq", desc = "Yank Macro" },
{ "dq", desc = "Delete All Macros" },
},
opts = {
useNerdFontsIcons = false,
slots = { "a", "b", "c", "d" },
mapping = {
startStopRecording = "q",
playMacro = "Q",
editMacro = "cq",
switchSlot = "<C-q>",
deleteAllMacros = "dq",
yankMacro = "yq",
},
},
},
{
"creativenull/dotfyle-metadata.nvim",
cmd = { "DotfyleGenerate", "DotfyleOpen" },
},
{
"willothy/flatten.nvim",
priority = 1001,
opts = {
window = {
open = "alternate",
},
},
},
{
"wakatime/vim-wakatime",
event = { "VimEnter" },
lazy = false,
},
{
"mvllow/modes.nvim",
event = { "BufReadPost", "BufNewFile" },
tag = "v0.2.0",
config = function()
require("modes").setup({
colors = {
visual = "#f5c359",
delete = "#c75c6a",
copy = "#78ccc5",
insert = "#c5739a",
},
line_opacity = 0.15,
set_cursor = true,
set_cursorline = true,
set_number = true,
ignore_filetypes = { "NvimTree", "TelescopePrompt" },
})
end,
},
{
"LunarVim/bigfile.nvim",
event = { "BufEnter", "WinEnter" },
opts = {
-- Disables LSP/treesitter, etc for files above 5000 lives (even if they have really long lines)
pattern = function(bufnr, filesize_mib)
if filesize_mib >= 2 then
return true
end
-- you can't use `nvim_buf_line_count` because this runs on BufReadPre
local file_contents = vim.fn.readfile(vim.api.nvim_buf_get_name(bufnr))
local file_length = #file_contents
if file_length > 5000 then
return true
end
return false
end,
},
},
{
"m4xshen/hardtime.nvim",
config = function()
require("hardtime").setup({ enabled = true })
end,
cmd = "Hardtime",
init = function()
vim.keymap.set("n", "<leader>ch", "<cmd>HardtimeToggle<cr>", { desc = "Toggle Hardtime" })
end,
},
}
+2 -1
View File
@@ -37,6 +37,7 @@ return {
'scss',
'lua',
'python',
'liquid',
},
auto_install = true,
playground = {
@@ -74,7 +75,7 @@ return {
{
'nvim-treesitter/nvim-treesitter-context',
event = 'VeryLazy',
config = function(_, opts)
config = function()
require('treesitter-context').setup({ mode = 'cursor', max_lines = 3 })
end,
},