This commit is contained in:
sankalp committed 2024-08-26 10:11:28 +05:45
1 parent 847238c1bc
commit 35a8122396
13 files changed
+363 -146

No files matched your search

+14 -2
View File
@@ -26,9 +26,9 @@
</p>
<p align="center">
<strong>Personalized Dev Env ❤️👨‍💻</strong>
<strong>Welcome to my personalized Neovim setup 👨‍💻</strong>
<br>
Handcrafted Neovim setup for the ultimate CLI dev experience.
Optimized for a smooth and efficient coding experience.
<br>
<br>
<a href="https://github.com/S4NKALP/nvim/wiki">Documentation</a>
@@ -40,6 +40,13 @@
<br>
## Highlights:
- **Modular Structure**: Organized Lua scripts for readability and easy customization.
- **Language Support**: Automated setup for various languages using Mason.nvim.
- **Keybindings**: Streamlined shortcuts for productivity, detailed in `lua/core/keymaps.lua`.
- **Plugins**: Handpicked plugins managed via Lazy.nvim for enhanced functionality.
## System dependencies
Important system dependencies:
@@ -52,6 +59,7 @@ Important system dependencies:
- **Tools for finding stuff**:
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation)
- [zig](https://ziglang.org/)
## Installation
@@ -75,6 +83,10 @@ Run neovim to complete the setup
nvim
```
### Customization:
Feel free to modify and adapt my configuration to your own needs!
### 🧰 Tools Used
- [dots](https://github.com/S4NKALP/hyprland) — Dev Environment
+1 -1
View File
@@ -1 +1 @@
{"distribution": "custom", "masonTools": ["actionlint", "bash-language-server", "biome", "black", "clang-format", "clangd", "emmet-ls", "eslint_d", "google-java-format", "graphql-lsp", "hadolint", "isort", "jdtls", "lua-language-server", "markdownlint", "prettier", "prettierd", "pylint", "pylsp", "pyright", "pyright-langserver", "selene", "shfmt", "stylua", "tailwindcss-language-server", "trivy", "typescript-language-server", "typos-lsp", "vim-language-server", "vint", "vscode-css-language-server", "vscode-eslint-language-server", "vscode-html-language-server", "vscode-json-language-server"], "plugins": ["2kabhishek/nerdy.nvim", "2kabhishek/tdo.nvim", "2kabhishek/termim.nvim", "CRAG666/code_runner.nvim", "Exafunction/codeium.vim", "HiPhish/rainbow-delimiters.nvim", "L3MON4D3/LuaSnip", "LudoPinelli/comment-box.nvim", "LunarVim/bigfile.nvim", "MunifTanjim/nui.nvim", "NStefan002/screenkey.nvim", "ThePrimeagen/refactoring.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim", "akinsho/toggleterm.nvim", "altermo/ultimate-autopair.nvim", "antosha417/nvim-lsp-file-operations", "creativenull/dotfyle-metadata.nvim", "debugloop/telescope-undo.nvim", "echasnovski/mini.files", "echasnovski/mini.icons", "echasnovski/mini.nvim", "folke/flash.nvim", "folke/lazy.nvim", "folke/noice.nvim", "folke/persistence.nvim", "folke/trouble.nvim", "folke/which-key.nvim", "folke/zen-mode.nvim", "gbprod/yanky.nvim", "hrsh7th/cmp-buffer", "hrsh7th/cmp-cmdline", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp-signature-help", "hrsh7th/cmp-nvim-lua", "hrsh7th/cmp-path", "hrsh7th/nvim-cmp", "iamcco/markdown-preview.nvim", "kristijanhusak/vim-dadbod-completion", "kristijanhusak/vim-dadbod-ui", "lukas-reineke/indent-blankline.nvim", "m-demare/hlargs.nvim", "m4xshen/hardtime.nvim", "max397574/better-escape.nvim", "mfussenegger/nvim-dap", "mfussenegger/nvim-lint", "mg979/vim-visual-multi", "mstuttgart/odoo-snippets", "mvllow/modes.nvim", "nacro90/numb.nvim", "navarasu/onedark.nvim", "neovim/nvim-lspconfig", "numToStr/Navigator.nvim", "nvim-lua/plenary.nvim", "nvim-lualine/lualine.nvim", "nvim-neo-tree/neo-tree.nvim", "nvim-neotest/neotest", "nvim-neotest/neotest-jest", "nvim-neotest/neotest-python", "nvim-neotest/nvim-nio", "nvim-pack/nvim-spectre", "nvim-telescope/telescope-file-browser.nvim", "nvim-telescope/telescope-fzf-native.nvim", "nvim-telescope/telescope-symbols.nvim", "nvim-telescope/telescope-ui-select.nvim", "nvim-telescope/telescope.nvim", "nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter-context", "nvim-treesitter/nvim-treesitter-textobjects", "nvimdev/dashboard-nvim", "nvimdev/lspsaga.nvim", "olimorris/neotest-rspec", "onsails/lspkind.nvim", "rafamadriz/friendly-snippets", "rcarriga/nvim-dap-ui", "rcarriga/nvim-notify", "saadparwaiz1/cmp_luasnip", "smjonas/inc-rename.nvim", "stevearc/conform.nvim", "stevearc/dressing.nvim", "szw/vim-maximizer", "tpope/vim-dadbod", "wakatime/vim-wakatime", "williamboman/mason-lspconfig.nvim", "williamboman/mason.nvim", "willothy/flatten.nvim", "windwp/nvim-ts-autotag", "zapling/mason-lock.nvim"], "keymaps": [{"desc": "Next Buffer", "noremap": true, "lhs": "<Tab>", "mode": "n", "rhs": "<Cmd>bnext<CR>"}, {"desc": "Escape and clear hlsearch", "noremap": true, "lhs": "<Esc>", "mode": "n", "rhs": "<Cmd>noh<CR><Esc>"}, {"desc": "Lspsaga | Code Outline", "noremap": true, "lhs": "<Space>lo", "mode": "n", "rhs": "<Cmd>Lspsaga outline<CR>"}, {"desc": "Copy Git URL", "noremap": true, "lhs": "<Space>yg", "mode": "n", "rhs": "<Cmd>lua require\"gitlinker\".get_buf_range_url()<CR>"}, {"desc": "File Name", "noremap": true, "lhs": "<Space>yf", "mode": "n", "rhs": "<Cmd>CopyFileName<CR>"}, {"desc": "Copy Whole File", "noremap": true, "lhs": "<Space>ya", "mode": "n", "rhs": "<Cmd>%y+<CR>"}, {"desc": "Absolute Path", "noremap": true, "lhs": "<Space>yP", "mode": "n", "rhs": "<Cmd>CopyAbsolutePath<CR>"}, {"desc": "Relative Path", "noremap": true, "lhs": "<Space>yp", "mode": "n", "rhs": "<Cmd>CopyRelativePath<CR>"}, {"desc": "Float File Explorer", "noremap": true, "lhs": "<Space>ee", "mode": "n", "rhs": ":Neotree toggle float<CR>"}, {"desc": " Left File Explorer", "noremap": true, "lhs": "<Space><Tab>", "mode": "n", "rhs": ":Neotree toggle left<CR>"}, {"desc": "Restore Last Session", "noremap": true, "lhs": "<Space>ml", "mode": "n", "rhs": "<function>"}, {"desc": "Restore Session", "noremap": true, "lhs": "<Space>ms", "mode": "n", "rhs": "<function>"}, {"desc": "Don't Save Current Session", "noremap": true, "lhs": "<Space>md", "mode": "n", "rhs": "<function>"}, {"desc": "Toggle IA (Codeium)", "noremap": true, "lhs": "<Space>cI", "mode": "n", "rhs": "<Cmd>CodeiumToggle<CR>"}, {"desc": "Command History", "noremap": true, "lhs": "<Space>kh", "mode": "n", "rhs": "<Cmd>Telescope command_history<CR>"}, {"desc": "Commands", "noremap": true, "lhs": "<Space>kc", "mode": "n", "rhs": "<Cmd>Telescope commands<CR>"}, {"desc": "Keymaps", "noremap": true, "lhs": "<Space>kk", "mode": "n", "rhs": "<Cmd>Telescope keymapLine truncated
{"distribution": "custom", "masonTools": ["basedpyright", "basedpyright-langserver", "bash-language-server", "black", "clang-format", "clangd", "codespell", "cpplint", "cspell", "emmet-ls", "eslint_d", "isort", "jdtls", "lua-language-server", "markdownlint", "mypy", "phpcs", "prettier", "pylint", "ruff", "selene", "shfmt", "stylua", "tailwindcss-language-server", "trivy", "typescript-language-server"], "plugins": ["2kabhishek/nerdy.nvim", "2kabhishek/tdo.nvim", "2kabhishek/termim.nvim", "CRAG666/code_runner.nvim", "Exafunction/codeium.vim", "HiPhish/rainbow-delimiters.nvim", "L3MON4D3/LuaSnip", "LudoPinelli/comment-box.nvim", "LunarVim/bigfile.nvim", "MunifTanjim/nui.nvim", "NStefan002/screenkey.nvim", "ThePrimeagen/refactoring.nvim", "akinsho/toggleterm.nvim", "altermo/ultimate-autopair.nvim", "antosha417/nvim-lsp-file-operations", "creativenull/dotfyle-metadata.nvim", "debugloop/telescope-undo.nvim", "echasnovski/mini.files", "echasnovski/mini.icons", "echasnovski/mini.nvim", "folke/flash.nvim", "folke/lazy.nvim", "folke/noice.nvim", "folke/persistence.nvim", "folke/trouble.nvim", "folke/which-key.nvim", "folke/zen-mode.nvim", "gbprod/yanky.nvim", "hrsh7th/cmp-buffer", "hrsh7th/cmp-cmdline", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp-signature-help", "hrsh7th/cmp-nvim-lua", "hrsh7th/cmp-path", "hrsh7th/nvim-cmp", "iamcco/markdown-preview.nvim", "kristijanhusak/vim-dadbod-completion", "kristijanhusak/vim-dadbod-ui", "lukas-reineke/indent-blankline.nvim", "m-demare/hlargs.nvim", "m4xshen/hardtime.nvim", "max397574/better-escape.nvim", "mfussenegger/nvim-dap", "mfussenegger/nvim-lint", "mg979/vim-visual-multi", "mstuttgart/odoo-snippets", "mvllow/modes.nvim", "nacro90/numb.nvim", "navarasu/onedark.nvim", "neovim/nvim-lspconfig", "numToStr/Navigator.nvim", "nvim-lua/plenary.nvim", "nvim-lualine/lualine.nvim", "nvim-neo-tree/neo-tree.nvim", "nvim-neotest/neotest", "nvim-neotest/neotest-jest", "nvim-neotest/neotest-python", "nvim-neotest/nvim-nio", "nvim-pack/nvim-spectre", "nvim-telescope/telescope-file-browser.nvim", "nvim-telescope/telescope-fzf-native.nvim", "nvim-telescope/telescope-symbols.nvim", "nvim-telescope/telescope-ui-select.nvim", "nvim-telescope/telescope.nvim", "nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter-context", "nvim-treesitter/nvim-treesitter-textobjects", "nvimdev/dashboard-nvim", "nvimdev/lspsaga.nvim", "olimorris/neotest-rspec", "onsails/lspkind.nvim", "rafamadriz/friendly-snippets", "rcarriga/nvim-dap-ui", "rcarriga/nvim-notify", "rshkarin/mason-nvim-lint", "saadparwaiz1/cmp_luasnip", "smjonas/inc-rename.nvim", "stevearc/conform.nvim", "stevearc/dressing.nvim", "szw/vim-maximizer", "tpope/vim-dadbod", "wakatime/vim-wakatime", "williamboman/mason-lspconfig.nvim", "williamboman/mason.nvim", "willothy/flatten.nvim", "windwp/nvim-ts-autotag", "zapling/mason-conform.nvim", "zapling/mason-lock.nvim"], "pluginManager": "lazy.nvim", "keymaps": [{"desc": "Next Buffer", "noremap": true, "lhs": "<Tab>", "mode": "n", "rhs": "<Cmd>bnext<CR>"}, {"desc": "Escape and clear hlsearch", "noremap": true, "lhs": "<Esc>", "mode": "n", "rhs": "<Cmd>noh<CR><Esc>"}, {"desc": "Lspsaga | Code Outline", "noremap": true, "lhs": "<Space>lo", "mode": "n", "rhs": "<Cmd>Lspsaga outline<CR>"}, {"desc": "Reload Module", "noremap": true, "lhs": "<Space>cr", "mode": "n", "rhs": "<Cmd>Telescope reloader<CR>"}, {"desc": "Fuzzy Find in File", "noremap": true, "lhs": "<Space>fs", "mode": "n", "rhs": "<Cmd>Telescope current_buffer_fuzzy_find<CR>"}, {"desc": "Quickfix", "noremap": true, "lhs": "<Space>fq", "mode": "n", "rhs": "<Cmd>Telescope quickfix<CR>"}, {"desc": "Undo History", "noremap": true, "lhs": "<Space>fu", "mode": "n", "rhs": "<Cmd>Telescope undo<CR>"}, {"desc": "Notifications", "noremap": true, "lhs": "<Space>cn", "mode": "n", "rhs": "<Cmd>Telescope notify<CR>"}, {"desc": "File Browser", "noremap": true, "lhs": "<Space>ef", "mode": "n", "rhs": "<Cmd>Telescope file_browser<CR>"}, {"desc": "Diagnostics", "noremap": true, "lhs": "<Space>fd", "mode": "n", "rhs": "<Cmd>Telescope diagnostics<CR>"}, {"desc": "Search History", "noremap": true, "lhs": "<Space>ks", "mode": "n", "rhs": "<Cmd>Telescope search_history<CR>"}, {"desc": "Command History", "noremap": true, "lhs": "<Space>kh", "mode": "n", "rhs": "<Cmd>Telescope command_history<CR>"}, {"desc": "Commands", "noremap": true, "lhs": "<Space>kc", "mode": "n", "rhs": "<Cmd>Telescope commands<CR>"}, {"desc": "Keymaps", "noremap": true, "lhs": "<Space>kk", "mode": "n", "rhs": "<Cmd>Telescope keymaps<CR>"}, {"desc": "Grep String", "noremap": true, "lhs": "<Space>fG", "mode": "n", "rhs": "<Cmd>Telescope grep_string<CR>"}, {"desc": "Find Highlight Groups", "noremap": true, "lhs": "<Space>fH", "mode": "n", "rhs": "<Cmd>Telescope highlights<CR>"}, {"desc": "Marks", "noremap": true, "lhs": "<Space>fm", "mode": "n", "rhs": "<Cmd>Telescope marks<CR>"}, {"desc": "Old Recent Files", "noremap": true, "lhs": "<Space>fo", "mode": "n", "rhs": "<Cmd>Telescope oldLine truncated
+117 -83
View File
@@ -1,109 +1,143 @@
local lspconfig = require("lspconfig")
-- Define nvim-lspconfig LSP servers here
local lsp_servers = {
'basedpyright',
'lua_ls',
'tsserver',
'tailwindcss',
'emmet_ls',
'bashls',
'jdtls',
'clangd',
}
local lspconfig = require('lspconfig')
-- import cmp-nvim-lsp plugin
local cmp_nvim_lsp = require("cmp_nvim_lsp")
local cmp_nvim_lsp = require('cmp_nvim_lsp')
-- import mason_lspconfig plugin
local mason_lspconfig = require("mason-lspconfig")
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 }
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
-- 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 = '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 = '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 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 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 = '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 = '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 = '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 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 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 = '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,
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 = "" }
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 = "" })
local hl = 'DiagnosticSign' .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' })
end
mason_lspconfig.setup_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" },
},
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,
-- 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' },
},
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,
['emmet_ls'] = function()
-- configure emmet language server
lspconfig['emmet_ls'].setup({
capabilities = capabilities,
filetypes = {
'html',
'javascript',
'typescript',
'javascriptreact',
'typescriptreact',
'css',
'less',
},
})
end,
},
})
+3 -1
View File
@@ -16,6 +16,7 @@ mason.setup({
})
mason_lspconfig.setup({
automatic_installation = true,
-- list of servers for mason to install
ensure_installed = {
'tsserver',
@@ -23,12 +24,12 @@ mason_lspconfig.setup({
'basedpyright',
'jdtls',
'bashls',
'jsonls',
'clangd',
},
})
mason_tool_installer.setup({
run_on_start = true,
ensure_installed = {
'prettier', -- prettier formatter
'stylua', -- lua formatter
@@ -38,5 +39,6 @@ mason_tool_installer.setup({
'ruff', -- python linter
'mypy', -- type checking
'eslint_d', --js linter
'shfmt', -- shell formatter
},
})
+126
View File
@@ -0,0 +1,126 @@
local vim = vim
local X = {}
---@param on_attach fun(client, buffer)
function X.on_attach(on_attach)
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local buffer = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
on_attach(client, buffer)
end,
})
end
function X.starts_with(str, start)
return str:sub(1, #start) == start
end
function X.is_table(to_check)
return type(to_check) == "table"
end
function X.has_key(t, key)
for t_key, _ in pairs(t) do
if t_key == key then
return true
end
end
return false
end
function X.has_value(t, val)
for _, value in ipairs(t) do
if value == val then
return true
end
end
return false
end
function X.tprint(table)
print(vim.inspect(table))
end
function X.tprint_keys(table)
for k in pairs(table) do
print(k)
end
end
X.reload = function()
local presentReload, reload = pcall(require, "plenary.reload")
if presentReload then
local counter = 0
for moduleName in pairs(package.loaded) do
if X.starts_with(moduleName, "lt.") then
reload.reload_module(moduleName)
counter = counter + 1
end
end
-- clear nvim-mapper keys
vim.g.mapper_records = nil
vim.notify("Reloaded " .. counter .. " modules!")
end
end
function X.is_macunix()
return vim.fn.has("macunix")
end
function X.link_highlight(from, to, override)
local hl_exists, _ = pcall(vim.api.nvim_get_hl_by_name, from, false)
if override or not hl_exists then
-- vim.cmd(("highlight link %s %s"):format(from, to))
vim.api.nvim_set_hl(0, from, { link = to })
end
end
X.highlight = function(group, opts)
vim.api.nvim_set_hl(0, group, opts)
end
X.highlight_bg = function(group, col)
vim.api.nvim_set_hl(0, group, { bg = col })
end
-- Define fg color
-- @param group Group
-- @param color Color
X.highlight_fg = function(group, col)
vim.api.nvim_set_hl(0, group, { fg = col })
end
-- Define bg and fg color
-- @param group Group
-- @param fgcol Fg Color
-- @param bgcol Bg Color
X.highlight_fg_bg = function(group, fgcol, bgcol)
vim.api.nvim_set_hl(0, group, { bg = bgcol, fg = fgcol })
end
X.from_highlight = function(hl)
local result = {}
local list = vim.api.nvim_get_hl_by_name(hl, true)
for k, v in pairs(list) do
local name = k == "background" and "bg" or "fg"
result[name] = string.format("#%06x", v)
end
return result
end
X.get_color_from_terminal = function(num, default)
local key = "terminal_color_" .. num
return vim.g[key] and vim.g[key] or default
end
X.cmd = function(name, command, desc)
vim.api.nvim_create_user_command(name, command, desc)
end
X.autocmd = function(evt, opts)
vim.api.nvim_create_autocmd(evt, opts)
end
return X
+2 -1
View File
@@ -29,8 +29,10 @@
"lspsaga.nvim": { "branch": "main", "commit": "4ce44df854f447cf0a8972e5387b3aeb5efc798b" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"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": "482350b050bd413931c2cdd4857443c3da7d57cb" },
"mason-nvim-lint": { "branch": "main", "commit": "b579a00ee39dcd590b1023028dc8fb3d203a67b0" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.files": { "branch": "main", "commit": "7ed15315247775b4c5fcfaf4c8fe45d3a0dde9ad" },
@@ -54,7 +56,6 @@
"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": "397982d197768ebdefc0e2db396d95c4d371ca86" },
"nvim-treesitter-context": { "branch": "master", "commit": "0f3332788e0bd37716fbd25f39120dcfd557c90f" },
+28
View File
@@ -0,0 +1,28 @@
{
"basedpyright": "1.17.0",
"bash-language-server": "5.4.0",
"black": "24.8.0",
"clang-format": "18.1.8",
"clangd": "18.1.3",
"codespell": "2.3.0",
"cpplint": "1.6.1",
"cspell": "8.14.2",
"emmet-ls": "0.4.2",
"eslint_d": "14.0.3",
"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",
"prettier": "3.3.3",
"pylint": "3.2.6",
"ruff": "0.6.2",
"selene": "0.27.1",
"shfmt": "v3.9.0",
"stylua": "v0.20.0",
"tailwindcss-language-server": "0.0.23",
"trivy": "v0.54.1",
"typescript-language-server": "4.3.3"
}
+5 -1
View File
@@ -21,7 +21,11 @@ return {
{
'zapling/mason-lock.nvim',
cmd = { 'MasonLock', 'MasonLockRestore' },
opts = {},
config = function()
require('mason-lock').setup({
lockfile_path = vim.fn.stdpath('config') .. '/lua/mason-lock.json', -- (default)
})
end,
},
{
'2kabhishek/nerdy.nvim',
+22 -3
View File
@@ -1,10 +1,27 @@
-- Define conform.nvim formatting servers here
local formatting_servers = {
'prettier',
'isort',
'clang-format',
'black',
'stylua',
'shfmt',
'php-cs-fixer',
'google-java-formatter',
'codespell',
}
return {
'stevearc/conform.nvim',
enabled = true,
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' },
@@ -17,7 +34,7 @@ return {
html = { 'prettier' },
json = { 'prettier' },
yaml = { 'prettier' },
markdown = { 'prettier' },
markdown = { 'prettier', 'markdownlint' },
lua = { 'stylua' },
python = { 'isort', 'black' },
php = { 'php-cs-fixer' },
@@ -26,6 +43,8 @@ return {
liquid = { 'prettier' },
bash = { 'shfmt' },
sh = { 'shfmt' },
['*'] = { 'codespell' },
['_'] = { 'trim_whitespace' },
},
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable
+26 -7
View File
@@ -1,8 +1,30 @@
-- Define nvim-lint linters here
local linting_servers = {
'cpplint',
'eslint_d',
'cspell',
'ruff',
'mypy',
'trivy',
'phpcs',
'markdownlint',
}
return {
'mfussenegger/nvim-lint',
dependencies = {
'rshkarin/mason-nvim-lint',
},
event = { 'BufReadPre', 'BufNewFile' },
opts = {
linters_by_ft = {
config = function()
local lint = require('lint')
require('mason-nvim-lint').setup({
ensure_installed = linting_servers,
automatic_installation = true,
})
lint.linters_by_ft = {
lua = { 'selene' },
cpp = { 'cpplint' },
c = { 'cpplint' },
@@ -14,12 +36,9 @@ return {
markdown = { 'markdownlint' },
java = { 'trivy' },
php = { 'phpcs' },
},
},
config = function()
local lint = require('lint')
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
}
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup,
callback = function()
+14 -5
View File
@@ -5,6 +5,7 @@ return {
dependencies = {
'hrsh7th/cmp-nvim-lsp',
{ 'antosha417/nvim-lsp-file-operations', config = true },
'williamboman/mason-lspconfig.nvim',
},
config = function()
require('configs.lsp')
@@ -13,12 +14,20 @@ return {
{
'williamboman/mason.nvim',
cmd = { 'Mason', 'MasonInstall', 'MasonInstallAll', 'MasonUpdate' },
dependencies = {
'williamboman/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
},
config = function()
require('mason').setup()
-- import mason
local mason = require('mason')
-- enable mason and configure icons
mason.setup({
ui = {
icons = {
package_installed = '✓',
package_pending = '➜',
package_uninstalled = '✗',
},
},
})
end,
},
-- {
+5 -7
View File
@@ -72,12 +72,10 @@ return {
end,
},
{
{
'nvim-treesitter/nvim-treesitter-context',
event = 'VeryLazy',
config = function()
require('treesitter-context').setup({ mode = 'cursor', max_lines = 3 })
end,
},
'nvim-treesitter/nvim-treesitter-context',
event = 'VeryLazy',
config = function()
require('treesitter-context').setup({ mode = 'cursor', max_lines = 3 })
end,
},
}
-35
View File
@@ -1,35 +0,0 @@
{
"actionlint": "v1.7.1",
"bash-language-server": "5.4.0",
"biome": "1.8.3",
"black": "24.8.0",
"clang-format": "18.1.8",
"clangd": "18.1.3",
"css-lsp": "4.10.0",
"emmet-ls": "0.4.2",
"eslint-lsp": "4.10.0",
"eslint_d": "14.0.3",
"google-java-format": "v1.23.0",
"graphql-language-service-cli": "3.5.0",
"hadolint": "v2.12.0",
"html-lsp": "4.10.0",
"isort": "5.13.2",
"jdtls": "v1.38.0",
"json-lsp": "4.10.0",
"lua-language-server": "3.10.5",
"markdownlint": "0.41.0",
"prettier": "3.3.3",
"prettierd": "0.25.3",
"pylint": "3.2.6",
"pyright": "1.1.377",
"python-lsp-server": "1.12.0",
"selene": "0.27.1",
"shfmt": "v3.9.0",
"stylua": "v0.20.0",
"tailwindcss-language-server": "0.0.23",
"trivy": "v0.54.1",
"typescript-language-server": "4.3.3",
"typos-lsp": "v0.1.22",
"vim-language-server": "2.3.1",
"vint": "0.3.21"
}