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

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,
},
})