|
4 | 4 | -- |
5 | 5 | -- Neovim from scratch, from the creator of LunarVim |
6 | 6 | -- https://www.youtube.com/watch?v=ctH-a-1eUME&list=PLhoH5vyxr6Qq41NFL4GvhFp-WLd5xzIzZ |
7 | | --- |
| 7 | +-- |
8 | 8 | -- Requires: |
9 | 9 | -- A patched font - https://www.nerdfonts.com/#home |
10 | 10 | -- ESLint - npm i -g eslint |
11 | | --- StyLua - cargo |
| 11 | +-- StyLua - cargo |
12 | 12 | -- |
13 | 13 | -- Heavily inspired by NvChad, LunarVim, AstroNvim |
14 | | --- |
| 14 | +-- |
15 | 15 | -- Huge list of plugins / themes |
16 | 16 | -- https://morioh.com/p/a7063de46490 |
17 | 17 |
|
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 |
26 | 18 |
|
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 | + }) |
91 | 30 | end |
| 31 | +vim.opt.rtp:prepend(lazypath) |
92 | 32 |
|
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') |
102 | 34 | require('config') |
| 35 | +require('keymaps') |
| 36 | +require('lsp') |
103 | 37 |
|
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') |
115 | 38 | require('plugins/cmp') |
116 | | -require('plugins/comment') |
117 | | -require('plugins/colorizer') |
| 39 | +require('plugins/treesitter') |
118 | 40 | require('plugins/gitsigns') |
| 41 | +require('plugins/lspconfig') |
119 | 42 | require('plugins/lualine') |
120 | | -require('plugins/nvim-autopairs') |
121 | | -require('plugins/nvim-surround') |
122 | | -require('plugins/nvim-treesitter') |
| 43 | +require('plugins/mason') |
123 | 44 | require('plugins/telescope') |
124 | | -require('plugins/trouble') |
125 | | -require('plugins/treesj') |
126 | | -require('plugins/which-key') |
127 | 45 |
|
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 | +}) |
0 commit comments