lazyvim
This commit is contained in:
1 parent
8a30e0caf6
commit
cdfe320c96
10 files changed
+564
-215
No files matched your search
@@ -1,202 +1,2 @@
|
||||
-- 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,
|
||||
},
|
||||
})
|
||||
-- bootstrap lazy.nvim, LazyVim and your plugins
|
||||
require("config.lazy")
|
||||
Reference in new issue
Block a user