This commit is contained in:
Kulvir Singh
2024-01-23 01:34:35 +05:30
parent 7a36ad102e
commit 68c30ee4f8
83 changed files with 0 additions and 0 deletions

2
.config/nvim/init.lua Normal file
View File

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

View File

@@ -0,0 +1,36 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" },
"bufferline.nvim": { "branch": "main", "commit": "6c456b888823d9e4832aa91c482bccd19445c009" },
"catppuccin": { "branch": "main", "commit": "f288876c6d05d3bb91b0e72b8031fe9e26ef05b8" },
"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" },
"conform.nvim": { "branch": "master", "commit": "cbc5745bf7519acaf3a5cbaaa677fd556aa813d7" },
"copilot.vim": { "branch": "release", "commit": "49e0348bfb913fae63ca5ddb987a8bccd193da86" },
"fidget.nvim": { "branch": "main", "commit": "3a93300c076109d86c7ce35ec67a8034ae6ba9db" },
"friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" },
"gitsigns.nvim": { "branch": "main", "commit": "4aaacbf5e5e2218fd05eb75703fe9e0f85335803" },
"indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" },
"lazy.nvim": { "branch": "main", "commit": "747bb955c5bfb2dc5d51280132f00a56a53f9f6d" },
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" },
"mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" },
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
"nvim-lint": { "branch": "master", "commit": "b32127ba52f3a1f7dc86773c2ca3f0029afa12c1" },
"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" }
}

View File

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

View File

@@ -0,0 +1,34 @@
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>n", vim.cmd.Ex)
-- Prime said this is greatest remap ever
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", "v"}, "<leader>d", [["_d]])
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
-- 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')
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)

View File

@@ -0,0 +1,34 @@
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.wildignore = "*/.git/*,*/.DS_Store/*,*/target/*,*/node_modules/*"
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.smartcase = true
vim.opt.wrap = false
vim.opt.hlsearch = true
vim.opt.incsearch = 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,19 @@
return {
{
"akinsho/bufferline.nvim",
version = "*",
dependencies = "nvim-tree/nvim-web-devicons",
config = function()
require("bufferline").setup{
options={
always_show_bufferline = false,
diagnostics = "nvim_lsp",
}
}
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,37 @@
--[[ 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" } },
},
})
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

@@ -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,37 @@
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,
char = '',
},
}
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
end
}

View File

@@ -0,0 +1,55 @@
return {
"nvim-lua/plenary.nvim",
"github/copilot.vim",
"nvim-tree/nvim-web-devicons",
{
"numToStr/Comment.nvim",
config = function()
require('Comment').setup({
toggler = {
line = "gcc",
block = "gbc",
},
opleader = {
line = "gc",
block = "gb",
},
})
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",
opts = {
user_default_options = {
tailwind = true,
},
},
},
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
build = function() vim.fn["mkdp#util#install"]() end,
},
}

View File

@@ -0,0 +1,26 @@
return {
"mfussenegger/nvim-lint",
event = {
"BufReadPre",
"BufNewFile",
},
config = function()
local lint = require("lint")
lint.linters_by_ft = {
javascript = { "eslint_d" },
typescript = { "eslint_d" },
javascriptreact = { "eslint_d" },
typescriptreact = { "eslint_d" },
python = { "flake8" },
}
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
callback = function()
lint.try_lint()
end,
})
end,
}

View File

@@ -0,0 +1,66 @@
return {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"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")
require("luasnip.loaders.from_vscode").lazy_load()
luasnip.config.setup({})
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
completion = {
completeopt = "menu,menuone,noselect",
},
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = cmp.mapping.complete(),
["<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" },
}),
formatting = {
format = lspkind.cmp_format({
maxwidth = 25,
ellipses_char = "",
}),
},
})
end
}

View File

@@ -0,0 +1,116 @@
return {
"williamboman/mason.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"j-hui/fidget.nvim",
"neovim/nvim-lspconfig",
"williamboman/mason-lspconfig.nvim",
},
config = function()
require("fidget").setup({
progress = {
display = {
render_limit = 3,
},
},
})
local mason = require("mason")
local mason_lspconfig = require("mason-lspconfig")
local cmp_lsp = require("cmp_nvim_lsp")
local lspconfig = require("lspconfig")
mason.setup({
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
},
})
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 = {
"clangd",
"cssls",
"gopls",
"html",
"prismals",
"pyright",
"tailwindcss",
"tsserver",
},
automatic_installation = true,
handlers = {
function(server_name)
lspconfig[server_name].setup {
capabilities = capabilities,
on_attach = on_attach,
settings = {
[server_name] = {
analyses = {
unusedparams = true,
},
usePlaceholders = true,
},
},
}
end,
["lua_ls"] = function()
lspconfig.lua_ls.setup({
capabilities = capabilities,
settings = {
Lua = {
diagnostics = { globals = {"vim"} },
},
},
})
end,
},
})
end,
}

View File

@@ -0,0 +1,24 @@
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,30 @@
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
},
config = function()
require("nvim-treesitter.configs").setup ({
ensure_installed = { "typescript", "tsx", "python", "go", "c", "cpp", "lua", "markdown" },
sync_install = false,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
},
})
end
},
}

View File

@@ -0,0 +1,23 @@
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 = true, jump = true })
end)
vim.keymap.set("n", "]d", function()
require("trouble").previous({ skip_groups = true, jump = true })
end)
end
},
}

View File

@@ -0,0 +1,22 @@
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 = {
enabled = true,
notify = false,
},
})