migrate from packer to lazy

most of my config has been carried over, still need to do colorizer
and markdown.

added a few new plugins, based off of josean's 2024 video
This commit is contained in:
2024-10-31 16:45:27 -04:00
parent 3494df804e
commit 28c75e157a
35 changed files with 883 additions and 236 deletions
+6
View File
@@ -0,0 +1,6 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 3
quote_style = "AutoPreferDouble"
call_parentheses = "None"
+2 -15
View File
@@ -1,15 +1,2 @@
-- ~/.config/nvim/init.lua require("core")
-- Charles Danesi (https://github.com/cdanesi) require("core.lazy")
-- Settings
require("plugins")
require("core.options")
require("core.keymaps")
require("core.colorscheme")
-- Plugins
require("plugins.gitsigns")
require("plugins.autopairs")
require("plugins.lualine")
require("plugins.treesitter")
require("plugins.colorizer")
+45
View File
@@ -0,0 +1,45 @@
{
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" },
"auto-session": { "branch": "main", "commit": "3cd531ce4d46fb156268ddedf5f3e6822ef26af7" },
"bufferline.nvim": { "branch": "main", "commit": "5c528bee3dd797d5bd6bae5f229411939b25b203" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "6a28c90082a67f62a323ab90d988e000a718a8c7" },
"dressing.nvim": { "branch": "master", "commit": "1b7921eecc65af1baf8ac1dc06f0794934cbcfb2" },
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
"gitsigns.nvim": { "branch": "main", "commit": "7c27a30450130cd59c4994a6755e3c5d74d83e76" },
"indent-blankline.nvim": { "branch": "master", "commit": "04e44b09ee3ff189c69ab082edac1ef7ae2e256c" },
"lazy.nvim": { "branch": "main", "commit": "cf8ecc2c5e4332760431a33534240b0cbc6680ab" },
"lazygit.nvim": { "branch": "main", "commit": "56760339a81cd1540d5a72fd9d93010a2677b55d" },
"lspkind.nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
"nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" },
"nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" },
"nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" },
"nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" },
"nvim-lspconfig": { "branch": "master", "commit": "54617a18f4cf46f0c2f6d024fa6feb7515fe036d" },
"nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
"nvim-tree.lua": { "branch": "master", "commit": "120ba58254835d412bbc91cffe847e9be835fadd" },
"nvim-treesitter": { "branch": "master", "commit": "92d2501d698e0fe855bd222540f9648890fab6c7" },
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" },
"nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" },
"onenord.nvim": { "branch": "main", "commit": "7f8a7482a1145c1286ee05d46ef4d028a4f7264a" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"substitute.nvim": { "branch": "main", "commit": "97f49d16f8eea7967d41db4f657dd63af53eeba1" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
"trouble.nvim": { "branch": "main", "commit": "2f3b537f2207ce32f4459f9d56746ee013b5e01b" },
"vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" },
"vim-tmux-navigator": { "branch": "master", "commit": "a9b52e7d36114d40350099f254b5f299a35df978" },
"which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" }
}
+15 -5
View File
@@ -1,6 +1,16 @@
-- set colorscheme if it's installed -- set colorscheme if it's installed
local status, _ = pcall(vim.cmd, "colorscheme nord")
if not status then -- local status, _ = pcall(vim.cmd, "colorscheme nord")
print("Color scheme not found!") -- if not status then
return -- print("Color scheme not found!")
end -- return
-- end
return {
"shaunsingh/nord.nvim",
lazy = false,
priority = 1000,
config = function()
vim.cmd([[colorscheme nord]])
end,
}
+3
View File
@@ -0,0 +1,3 @@
require('core.options')
require('core.keymaps')
require('core.colorscheme')
+20
View File
@@ -3,3 +3,23 @@ vim.g.mapleader = " "
vim.g.maplocalleader = "\\" vim.g.maplocalleader = "\\"
local keymap = vim.keymap local keymap = vim.keymap
keymap.set("i", "jk", "<ESC>", { desc = "Exit insert mode with jk" })
keymap.set("n", "<leader>nh", ":nohl<CR>", { desc = "Clear search highlights" })
-- inc/dec numbers
keymap.set("n", "<leader>+", "<C-a>", { desc = "Increment number" })
keymap.set("n", "<leader>-", "<C-x>", { desc = "Decrement number" })
-- window management
keymap.set("n", "<leader>sv", "<C-w>v", { desc = "Split window vertically" })
keymap.set("n", "<leader>sh", "<C-w>s", { desc = "Split window horizontally" })
keymap.set("n", "<leader>se", "<C-w>=", { desc = "Make splits equal size" })
keymap.set("n", "<leader>sx", "<cmd>close<CR>", { desc = "Close current split" })
keymap.set("n", "<leader>to", "<cmd>tabnew<CR>", { desc = "Open new tab" })
keymap.set("n", "<leader>tx", "<cmd>tabclose<CR>", { desc = "Close current tab" })
keymap.set("n", "<leader>tn", "<cmd>tabn<CR>", { desc = "Go to next tab" })
keymap.set("n", "<leader>tp", "<cmd>tabp<CR>", { desc = "Go to previous tab" })
keymap.set("n", "<leader>tf", "<cmd>tabnew %<CR>", { desc = "Open current buffer in new tab" })
+24
View File
@@ -0,0 +1,24 @@
-- lazy bootstrap
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)
-- lazy setup
require("lazy").setup({ { import = "plugins" }, { import = "plugins.lsp" } }, {
checker = {
enabled = true,
notify = false,
},
change_detection = {
notify = false,
}
})
+3 -1
View File
@@ -1,3 +1,5 @@
vim.cmd("let g:netrw_liststyle = 3")
local opt = vim.opt local opt = vim.opt
-- line numbers -- line numbers
@@ -24,7 +26,7 @@ opt.iskeyword:append("-") -- consider string-string as a whole word
opt.cursorline = true opt.cursorline = true
-- appearance -- appearance
opt.termguicolors = false opt.termguicolors = true
opt.background = "dark" opt.background = "dark"
opt.signcolumn = "yes" opt.signcolumn = "yes"
opt.colorcolumn = "90" opt.colorcolumn = "90"
-69
View File
@@ -1,69 +0,0 @@
-- auto install packer if not installed
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
vim.cmd([[packadd packer.nvim]])
return true
end
return false
end
local packer_bootstrap = ensure_packer() -- true if packer was just installed
-- autocommand that reloads neovim and installs/updates/removes plugins
-- when file is saved
vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerSync
augroup end
]])
-- import packer safely
local status, packer = pcall(require, "packer")
if not status then
return
end
packer.init({
display = {
open_fn = function()
return require('packer.util').float({ border = 'rounded' })
end,
},
})
-- add list of plugins to install
return packer.startup(function(use)
use("wbthomason/packer.nvim")
use("nvim-lua/plenary.nvim")
use("rmehri01/onenord.nvim")
use("shaunsingh/nord.nvim")
use("christoomey/vim-tmux-navigator")
use("lewis6991/gitsigns.nvim")
use("windwp/nvim-autopairs")
use("nvim-lualine/lualine.nvim")
use("nvim-tree/nvim-web-devicons")
use({
"nvim-treesitter/nvim-treesitter",
run = function()
local ts_update = require("nvim-treesitter.install").update({ with_sync = true })
ts_update()
end,
})
use("tpope/vim-obsession")
use("norcalli/nvim-colorizer.lua")
use({
"MeanderingProgrammer/render-markdown.nvim",
after = { 'nvim-treesitter' },
requires = { 'nvim-tree/nvim-web-devicons', opt = true },
})
use("seanbreckenridge/gitsigns-yadm") -- bring yadm support back to gitsigns
use("ThePrimeagen/vim-be-good") -- get gud
if packer_bootstrap then
require("packer").sync()
end
end)
+36
View File
@@ -0,0 +1,36 @@
return {
"goolord/alpha-nvim",
event = "VimEnter",
config = function()
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
-- Set header
dashboard.section.header.val = {
" ",
" ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ",
" ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ",
" ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ",
" ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ",
" ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ",
" ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ",
" ",
}
-- Set menu
dashboard.section.buttons.val = {
dashboard.button("e", " > New File", "<cmd>ene<CR>"),
dashboard.button("SPC ee", " > Toggle file explorer", "<cmd>NvimTreeToggle<CR>"),
dashboard.button("SPC ff", "󰱼 > Find File", "<cmd>Telescope find_files<CR>"),
dashboard.button("SPC fs", " > Find Word", "<cmd>Telescope live_grep<CR>"),
dashboard.button("SPC wr", "󰁯 > Restore Session For Current Directory", "<cmd>SessionRestore<CR>"),
dashboard.button("q", " > Quit NVIM", "<cmd>qa<CR>"),
}
-- Send config to alpha
alpha.setup(dashboard.opts)
-- Disable folding on alpha buffer
vim.cmd([[autocmd FileType alpha setlocal nofoldenable]])
end,
}
+16
View File
@@ -0,0 +1,16 @@
return {
"rmagatti/auto-session",
config = function()
local auto_session = require("auto-session")
auto_session.setup({
auto_restore_enabled = false,
auto_session_suppress_dirs = { "~/", "~/Downloads", "~/Documents", "~/Desktop", "~/Photos" }
})
local keymap = vim.keymap
keymap.set("n", "<leader>wr", "<cmd>SessionRestore<CR>", { desc = "Restore session for cwd" })
keymap.set("n", "<leader>ws", "<cmd>SessionSave<CR>", { desc = "Save session for auto session root dir" })
end,
}
+22 -12
View File
@@ -1,14 +1,24 @@
local autopairs_setup, autopairs = pcall(require, "nvim-autopairs") return {
if not autopairs_setup then "windwp/nvim-autopairs",
return event = { "InsertEnter" },
end dependencies = {
"hrsh7th/nvim-cmp",
autopairs.setup({
check_ts = true,
ts_config = {
lua = { "string" },
javascript = { "template_string" },
java = false,
}, },
})
config = function()
local autopairs = require("nvim-autopairs")
autopairs.setup({
check_ts = true,
ts_config = {
lua = { "string" },
javascript = { "template_string" },
java = false,
},
})
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp = require("cmp")
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
end,
}
+11
View File
@@ -0,0 +1,11 @@
return {
"akinsho/bufferline.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
version = "*",
opts = {
options = {
mode = "tabs",
separator_style = "slant",
},
},
}
-7
View File
@@ -1,7 +0,0 @@
require 'colorizer'.setup({
'css';
'javascript';
'html';
'conf';
'yaml';
})
+16
View File
@@ -0,0 +1,16 @@
return {
"numToStr/Comment.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"JoosepAlviste/nvim-ts-context-commentstring",
},
config = function()
local comment = require("Comment")
local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim")
comment.setup({
pre_hook = ts_context_commentstring.create_pre_hook(),
})
end,
}
+5
View File
@@ -0,0 +1,5 @@
return {
"stevearc/dressing.nvim",
event = "VeryLazy",
opts = {},
}
+80 -45
View File
@@ -1,49 +1,84 @@
local setup, gitsigns = pcall(require, "gitsigns") return {
if not setup then "lewis6991/gitsigns.nvim",
return event = { "BufReadPre", "BufNewFile" },
end opts = {
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, desc)
vim.keuymap.set(mode, l, r, { buffer = bufnr, desc = desc })
end
gitsigns.setup { map("n", "]h", gs.next_hunk, "Next Hunk")
_on_attach_pre = map("n", "[h", gs.prev_hunk, "Prev Hunk")
function(_, callback)
require("gitsigns-yadm").yadm_signs(callback) map("n", "<leader>hs", gs.stage_hunk, "Stage Hunk")
map("n", "<leader>hr", gs.reset_hunk, "Reset Hunk")
map("v", "<leader>hs", function()
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
end, "Reset Hunk")
map("n", "<leader>hS", gs.stage_buffer, "Stage buffer")
map("n", "<leader>hR", gs.reset_buffer, "Reset buffer")
map("n", "<leader>hu", gs.undo_stage_hunk, "Undo stage hunk")
map("n", "<leader>hp", gs.preview_hunk, "Preview hunk")
map("n", "<leader>hb", function()
gs.blame_line({ full = true })
end, "Blame line")
map("n", "<leader>hB", gs.toggle_current_line_blame, "Toggle line blame")
map("n", "<leader>hd", gs.diffthis, "Diff this")
map("n", "<leader>hD", function()
gs.diffthis("~")
end, "Diff this ~")
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "Gitsigns select hunk")
end, end,
signs = {
add = { text = '+' },
change = { text = '' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
}, },
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl` config = function()
linehl = false, -- Toggle with `:Gitsigns toggle_linehl` local gitsigns = require("gitsigns")
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = { gitsigns.setup {
interval = 1000, signs = {
follow_files = true add = { text = '+' },
}, change = { text = '' },
attach_to_untracked = true, delete = { text = '_' },
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` topdelete = { text = '' },
current_line_blame_opts = { changedelete = { text = '~' },
virt_text = true, untracked = { text = '' },
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' },
delay = 200, signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
ignore_whitespace = false, numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
}, linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>', word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
sign_priority = 6, watch_gitdir = {
update_debounce = 100, interval = 1000,
status_formatter = nil, -- Use default follow_files = true
max_file_length = 40000, -- Disable if file is longer than this (in lines) },
preview_config = { attach_to_untracked = true,
-- Options passed to nvim_open_win current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
border = 'single', current_line_blame_opts = {
style = 'minimal', virt_text = true,
relative = 'cursor', virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
row = 0, delay = 200,
col = 1 ignore_whitespace = false,
}, },
-- on_attach = function(bufnr) current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
border = 'single',
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1
},
}
end,
} }
@@ -0,0 +1,8 @@
return {
"lukas-reineke/indent-blankline.nvim",
event = { "BufReadPre", "BufNewFile" },
main = "ibl",
opts = {
indent = { char = "" },
},
}
+4
View File
@@ -0,0 +1,4 @@
return {
"nvim-lua/plenary.nvim",
"christoomey/vim-tmux-navigator",
}
+16
View File
@@ -0,0 +1,16 @@
return {
"kdheepak/lazygit.nvim",
cmd = {
"LazyGit",
"LazyGitConfig",
"LazyGitCurrentFile",
"LazyGitFilter",
"LazyGitFilterCurrentFile",
},
dependencies = {
"nvim-lua/plenary.nvim",
},
keys = {
{ "<leader>lg", "<cmd>LazyGit<cr>", desc = "Open LazyGit" },
},
}
+30
View File
@@ -0,0 +1,30 @@
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" },
svelte = { "eslint_d" },
python = { "pylint" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
vim.keymap.set("n", "<leader>l", function()
lint.try_lint()
end, { desc = "Trigger linting for current file"})
end,
}
+103
View File
@@ -0,0 +1,103 @@
return {
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"hrsh7th/cmp-nvim-lsp",
{ "antosha417/nvim-lsp-file-operations", config = true },
{ "folke/neodev.nvim", opts = {} },
},
config = function()
local lspconfig = require("lspconfig")
local mason_lspconfig = require("mason-lspconfig")
local cmp_nvim_lsp = require("cmp_nvim_lsp")
local keymap = vim.keymap
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev)
local opts = { buffer = ev.buf, silent=true }
opts.desc = "Show LSP references"
keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts)
opts.desc = "Go to declaration"
keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
opts.desc = "Show LSP definitions"
keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
opts.desc = "Show LSP implementations"
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts)
opts.desc = "Show LSP type definitions"
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts)
opts.desc = "See available code actions"
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
opts.desc = "Smart rename"
keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
opts.desc = "Show buffer diagnostics"
keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics bufnf=0<CR>", opts)
opts.desc = "Show line diagnostics"
keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts)
opts.desc = "Go to previous diagnostic"
keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
opts.desc = "Go to next diagnostic"
keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
opts.desc = "Show documentation for what is under cursor"
keymap.set("n", "K", vim.lsp.buf.hover, opts)
opts.desc = "Restart LSP"
keymap.set("n", "<leader>rs", ":LspRestart<CR>", opts)
end,
})
local capabilities = cmp_nvim_lsp.default_capabilities()
local signs = { Error = "", Warn = "", Hint = "󰠠 ", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
mason_lspconfig.setup_handlers({
-- default handler for installed servers
function(server_name)
lspconfig[server_name].setup({
capabilities = capabilities,
})
end,
["emmet_ls"] = function()
-- configure emmet language server
lspconfig["emmet_ls"].setup({
capabilities = capabilities,
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
})
end,
["lua_ls"] = function()
-- configure lua server (with special settings)
lspconfig["lua_ls"].setup({
capabilities = capabilities,
settings = {
Lua = {
-- make the language server recognize "vim" global
diagnostics = {
globals = { "vim" },
},
completion = {
callSnippet = "Replace",
},
},
},
})
end,
})
end,
}
+43
View File
@@ -0,0 +1,43 @@
return {
"williamboman/mason.nvim",
dependencies = {
"williamboman/mason-lspconfig.nvim",
"WhoIsSethDaniel/mason-tool-installer.nvim",
},
config = function()
local mason = require("mason")
local mason_lspconfig = require("mason-lspconfig")
local mason_tool_installer = require("mason-tool-installer")
mason.setup({
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
},
})
mason_lspconfig.setup({
ensure_installed = {
"html",
"cssls",
"lua_ls",
"emmet_ls",
},
})
mason_tool_installer.setup({
ensure_installed = {
"prettier",
"stylua",
"isort",
"black",
"pylint",
"eslint_d",
},
})
end,
}
+58 -39
View File
@@ -1,40 +1,59 @@
require('lualine').setup { return {
options = { "nvim-lualine/lualine.nvim",
icons_enabled = true, dependencies = {
theme = 'onenord', "nvim-tree/nvim-web-devicons",
component_separators = { left = '', right = ''}, "rmehri01/onenord.nvim"
section_separators = { left = '', right = ''}, },
disabled_filetypes = { config = function()
statusline = {}, local lualine = require("lualine")
winbar = {}, local lazy_status = require("lazy.status")
},
ignore_focus = {}, lualine.setup({
always_divide_middle = true, options = {
globalstatus = false, icons_enabled = true,
refresh = { theme = 'onenord',
statusline = 1000, component_separators = { left = '', right = ''},
tabline = 1000, section_separators = { left = '', right = ''},
winbar = 1000, disabled_filetypes = {
} statusline = {},
}, winbar = {},
sections = { },
lualine_a = {'mode'}, ignore_focus = {},
lualine_b = {'branch', 'diff', 'diagnostics'}, always_divide_middle = true,
lualine_c = {'filename'}, globalstatus = false,
lualine_x = {'encoding', 'fileformat', 'filetype'}, refresh = {
lualine_y = {'progress'}, statusline = 1000,
lualine_z = {'location'} tabline = 1000,
}, winbar = 1000,
inactive_sections = { }
lualine_a = {}, },
lualine_b = {}, sections = {
lualine_c = {'filename'}, lualine_a = {'mode'},
lualine_x = {'location'}, lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_y = {}, lualine_c = {'filename'},
lualine_z = {} lualine_x = {
}, {
tabline = {}, lazy_status.updates,
winbar = {}, cond = lazy_status.has_updates,
inactive_winbar = {}, color = { fg = "#ff9e64" },
extensions = {} },
{'encoding', 'fileformat', 'filetype'},
},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
})
end,
} }
+56
View File
@@ -0,0 +1,56 @@
return {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
{
"L3MON4D3/LuaSnip",
version = "v2.*",
build = "make install_jsregexp",
},
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets",
"onsails/lspkind.nvim",
},
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
local lspkind = require("lspkind")
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
completion = {
completeopt = "menu,menuone,preview,noselect",
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = false }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
}),
formatting = {
format = lspkind.cmp_format({
maxwidth = 50,
ellipsis_char = "...",
}),
},
})
end,
}
+50
View File
@@ -0,0 +1,50 @@
return {
"nvim-tree/nvim-tree.lua",
dependencies = "nvim-tree/nvim-web-devicons",
config = function()
local nvimtree = require("nvim-tree")
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
nvimtree.setup({
view = {
width = 35,
relativenumber = true,
},
renderer = {
indent_markers = {
enable = true,
},
icons = {
glyphs = {
folder = {
arrow_closed = "", -- arrow when folder is closed
arrow_open = "", -- arrow when folder is open
},
},
},
},
actions = {
open_file = {
window_picker = {
enable = false,
},
},
},
filters = {
custom = { ".DS_Store" },
},
git = {
ignore = false,
},
})
local keymap = vim.keymap
keymap.set("n", "<leader>ee", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle file explorer" })
keymap.set("n", "<leader>ef", "<cmd>NvimTreeFindFileToggle<CR>", { desc = "Toggle file explorer on current file" })
keymap.set("n", "<leader>ec", "<cmd>NvimTreeCollapse<CR>", { desc = "Collapse file explorer" })
keymap.set("n", "<leader>er", "<cmd>NvimTreeRefresh<CR>", { desc = "Refresh file explorer" })
end
}
+40
View File
@@ -0,0 +1,40 @@
return {
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
svelte = { "prettier" },
css = { "prettier" },
html = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
graphql = { "prettier" },
liquid = { "prettier" },
lua = { "stylua" },
python = { "sort", "black" },
},
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 1000,
},
})
vim.keymap.set({ "n", "v" }, "<leader>mp", function()
conform.format({
lsp_fallback = true,
async = false,
timeout_ms = 1000,
})
end, { desc = "Format file or range (in visual mode)" })
end,
}
+17
View File
@@ -0,0 +1,17 @@
return {
"gbprod/substitute.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local substitute = require("substitute")
substitute.setup()
local keymap = vim.keymap
keymap.set("n", "s", substitute.operator, { desc = "Substitute with motion" })
keymap.set("n", "ss", substitute.line, { desc = "Substitute line" })
keymap.set("n", "S", substitute.line, { desc = "Substitute to end of line" })
keymap.set("x", "s", substitute.visual, { desc = "Substitute in visual mode" })
end,
}
+6
View File
@@ -0,0 +1,6 @@
return {
"kylechui/nvim-surround",
event = { "BufReadPre", "BufNewFile" },
version = "*",
config = true,
}
+38
View File
@@ -0,0 +1,38 @@
return {
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
dependencies = {
"nvim-lua/plenary.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
"nvim-tree/nvim-web-devicons",
"folke/todo-comments.nvim",
},
config = function()
local telescope = require("telescope")
local actions = require("telescope.actions")
telescope.setup({
defaults = {
path_display = { "smart" },
mappings = {
i = {
["<C-k>"] = actions.move_selection_previous,
["<C-j>"] = actions.move_selection_next,
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
},
},
},
})
telescope.load_extension("fzf")
-- keymaps
local keymap = vim.keymap
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Fuzzy find files in cwd" })
keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Fuzzy find recent files" })
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd" })
keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>", { desc = "Find string under cursor in cwd" })
keymap.set("n", "<leader>ft", "<cmd>TodoTelescope<cr>", { desc = "Find todos" })
end,
}
@@ -0,0 +1,20 @@
return {
"folke/todo-comments.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local todo_comments = require("todo-comments")
local keymap = vim.keymap
keymap.set("n", "]t", function()
todo_comments.jump_next()
end, { desc = "Next todo comment" })
keymap.set("n", "[t", function()
todo_comments.jump_prev()
end, { desc = "Previous todo comment" })
todo_comments.setup()
end,
}
+59 -43
View File
@@ -1,44 +1,60 @@
local status, treesitter = pcall(require, "nvim-treesitter.configs") return {
if not status then "nvim-treesitter/nvim-treesitter",
return event = { "BufReadPre", "BufNewFile" },
end build = ":TSUpdate",
dependencies = {
"windwp/nvim-ts-autotag",
},
config = function()
local treesitter = require("nvim-treesitter.configs")
treesitter.setup({ treesitter.setup({
highlight = { highlight = {
enable = true, enable = true,
}, },
indent = { enable = true }, indent = { enable = true },
autotag = { enable = true }, autotag = { enable = true },
ensure_installed = { ensure_installed = {
"bash", "bash",
"cmake", "cmake",
"cpp", "cpp",
"css", "css",
"diff", "diff",
"dockerfile", "dockerfile",
"git_config", "git_config",
"git_rebase", "git_rebase",
"gitcommit", "gitcommit",
"gitignore", "gitignore",
"graphql", "graphql",
"html", "html",
"javascript", "javascript",
"json", "json",
"lua", "lua",
"markdown", "markdown",
"markdown_inline", "markdown_inline",
"nginx", "nginx",
"perl", "perl",
"php", "php",
"python", "python",
"regex", "regex",
"sql", "sql",
"ssh_config", "ssh_config",
"todotxt", "todotxt",
"typescript", "typescript",
"vim", "vim",
"xml", "xml",
"yaml", "yaml",
}, },
auto_install = true, auto_install = true,
}) incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
})
end,
}
+15
View File
@@ -0,0 +1,15 @@
return {
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons", "folke/todo-comments.nvim", },
opts = {
focus = true,
},
cmd = "Trouble",
keys = {
{ "<leader>xw", "<cmd>Trouble diagnostics toggle<CR>", desc = "Open trouble workspace diagnostics" },
{ "<leader>xd", "<cmd>Trouble diagnostics toggle filter.buf=0<CR>", desc = "Open trouble document diagnostics" },
{ "<leader>xq", "<cmd>Trouble quickfix toggle<CR>", desc = "Open trouble quickfix list" },
{ "<leader>xl", "<cmd>Trouble loclist toggle<CR>", desc = "Open trouble location list" },
{ "<leader>xt", "<cmd>Trouble todo toggle<CR>", desc = "Open todos in trouble" },
},
}
@@ -0,0 +1,6 @@
return {
"szw/vim-maximizer",
keys = {
{ "<leader>sm", "<cmd>MaximizerToggle<CR>", desc = "Maximize/Minimize a split" },
},
}
+10
View File
@@ -0,0 +1,10 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 500
end,
opts = {
},
}