Lazy
This commit is contained in:
commit
8a30e0caf6
2 files changed
+221
No files matched your search
@@ -0,0 +1,202 @@
|
|||||||
|
-- Bootstrap lazy.nvim
|
||||||
|
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)
|
||||||
|
|
||||||
|
-- Set Leader Key to Space
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = " "
|
||||||
|
|
||||||
|
vim.opt.clipboard = "unnamedplus"
|
||||||
|
|
||||||
|
-- Setup lazy.nvim with your plugin specifications
|
||||||
|
require("lazy").setup({
|
||||||
|
|
||||||
|
-- Git signs
|
||||||
|
{
|
||||||
|
"lewis6991/gitsigns.nvim",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
opts = {
|
||||||
|
signs = {
|
||||||
|
add = { text = "┃" },
|
||||||
|
change = { text = "┃" },
|
||||||
|
delete = { text = "_" },
|
||||||
|
topdelete = { text = "‾" },
|
||||||
|
changedelete = { text = "~" },
|
||||||
|
untracked = { text = "┆" },
|
||||||
|
},
|
||||||
|
on_attach = function(bufnr)
|
||||||
|
local gs = package.loaded.gitsigns
|
||||||
|
|
||||||
|
local function map(mode, l, r, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.buffer = bufnr
|
||||||
|
vim.keymap.set(mode, l, r, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
map("n", "]h", gs.next_hunk, { desc = "Next Git Hunk" })
|
||||||
|
map("n", "[h", gs.prev_hunk, { desc = "Previous Git Hunk" })
|
||||||
|
map("n", "<leader>hp", gs.preview_hunk, { desc = "Preview Hunk" })
|
||||||
|
map("n", "<leader>hb", gs.blame_line, { desc = "Blame Line" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Telescope (Fuzzy Finder)
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
|
keys = {
|
||||||
|
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find Files" },
|
||||||
|
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Live Grep (Search Text)" },
|
||||||
|
{ "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Find Buffers" },
|
||||||
|
{ "<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "Help Tags" },
|
||||||
|
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent Files" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- File Tree
|
||||||
|
{
|
||||||
|
"nvim-tree/nvim-tree.lua",
|
||||||
|
version = "*",
|
||||||
|
lazy = false,
|
||||||
|
dependencies = {
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{ "<leader>e", "<cmd>NvimTreeToggle<cr>", desc = "Toggle NvimTree" },
|
||||||
|
{ "<leader>o", "<cmd>NvimTreeFocus<cr>", desc = "Focus NvimTree" },
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("nvim-tree").setup({
|
||||||
|
view = {
|
||||||
|
width = 35,
|
||||||
|
relativenumber = true,
|
||||||
|
},
|
||||||
|
actions = {
|
||||||
|
open_file = {
|
||||||
|
quit_on_open = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Treesitter
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
build = ":TSUpdate",
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
local configs = require("nvim-treesitter.configs")
|
||||||
|
configs.setup({
|
||||||
|
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "python", "javascript" },
|
||||||
|
sync_install = false,
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- LSP & Mason Manager
|
||||||
|
{ 'williamboman/mason.nvim', config = true },
|
||||||
|
{ 'williamboman/mason-lspconfig.nvim' },
|
||||||
|
{ 'neovim/nvim-lspconfig' },
|
||||||
|
|
||||||
|
-- Autocompletion Engine
|
||||||
|
{
|
||||||
|
'hrsh7th/nvim-cmp',
|
||||||
|
event = "InsertEnter",
|
||||||
|
dependencies = {
|
||||||
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
|
'hrsh7th/cmp-buffer',
|
||||||
|
'hrsh7th/cmp-path',
|
||||||
|
'L3MON4D3/LuaSnip', -- Snippet engine required by cmp
|
||||||
|
'saadparwaiz1/cmp_luasnip', -- Snippet completions
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local cmp = require('cmp')
|
||||||
|
local luasnip = require('luasnip')
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<C-Space>'] = cmp.mapping.complete(), -- Trigger completion menu
|
||||||
|
['<C-e>'] = cmp.mapping.abort(), -- Close completion menu
|
||||||
|
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept current selected item
|
||||||
|
|
||||||
|
-- Tab / Shift-Tab navigation through completion menu and snippet placeholders
|
||||||
|
['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' }),
|
||||||
|
|
||||||
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' }),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
{ name = 'path' },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Formatting
|
||||||
|
{
|
||||||
|
'stevearc/conform.nvim',
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = { "stylua" },
|
||||||
|
python = { "black" },
|
||||||
|
javascript = { "prettierd", "prettier" },
|
||||||
|
},
|
||||||
|
format_on_save = { timeout_ms = 500, lsp_fallback = true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Autopairs
|
||||||
|
{
|
||||||
|
'windwp/nvim-autopairs',
|
||||||
|
event = "InsertEnter",
|
||||||
|
config = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Colorscheme
|
||||||
|
{
|
||||||
|
"tomasiser/vim-code-dark",
|
||||||
|
lazy = false,
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
vim.opt.background = "dark"
|
||||||
|
vim.cmd.colorscheme("codedark")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||||
|
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||||
|
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||||
|
"conform.nvim": { "branch": "master", "commit": "016802de402556da54c36bd7359b441266b01cdd" },
|
||||||
|
"gitsigns.nvim": { "branch": "main", "commit": "5be654f2232c10ddcad19c1607a67b6b4b78fc29" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "40276c4df7e6bdce6801d6c035c6227f9115a855" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" },
|
||||||
|
"nvim-autopairs": { "branch": "master", "commit": "430522f95fe4fb7c511ec64f8c1a90cc6a66c05c" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "2ffe79f1f021def8dd1fcd81deb16f1bb0d989f3" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "84252f9832fb5b9024fe9f7258e7c2aff915e6fb" },
|
||||||
|
"nvim-tree.lua": { "branch": "master", "commit": "531b807b8f0d6f75016a0ee1e0cd5ce2086e9d95" },
|
||||||
|
"nvim-treesitter": { "branch": "main", "commit": "41416e81a6c7f4af4984395bfe0cd8d174e70976" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "5f032a85be210cd1c6ac98861eb3b187ff3bd5eb" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
|
||||||
|
"telescope.nvim": { "branch": "master", "commit": "40aedd8a68c78a656a10a8d62d80c54af59420fb" },
|
||||||
|
"vim-code-dark": { "branch": "master", "commit": "4624dc223bf574aa9a731c2383c579847303c380" }
|
||||||
|
}
|
||||||
Reference in new issue
Block a user