This commit is contained in:
sankalp committed 2024-11-05 14:07:43 +05:45
1 parent bd932cf5e1
commit a4647b1cae
69 files changed
+12974 -5399

No files matched your search

+42
View File
@@ -135,6 +135,48 @@ vim.api.nvim_create_autocmd('FileType', {
end,
})
vim.api.nvim_create_autocmd('BufReadPost', {
callback = function()
if vim.fn.line('\'"') > 1 and vim.fn.line('\'"') <= vim.fn.line('$') then
vim.cmd('normal! g`"')
end
end,
group = augroup('General'),
desc = 'Go To The Last Cursor Position',
})
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'c', 'cpp', 'py', 'java', 'cs' },
callback = function()
vim.bo.shiftwidth = 4
end,
group = augroup('General'),
desc = 'Set shiftwidth to 4 in these filetypes',
})
-- Toggle between relative/absolute line numbers
local numbertoggle = augroup('numbertoggle')
vim.api.nvim_create_autocmd({ 'BufEnter', 'FocusGained', 'InsertLeave', 'CmdlineLeave', 'WinEnter' }, {
pattern = '*',
group = numbertoggle,
callback = function()
if vim.o.nu and vim.api.nvim_get_mode().mode ~= 'i' then
vim.opt.relativenumber = true
end
end,
})
vim.api.nvim_create_autocmd({ 'BufLeave', 'FocusLost', 'InsertEnter', 'CmdlineEnter', 'WinLeave' }, {
pattern = '*',
group = numbertoggle,
callback = function()
if vim.o.nu then
vim.opt.relativenumber = false
vim.cmd.redraw()
end
end,
})
-- ╭─────────────────────────────────────────────────────────╮
-- │ VIM-VISUAL-MULTI │
-- ╰─────────────────────────────────────────────────────────╯
+69 -1
View File
@@ -15,7 +15,23 @@ vim.g.maplocalleader = ' '
-- visual_block_mode = "x", term_mode = "t", command_mode = "c",
-- Comment
map({ 'n', 'v' }, '<leader>/', 'gcc', { remap = true })
map({ 'n', 'v' }, '<leader>/', 'gcc', { desc = 'Comment toggle', remap = true })
map({ 'v', 'x' }, '<leader>/', 'gc', { desc = 'Comment toggle', remap = true })
-- save file
map({ 'x', 'i', 'n', 's' }, '<C-s>', '<cmd>w<cr>', { desc = 'Save File' })
-- Shortcut for surrounding a word (inner) with a '
map('n', 'S', '<nop>') -- Don't keep S mapping
map('n', 'Sq', "Siw'", { desc = "Wrap word with '", remap = true })
map('n', 'Sp', 'SiW(', { desc = 'Wrap word with ()', remap = true })
map('n', 'Sb', 'Saw}', { desc = 'Wrap word with {}', remap = true })
-- Remove all text
map('n', '<leader>r', '<cmd>%d+<cr>', { desc = 'General | Remove All Text', silent = true })
-- Able to use semicolon in normal mode
map('n', ';', ':', { desc = '; Command mode' })
-- Select all
map('n', '<C-a>', 'gg<S-v>G')
@@ -84,3 +100,55 @@ map('n', 'd', '"_d', { desc = 'Delete without replacing clipboad' })
map('n', 'x', '"_x', { desc = 'Cut without replacing clipboad' })
map('n', 'c', '"_c', { desc = 'Change without replacing clipboad' })
map('v', 'p', '"_dP', { desc = 'Paste without replacing clipboard' })
map('n', '<leader>oz', function()
---@diagnostic disable-next-line: undefined-field
if vim.opt.foldcolumn:get() == '0' then
vim.opt.foldcolumn = '1'
else
vim.opt.foldcolumn = '0'
end
end, { desc = 'Toggle foldcolumn' })
map('n', '<leader>op', function()
vim.g.minipairs_disable = not vim.g.minipairs_disable and true or false
end, { desc = 'Toggle mini.pairs' })
-- -- Indent backward
-- vim.keymap.set("n", "<", "<<", { desc = "General | Indent backward", silent = true })
--
-- -- Indent forward
-- vim.keymap.set("n", ">", ">>", { desc = "General | Indent forward", silent = true })
--
-- -- Move the line up
-- vim.keymap.set("n", "<A-j>", "<cmd>m .+1<CR>==", { desc = "General | Move the line up", silent = true })
--
-- -- Move the line down
-- vim.keymap.set("n", "<A-k>", "<cmd>m .-2<CR>==", { desc = "General | Move the line down", silent = true })
--
-- -- Move the line up (Insert Mode)
-- vim.keymap.set("i", "<A-j>", "<Esc>:m .+1<CR>==gi", { desc = "General | Move the line up", silent = true })
--
-- -- Move the line down (Insert Mode)
-- vim.keymap.set("i", "<A-k>", "<Esc>:m .-2<CR>==gi", { desc = "General | Move the line down", silent = true })
--
-- -- Better Down (Visual Mode)
-- vim.keymap.set("v", "j", "v:count == 0 ? 'gj' : 'j'", { desc = "General | Better Down", expr = true, silent = true })
--
-- -- Better Up (Visual Mode)
-- vim.keymap.set("v", "k", "v:count == 0 ? 'gk' : 'k'", { desc = "General | Better Up", expr = true, silent = true })
--
-- -- Better Paste (Visual Mode)
-- vim.keymap.set("v", "p", '"_dP', { desc = "General | Better Paste", silent = true })
--
-- -- Indent backward (Visual Mode)
-- vim.keymap.set("v", "<", "<gv", { desc = "General | Indent backward", silent = true })
--
-- -- Indent forward (Visual Mode)
-- vim.keymap.set("v", ">", ">gv", { desc = "General | Indent forward", silent = true })
--
-- -- Move the selected text up (Visual Mode)
-- vim.keymap.set("v", "<A-j>", "<cmd>m '>+1<CR>gv=gv", { desc = "General | Move the selected text up", silent = true })
--
-- -- Move the selected text down (Visual Mode)
-- vim.keymap.set("v", "<A-k>", "<cmd>m '<-2<CR>gv=gv", { desc = "General | Move the selected text down", silent = true })
+32 -26
View File
@@ -1,7 +1,7 @@
{
"LuaSnip": { "branch": "master", "commit": "787dee55ca364cc9119787165418fe93b74c1842" },
"LuaSnip": { "branch": "master", "commit": "4bf40748f6fe939bdcb69325918535b1c5edea51" },
"Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" },
"better-escape.nvim": { "branch": "master", "commit": "bb197e51a91a635deb88630813c3bfc284413697" },
"better-escape.nvim": { "branch": "master", "commit": "199dcc2643dec5d8dbdab4ec672cf405224dcb3b" },
"bigfile.nvim": { "branch": "main", "commit": "33eb067e3d7029ac77e081cfe7c45361887a311a" },
"ccc.nvim": { "branch": "main", "commit": "7c639042583c7bdc7ce2e37e5a0e0aa6d0659c6a" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
@@ -10,35 +10,40 @@
"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" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"codeium.vim": { "branch": "main", "commit": "8c01979323b2b480c8bf160d3ff85bd1668baa49" },
"codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" },
"comment-box.nvim": { "branch": "main", "commit": "06bb771690bc9df0763d14769b779062d8f12bc5" },
"conform.nvim": { "branch": "master", "commit": "5fbea7d7043bae2499d643c97b407f6da44abff4" },
"dashboard-nvim": { "branch": "master", "commit": "d2c5a4d1341f5ca1ed2ecb4ecfcff2bc8ea18b14" },
"conform.nvim": { "branch": "master", "commit": "d28ccf945374edd9f1c34a82f6c22261dbd8ab98" },
"dashboard-nvim": { "branch": "master", "commit": "ae309606940d26d8c9df8b048a6e136b6bbec478" },
"dotfyle-metadata.nvim": { "branch": "main", "commit": "342ef8f3f98f3ccc451c9cf2be74e95149ced05d" },
"dressing.nvim": { "branch": "master", "commit": "1b7921eecc65af1baf8ac1dc06f0794934cbcfb2" },
"dressing.nvim": { "branch": "master", "commit": "6ef1ca479d37d4ff66f13eed44d08912caff483a" },
"esqueleto.nvim": { "branch": "main", "commit": "0f79ccafc931f706d175549c1339848eb8fa8470" },
"fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" },
"flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" },
"flatten.nvim": { "branch": "main", "commit": "e420e531d2ab24aebcf7b3c9fca28e6c5c34964d" },
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
"hardtime.nvim": { "branch": "main", "commit": "027d6f991927a71bd510a7673ae5bb404ca2a1c7" },
"hlargs.nvim": { "branch": "main", "commit": "53ec5d8ca6ed012de5545ba83ea1eb3d636b09fb" },
"inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" },
"indent-blankline.nvim": { "branch": "master", "commit": "e7a4442e055ec953311e77791546238d1eaae507" },
"lazy.nvim": { "branch": "main", "commit": "cf8ecc2c5e4332760431a33534240b0cbc6680ab" },
"indent-blankline.nvim": { "branch": "master", "commit": "04e44b09ee3ff189c69ab082edac1ef7ae2e256c" },
"lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" },
"lazydev.nvim": { "branch": "main", "commit": "d5800897d9180cea800023f2429bce0a94ed6064" },
"leap.nvim": { "branch": "main", "commit": "c6bfb191f1161fbabace1f36f578a20ac6c7642c" },
"lspkind.nvim": { "branch": "master", "commit": "59c3f419af48a2ffb2320cea85e44e5a95f71664" },
"leetcode.nvim": { "branch": "master", "commit": "6a2e54ff13027fb3ce46b61a0e721eccc020ec80" },
"lspkind.nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" },
"lspsaga.nvim": { "branch": "main", "commit": "d027f8b9c7c55e26cf4030c8657a2fc8222ed762" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"lualine.nvim": { "branch": "master", "commit": "640260d7c2d98779cab89b1e7088ab14ea354a02" },
"luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-conform.nvim": { "branch": "main", "commit": "abce2be529f3b4b336c56d0ba6336a9144e0fee6" },
"mason-lock.nvim": { "branch": "main", "commit": "86614f76c3442fba1c5c8d79aa1efcb3ad69de1c" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "7446f47b3dfb7df801f31a6f6783c2ad119a6935" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" },
"mason-nvim-lint": { "branch": "main", "commit": "b579a00ee39dcd590b1023028dc8fb3d203a67b0" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.files": { "branch": "main", "commit": "6abe854f1410fc6aec69897a78b1db994c32d9c6" },
"mini.icons": { "branch": "main", "commit": "a2742459f0ee32806c2438ca06b4d8b331f3f4d4" },
"mini.nvim": { "branch": "main", "commit": "77533e69cc4fadb7f4c25f23255ae0890a058818" },
"mini.nvim": { "branch": "main", "commit": "c8bc67a35e627908da644c5f8cd26b3f987f2627" },
"modes.nvim": { "branch": "main", "commit": "3188692abf02a8838ec75e59d68c2ce3e4323f5c" },
"neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" },
"neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" },
@@ -46,30 +51,30 @@
"neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" },
"neotest-rspec": { "branch": "main", "commit": "53fc108a06ae43d7f873d42ee5189c2301e33623" },
"nerdy.nvim": { "branch": "main", "commit": "b467d6609b78d6a5f1e12cbc08fcc1ac87af20f5" },
"noice.nvim": { "branch": "main", "commit": "df448c649ef6bc5a6a633a44f2ad0ed8d4442499" },
"noice.nvim": { "branch": "main", "commit": "5a78b42bec5e775f2db03bf93f6d1e0f3636306c" },
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
"numb.nvim": { "branch": "master", "commit": "3f7d4a74bd456e747a1278ea1672b26116e0824d" },
"nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" },
"nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" },
"nvim-dap": { "branch": "master", "commit": "7ff6936010b7222fea2caea0f67ed77f1b7c60dd" },
"nvim-dap-python": { "branch": "master", "commit": "3e3dd98d4d83715c9e0e429b4a5da7bd706e6ceb" },
"nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" },
"nvim-lint": { "branch": "master", "commit": "16b21a7d04d06661f92f273a0744fd81fb19e09e" },
"nvim-lsp-file-operations": { "branch": "master", "commit": "92a673de7ecaa157dd230d0128def10beb56d103" },
"nvim-lspconfig": { "branch": "master", "commit": "edd9591199d1c78c0cb20514231f7f936f9412a2" },
"nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" },
"nvim-lspconfig": { "branch": "master", "commit": "bc6ada4b0892b7f10852c0b8ca7209fd39a6d754" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" },
"nvim-spectre": { "branch": "master", "commit": "ba7fb777edff6c1fbbeffd343e113af64c04e90a" },
"nvim-treesitter": { "branch": "master", "commit": "377039daa260b71f304c881d1b21d643c501a261" },
"nvim-treesitter-context": { "branch": "master", "commit": "e7fdb4cdf0942cd6e63dd822110a93c0ec777fe5" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "0d79d169fcd45a8da464727ac893044728f121d4" },
"nvim-spectre": { "branch": "master", "commit": "08be31c104df3b4b049607694ebb2b6ced4f928b" },
"nvim-treesitter": { "branch": "master", "commit": "509d38fee865eefd38eacf17c8920b68cf67b0fd" },
"nvim-treesitter-context": { "branch": "master", "commit": "a2a334900d3643de585ac5c6140b03403454124f" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "3e450cd85243da99dc23ebbf14f9c70e9a0c26a4" },
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
"nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" },
"odoo-snippets": { "branch": "main", "commit": "5e6b7191e3ea60bba00df6cdbc031291b194768d" },
"onedark.nvim": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" },
"persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "d227e6c9879bb50af35cd733461198666981d482" },
"refactoring.nvim": { "branch": "master", "commit": "c406fc5fb4d7ba5fce7b668637075fad6e75e9f8" },
"screenkey.nvim": { "branch": "main", "commit": "0589de3c857721e150ea694cfe66d6d0e8aecacb" },
"pomo.nvim": { "branch": "main", "commit": "aa8decc421d89be0f10b1fc6a602cdd269f350ff" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "e0f9b3efe150724af2d2ed59997d5ece373840e3" },
"refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" },
"showkeys": { "branch": "main", "commit": "82965404a3d1b740d5efa24c09c0daccf7571f24" },
"sniprun": { "branch": "master", "commit": "67ac2d84d03f3b857d59571ff5fefb6080dffa2d" },
"suda.vim": { "branch": "master", "commit": "b97fab52f9cdeabe2bbb5eb98d82356899f30829" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "626998e5c1b71c130d8bc6cf7abb6709b98287bb" },
@@ -77,12 +82,13 @@
"telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope-undo.nvim": { "branch": "main", "commit": "51be9ae7c42fc27c0b05505e3a0162e0f05fbb6a" },
"telescope.nvim": { "branch": "master", "commit": "df534c3042572fb958586facd02841e10186707c" },
"telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" },
"termim.nvim": { "branch": "main", "commit": "58344167abb97bcef9bf720a762ea653a94e9daa" },
"toggleterm.nvim": { "branch": "main", "commit": "48be57eaba817f038d61bbf64d2c597f578c0827" },
"trouble.nvim": { "branch": "main", "commit": "2f3b537f2207ce32f4459f9d56746ee013b5e01b" },
"twilight.nvim": { "branch": "main", "commit": "1584c0b0a979b71fd86b18d302ba84e9aba85b1b" },
"ultimate-autopair.nvim": { "branch": "v0.6", "commit": "9e3209190c22953566ae4e6436ad2b4ff4dabb95" },
"venv-selector.nvim": { "branch": "regexp", "commit": "e82594274bf7b54387f9a2abe65f74909ac66e97" },
"vim-alternate": { "branch": "master", "commit": "b3b7d5e9982f228a4d62fbbe2f2fe3e3ae92768c" },
"vim-dadbod": { "branch": "master", "commit": "fe5a55e92b2dded7c404006147ef97fb073d8b1b" },
"vim-dadbod-completion": { "branch": "master", "commit": "880f7e9f2959e567c718d52550f9fae1aa07aa81" },
+24 -18
View File
@@ -1,25 +1,31 @@
{
"basedpyright": "1.17.0",
"bash-language-server": "5.4.0",
"black": "24.8.0",
"clang-format": "18.1.8",
"clangd": "18.1.3",
"bash-language-server": "5.4.2",
"beautysh": "6.2.1",
"black": "24.10.0",
"clangd": "19.1.0",
"codespell": "2.3.0",
"cspell": "8.14.2",
"cspell": "8.15.7",
"css-lsp": "4.10.0",
"djlint": "1.35.4",
"emmet-ls": "0.4.2",
"eslint_d": "14.0.3",
"eslint_d": "14.2.2",
"html-lsp": "4.10.0",
"isort": "5.13.2",
"jdtls": "v1.38.0",
"lua-language-server": "3.10.5",
"markdownlint": "0.41.0",
"mypy": "1.11.2",
"phpcs": "3.10.2",
"jdtls": "v1.41.0",
"lua-language-server": "3.12.0",
"markdownlint": "0.42.0",
"phpcs": "3.10.3",
"prettier": "3.3.3",
"pylint": "3.2.6",
"ruff": "0.6.2",
"shfmt": "v3.9.0",
"prettierd": "0.25.3",
"pylint": "3.3.1",
"pyright": "1.1.387",
"ruff": "0.7.2",
"rust-analyzer": "2024-11-04",
"selene": "0.27.1",
"stylua": "v0.20.0",
"tailwindcss-language-server": "0.0.23",
"trivy": "v0.54.1",
"typescript-language-server": "4.3.3"
"tailwindcss-language-server": "0.0.26",
"taplo": "0.9.3",
"trivy": "v0.57.0",
"typescript-language-server": "4.3.3",
"yaml-language-server": "1.15.0"
}
+55
View File
@@ -0,0 +1,55 @@
-- autopairs
-- https://github.com/windwp/nvim-autopairs
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
enabled = false,
-- Optional dependency
dependencies = { 'hrsh7th/nvim-cmp' },
config = function()
local npairs = require('nvim-autopairs')
npairs.setup({
-- The string you provided appears to be a pattern or sequence of characters enclosed within [=[[ and ]]=].
-- This syntax is used in Lua to create long string literals that can span multiple lines.
-- Here's what the pattern [=[[%w%%%'%[%"%.%%$]]=]` represents:
--
-- %w matches any alphanumeric character (letters and digits) and underscore.
-- %% matches a literal percent sign %.
-- %' matches a literal single quote '.
-- %[ matches a literal opening square bracket [.
-- %" matches a literal double quote ".
-- %. matches a literal period or dot ..
-- %`` matches a literal backtick `` ``.
-- %$ matches a literal dollar sign $.
--
-- So, this pattern would match any string that contains alphanumeric characters, underscores, percent signs,
-- single quotes, square brackets, double quotes, periods, backticks, and dollar signs.
-- ignored_next_char = [=[[%w%%%'%[%"%.%`%$]]=]
-- Add { and ( to the list so it won't add the pair when we're adding a function around
-- existing text
ignored_next_char = [=[[%w%%%'%[%"%.%`%$%{%(]]=],
fast_wrap = {},
check_ts = true,
ts_config = {
lua = { 'string' }, -- it will not add a pair on that treesitter node
javascript = { 'template_string' },
java = false, -- don't check treesitter on java
},
})
-- If you want to automatically add `(` after selecting a function or method
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
local Rule = require('nvim-autopairs.rule')
local cond = require('nvim-autopairs.conds')
vim.notify(vim.inspect(npairs.get_rules('"')))
npairs.remove_rule('`')
npairs.add_rule(Rule('`', '`'):with_pair(cond.not_before_regex('[%w%p]')))
end,
}
+19 -32
View File
@@ -1,7 +1,5 @@
--Coding related
return {
{
'max397574/better-escape.nvim',
event = 'InsertEnter',
@@ -27,7 +25,6 @@ return {
vim.g.VM_maps = {
['Find Under'] = '',
}
vim.g.VM_maps['I BS'] = ''
vim.g.VM_maps['I CtrlC'] = ''
vim.g.VM_maps['I CtrlN'] = ''
@@ -46,7 +43,6 @@ return {
terminal_width = 45,
notification_timeout = 5,
},
inline_messages = 0,
borders = 'single',
})
@@ -108,37 +104,29 @@ return {
vim.g.codeium_manual = false
vim.fn['codeium#Complete']()
end)
vim.g.codeium_filetypes = {
TelescopePrompt = false,
DressingInput = false,
['neo-tree-popup'] = false,
['dap-repl'] = false,
}
local opts = { expr = true, silent = true }
vim.g.codeium_disable_bindings = 1
vim.keymap.set('i', '<M-CR>', function()
return vim.fn['codeium#Accept']()
end, opts)
-- vim.keymap.set('n', '<leader>ch', function()
-- return vim.fn['codeium#Chat']()
-- end, { desc = 'Chat with IA (Codeium)' })
vim.keymap.set('i', '<M-]>', function()
return vim.fn['codeium#CycleCompletions'](1)
end, opts)
vim.keymap.set('i', '<M-[>', function()
return vim.fn['codeium#CycleCompletions'](-1)
end, opts)
vim.keymap.set('i', '<M-c>', function()
return vim.fn['codeium#Clear']()
end, opts)
vim.keymap.set('n', '<leader>cI', '<cmd>CodeiumToggle<cr>', { desc = 'Toggle IA (Codeium)' })
end,
},
@@ -147,6 +135,18 @@ return {
lazy = true,
ft = { 'cpp', 'h', 'hpp', 'c' },
},
{
'linux-cultist/venv-selector.nvim',
branch = 'regexp',
cmd = { 'VenvSelect', 'VenvSelectCached' },
init = function()
vim.keymap.set('n', '<leader>cv', '<cmd>VenvSelect<cr>', { desc = 'Venv Selector | Select Python venv' })
end,
opts = {},
config = function(_, opts)
require('venv-selector').setup(opts)
end,
},
{
'nacro90/numb.nvim',
event = 'CmdlineEnter',
@@ -161,27 +161,14 @@ return {
end,
},
{
'NStefan002/screenkey.nvim',
cmd = 'Screenkey',
version = '*',
config = function()
require('screenkey').setup({
win_opts = {
relative = 'editor',
anchor = 'SE',
width = 40,
height = 1,
border = 'single',
},
compress_after = 3,
clear_after = 3,
disable = {
filetypes = {}, -- for example: "toggleterm"
buftypes = {}, -- for example: "terminal"
},
})
end,
'nvchad/showkeys',
cmd = 'ShowkeysToggle',
opts = {
timeout = 1,
maxkeys = 8,
},
},
-- { 'rachartier/tiny-inline-diagnostic.nvim', event = 'BufReadPost', opts = {} },
{
'gbprod/yanky.nvim',
event = 'BufReadPost',
-205
View File
@@ -1,205 +0,0 @@
-- Define nvim-lspconfig LSP servers here
local lsp_servers = {
-- 'basedpyright',
'pyright',
'pylsp',
'lua_ls',
'ts_ls',
'tailwindcss',
'emmet_ls',
'bashls',
'jdtls',
'clangd',
'html',
'cssls',
}
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', {
-- group = vim.api.nvim_create_augroup('UserLspConfig', {}),
-- callback = function(ev)
-- -- Buffer local mappings.
-- -- See `:help vim.lsp.*` for documentation on any of the below functions
-- local opts = { buffer = ev.buf, silent = true }
--
-- -- set keybinds
-- opts.desc = 'Show LSP references'
-- keymap.set('n', 'lR', '<cmd>Telescope lsp_references<CR>', opts) -- show definition, references
--
-- 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
--
-- opts.desc = 'Show LSP implementations'
-- keymap.set('n', 'li', '<cmd>Telescope lsp_implementations<CR>', opts) -- show lsp implementations
--
-- opts.desc = 'Show LSP type definitions'
-- 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>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
--
-- opts.desc = 'Show buffer diagnostics'
-- keymap.set('n', '<leader>lD', '<cmd>Telescope diagnostics bufnr=0<CR>', opts) -- show diagnostics for file
--
-- opts.desc = 'Show line diagnostics'
-- keymap.set('n', '<leader>ld', vim.diagnostic.open_float, opts) -- show diagnostics for line
--
-- opts.desc = 'Show documentation for what is under cursor'
-- keymap.set('n', 'K', vim.lsp.buf.hover, opts) -- show documentation for what is under cursor
--
-- opts.desc = 'Restart LSP'
-- keymap.set('n', '<leader>ls', ':LspRestart<CR>', opts) -- mapping to restart lsp if necessary
-- end,
-- })
-- used to enable autocompletion (assign to every lsp server config)
local capabilities = cmp_nvim_lsp.default_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
-- Set Mason LSPs Here
mason_lspconfig.setup({
ensure_installed = lsp_servers,
automatic_installation = true,
handlers = {
-- default handler for installed servers
function(server_name)
lspconfig[server_name].setup({
capabilities = capabilities,
})
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' },
},
completion = {
callSnippet = 'Replace',
},
workspace = {
library = {
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
[vim.fn.stdpath('config') .. '/lua'] = true,
},
},
},
},
})
end,
['pyright'] = function()
-- configure pyright server (with special settings)
lspconfig['pyright'].setup({
capabilities = capabilities,
settings = {
python = {
hint = { enable = true },
analysis = {
ignore = { '*' },
autoImportCompletions = false,
},
},
-- pyright = {
-- -- Using Ruff's import organizer
-- disableOrganizeImports = true,
-- },
},
handlers = {
['textDocument/publishDiagnostics'] = function() end,
},
})
end,
-- ['pylsp'] = function()
-- lspconfig['pylsp'].setup({
-- capabilities = capabilities,
-- settings = {
-- pylsp = {
-- plugins = {
-- autopep8 = {
-- enabled = true,
-- },
-- pycodestyle = {
-- enabled = true,
-- ignore = { 'E501', 'E231', 'W503' },
-- maxLineLength = 79,
-- },
-- pylint = {
-- enabled = true,
-- executable = 'pylint',
-- args = {
-- '--enable=W0611,W0614',
-- },
-- },
-- },
-- },
-- },
-- })
-- end,
['emmet_ls'] = function()
-- configure emmet language server
lspconfig['emmet_ls'].setup({
capabilities = capabilities,
filetypes = {
'html',
'javascript',
'typescript',
'javascriptreact',
'typescriptreact',
'css',
'less',
},
})
end,
['cssls'] = function()
lspconfig.cssls.setup({
capabilities = capabilities,
settings = {
css = {
validate = true,
lint = {
unknownAtRules = 'ignore',
},
},
scss = {
validate = true,
lint = {
unknownAtRules = 'ignore',
},
},
},
})
end,
},
})
+1 -1
View File
@@ -59,9 +59,9 @@ local n_mappings = {
{ '<leader>cR', '<cmd>ReloadConfig<cr>', desc = 'Reload Configs' },
{ '<leader>cc', '<cmd>CccHighlighterToggle<cr>', desc = 'Highlight Colors' },
{ '<leader>cd', '<cmd>RootDir<cr>', desc = 'Root Directory' },
{ '<leader>ce', '<cmd>:g/^\\s*$/d<cr>', desc = 'Clean Empty Lines' },
{ '<leader>cf', group = 'Formate File' },
{ '<leader>ch', '<cmd>Hardtime toggle<cr>', desc = 'Hardtime' },
{ '<leader>cl', '<cmd>:g/^\\s*$/d<cr>', desc = 'Clean Empty Lines' },
{ '<leader>cm', '<cmd>MarkdownPreviewToggle<cr>', desc = 'Markdown Preview' },
{ '<leader>cn', '<cmd>Telescope notify<cr>', desc = 'Notifications' },
{ '<leader>co', '<cmd>Dashboard<cr>', desc = 'Dashboard' },
+146
View File
@@ -0,0 +1,146 @@
-- Define conform.nvim formatting servers here
local formatting_servers = {
'prettier',
'isort',
'uncrustify',
'black',
'stylua',
'shfmt',
'php-cs-fixer',
'google-java-formatter',
'codespell',
'autoflake',
'djlint',
}
return {
'stevearc/conform.nvim',
dependencies = { 'zapling/mason-conform.nvim' },
event = { 'BufReadPre', 'BufNewFile' },
cmd = { 'ConformInfo' },
keys = {
{
'<leader>cfF',
function()
require('conform').format({ async = true, lsp_format = 'fallback' })
end,
mode = '',
desc = 'Format Buffer',
},
{
'<leader>cff',
function()
if vim.b.disable_autoformat then
vim.cmd('FormatEnable!')
vim.notify('Formatting enabled')
else
vim.cmd('FormatDisable!')
vim.notify('Formatting disabled')
end
end,
mode = '',
desc = 'Toggle Format on save',
},
},
config = function()
local conform = require('conform')
require('mason-conform').setup({
ensure_installed = formatting_servers,
automatic_installation = true,
})
conform.setup({
notify_on_error = true,
formatters_by_ft = {
cpp = { 'uncrustify' },
c = { 'uncrustify' },
-- Conform can also run multiple formatters sequentially
-- You can use a sub-list to tell conform to run *until* a formatter is found.
javascript = { 'eslint_d', 'prettierd', 'prettier', stop_after_first = true },
typescript = { 'eslint_d', 'prettierd', 'prettier', stop_after_first = true },
javascriptreact = { 'eslint_d', 'prettierd', 'prettier', stop_after_first = true },
typescriptreact = { 'eslint_d', 'prettierd', 'prettier', stop_after_first = true },
css = { 'prettierd', 'prettier', stop_after_first = true },
html = { 'prettierd', 'prettier', stop_after_first = true },
json = { 'prettierd', 'prettier', stop_after_first = true },
yaml = { 'prettierd', 'prettier', stop_after_first = true },
markdown = { 'prettierd', 'prettier', stop_after_first = true },
lua = { 'stylua' },
python = { 'isort', 'black' },
php = { 'php-cs-fixer' },
htmldjango = { 'djlint' },
java = { 'google-java-formatter' },
graphql = { 'prettierd', 'prettier', stop_after_first = true },
liquid = { 'prettierd', 'prettier', stop_after_first = true },
bash = { 'beautysh' },
sh = { 'beautysh' },
-- yaml = {'yamlfix'},
['*'] = { 'codespell' },
['_'] = { 'trim_whitespace' },
},
formatters = {
prettier = {
javascript = {
args = { '--single-quote' },
},
},
eslint_d = {
require_cwd = true,
},
yamlfix = {
env = {
YAMLFIX_SEQUENCE_STYLE = 'block_style',
YAMLFIX_preserve_quotes = 'true',
},
},
},
-- support a global format disable
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
-- Disable "format_on_save lsp_fallback" for languages that don't
-- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones.
local disable_filetypes = {
c = true,
cpp = true,
liquid = true,
}
local lsp_format_opt
if disable_filetypes[vim.bo[bufnr].filetype] then
lsp_format_opt = 'never'
else
lsp_format_opt = 'fallback'
end
return {
timeout_ms = 2000,
lsp_format = lsp_format_opt,
}
end,
})
-- From: https://github.com/stevearc/conform.nvim/blob/master/doc/recipes.md#command-to-toggle-format-on-save
vim.api.nvim_create_user_command('FormatDisable', function(args)
if args.bang then
-- FormatDisable! will disable formatting just for this buffer
vim.b.disable_autoformat = true
else
vim.g.disable_autoformat = true
end
end, {
desc = 'Disable autoformat-on-save',
bang = true,
})
vim.api.nvim_create_user_command('FormatEnable', function(args)
if args.bang then
vim.b.disable_autoformat = false
else
vim.g.disable_autoformat = false
end
end, {
desc = 'Re-enable autoformat-on-save',
bang = true,
})
end,
}
+43 -16
View File
@@ -2,7 +2,10 @@ return {
{
'mfussenegger/nvim-dap',
dependencies = {
-- Creates a beautiful debugger UI
'rcarriga/nvim-dap-ui',
-- Required dependency for nvim-dap-ui
'nvim-neotest/nvim-nio',
},
cmd = { 'DapUIToggle', 'DapToggleRepl', 'DapToggleBreakpoint' },
config = function()
@@ -94,27 +97,51 @@ return {
end,
},
}
-- local dap_utils = require 'user.plugins.configs.dap.utils'
local BASH_DEBUG_ADAPTER_BIN = vim.fn.stdpath('data')
.. '/mason/packages/bash-debug-adapter/bash-debug-adapter'
local BASHDB_DIR = vim.fn.stdpath('data') .. '/mason/packages/bash-debug-adapter/extension/bashdb_dir'
-- dap.adapters.ruby = {
-- type = 'executable',
-- command = 'bundle',
-- args = { 'exec', 'readapt', 'stdio' },
-- }
-- dap.configurations.ruby = {
-- {
-- type = 'ruby',
-- request = 'launch',
-- name = 'Rails',
-- program = 'bundle',
-- programArgs = { 'exec', 'rails', 's' },
-- useBundler = true,
-- },
-- }
dap.adapters.sh = {
type = 'executable',
command = BASH_DEBUG_ADAPTER_BIN,
}
dap.configurations.sh = {
{
name = 'Launch Bash debugger',
type = 'sh',
request = 'launch',
program = '${file}',
cwd = '${fileDirname}',
pathBashdb = BASHDB_DIR .. '/bashdb',
pathBashdbLib = BASHDB_DIR,
pathBash = 'bash',
pathCat = 'cat',
pathMkfifo = 'mkfifo',
pathPkill = 'pkill',
env = {},
args = {},
-- showDebugOutput = true,
-- trace = true,
},
}
vim.api.nvim_create_user_command('DapUIToggle', function()
require('dapui').toggle()
end, {})
end,
},
{
'mfussenegger/nvim-dap-python',
ft = 'python',
dependencies = {
'mfussenegger/nvim-dap',
'rcarriga/nvim-dap-ui',
'nvim-neotest/nvim-nio',
},
config = function(_, _)
local path = '~/.local/share/nvim/mason/packages/debugpy/venv/bin/python'
require('dap-python').setup(path)
end,
},
}
+8 -1
View File
@@ -30,6 +30,7 @@ return {
},
{
'folke/flash.nvim',
enabled = false,
keys = {
{
's',
@@ -71,7 +72,13 @@ return {
lazy = true,
dependencies = {
{ 'nvim-tree/nvim-web-devicons' },
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'zig' },
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make',
cond = function()
return vim.fn.executable('make') == 1
end,
},
{ 'nvim-telescope/telescope-ui-select.nvim' },
{ 'nvim-telescope/telescope-symbols.nvim' },
{ 'nvim-telescope/telescope-file-browser.nvim' },
+54
View File
@@ -6,6 +6,60 @@ return {
require('leap').add_default_mappings()
end,
},
{
'cvigilv/esqueleto.nvim',
event = 'VeryLazy',
opts = {
directories = {
vim.fn.stdpath('config') .. '/templates',
},
patterns = {
-- File
'README',
'LICENSE',
-- Filetype
'sh',
'markdown',
'python',
'lua',
'html',
'vue',
},
},
},
{
'kawre/leetcode.nvim',
cmd = 'Leet',
build = ':TSUpdate html',
dependencies = {
'nvim-telescope/telescope.nvim',
'nvim-lua/plenary.nvim', -- required by telescope
'MunifTanjim/nui.nvim',
-- optional
'nvim-treesitter/nvim-treesitter',
'rcarriga/nvim-notify',
'nvim-tree/nvim-web-devicons',
},
opts = {},
},
{
'epwalsh/pomo.nvim',
cmd = { 'TimerStart', 'TimerStop', 'TimerRepeat' },
dependencies = {
'rcarriga/nvim-notify',
},
opts = {
notifiers = {
{
name = 'Default',
opts = {
sticky = false,
},
},
},
},
},
{
'ThePrimeagen/refactoring.nvim',
config = function()
-106
View File
@@ -1,106 +0,0 @@
-- Define conform.nvim formatting servers here
local formatting_servers = {
'prettier',
'isort',
'clang-format',
'black',
'stylua',
'shfmt',
'php-cs-fixer',
'google-java-formatter',
'codespell',
'autoflake',
'djlint',
}
return {
'stevearc/conform.nvim',
dependencies = { 'zapling/mason-conform.nvim' },
event = { 'BufReadPre', 'BufNewFile' },
cmd = { 'ConformInfo' },
config = function()
local conform = require('conform')
require('mason-conform').setup({
ensure_installed = formatting_servers,
automatic_installation = true,
})
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', 'markdownlint' },
lua = { 'stylua' },
python = { 'isort', 'black' },
php = { 'php-cs-fixer' },
htmldjango = { 'djlint' },
java = { 'google-java-formatter' },
graphql = { 'prettier' },
liquid = { 'prettier' },
bash = { 'shfmt' },
sh = { 'shfmt' },
['*'] = { 'codespell' },
['_'] = { 'trim_whitespace' },
},
formatters = {
prettier = {
javascript = {
args = { '--single-quote' },
},
},
isort = {
python = {
args = { '--profile', 'black' },
},
},
black = {
python = {
args = { '--fast', '--line-length', '80' },
},
},
},
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 = 2500,
}
end,
})
vim.keymap.set({ 'n', 'v' }, '<leader>cff', function()
conform.format({
lsp_fallback = true,
async = true,
timeout_ms = 2500,
})
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>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,
}
+61 -7
View File
@@ -2,12 +2,13 @@
local linting_servers = {
'eslint_d',
'cspell',
'ruff',
'mypy',
-- 'ruff',
-- 'mypy',
'trivy',
'phpcs',
'markdownlint',
'pylint',
-- 'shellcheck',
}
return {
@@ -25,27 +26,80 @@ return {
})
lint.linters_by_ft = {
-- lua = { 'selene' },
lua = { 'selene' },
javascript = { 'eslint_d' },
typescript = { 'eslint_d' },
javascriptreact = { 'eslint_d' },
typescriptreact = { 'eslint_d' },
python = { 'ruff', 'mypy' },
python = { 'pylint' },
markdown = { 'markdownlint' },
java = { 'trivy' },
php = { 'phpcs' },
-- bash = { 'shellcheck' },
}
-- Run pylint in the venv
-- https://gist.github.com/Norbiox/652befc91ca0f90014aec34eccee27b2
lint.linters.pylint.cmd = 'python'
lint.linters.pylint.args = {
'-m',
'pylint',
'-f',
'json',
'--from-stdin',
function()
return vim.api.nvim_buf_get_name(0)
end,
}
-- To allow other plugins to add linters to require('lint').linters_by_ft,
-- instead set linters_by_ft like this:
-- lint.linters_by_ft = lint.linters_by_ft or {}
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
--
-- However, note that this will enable a set of default linters,
-- which will cause errors unless these tools are available:
-- {
-- clojure = { "clj-kondo" },
-- dockerfile = { "hadolint" },
-- inko = { "inko" },
-- janet = { "janet" },
-- json = { "jsonlint" },
-- markdown = { "vale" },
-- rst = { "vale" },
-- ruby = { "ruby" },
-- terraform = { "tflint" },
-- text = { "vale" }
-- }
--
-- You can disable the default linters by setting their filetypes to nil:
-- lint.linters_by_ft['clojure'] = nil
-- lint.linters_by_ft['dockerfile'] = nil
-- lint.linters_by_ft['inko'] = nil
-- lint.linters_by_ft['janet'] = nil
-- lint.linters_by_ft['json'] = nil
-- lint.linters_by_ft['markdown'] = nil
-- lint.linters_by_ft['rst'] = nil
-- lint.linters_by_ft['ruby'] = nil
-- lint.linters_by_ft['terraform'] = nil
-- lint.linters_by_ft['text'] = nil
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()
if not vim.g.disable_linting then
if not vim.b.disable_linting then
lint.try_lint()
end
end
end,
})
vim.keymap.set('n', '<leader>cl', function()
vim.b.disable_linting = not (vim.b.disable_linting == true)
end, { desc = 'Toggle linting for file' })
vim.keymap.set('n', '<leader>cL', function()
lint.try_lint()
end, { desc = 'Trigger linting for current file' })
vim.g.disable_linting = not (vim.g.disable_linting == true)
end, { desc = 'Toggle linting for all files' })
end,
}
+361 -13
View File
@@ -1,19 +1,7 @@
return {
{
'neovim/nvim-lspconfig',
event = { 'BufReadPost', 'BufNewFile', 'BufWritePre' },
dependencies = {
'hrsh7th/cmp-nvim-lsp',
{ 'antosha417/nvim-lsp-file-operations', config = true },
'williamboman/mason-lspconfig.nvim',
},
config = function()
require('plugins.configs.lsp')
end,
},
{
'williamboman/mason.nvim',
cmd = { 'Mason', 'MasonInstall', 'MasonInstallAll', 'MasonUpdate' },
cmd = { 'Mason', 'MasonInstall', 'MasonUninstall', 'MasonInstallAll', 'MasonUpdate' },
config = function()
-- import mason
local mason = require('mason')
@@ -30,4 +18,364 @@ return {
})
end,
},
{
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
},
},
},
{ 'Bilal2453/luvit-meta', lazy = true },
{
-- Main LSP Configuration
'neovim/nvim-lspconfig',
event = { 'BufReadPre', 'BufNewFile' },
dependencies = {
-- Automatically install LSPs and related tools to stdpath for Neovim
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
-- Useful status updates for LSP.
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
{ 'j-hui/fidget.nvim', opts = {} },
-- Allows extra capabilities provided by nvim-cmp
'hrsh7th/cmp-nvim-lsp',
},
config = function()
-- Brief aside: **What is LSP?**
--
-- LSP is an initialism you've probably heard, but might not understand what it is.
--
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
-- and language tooling communicate in a standardized fashion.
--
-- In general, you have a "server" which is some tool built to understand a particular
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
-- processes that communicate with some "client" - in this case, Neovim!
--
-- LSP provides Neovim with features like:
-- - Go to definition
-- - Find references
-- - Autocompletion
-- - Symbol Search
-- - and more!
--
-- Thus, Language Servers are external tools that must be installed separately from
-- Neovim. This is where `mason` and related plugins come into play.
--
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
-- and elegantly composed help section, `:help lsp-vs-treesitter`
-- This function gets run when an LSP attaches to a particular buffer.
-- That is to say, every time a new file is opened that is associated with
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
-- function will be executed to configure the current buffer
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
callback = function(event)
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
-- to define small helper and utility functions so you don't have to repeat yourself.
--
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local map = function(keys, func, desc, mode)
mode = mode or 'n'
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end
-- Jump to the definition of the word under your cursor.
-- This is where a variable was first declared, or where a function is defined, etc.
-- To jump back, press <C-t>.
map('gd', function()
require('telescope.builtin').lsp_definitions()
end, 'Goto definition')
-- Find references for the word under your cursor.
map('gr', function()
require('telescope.builtin').lsp_references()
end, 'Goto references')
-- Jump to the implementation of the word under your cursor.
-- Useful when your language has ways of declaring types without an actual implementation.
map('gI', function()
require('telescope.builtin').lsp_implementations()
end, 'Goto implementation')
-- Jump to the type of the word under your cursor.
-- Useful when you're not sure what type a variable is and you want to see
-- the definition of its *type*, not where it was *defined*.
map('<leader>cD', function()
require('telescope.builtin').lsp_type_definitions()
end, 'Code Type definition')
-- Fuzzy find all the symbols in your current document.
-- Symbols are things like variables, functions, types, etc.
map('<leader>ss', function()
require('telescope.builtin').lsp_document_symbols()
end, 'Document symbols')
-- Fuzzy find all the symbols in your current workspace.
-- Similar to document symbols, except searches over your entire project.
map('<leader>sS', function()
require('telescope.builtin').lsp_dynamic_workspace_symbols()
end, 'Workspace symbols')
-- Rename the variable under your cursor.
-- Most Language Servers support renaming across files, etc.
map('<leader>cR', vim.lsp.buf.rename, 'Code: rename')
-- Execute a code action, usually your cursor needs to be on top of an error
-- or a suggestion from your LSP for this to activate.
-- map('<leader>ca', vim.lsp.buf.code_action, 'Code action')
map('<leader>ca', vim.lsp.buf.code_action, 'Code action', { 'n', 'x' })
-- map('<leader>ca', function() require('tiny-code-action').code_action() end, 'Code action', { 'n', 'x' })
map('<leader>vR', '<cmd>LspRestart<CR>', 'Restart LSP')
-- Opens a popup that displays documentation about the word under your cursor
-- See `:help K` for why this keymap.
map('K', vim.lsp.buf.hover, 'Hover Documentation')
-- WARN: This is not Goto Definition, this is Goto Declaration.
-- For example, in C this would take you to the header.
map('gD', vim.lsp.buf.declaration, 'Goto declaration')
-- The following two autocommands are used to highlight references of the
-- word under your cursor when your cursor rests there for a little while.
-- See `:help CursorHold` for information about when this is executed
--
-- When you move your cursor, the highlights will be cleared (the second autocommand).
local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
local highlight_augroup =
vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.clear_references,
})
vim.api.nvim_create_autocmd('LspDetach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
callback = function(event2)
vim.lsp.buf.clear_references()
vim.api.nvim_clear_autocmds({ group = 'kickstart-lsp-highlight', buffer = event2.buf })
end,
})
end
-- The following code creates a keymap to toggle inlay hints in your
-- code, if the language server you are using supports them
--
-- This may be unwanted, since they displace some of your code
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
map('<leader>vH', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }))
end, 'Toggle inlay hints')
vim.lsp.inlay_hint.enable()
end
end,
})
-- LSP servers and clients are able to communicate to each other what features they support.
-- By default, Neovim doesn't support everything that is in the LSP specification.
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
-- Change the Diagnostic symbols in the sign column (gutter)
-- local signs = { Error = '󰅚 ', Warn = '󰀪 ', Info = ' ', Hint = '󰌶 ' }
local signs = { Error = '', Warn = '', Info = '', Hint = '' }
for type, icon in pairs(signs) do
local hl = 'DiagnosticSign' .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' })
end
-- Change border of documentation hover window, See https://github.com/neovim/neovim/pull/13998.
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, {
border = 'rounded',
})
-- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
--
-- Add any additional override configuration in the following tables. Available keys are:
-- - cmd (table): Override the default command used to start the server
-- - filetypes (table): Override the default list of associated filetypes for the server
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
-- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
-- clangd = {},
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
--
-- Some languages (like typescript) have entire language plugins that can be useful:
-- https://github.com/pmizio/typescript-tools.nvim
--
-- But for many setups, the LSP (`tsserver`) will work just fine
-- tsserver = {},
--
lua_ls = {
-- cmd = {...},
-- filetypes = { ...},
-- capabilities = {},
settings = {
Lua = {
workspace = {
checkThirdParty = false,
},
completion = {
callSnippet = 'Replace',
},
codeLens = {
enable = true,
},
doc = {
privateName = { '^_' },
},
hint = {
enable = true,
setType = false,
paramType = true,
paramName = 'Disable',
semicolon = 'Disable',
arrayIndex = 'Disable',
},
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
-- diagnostics = { disable = { 'missing-fields' } },
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {
'vim',
'it',
'describe',
'before_each',
'after_each',
},
},
},
},
},
-- Bash
bashls = {
filetypes = { 'sh', 'bash' },
},
-- HTML / CSS
html = {},
cssls = {},
tailwindcss = {},
-- Javascript/Typescript
ts_ls = {},
-- Java
jdtls = {},
-- Python
pyright = {},
ruff = {},
-- C/C++
clangd = {},
-- Ruby for Shopify
-- ruby_lsp = {
-- init_options = {
-- formatter = 'standard',
-- linters = { 'standard' },
-- },
-- },
rust_analyzer = {
cargo = {
allFeatures = true,
loadOutDirsFromCheck = true,
buildScripts = {
enable = true,
},
},
-- Add clippy lints for Rust.
checkOnSave = true,
procMacro = {
enable = true,
ignored = {
['async-trait'] = { 'async_trait' },
['napi-derive'] = { 'napi' },
['async-recursion'] = { 'async_recursion' },
},
},
},
-- TOML
taplo = {},
-- Shopify
-- theme_check = {},
-- Typo is too noisy for me without a simple way to override
-- typos_lsp = {},
-- YAML
yamlls = {},
}
-- Ensure the servers and tools above are installed
-- To check the current status of installed tools and/or manually install
-- other tools, you can run
-- :Mason
--
-- You can press `g?` for help in this menu.
-- You can add other tools here that you want Mason to install
-- for you, so that they are available from within Neovim.
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
'pyright', -- Used to format Lua code
})
if not vim.g.no_mason_autoinstall then
require('mason-lspconfig').setup({ ensure_installed = ensure_installed })
end
require('mason-lspconfig').setup({
handlers = {
function(server_name)
-- https://github.com/neovim/nvim-lspconfig/pull/3232#issuecomment-2331025714
-- if server_name == 'tsserver' then server_name = 'ts_ls' end
local server = servers[server_name] or {}
-- This handles overriding only values explicitly passed
-- by the server configuration above. Useful when disabling
-- certain features of an LSP (for example, turning off formatting for tsserver)
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server)
end,
},
})
-- Border for LSPInfo
require('lspconfig.ui.windows').default_options.border = 'single'
end,
},
}
+101 -79
View File
@@ -1,82 +1,104 @@
return {
{
"echasnovski/mini.nvim",
event = { "BufReadPost", "BufAdd", "BufNewFile" },
version = false,
config = function()
require("mini.comment").setup({})
require("mini.ai").setup({})
require("mini.cursorword").setup()
require("mini.bracketed").setup({
file = { suffix = "" },
window = { suffix = "" },
quickfix = { suffix = "" },
yank = { suffix = "" },
treesitter = { suffix = "n" },
})
require("mini.surround").setup({
mappings = {
add = "gsa", -- Add surrounding in Normal and Visual modes
delete = "gsd", -- Delete surrounding
replace = "gsr", -- Replace surrounding
find = "gsf", -- Find surrounding (to the right)
find_left = "gsF", -- Find surrounding (to the left)
highlight = "gsh", -- Highlight surrounding
update_n_lines = "gsn", -- Update `n_lines`
},
keys = {
{ "gz", "", desc = "+surround" },
},
})
require("mini.pairs").setup({
-- odes = { command = true },
-- mappings = {
-- ['<'] = { action = 'open', pair = '<>', neigh_pattern = '[^\\].' },
-- ['>'] = { action = 'close', pair = '<>', neigh_pattern = '[^\\].' },
-- },
})
require("mini.move").setup({
keys = {
{ "<M-Left>", mode = { "n", "v" } },
{ "<M-Down>", mode = { "n", "v" } },
{ "<M-Up>", mode = { "n", "v" } },
{ "<M-Right>", mode = { "n", "v" } },
},
{
'echasnovski/mini.nvim',
event = 'VeryLazy',
-- event = { "BufReadPost", "BufAdd", "BufNewFile" },
version = false,
config = function()
require('mini.comment').setup({})
require('mini.ai').setup({})
require('mini.cursorword').setup()
require('mini.bracketed').setup({
file = { suffix = '' },
window = { suffix = '' },
quickfix = { suffix = '' },
yank = { suffix = '' },
treesitter = { suffix = 'n' },
})
local ai = require('mini.ai')
ai.setup({
n_lines = 500,
custom_textobjects = {
s = ai.gen_spec.treesitter({ -- code block
a = { '@block.outer', '@conditional.outer', '@loop.outer' },
i = { '@block.inner', '@conditional.inner', '@loop.inner' },
}),
f = ai.gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' }), -- function
i = require('mini.extra').gen_ai_spec.indent(),
g = require('mini.extra').gen_ai_spec.buffer(),
},
})
require('mini.surround').setup({
mappings = {
add = 'gsa', -- Add surrounding in Normal and Visual modes
delete = 'gsd', -- Delete surrounding
replace = 'gsr', -- Replace surrounding
find = 'gsf', -- Find surrounding (to the right)
find_left = 'gsF', -- Find surrounding (to the left)
highlight = 'gsh', -- Highlight surrounding
update_n_lines = 'gsn', -- Update `n_lines`
},
keys = {
{ 'gz', '', desc = '+surround' },
},
})
require('mini.pairs').setup({
-- odes = { command = true },
-- mappings = {
-- ['<'] = { action = 'open', pair = '<>', neigh_pattern = '[^\\].' },
-- ['>'] = { action = 'close', pair = '<>', neigh_pattern = '[^\\].' },
-- },
mappings = {
['('] = { action = 'open', pair = '()', neigh_pattern = '[^\\][%s)}%]]' },
['['] = { action = 'open', pair = '[]', neigh_pattern = '[^\\][%s)}%]]' },
['{'] = { action = 'open', pair = '{}', neigh_pattern = '[^\\][%s)}%]]' },
['`'] = { neigh_pattern = '[^%a%d\\%-`][%s)}%]]' },
['"'] = { neigh_pattern = '[^%a%d\\%-"][%s)}%]]' },
["'"] = { neigh_pattern = "[^%a%d\\%-'][%s)}%]]" },
},
})
require('mini.move').setup({
keys = {
{ '<M-Left>', mode = { 'n', 'v' } },
{ '<M-Down>', mode = { 'n', 'v' } },
{ '<M-Up>', mode = { 'n', 'v' } },
{ '<M-Right>', mode = { 'n', 'v' } },
},
mappings = {
left = "<M-Left>",
line_left = "<M-Left>",
right = "<M-Right>",
line_right = "<M-Right>",
down = "<M-Down>",
line_down = "<M-Down>",
up = "<M-Up>",
line_up = "<M-Up>",
},
})
end,
},
{
"echasnovski/mini.files",
version = false,
keys = {
{ "-", "<cmd>lua require('mini.files').open(vim.api.nvim_buf_get_name(0))<CR>", { silent = true } },
},
},
{
"echasnovski/mini.icons",
opts = {},
lazy = true,
specs = {
{ "nvim-tree/nvim-web-devicons", enabled = false, optional = true },
},
init = function()
package.preload["nvim-web-devicons"] = function()
-- needed since it will be false when loading and mini will fail
package.loaded["nvim-web-devicons"] = {}
require("mini.icons").mock_nvim_web_devicons()
return package.loaded["nvim-web-devicons"]
end
end,
},
mappings = {
left = '<M-Left>',
line_left = '<M-Left>',
right = '<M-Right>',
line_right = '<M-Right>',
down = '<M-Down>',
line_down = '<M-Down>',
up = '<M-Up>',
line_up = '<M-Up>',
},
})
end,
},
{
'echasnovski/mini.files',
version = false,
keys = {
{ '-', "<cmd>lua require('mini.files').open(vim.api.nvim_buf_get_name(0))<CR>", { silent = true } },
},
},
{
'echasnovski/mini.icons',
opts = {},
lazy = true,
specs = {
{ 'nvim-tree/nvim-web-devicons', enabled = false, optional = true },
},
init = function()
package.preload['nvim-web-devicons'] = function()
-- needed since it will be false when loading and mini will fail
package.loaded['nvim-web-devicons'] = {}
require('mini.icons').mock_nvim_web_devicons()
return package.loaded['nvim-web-devicons']
end
end,
},
}
+55 -7
View File
@@ -3,20 +3,18 @@ return {
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
event = 'FileType',
event = 'VeryLazy',
cmd = { 'TSInstall', 'TSBufEnable', 'TSBufDisable', 'TSModuleInfo' },
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
{ 'windwp/nvim-ts-autotag', event = { 'BufReadPost', 'BufNewFile', 'BufWritePre' } },
{ 'windwp/nvim-ts-autotag', ft = { 'html', 'xml', 'tsx' }, opts = {} },
},
config = function()
require('nvim-ts-autotag').setup()
require('nvim-treesitter.configs').setup({
highlight = {
enable = true,
},
indent = {
enable = true,
disable = { 'ruby' },
},
ensure_installed = {
'vim',
@@ -25,21 +23,58 @@ return {
'markdown_inline',
'bash',
'c',
'cpp',
'java',
'javascript',
'typescript',
'tsx',
'json',
'toml',
'html',
'css',
'scss',
'lua',
'luadoc',
'diff',
'gitcommit',
'python',
'liquid',
},
auto_install = true,
highlight = {
enable = true,
disable = function(_, buf)
local line_count = vim.api.nvim_buf_line_count(buf)
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
-- vim.notify('stats: ' .. vim.inspect(stats))
-- if file is at least 10k and the average bytes per line is > 250, then disable treesitter
if ok and stats and (stats.size > (10 * 1024)) and (stats.size / line_count) > 250 then
vim.notify(
'Disabling treesitter, bytes: '
.. stats.size
.. ', lines: '
.. line_count
.. ', bytes / lines: '
.. math.floor(stats.size / line_count)
)
return true
end
return false
end,
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
-- If you are experiencing weird indenting issues, add the language to
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
additional_vim_regex_highlighting = { 'ruby' },
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<C-space>',
node_incremental = '<C-space>',
scope_incremental = false,
node_decremental = '<bs>',
},
},
playground = {
enable = true,
disable = {},
@@ -55,6 +90,19 @@ return {
['ic'] = { query = '@class.inner', desc = 'Select inner part of a class region' },
},
},
move = {
enable = true,
-- don't include classes to not conflict with conflicts in a diff
-- (LazyVim has some clever code but i don't think we need it right now)
-- goto_next_start = { [']f'] = '@function.outer', [']c'] = '@class.outer', [']a'] = '@parameter.inner' },
-- goto_next_end = { [']F'] = '@function.outer', [']C'] = '@class.outer', [']A'] = '@parameter.inner' },
-- goto_previous_start = { ['[f'] = '@function.outer', ['[c'] = '@class.outer', ['[a'] = '@parameter.inner' },
-- goto_previous_end = { ['[F'] = '@function.outer', ['[C'] = '@class.outer', ['[A'] = '@parameter.inner' },
goto_next_start = { [']f'] = '@function.outer', [']a'] = '@parameter.inner' },
goto_next_end = { [']F'] = '@function.outer', [']A'] = '@parameter.inner' },
goto_previous_start = { ['[f'] = '@function.outer', ['[a'] = '@parameter.inner' },
goto_previous_end = { ['[F'] = '@function.outer', ['[A'] = '@parameter.inner' },
},
swap = {
enable = true,
swap_next = {
+1
View File
@@ -144,6 +144,7 @@ return {
})
end,
},
{},
{
'nvim-lualine/lualine.nvim',
event = { 'BufReadPost', 'BufNewFile' },