Neovim revamped 2k24 (lazy.nvim)

This commit is contained in:
Kulvir Singh
2024-01-08 02:14:39 +05:30
parent a44a6b72de
commit 074b28112b
20 changed files with 539 additions and 0 deletions

2
nvim/init.lua Normal file
View File

@@ -0,0 +1,2 @@
require("lilJ.core")
require("lilJ.lazy_init")

34
nvim/lazy-lock.json Normal file
View File

@@ -0,0 +1,34 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "2f0db89fcb22d27b908b3609d2441c02798106ab" },
"blame.nvim": { "branch": "main", "commit": "562661972085a273914c8f702b11924f8aa573ea" },
"bufferline.nvim": { "branch": "main", "commit": "6c456b888823d9e4832aa91c482bccd19445c009" },
"catppuccin": { "branch": "main", "commit": "5e36ca599f4aa41bdd87fbf2c5aae4397ac55074" },
"cloak.nvim": { "branch": "main", "commit": "951b163e55ce7639eb320c450bde9283c4fe968b" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"copilot.vim": { "branch": "release", "commit": "5b19fb001d7f31c4c7c5556d7a97b243bd29f45f" },
"fidget.nvim": { "branch": "main", "commit": "a4a7edfea37e557dbff5509ee374ffb57051bba9" },
"friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" },
"gitsigns.nvim": { "branch": "main", "commit": "3e6e91b09f0468c32d3b96dcacf4b947f037ce25" },
"indent-blankline.nvim": { "branch": "master", "commit": "3c8a185da4b8ab7aef487219f5e001b11d4b6aaf" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lspkind.nvim": { "branch": "master", "commit": "7f26cf5e27e2bd910ce0ea00c514da2bf97423b8" },
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0989bdf4fdf7b5aa4c74131d7ffccc3f399ac788" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "8b70e7f1e0a4119c1234c3bde4a01c241cabcc74" },
"mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" },
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
"nvim-lspconfig": { "branch": "master", "commit": "796394fd19fb878e8dbc4fd1e9c9c186ed07a5f4" },
"nvim-tmux-navigation": { "branch": "main", "commit": "d9efffa413a530bdea3783af4fea86be84940283" },
"nvim-treesitter": { "branch": "master", "commit": "8cd2b230174efbf7b5d9f49fe2f90bda6b5eb16e" },
"nvim-web-devicons": { "branch": "master", "commit": "db0c864375c198cacc171ff373e76bfce2a85045" },
"plenary": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
"vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" }
}

View File

@@ -0,0 +1,2 @@
require("lilJ.core.remap")
require("lilJ.core.set")

View File

@@ -0,0 +1,61 @@
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>n", vim.cmd.Ex)
-- Prime said this is greated remap ever
vim.keymap.set("x", "<leader>p", [["_dP]])
-- 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")
-- Pasting from clipboard hurts in vim
vim.keymap.set('n', 'P', '"+p')
-- Copying to Clipboard
--vim.keymap.set('v', '<leader>y', '"+y')
vim.keymap.set('n', '<leader>h', vim.cmd.split)
vim.keymap.set('n', '<leader>v', 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')
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", "gd", function() vim.lsp.buf.definition() 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", "K", vim.lsp.buf.hover, 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

@@ -0,0 +1,30 @@
vim.opt.nu = true
vim.opt.rnu = true
vim.opt.autoread = true
-- Prevent continue comment on new line
vim.api.nvim_create_autocmd(
"FileType",
{ pattern = "*", command = [[setlocal formatoptions-=c formatoptions-=r formatoptions-=o]] }
)
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.shiftround = true
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = 'yes'
vim.cmd.termguicolors = true
-- netrw settings
vim.g.netrw_banner = 0
vim.g.netrw_browse_split = 0
vim.g.netrw_winsize = 25

View File

@@ -0,0 +1,7 @@
return{
"FabijanZulj/blame.nvim",
config = function()
require("blame").setup{}
end
}

View File

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

View File

@@ -0,0 +1,23 @@
return{
"laytan/cloak.nvim",
config = function()
require("cloak").setup({
enabled = true,
cloak_character = "*",
-- The applied highlight group (colors) on the cloaking, see `:h highlight`.
highlight_group = "Comment",
patterns = {
{
-- Match any file starting with '.env'.
-- This can be a table to match multiple file patterns.
file_pattern = ".env*",
-- Match an equals sign and any character after it.
-- This can also be a table of patterns to cloak,
-- example: cloak_pattern = { ':.+', '-.+' } for yaml files.
cloak_pattern = "=.+",
},
},
})
end
}

View File

@@ -0,0 +1,22 @@
function ColorMyPencils(color)
color = color or "catppuccin"
vim.cmd([[colorscheme catppuccin]])
vim.api.nvim_set_hl(0, 'Normal', { bg = "none" })
vim.api.nvim_set_hl(0, 'NormalFloat', { bg = "none" })
end
return{
{
"catppuccin/nvim",
name= "catppuccin",
priority = 1000,
config = function()
require("catppuccin").setup({
flavour = "mocha",
transparent_background = true,
})
ColorMyPencils()
end
},
}

View File

@@ -0,0 +1,7 @@
return {
"tpope/vim-fugitive",
config = function()
vim.keymap.set("n", "<leader>gs", vim.cmd.Git);
end
}

View File

@@ -0,0 +1,31 @@
return{
"lukas-reineke/indent-blankline.nvim",
config = function()
local highlight = {
"RainbowRed",
"RainbowYellow",
"RainbowBlue",
"RainbowOrange",
"RainbowGreen",
"RainbowViolet",
"RainbowCyan",
}
local hooks = require "ibl.hooks"
-- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
end)
vim.g.rainbow_delimiters = { highlight = highlight }
require("ibl").setup { scope = { highlight = highlight } }
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
end,
}

View File

@@ -0,0 +1,38 @@
return{
{
"nvim-lua/plenary.nvim",
name = "plenary",
},
"github/copilot.vim",
"lewis6991/gitsigns.nvim",
{
"numToStr/Comment.nvim",
config = function()
require('Comment').setup({
toggler = {
line = "gcc",
block = "gbc",
},
opleader = {
line = "gc",
block = "gb",
},
})
end
},
"nvim-tree/nvim-web-devicons",
{
"NvChad/nvim-colorizer.lua",
opts = {
user_default_options = {
tailwind = true,
},
},
},
}

View File

@@ -0,0 +1,54 @@
return{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets",
"onsails/lspkind.nvim",
},
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()
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
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-y>"] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" },
}, {
{ name = 'buffer' },
}),
formatting = {
format = lspkind.cmp_format({
maxwidth = 50,
ellipses_char = "",
}),
},
})
end
}

View File

@@ -0,0 +1,90 @@
return {
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"j-hui/fidget.nvim",
"hrsh7th/cmp-nvim-lsp",
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"WhoIsSethDaniel/mason-tool-installer.nvim",
},
config = function()
require("fidget").setup({})
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())
mason.setup({
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
},
})
mason_lspconfig.setup({
ensure_installed = {
"tsserver",
"html",
"cssls",
"clangd",
"tailwindcss",
"prismals",
"pyright",
},
automatic_installation = true,
handlers = {
function(server_name)
require("lspconfig")[server_name].setup {
capabilities = capabilities,
}
end,
["lua_ls"] = function()
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup({
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = {"vim"},
},
},
},
})
end,
},
})
mason_tool_installer.setup({
ensure_installed = {
"prettier",
"stylua",
-- "pylint",
"eslint_d",
},
})
end,
opts = {
servers = {
tailwindcss = {},
},
},
}

View File

@@ -0,0 +1,20 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'catppuccin',
},
sections = {
lualine_a = {
{
'filename',
path = 1,
}
}
}
}
end,
}

View File

@@ -0,0 +1,28 @@
return {
"nvim-telescope/telescope.nvim",
tag = "0.1.5",
dependencies = {
"nvim-lua/plenary.nvim",
},
config = function()
require('telescope').setup({
defaults = {
file_ignore_patterns = { ".git/", "node%_modules/.*" },
layout_strategy = 'horizontal',
prompt_prefix = '🔭 ',
selection_caret = '',
initial_mode = 'insert',
},
})
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>f', builtin.find_files, {})
vim.keymap.set('n', '<c-p>', builtin.git_files, {})
-- vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
-- vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
end
}

View File

@@ -0,0 +1,15 @@
return {
"alexghergh/nvim-tmux-navigation",
config = function()
require("nvim-tmux-navigation").setup {
keybindings = {
left = "<C-h>",
down = "<C-j>",
up = "<C-k>",
right = "<C-l>",
next = "<C-Space>",
}
}
end,
}

View File

@@ -0,0 +1,21 @@
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup ({
ensure_installed = { "cpp", "typescript", "c", "python" },
sync_install = false,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
})
end
},
}

View File

@@ -0,0 +1,22 @@
return{
{
"folke/trouble.nvim",
config = function()
require("trouble").setup {
icons=true,
}
vim.keymap.set("n", "<leader>tt", function()
require("trouble").toggle()
end)
vim.keymap.set("n", "[d", function()
require("trouble").next({ skip_groups = ture, jump = true })
end)
vim.keymap.set("n", "]d", function()
require("trouble").previous({ skip_groups = ture, jump = true })
end)
end
},
}

View File

@@ -0,0 +1,21 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{ import = "lilJ.lazy" },
{ import = "lilJ.lazy.lsp" }
}, {
change_detection = {
notify = false,
},
})