Skip to content

Commit abcbb57

Browse files
committed
feat(nvim): update neovim configuration to use lazy.nim instead of packer
1 parent 726d563 commit abcbb57

15 files changed

Lines changed: 571 additions & 352 deletions

.config/nvim/init.lua

Lines changed: 162 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -4,131 +4,183 @@
44
--
55
-- Neovim from scratch, from the creator of LunarVim
66
-- https://www.youtube.com/watch?v=ctH-a-1eUME&list=PLhoH5vyxr6Qq41NFL4GvhFp-WLd5xzIzZ
7-
--
7+
--
88
-- Requires:
99
-- A patched font - https://www.nerdfonts.com/#home
1010
-- ESLint - npm i -g eslint
11-
-- StyLua - cargo
11+
-- StyLua - cargo
1212
--
1313
-- Heavily inspired by NvChad, LunarVim, AstroNvim
14-
--
14+
--
1515
-- Huge list of plugins / themes
1616
-- https://morioh.com/p/a7063de46490
1717

18-
-- Install packer
19-
local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
20-
local is_bootstrap = false
21-
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
22-
is_bootstrap = true
23-
vim.fn.execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path)
24-
vim.cmd [[packadd packer.nvim]]
25-
end
2618

27-
require('packer').startup(function(use)
28-
-- Package manager
29-
use 'wbthomason/packer.nvim'
30-
31-
-- Shared dependencies
32-
use 'nvim-lua/plenary.nvim'
33-
use 'kyazdani42/nvim-web-devicons'
34-
35-
-- Plugins
36-
use 'akinsho/bufferline.nvim' -- Fancy tabs
37-
use 'numToStr/Comment.nvim' -- Comment / uncomment lines
38-
use 'lewis6991/gitsigns.nvim' -- git status in sign column
39-
use 'nvim-lualine/lualine.nvim' -- Status line
40-
use 'NvChad/nvim-colorizer.lua' -- Colorize hex and others
41-
use 'windwp/nvim-autopairs' -- Smart handling of pairs of quotes, brackets, etc
42-
use 'kylechui/nvim-surround' -- vim-surround for nvim
43-
use 'nvim-telescope/telescope.nvim' -- Fuzzy finder for files, words, etc
44-
use 'nvim-treesitter/nvim-treesitter' -- Highlight, edit, and navigate code
45-
use 'nvim-treesitter/nvim-treesitter-textobjects' -- Additional textobjects for treesitter
46-
use 'folke/which-key.nvim' -- View possible keybindings
47-
use 'tpope/vim-abolish' -- :Subvert et al
48-
use 'tpope/vim-eunuch' -- :Move, :Rename et al
49-
use 'Wansmer/treesj' -- splitjoin.vim for neovim
50-
use 'mattn/emmet-vim' -- HTML zencoding
51-
52-
-- Linting, formatting
53-
use 'jose-elias-alvarez/null-ls.nvim' -- Linters, formatters
54-
55-
-- LSP Support, Diagnostics
56-
use 'williamboman/mason.nvim' -- Installer for LSP servers, DAP, linters, and formatters
57-
use 'williamboman/mason-lspconfig.nvim' -- Configurations for a number of popular languages and ecosystems
58-
use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client
59-
use 'folke/lsp-colors.nvim' -- LSP colors
60-
use 'folke/trouble.nvim' -- Show LSP diagnostics inline and in a dedicated window
61-
62-
use 'hrsh7th/cmp-nvim-lsp'
63-
use 'hrsh7th/cmp-buffer'
64-
use 'hrsh7th/cmp-path'
65-
use 'hrsh7th/cmp-cmdline'
66-
use 'hrsh7th/nvim-cmp'
67-
use 'L3MON4D3/LuaSnip'
68-
69-
-- Themes
70-
use 'navarasu/onedark.nvim'
71-
use 'shaunsingh/nord.nvim'
72-
use 'EdenEast/nightfox.nvim'
73-
use 'folke/tokyonight.nvim'
74-
75-
if is_bootstrap then
76-
require('packer').sync()
77-
end
78-
end)
79-
80-
-- When we are bootstrapping a configuration, it doesn't
81-
-- make sense to execute the rest of the init.lua.
82-
--
83-
-- You'll need to restart nvim, and then it will work.
84-
if is_bootstrap then
85-
print '=================================='
86-
print ' Plugins are being installed'
87-
print ' Wait until Packer completes,'
88-
print ' then restart nvim'
89-
print '=================================='
90-
return
19+
-- bootstrap lazy.nvim https://github.com/folke/lazy.nvim
20+
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
21+
if not vim.loop.fs_stat(lazypath) then
22+
vim.fn.system({
23+
'git',
24+
'clone',
25+
'--filter=blob:none',
26+
'https://github.com/folke/lazy.nvim.git',
27+
'--branch=stable', -- latest stable release
28+
lazypath,
29+
})
9130
end
31+
vim.opt.rtp:prepend(lazypath)
9232

93-
-- Automatically source and re-compile packer whenever you save this init.lua
94-
local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true })
95-
vim.api.nvim_create_autocmd('BufWritePost', {
96-
command = 'source <afile> | PackerSync',
97-
group = packer_group,
98-
pattern = vim.fn.expand '$MYVIMRC',
99-
})
100-
101-
-- Load (n)vim configuration
33+
-- require('utils')
10234
require('config')
35+
require('keymaps')
36+
require('lsp')
10337

104-
-- Linting, formatting
105-
require('plugins/null-ls')
106-
107-
-- LSP
108-
require('plugins/lsp')
109-
110-
-- Load shared dependencies configurations
111-
require('plugins/nvim-web-devicons')
112-
113-
-- Load plugin configurations
114-
require('plugins/bufferline')
11538
require('plugins/cmp')
116-
require('plugins/comment')
117-
require('plugins/colorizer')
39+
require('plugins/treesitter')
11840
require('plugins/gitsigns')
41+
require('plugins/lspconfig')
11942
require('plugins/lualine')
120-
require('plugins/nvim-autopairs')
121-
require('plugins/nvim-surround')
122-
require('plugins/nvim-treesitter')
43+
require('plugins/mason')
12344
require('plugins/telescope')
124-
require('plugins/trouble')
125-
require('plugins/treesj')
126-
require('plugins/which-key')
12745

128-
-- Load keymaps
129-
require('keymaps')
130-
131-
-- Load themes
132-
-- require('themes/onedark')
133-
-- require('themes/nord')
134-
require('themes/nightfox')
46+
require('lazy').setup({
47+
--------------------------------------------- Themes
48+
49+
{
50+
'shaunsingh/nord.nvim',
51+
lazy = false,
52+
priority = 1000,
53+
},
54+
{
55+
'EdenEast/nightfox.nvim',
56+
lazy = false,
57+
priority = 1000,
58+
config = function()
59+
vim.cmd('colorscheme nightfox')
60+
end
61+
},
62+
63+
--- Shared dependencies
64+
{ 'nvim-lua/plenary.nvim', lazy = false },
65+
{ 'kyazdani42/nvim-web-devicons', lazy = false, opts = { default = true } },
66+
67+
----------------------------------------- Treesitter
68+
{
69+
'nvim-treesitter/nvim-treesitter', -- Highlight, edit, and navigate code
70+
build = ':TSUpdate',
71+
config = config_treesitter,
72+
},
73+
{
74+
'nvim-treesitter/nvim-treesitter-textobjects', -- Additional textobjects for treesitter
75+
dependencies = { 'nvim-treesitter' },
76+
},
77+
78+
---------------------- Text Editing, File Management
79+
80+
'tpope/vim-abolish', -- :Subvert et al
81+
'tpope/vim-eunuch', -- :Move, :Rename et al
82+
'mattn/emmet-vim', -- HTML zencoding
83+
{
84+
'windwp/nvim-autopairs', -- Smart handling of pairs of quotes, brackets, etc
85+
event = 'InsertEnter',
86+
opts = {},
87+
},
88+
{
89+
'kylechui/nvim-surround', -- vim-surround for nvim
90+
version = '*',
91+
event = 'VeryLazy',
92+
opts = {}
93+
},
94+
{
95+
'Wansmer/treesj', -- splitjoin.vim for neovim
96+
opts = {
97+
use_default_keymaps = false,
98+
max_join_length = 9999,
99+
},
100+
},
101+
{
102+
'numToStr/Comment.nvim', -- Comment / uncomment lines
103+
opts = {},
104+
},
105+
106+
------------------------------------------------- UI
107+
108+
{
109+
'nvim-telescope/telescope.nvim', -- Fuzzy finder for files, words, etc
110+
config = config_telescope,
111+
},
112+
{
113+
'akinsho/bufferline.nvim', -- Fancy tabs
114+
opts = {
115+
options = {
116+
mode = 'tabs',
117+
diagnostics = 'nvim-lsp',
118+
separator_style = 'slant',
119+
},
120+
},
121+
},
122+
{
123+
'lewis6991/gitsigns.nvim', -- git status in sign column
124+
config = config_gitsigns,
125+
},
126+
{
127+
'nvim-lualine/lualine.nvim', -- Status line
128+
config = config_lualine,
129+
},
130+
{
131+
'NvChad/nvim-colorizer.lua', -- Colorize hex and others
132+
opts = {},
133+
},
134+
{
135+
'folke/which-key.nvim', -- View possible keybindings
136+
opts = {},
137+
},
138+
139+
--------------------------- LSP Support, Diagnostics
140+
141+
{
142+
'williamboman/mason.nvim', -- Installer for LSP servers, DAP, linters, and formatters
143+
opts = {}
144+
},
145+
{
146+
'williamboman/mason-lspconfig.nvim', -- Configurations for a number of popular languages and ecosystems
147+
config = config_mason_lspconfig,
148+
},
149+
{
150+
'neovim/nvim-lspconfig', -- Collection of configurations for built-in LSP clienIt
151+
config = config_lspconfig,
152+
},
153+
{
154+
'folke/lsp-colors.nvim', -- LSP colors
155+
opts = {},
156+
},
157+
{
158+
'folke/trouble.nvim', -- Show LSP diagnostics inline and in a dedicated window
159+
opts = { use_diagnostic_signs = true },
160+
},
161+
162+
---------------------------------------- Completion
163+
164+
{
165+
'hrsh7th/cmp-nvim-lsp',
166+
dependencies = {
167+
'hrsh7th/cmp-buffer',
168+
'hrsh7th/cmp-path',
169+
'hrsh7th/cmp-cmdline',
170+
'hrsh7th/nvim-cmp',
171+
'L3MON4D3/LuaSnip',
172+
},
173+
config = config_cmp,
174+
},
175+
'hrsh7th/cmp-buffer',
176+
'hrsh7th/cmp-path',
177+
'hrsh7th/cmp-cmdline',
178+
'hrsh7th/nvim-cmp',
179+
'L3MON4D3/LuaSnip',
180+
181+
------------------------------- Linting, formatting
182+
{
183+
'jose-elias-alvarez/null-ls.nvim', -- Linters, formatters
184+
config = config_null_ls,
185+
},
186+
})

.config/nvim/lazy-lock.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"Comment.nvim": { "branch": "master", "commit": "176e85eeb63f1a5970d6b88f1725039d85ca0055" },
3+
"LuaSnip": { "branch": "master", "commit": "0b4950a237ce441a6a3a947d501622453f6860ea" },
4+
"bufferline.nvim": { "branch": "main", "commit": "99f0932365b34e22549ff58e1bea388465d15e99" },
5+
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
6+
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
7+
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
8+
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
9+
"emmet-vim": { "branch": "master", "commit": "def5d57a1ae5afb1b96ebe83c4652d1c03640f4d" },
10+
"gitsigns.nvim": { "branch": "main", "commit": "11b80e7eea249affc8776483272bcfc627b5552a" },
11+
"lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" },
12+
"lsp-colors.nvim": { "branch": "main", "commit": "2bbe7541747fd339bdd8923fc45631a09bb4f1e5" },
13+
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
14+
"mason-lspconfig.nvim": { "branch": "main", "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" },
15+
"mason.nvim": { "branch": "main", "commit": "fe9e34a9ab4d64321cdc3ecab4ea1809239bb73f" },
16+
"nightfox.nvim": { "branch": "main", "commit": "77aa7458d2b725c2d9ff55a18befe1b891ac473e" },
17+
"nord.nvim": { "branch": "master", "commit": "fab04b2dd4b64f4b1763b9250a8824d0b5194b8f" },
18+
"null-ls.nvim": { "branch": "main", "commit": "db09b6c691def0038c456551e4e2772186449f35" },
19+
"nvim-autopairs": { "branch": "master", "commit": "ae5b41ce880a6d850055e262d6dfebd362bb276e" },
20+
"nvim-cmp": { "branch": "main", "commit": "c4e491a87eeacf0408902c32f031d802c7eafce8" },
21+
"nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
22+
"nvim-lspconfig": { "branch": "master", "commit": "6f426c34c8e21af2f934e56be9d1198a507ecc9f" },
23+
"nvim-surround": { "branch": "main", "commit": "211eaad7c6d01ef4ac02cba9052b3082ec232101" },
24+
"nvim-treesitter": { "branch": "master", "commit": "736a672afe852dbad4199002c89b7461b285c47f" },
25+
"nvim-treesitter-textobjects": { "branch": "master", "commit": "9e519b6146512c8e2e702faf8ac48420f4f5deec" },
26+
"nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" },
27+
"plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" },
28+
"telescope.nvim": { "branch": "master", "commit": "1228f3b15ca3d9b95dcb92efda6a3448871030bd" },
29+
"treesj": { "branch": "main", "commit": "3203aa553217921fd4dcb79245f9df07278910b2" },
30+
"vim-abolish": { "branch": "master", "commit": "cb3dcb220262777082f63972298d57ef9e9455ec" },
31+
"vim-eunuch": { "branch": "master", "commit": "67f3dd32b4dcd1c427085f42ff5f29c7adc645c6" },
32+
"which-key.nvim": { "branch": "main", "commit": "38b990f6eabf62014018b4aae70a97d7a6c2eb88" }
33+
}

0 commit comments

Comments
 (0)