This commit is contained in:
Kulvir Singh
2024-01-23 01:26:45 +05:30
parent c5fbb6c4b7
commit 7a36ad102e
14 changed files with 162 additions and 160 deletions

View File

@@ -1,7 +1,6 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" },
"blame.nvim": { "branch": "main", "commit": "562661972085a273914c8f702b11924f8aa573ea" },
"bufferline.nvim": { "branch": "main", "commit": "6c456b888823d9e4832aa91c482bccd19445c009" },
"catppuccin": { "branch": "main", "commit": "f288876c6d05d3bb91b0e72b8031fe9e26ef05b8" },
"cloak.nvim": { "branch": "main", "commit": "951b163e55ce7639eb320c450bde9283c4fe968b" },
@@ -20,7 +19,6 @@
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "bf0f4f8062d3acbe0afcc61db01a4d19d96310e4" },
"mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" },
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
@@ -28,10 +26,11 @@
"nvim-lspconfig": { "branch": "master", "commit": "042aa6b27b8b8d4f4e1bd42de2037c83d676a8a0" },
"nvim-tmux-navigation": { "branch": "main", "commit": "d9efffa413a530bdea3783af4fea86be84940283" },
"nvim-treesitter": { "branch": "master", "commit": "4a4dbe1cb1da34d87fc42a40aaf8e218af4cfe0f" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" },
"nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" },
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" },
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
"vim-fugitive": { "branch": "master", "commit": "ec8f7eed103c6d5b75eac69196bb87db0825629a" },
"vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" }
"vim-fugitive": { "branch": "master", "commit": "ec8f7eed103c6d5b75eac69196bb87db0825629a" }
}

View File

@@ -6,61 +6,29 @@ vim.keymap.set("n", "<leader>n", vim.cmd.Ex)
vim.keymap.set("x", "<leader>p", [["_dP]])
vim.keymap.set('n', 'P', '"+p')
-- some next greatest remaps
vim.keymap.set({"n", "v"}, "<leader>y", [["+y]])
vim.keymap.set("n", "<leader>Y", [["+Y]])
vim.keymap.set({"n", "v"}, "<leader>d", [["_d]])
-- move lines smooth butter smooth
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set('n', '<leader>h', vim.cmd.split)
vim.keymap.set('n', '<leader>v', vim.cmd.vsplit)
-- stay in indent mode only
vim.keymap.set("v", "<", "<gv")
vim.keymap.set("v", ">", ">gv")
vim.keymap.set('n', '<leader>vp', vim.cmd.split)
vim.keymap.set('n', '<leader>hp', vim.cmd.vsplit)
-- Keep ya head straight
vim.keymap.set("n", "J", "mzJ`z")
vim.keymap.set('n', '<C-d>', '<C-d>zz')
vim.keymap.set('n', '<C-u>', '<C-u>zz')
-- stay in indent mode only
vim.keymap.set("v", "<", "<gv")
vim.keymap.set("v", ">", ">gv")
vim.keymap.set("n", "<Tab>", vim.cmd.bnext)
vim.keymap.set("n", "<S-Tab>", vim.cmd.bprev)
vim.keymap.set('n', '<leader>q', vim.cmd.bdelete)
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(e)
vim.bo[e.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
local opts = { buffer = e.buf }
local keymap = vim.keymap
keymap.set("n", "K", vim.lsp.buf.hover, opts)
keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, opts)
keymap.set("n", "gi", function() vim.lsp.buf.implementation() end, opts)
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
keymap.set("n", "<leader>rr", function() vim.lsp.buf.references() end, opts)
keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
keymap.set("n", "<leader>ws", function() vim.lsp.buf.workspace_symbol() end, opts)
end,
})

View File

@@ -8,6 +8,7 @@ vim.api.nvim_create_autocmd(
"FileType",
{ pattern = "*", command = [[setlocal formatoptions-=c formatoptions-=r formatoptions-=o]] }
)
vim.opt.wildignore = "*/.git/*,*/.DS_Store/*,*/target/*,*/node_modules/*"
vim.opt.tabstop = 4
vim.opt.softtabstop = 4

View File

@@ -1,8 +1,11 @@
return{
return {
{
"akinsho/bufferline.nvim",
version = "*",
dependencies = "nvim-tree/nvim-web-devicons",
config = function()
require("bufferline").setup{
options={

View File

@@ -1,32 +1,37 @@
return {
--[[ return {
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
lua = { "stylua" },
html = { "htmlbeautifier" },
css = { { "prettierd", "prettier" } },
javascript = { { "prettierd", "prettier" } },
typescript = { { "prettierd", "prettier" } },
javascriptreact = { { "prettierd", "prettier" } },
typescriptreact = { { "prettierd", "prettier" } },
json = { { "prettierd", "prettier" } },
markdown = { { "prettierd", "prettier" } },
html = { "htmlbeautifier" },
css = { { "prettierd", "prettier" } },
go = { "gofmt" },
cpp = { "clangformat" },
c = { "clangformat" },
},
})
vim.keymap.set({ "n", "v" }, "<leader>l", function()
vim.keymap.set({ "n", "v" }, "<leader>ll", function()
conform.format({
lsp_fallback = true,
async = false,
timeout_ms = 500,
-- Format on save
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
})
end, { desc = "Format file or range (in visual mode)" })
end,
}
} ]]

View File

@@ -1,5 +1,6 @@
return{
"lukas-reineke/indent-blankline.nvim",
config = function()
local highlight = {
"RainbowRed",
@@ -24,8 +25,13 @@ return{
end)
vim.g.rainbow_delimiters = { highlight = highlight }
require("ibl").setup { scope = { highlight = highlight } }
require("ibl").setup {
scope = {
highlight = highlight,
char = '',
},
}
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
end,
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
end
}

View File

@@ -1,39 +1,10 @@
return {
"nvim-lua/plenary.nvim",
"github/copilot.vim",
"nvim-tree/nvim-web-devicons",
{
"RRethy/vim-illuminate",
config = function()
require("illuminate")
end,
},
{
"FabijanZulj/blame.nvim",
config = function()
require("blame").setup{}
end
},
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
build = function() vim.fn["mkdp#util#install"]() end,
},
{
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup()
end
},
{
"numToStr/Comment.nvim",
config = function()
@@ -50,6 +21,21 @@ return {
end
},
{
"folke/todo-comments.nvim",
dependencies = {
"nvim-lua/plenary.nvim"
},
-- TODO: this is not working
opts = {},
},
{
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup()
end
},
{
"NvChad/nvim-colorizer.lua",
@@ -59,4 +45,11 @@ return {
},
},
},
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
build = function() vim.fn["mkdp#util#install"]() end,
},
}

View File

@@ -1,9 +1,11 @@
return {
"mfussenegger/nvim-lint",
event = {
"BufReadPre",
"BufNewFile",
},
config = function()
local lint = require("lint")
@@ -12,25 +14,13 @@ return {
typescript = { "eslint_d" },
javascriptreact = { "eslint_d" },
typescriptreact = { "eslint_d" },
go = { "golangci_lint" },
html = { "htmlhint" },
css = { "stylelint" },
python = { "flake8" },
cpp = { "clangtidy" },
c = { "clangtidy" },
}
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>ll", function()
lint.try_lint()
end, { desc = "Trigger linting for current file" })
end,
}

View File

@@ -1,25 +1,27 @@
return{
return {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"rafamadriz/friendly-snippets",
"onsails/lspkind.nvim",
"hrsh7th/cmp-buffer",
},
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
local lspkind = require("lspkind")
local cmp_select = {behavior = cmp.SelectBehavior.Select}
require("luasnip.loaders.from_vscode").lazy_load()
luasnip.config.setup({})
cmp.setup({
snippet = {
@@ -28,24 +30,34 @@ return{
end,
},
completion = {
completeopt = "menu,menuone,noselect",
},
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = cmp.mapping.complete(),
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
["<C-y>"] = cmp.mapping.confirm({ select = true }),
["CR"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" },
{ name = "treesitter" },
{ name = "tmux" },
}, {
{ name = 'buffer' },
{ name = "buffer" },
}),
formatting = {
format = lspkind.cmp_format({
maxwidth = 50,
maxwidth = 25,
ellipses_char = "",
}),
},

View File

@@ -1,30 +1,27 @@
return {
"neovim/nvim-lspconfig",
"williamboman/mason.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"j-hui/fidget.nvim",
"hrsh7th/cmp-nvim-lsp",
"williamboman/mason.nvim",
"neovim/nvim-lspconfig",
"williamboman/mason-lspconfig.nvim",
"WhoIsSethDaniel/mason-tool-installer.nvim",
},
config = function()
require("fidget").setup({})
require("fidget").setup({
progress = {
display = {
render_limit = 3,
},
},
})
local mason = require("mason")
local mason_lspconfig = require("mason-lspconfig")
local mason_tool_installer = require("mason-tool-installer")
local cmp_lsp = require("cmp_nvim_lsp")
local capabilities = vim.tbl_deep_extend(
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
cmp_lsp.default_capabilities())
local lspconfig = require("lspconfig")
mason.setup({
ui = {
@@ -36,68 +33,84 @@ return {
},
})
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = cmp_lsp.default_capabilities(capabilities)
vim.api.nvim_buf_create_user_command(0, 'Format', function(_)
if vim.lsp.buf.format then
vim.lsp.buf.format()
elseif vim.lsp.buf.formatting then
vim.lsp.buf.formatting()
end
end, {})
local on_attach = function(_, bufnr)
local buf_map = vim.api.nvim_buf_set_keymap
local opts = { noremap = true, silent = true }
buf_map(bufnr, "n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
buf_map(bufnr, "n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
buf_map(bufnr, "n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
buf_map(bufnr, "n", "gi", "<Cmd>lua vim.lsp.buf.implementation()<CR>", opts)
buf_map(bufnr, { "n", "v" }, "<leader>ca", "<Cmd>lua vim.lsp.buf.code_action()<CR>", opts)
buf_map(bufnr, "n", "<leader>rn", "<Cmd>lua vim.lsp.buf.rename()<CR>", opts)
buf_map(bufnr, "n", "<leader>vd", "<Cmd>lua vim.diagnostic.open_float()<CR>", opts)
buf_map(bufnr, "n", "<leader>rr", "<Cmd>lua vim.lsp.buf.references()<CR>", opts)
buf_map(bufnr, "i", "<C-h>", "<Cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
buf_map(bufnr, "n", "<leader>ws", "<Cmd>lua vim.lsp.buf.workspace_symbol()<CR>", opts)
end
mason_lspconfig.setup({
ensure_installed = {
"tsserver",
"html",
"cssls",
"clangd",
"tailwindcss",
"cssls",
"gopls",
"html",
"prismals",
"pyright",
"tailwindcss",
"tsserver",
},
automatic_installation = true,
handlers = {
function(server_name)
require("lspconfig")[server_name].setup {
lspconfig[server_name].setup {
capabilities = capabilities,
on_attach = on_attach,
settings = {
[server_name] = {
analyses = {
unusedparams = true,
},
usePlaceholders = true,
},
},
}
end,
["lua_ls"] = function()
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup({
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = {"vim"},
},
diagnostics = { globals = {"vim"} },
},
},
})
end,
["tsserver"] = function()
local lspconfig = require("lspconfig")
lspconfig.tsserver.setup({
capabilities = capabilities,
on_attach = function(client)
client.resolved_capabilities.document_formatting = true
end,
})
end,
},
})
mason_tool_installer.setup({
ensure_installed = {
"prettier",
"prettierd",
"stylua",
"pylint",
"eslint_d",
"htmlbeautifier",
},
})
end,
opts = {
servers = {
tailwindcss = {},
},
},
}

View File

@@ -1,6 +1,10 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
dependencies = {
"nvim-tree/nvim-web-devicons"
},
config = function()
require('lualine').setup {
options = {

View File

@@ -1,10 +1,16 @@
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
},
config = function()
require("nvim-treesitter.configs").setup ({
ensure_installed = { "cpp", "typescript", "tsx", "c", "python", "go", "html" },
ensure_installed = { "typescript", "tsx", "python", "go", "c", "cpp", "lua", "markdown" },
sync_install = false,

View File

@@ -1,6 +1,7 @@
return{
return {
{
"folke/trouble.nvim",
config = function()
require("trouble").setup {
icons=true,

View File

@@ -16,6 +16,7 @@ require("lazy").setup({
{ import = "lilJ.lazy.lsp" }
}, {
change_detection = {
enabled = true,
notify = false,
},
})