comparison .chezmoitemplates/init.lua @ 706:679c3a5464d7

feat: add packer lock file
author zegervdv <zegervdv@me.com>
date Sun, 23 Oct 2022 11:30:22 +0200
parents f8d8c64f579c
children 45c34cfecc3e
comparison
equal deleted inserted replaced
705:f8d8c64f579c 706:679c3a5464d7
25 else 25 else
26 return 'zegervdv/' .. name 26 return 'zegervdv/' .. name
27 end 27 end
28 end 28 end
29 29
30 require('packer').startup(function() 30 require('packer').startup {
31 use { 'wbthomason/packer.nvim', opt = true } 31 function()
32 32 use { 'wbthomason/packer.nvim', opt = true }
33 -- General plugins 33
34 use { 'tpope/vim-sensible' } 34 -- General plugins
35 use { 'tpope/vim-repeat' } 35 use { 'tpope/vim-sensible' }
36 use { 'tpope/vim-rsi' } 36 use { 'tpope/vim-repeat' }
37 use { 'sgur/vim-editorconfig' } 37 use { 'tpope/vim-rsi' }
38 use { 38 use { 'sgur/vim-editorconfig' }
39 'ojroques/nvim-osc52', 39 use {
40 config = function() 40 'ojroques/nvim-osc52',
41 require('osc52').setup { trim = true } 41 config = function()
42 local copy = function(lines, _) require('osc52').copy(table.concat(lines, '\n')) end 42 require('osc52').setup { trim = true }
43 local paste = function() return { vim.fn.split(vim.fn.getreg '', '\n'), vim.fn.getregtype '' } end 43 local copy = function(lines, _) require('osc52').copy(table.concat(lines, '\n')) end
44 vim.g.clipboard = { 44 local paste = function() return { vim.fn.split(vim.fn.getreg '', '\n'), vim.fn.getregtype '' } end
45 name = 'osc52', 45 vim.g.clipboard = {
46 copy = { ['+'] = copy, ['*'] = copy }, 46 name = 'osc52',
47 paste = { ['+'] = paste, ['*'] = paste }, 47 copy = { ['+'] = copy, ['*'] = copy },
48 } 48 paste = { ['+'] = paste, ['*'] = paste },
49 end, 49 }
50 } 50 end,
51 51 }
52 use { 52
53 'tpope/vim-eunuch', 53 use {
54 cmd = { 54 'tpope/vim-eunuch',
55 'Delete', 55 cmd = {
56 'Unlink', 56 'Delete',
57 'Move', 57 'Unlink',
58 'Rename', 58 'Move',
59 'Mkdir', 59 'Rename',
60 'Chmod', 60 'Mkdir',
61 'Cfind', 61 'Chmod',
62 'Clocate', 62 'Cfind',
63 'Lfind', 63 'Clocate',
64 'Llocate', 64 'Lfind',
65 'SudoEdit', 65 'Llocate',
66 'SudoWrite', 66 'SudoEdit',
67 'Wall', 67 'SudoWrite',
68 }, 68 'Wall',
69 } 69 },
70 70 }
71 -- Smooth scrolling 71
72 use { 72 -- Smooth scrolling
73 'karb94/neoscroll.nvim', 73 use {
74 config = function() require('neoscroll').setup {} end, 74 'karb94/neoscroll.nvim',
75 } 75 config = function() require('neoscroll').setup {} end,
76 76 }
77 -- Faster lua package loading (until 15436 is merged) 77
78 use { 78 -- Faster lua package loading (until 15436 is merged)
79 'lewis6991/impatient.nvim', 79 use {
80 module = { 'impatient' }, 80 'lewis6991/impatient.nvim',
81 setup = function() require 'impatient' end, 81 module = { 'impatient' },
82 } 82 setup = function() require 'impatient' end,
83 83 }
84 -- Library with lua functions 84
85 use { 'nvim-lua/plenary.nvim' } 85 -- Library with lua functions
86 86 use { 'nvim-lua/plenary.nvim' }
87 -- Spelling/autocorrection 87
88 use { 'tpope/vim-abolish' } 88 -- Spelling/autocorrection
89 89 use { 'tpope/vim-abolish' }
90 -- Git/VCS 90
91 use { 'vim-scripts/gitignore' } 91 -- Git/VCS
92 use { 92 use { 'vim-scripts/gitignore' }
93 'zegervdv/settle.nvim', 93 use {
94 opt = true, 94 'zegervdv/settle.nvim',
95 cmd = { 'SettleInit' }, 95 opt = true,
96 config = function() 96 cmd = { 'SettleInit' },
97 require('settle').setup { 97 config = function()
98 wrap = true, 98 require('settle').setup {
99 symbol = '▊', 99 wrap = true,
100 pre_hook = function() 100 symbol = '▊',
101 -- disable dirvish 101 pre_hook = function()
102 vim.api.nvim_del_keymap('n', '-') 102 -- disable dirvish
103 end, 103 vim.api.nvim_del_keymap('n', '-')
104 } 104 end,
105 end, 105 }
106 } 106 end,
107 use { 'tpope/vim-git', ft = { 'gitcommit', 'gitrebase' } } 107 }
108 use { 108 use { 'tpope/vim-git', ft = { 'gitcommit', 'gitrebase' } }
109 local_plugin 'diffview.nvim', 109 use {
110 config = function() require('diffview').setup { use_icons = false } end, 110 local_plugin 'diffview.nvim',
111 } 111 config = function() require('diffview').setup { use_icons = false } end,
112 112 }
113 -- Comments 113
114 use { 114 -- Comments
115 'numToStr/Comment.nvim', 115 use {
116 config = function() 116 'numToStr/Comment.nvim',
117 local ft = require 'Comment.ft' 117 config = function()
118 ft.systemverilog = { '//%s', '/*%s*/' } 118 local ft = require 'Comment.ft'
119 ft.verilog = { '//%s', '/*%s*/' } 119 ft.systemverilog = { '//%s', '/*%s*/' }
120 120 ft.verilog = { '//%s', '/*%s*/' }
121 require('Comment').setup { 121
122 padding = true, 122 require('Comment').setup {
123 sticky = true, 123 padding = true,
124 ignore = '^(%s*)$', 124 sticky = true,
125 mappings = { 125 ignore = '^(%s*)$',
126 basic = true, 126 mappings = {
127 extra = true, 127 basic = true,
128 }, 128 extra = true,
129 } 129 },
130 end, 130 }
131 keys = { 131 end,
132 { 'n', 'gc' }, 132 keys = {
133 { 'n', 'gb' }, 133 { 'n', 'gc' },
134 { 'v', 'gc' }, 134 { 'n', 'gb' },
135 { 'v', 'gb' }, 135 { 'v', 'gc' },
136 }, 136 { 'v', 'gb' },
137 } 137 },
138 138 }
139 -- Parentheses etc 139
140 use { 'kylechui/nvim-surround', config = function() require('nvim-surround').setup() end } 140 -- Parentheses etc
141 use { 141 use { 'kylechui/nvim-surround', config = function() require('nvim-surround').setup() end }
142 'windwp/nvim-autopairs', 142 use {
143 config = function() 143 'windwp/nvim-autopairs',
144 local npairs = require 'nvim-autopairs' 144 config = function()
145 local Rule = require 'nvim-autopairs.rule' 145 local npairs = require 'nvim-autopairs'
146 146 local Rule = require 'nvim-autopairs.rule'
147 local cmp = require 'nvim-autopairs.completion.cmp' 147
148 148 local cmp = require 'nvim-autopairs.completion.cmp'
149 require('cmp').event:on('confirm_done', cmp.on_confirm_done()) 149
150 150 require('cmp').event:on('confirm_done', cmp.on_confirm_done())
151 npairs.setup { 151
152 ignored_next_char = string.gsub([[ [%w%%%'%[%.] ]], '%s+', ''), 152 npairs.setup {
153 enable_afterquote = false, 153 ignored_next_char = string.gsub([[ [%w%%%'%[%.] ]], '%s+', ''),
154 } 154 enable_afterquote = false,
155 155 }
156 npairs.add_rules { 156
157 Rule(' ', ' '):with_pair(function(opts) 157 npairs.add_rules {
158 local pair = opts.line:sub(opts.col - 1, opts.col) 158 Rule(' ', ' '):with_pair(function(opts)
159 return vim.tbl_contains({ '()', '[]', '{}' }, pair) 159 local pair = opts.line:sub(opts.col - 1, opts.col)
160 end), 160 return vim.tbl_contains({ '()', '[]', '{}' }, pair)
161 Rule('( ', ' )') 161 end),
162 :with_pair(function() return false end) 162 Rule('( ', ' )')
163 :with_move(function(opts) return opts.prev_char:match '.%)' ~= nil end) 163 :with_pair(function() return false end)
164 :use_key ')', 164 :with_move(function(opts) return opts.prev_char:match '.%)' ~= nil end)
165 Rule('{ ', ' }') 165 :use_key ')',
166 :with_pair(function() return false end) 166 Rule('{ ', ' }')
167 :with_move(function(opts) return opts.prev_char:match '.%}' ~= nil end) 167 :with_pair(function() return false end)
168 :use_key '}', 168 :with_move(function(opts) return opts.prev_char:match '.%}' ~= nil end)
169 Rule('[ ', ' ]') 169 :use_key '}',
170 :with_pair(function() return false end) 170 Rule('[ ', ' ]')
171 :with_move(function(opts) return opts.prev_char:match '.%]' ~= nil end) 171 :with_pair(function() return false end)
172 :use_key ']', 172 :with_move(function(opts) return opts.prev_char:match '.%]' ~= nil end)
173 } 173 :use_key ']',
174 174 }
175 npairs.get_rule('`'):with_pair(function() return vim.bo.filetype ~= 'systemverilog' end) 175
176 176 npairs.get_rule('`'):with_pair(function() return vim.bo.filetype ~= 'systemverilog' end)
177 npairs.get_rule("'")[1]:with_pair(function() return vim.bo.filetype ~= 'systemverilog' end) 177
178 end, 178 npairs.get_rule("'")[1]:with_pair(function() return vim.bo.filetype ~= 'systemverilog' end)
179 after = { 'nvim-cmp' }, 179 end,
180 } 180 after = { 'nvim-cmp' },
181 181 }
182 -- Moving around within lines 182
183 use { 'wellle/targets.vim', event = 'InsertEnter *' } 183 -- Moving around within lines
184 184 use { 'wellle/targets.vim', event = 'InsertEnter *' }
185 -- Searching 185
186 use { 186 -- Searching
187 'mhinz/vim-grepper', 187 use {
188 cmd = { 'Grepper', 'Ag' }, 188 'mhinz/vim-grepper',
189 keys = { { 'n', 'gs' }, { 'x', 'gs' } }, 189 cmd = { 'Grepper', 'Ag' },
190 config = function() 190 keys = { { 'n', 'gs' }, { 'x', 'gs' } },
191 vim.g.grepper = { 191 config = function()
192 tools = { 'ag', 'hg' }, 192 vim.g.grepper = {
193 highlight = 1, 193 tools = { 'ag', 'hg' },
194 ag = { 194 highlight = 1,
195 grepprg = 'rg --vimgrep', 195 ag = {
196 }, 196 grepprg = 'rg --vimgrep',
197 } 197 },
198 198 }
199 vim.keymap.set({ 'x', 'n' }, 'gs', '<plug>(GrepperOperator)') 199
200 vim.api.nvim_create_user_command( 200 vim.keymap.set({ 'x', 'n' }, 'gs', '<plug>(GrepperOperator)')
201 'Ag', 201 vim.api.nvim_create_user_command(
202 'Grepper -noprompt -tool ag -grepprg rg --vimgrep <args>', 202 'Ag',
203 { complete = 'file', nargs = '*' } 203 'Grepper -noprompt -tool ag -grepprg rg --vimgrep <args>',
204 ) 204 { complete = 'file', nargs = '*' }
205 end, 205 )
206 } 206 end,
207 207 }
208 -- Opening files 208
209 use { 'wsdjeg/vim-fetch' } 209 -- Opening files
210 210 use { 'wsdjeg/vim-fetch' }
211 -- session management 211
212 use { 212 -- session management
213 'folke/persistence.nvim', 213 use {
214 event = 'BufReadPre', 214 'folke/persistence.nvim',
215 module = 'persistence', 215 event = 'BufReadPre',
216 config = function() require('persistence').setup() end, 216 module = 'persistence',
217 } 217 config = function() require('persistence').setup() end,
218 218 }
219 -- Indent lines 219
220 use { 220 -- Indent lines
221 'lukas-reineke/indent-blankline.nvim', 221 use {
222 config = function() 222 'lukas-reineke/indent-blankline.nvim',
223 vim.g.indent_blankline_buftype_exclude = { 'terminal', 'help', 'nofile' } 223 config = function()
224 vim.g.indent_blankline_show_first_indent_level = false 224 vim.g.indent_blankline_buftype_exclude = { 'terminal', 'help', 'nofile' }
225 vim.g.indent_blankline_char = '│' 225 vim.g.indent_blankline_show_first_indent_level = false
226 end, 226 vim.g.indent_blankline_char = '│'
227 } 227 end,
228 228 }
229 -- Increment/decrement 229
230 use { 230 -- Increment/decrement
231 'zegervdv/nrpattern.nvim', 231 use {
232 branch = 'lua', 232 'zegervdv/nrpattern.nvim',
233 requires = 'tpope/vim-repeat', 233 branch = 'lua',
234 config = function() 234 requires = 'tpope/vim-repeat',
235 local nrpattern = require 'nrpattern' 235 config = function()
236 local defaults = require 'nrpattern.default' 236 local nrpattern = require 'nrpattern'
237 237 local defaults = require 'nrpattern.default'
238 defaults[{ 'input', 'output' }] = { priority = 12, filetypes = { 'verilog', 'systemverilog' } } 238
239 defaults[{ "'1", "'0" }] = { priority = 9, filetypes = { 'verilog', 'systemverilog' } } 239 defaults[{ 'input', 'output' }] = { priority = 12, filetypes = { 'verilog', 'systemverilog' } }
240 240 defaults[{ "'1", "'0" }] = { priority = 9, filetypes = { 'verilog', 'systemverilog' } }
241 nrpattern.setup(defaults) 241
242 end, 242 nrpattern.setup(defaults)
243 } 243 end,
244 244 }
245 -- Tmux 245
246 use { 246 -- Tmux
247 'numtostr/navigator.nvim', 247 use {
248 config = function() 248 'numtostr/navigator.nvim',
249 require('Navigator').setup { auto_save = 'current', disable_on_zoom = true } 249 config = function()
250 250 require('Navigator').setup { auto_save = 'current', disable_on_zoom = true }
251 local nmap = function(lhs, rhs, opts) return vim.keymap.set('n', lhs, rhs, opts) end 251
252 nmap('<c-h>', require('Navigator').left, { silent = true }) 252 local nmap = function(lhs, rhs, opts) return vim.keymap.set('n', lhs, rhs, opts) end
253 nmap('<c-j>', require('Navigator').down, { silent = true }) 253 nmap('<c-h>', require('Navigator').left, { silent = true })
254 nmap('<c-k>', require('Navigator').up, { silent = true }) 254 nmap('<c-j>', require('Navigator').down, { silent = true })
255 nmap('<c-l>', require('Navigator').right, { silent = true }) 255 nmap('<c-k>', require('Navigator').up, { silent = true })
256 end, 256 nmap('<c-l>', require('Navigator').right, { silent = true })
257 } 257 end,
258 258 }
259 -- Keymap help 259
260 use { 260 -- Keymap help
261 'folke/which-key.nvim', 261 use {
262 config = function() 262 'folke/which-key.nvim',
263 require('which-key').setup { 263 config = function()
264 triggers = { '<leader>', 'g', '<c-w>', '"', '`' }, 264 require('which-key').setup {
265 } 265 triggers = { '<leader>', 'g', '<c-w>', '"', '`' },
266 end, 266 }
267 } 267 end,
268 268 }
269 -- Completion/snippets/LSP 269
270 use { 'neovim/nvim-lspconfig' } 270 -- Completion/snippets/LSP
271 use { 271 use { 'neovim/nvim-lspconfig' }
272 'hrsh7th/nvim-cmp', 272 use {
273 requires = { 273 'hrsh7th/nvim-cmp',
274 'hrsh7th/cmp-buffer', 274 requires = {
275 'hrsh7th/cmp-nvim-lsp', 275 'hrsh7th/cmp-buffer',
276 'saadparwaiz1/cmp_luasnip', 276 'hrsh7th/cmp-nvim-lsp',
277 'hrsh7th/cmp-path', 277 'saadparwaiz1/cmp_luasnip',
278 'hrsh7th/cmp-cmdline', 278 'hrsh7th/cmp-path',
279 'hrsh7th/cmp-nvim-lsp-signature-help', 279 'hrsh7th/cmp-cmdline',
280 }, 280 'hrsh7th/cmp-nvim-lsp-signature-help',
281 config = function() 281 },
282 local cmp = require 'cmp' 282 config = function()
283 local luasnip = require 'luasnip' 283 local cmp = require 'cmp'
284 284 local luasnip = require 'luasnip'
285 local has_words_before = function() 285
286 local line, col = unpack(vim.api.nvim_win_get_cursor(0)) 286 local has_words_before = function()
287 return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil 287 local line, col = unpack(vim.api.nvim_win_get_cursor(0))
288 end 288 return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil
289 289 end
290 cmp.setup { 290
291 snippet = { 291 cmp.setup {
292 expand = function(args) luasnip.lsp_expand(args.body) end, 292 snippet = {
293 }, 293 expand = function(args) luasnip.lsp_expand(args.body) end,
294 mapping = { 294 },
295 ['<C-p>'] = { i = cmp.mapping.select_prev_item() }, 295 mapping = {
296 ['<C-n>'] = { i = cmp.mapping.select_next_item() }, 296 ['<C-p>'] = { i = cmp.mapping.select_prev_item() },
297 ['<C-d>'] = { i = cmp.mapping.scroll_docs(-4) }, 297 ['<C-n>'] = { i = cmp.mapping.select_next_item() },
298 ['<C-y>'] = { i = cmp.mapping.complete() }, 298 ['<C-d>'] = { i = cmp.mapping.scroll_docs(-4) },
299 ['<C-e>'] = { i = cmp.mapping.close() }, 299 ['<C-y>'] = { i = cmp.mapping.complete() },
300 ['<CR>'] = { i = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace } }, 300 ['<C-e>'] = { i = cmp.mapping.close() },
301 ['<C-k>'] = { i = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace } }, 301 ['<CR>'] = { i = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace } },
302 }, 302 ['<C-k>'] = { i = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace } },
303 sources = { 303 },
304 { name = 'nvim_lsp' }, 304 sources = {
305 { name = 'nvim_lsp_signature_help' }, 305 { name = 'nvim_lsp' },
306 { name = 'buffer', keyword_length = 5 }, 306 { name = 'nvim_lsp_signature_help' },
307 { name = 'luasnip' }, 307 { name = 'buffer', keyword_length = 5 },
308 { name = 'path' }, 308 { name = 'luasnip' },
309 }, 309 { name = 'path' },
310 experimental = { 310 },
311 native_menu = false, 311 experimental = {
312 ghost_text = true, 312 native_menu = false,
313 }, 313 ghost_text = true,
314 } 314 },
315 315 }
316 cmp.setup.cmdline(':', { 316
317 mapping = cmp.mapping.preset.cmdline { 317 cmp.setup.cmdline(':', {
318 ['<C-p>'] = { c = cmp.mapping.select_prev_item() }, 318 mapping = cmp.mapping.preset.cmdline {
319 ['<C-n>'] = { c = cmp.mapping.select_next_item() }, 319 ['<C-p>'] = { c = cmp.mapping.select_prev_item() },
320 ['<C-y>'] = { c = cmp.mapping.complete() }, 320 ['<C-n>'] = { c = cmp.mapping.select_next_item() },
321 }, 321 ['<C-y>'] = { c = cmp.mapping.complete() },
322 sources = cmp.config.sources({ 322 },
323 { name = 'path' }, 323 sources = cmp.config.sources({
324 }, { 324 { name = 'path' },
325 { name = 'cmdline', keyword_length = 4 }, 325 }, {
326 }), 326 { name = 'cmdline', keyword_length = 4 },
327 }) 327 }),
328 end, 328 })
329 after = 'luasnip', 329 end,
330 } 330 after = 'luasnip',
331 use { 331 }
332 { 332 use {
333 'nvim-treesitter/nvim-treesitter', 333 {
334 run = ':TSUpdate', 334 'nvim-treesitter/nvim-treesitter',
335 config = function() 335 run = ':TSUpdate',
336 require 'nvim-treesitter.highlight' 336 config = function()
337 337 require 'nvim-treesitter.highlight'
338 require('nvim-treesitter.configs').setup { 338
339 ensure_installed = { 339 require('nvim-treesitter.configs').setup {
340 'python', 340 ensure_installed = {
341 'lua', 341 'python',
342 'verilog', 342 'lua',
343 'json', 343 'verilog',
344 'yaml', 344 'json',
345 'bash', 345 'yaml',
346 'dockerfile', 346 'bash',
347 'c', 347 'dockerfile',
348 'cpp', 348 'c',
349 'regex', 349 'cpp',
350 'markdown', 350 'regex',
351 'rst', 351 'markdown',
352 'beancount', 352 'rst',
353 }, 353 'beancount',
354 indent = {
355 enable = false,
356 },
357 highlight = {
358 enable = true,
359 disable = { 'systemverilog', 'verilog' },
360 },
361 incremental_selection = {
362 enable = true,
363 keymaps = {
364 init_selection = 'gnn',
365 node_incremental = 'grn',
366 scope_incremental = 'grc',
367 node_decremental = 'grm',
368 }, 354 },
369 }, 355 indent = {
370 refactor = { 356 enable = false,
371 highlight_definitions = { enable = true }, 357 },
372 smart_rename = { enable = true, keymaps = { smart_rename = 'gsr' } }, 358 highlight = {
373 navigation = {
374 enable = true, 359 enable = true,
375 keymaps = { goto_definition = 'gnd', list_definitions = 'gnD' }, 360 disable = { 'systemverilog', 'verilog' },
376 }, 361 },
377 }, 362 incremental_selection = {
378 textobjects = {
379 move = {
380 enable = true, 363 enable = true,
381 goto_next_start = { [']]'] = '@block.outer' },
382 goto_previous_start = { ['[['] = '@block.outer' },
383 goto_next_end = { [']['] = '@block.outer' },
384 goto_previous_end = { ['[]'] = '@block.outer' },
385 },
386 select = {
387 enable = true,
388 lookahead = true,
389 keymaps = { 364 keymaps = {
390 ['af'] = '@function.outer', 365 init_selection = 'gnn',
391 ['if'] = '@function.inner', 366 node_incremental = 'grn',
367 scope_incremental = 'grc',
368 node_decremental = 'grm',
392 }, 369 },
393 }, 370 },
394 }, 371 refactor = {
395 playground = { enable = true, disable = {}, updatetime = 25, persist_queries = false }, 372 highlight_definitions = { enable = true },
396 } 373 smart_rename = { enable = true, keymaps = { smart_rename = 'gsr' } },
397 end, 374 navigation = {
398 }, 375 enable = true,
399 'nvim-treesitter/nvim-treesitter-refactor', 376 keymaps = { goto_definition = 'gnd', list_definitions = 'gnD' },
400 'nvim-treesitter/nvim-treesitter-textobjects', 377 },
401 { 'nvim-treesitter/playground', opt = true }, 378 },
402 } 379 textobjects = {
403 use { 'L3MON4D3/luasnip' } 380 move = {
404 use { 381 enable = true,
405 'rmagatti/goto-preview', 382 goto_next_start = { [']]'] = '@block.outer' },
406 config = function() require('goto-preview').setup {} end, 383 goto_previous_start = { ['[['] = '@block.outer' },
407 } 384 goto_next_end = { [']['] = '@block.outer' },
408 use { 385 goto_previous_end = { ['[]'] = '@block.outer' },
409 'jose-elias-alvarez/null-ls.nvim', 386 },
410 requires = 'nvim-lua/plenary.nvim', 387 select = {
411 } 388 enable = true,
412 use { 'folke/neodev.nvim' } 389 lookahead = true,
413 use { 390 keymaps = {
414 'smjonas/inc-rename.nvim', 391 ['af'] = '@function.outer',
415 config = function() 392 ['if'] = '@function.inner',
416 require('inc_rename').setup { 393 },
417 post_hook = function(result) 394 },
418 local changed = {} 395 },
419 for uri, changes in pairs(result.changes or result.documentChanges) do 396 playground = { enable = true, disable = {}, updatetime = 25, persist_queries = false },
420 local bufnr = vim.uri_to_bufnr(uri) 397 }
421 for _, edits in ipairs(changes) do 398 end,
422 table.insert(changed, { 399 },
423 bufnr = bufnr, 400 'nvim-treesitter/nvim-treesitter-refactor',
424 lnum = edits.range.start.line + 1, 401 'nvim-treesitter/nvim-treesitter-textobjects',
425 col = edits.range.start.character + 1, 402 { 'nvim-treesitter/playground', opt = true },
426 text = vim.api.nvim_buf_get_lines(bufnr, edits.range.start.line, edits.range.start.line + 1, false)[1], 403 }
427 }) 404 use { 'L3MON4D3/luasnip' }
405 use {
406 'rmagatti/goto-preview',
407 config = function() require('goto-preview').setup {} end,
408 }
409 use {
410 'jose-elias-alvarez/null-ls.nvim',
411 requires = 'nvim-lua/plenary.nvim',
412 }
413 use { 'folke/neodev.nvim' }
414 use {
415 'smjonas/inc-rename.nvim',
416 config = function()
417 require('inc_rename').setup {
418 post_hook = function(result)
419 local changed = {}
420 for uri, changes in pairs(result.changes or result.documentChanges) do
421 local bufnr = vim.uri_to_bufnr(uri)
422 for _, edits in ipairs(changes) do
423 table.insert(changed, {
424 bufnr = bufnr,
425 lnum = edits.range.start.line + 1,
426 col = edits.range.start.character + 1,
427 text = vim.api.nvim_buf_get_lines(bufnr, edits.range.start.line, edits.range.start.line + 1, false)[1],
428 })
429 end
428 end 430 end
429 end 431 vim.fn.setqflist(changed, 'r')
430 vim.fn.setqflist(changed, 'r') 432 end,
431 end, 433 }
432 } 434 end,
433 end, 435 }
434 } 436 use {
435 use { 437 'j-hui/fidget.nvim',
436 'j-hui/fidget.nvim', 438 config = function()
437 config = function() 439 require('fidget').setup {
438 require('fidget').setup { 440 text = {
439 text = { 441 spinner = 'dots',
440 spinner = 'dots', 442 },
441 }, 443 window = {
442 window = { 444 relative = 'editor',
443 relative = 'editor', 445 blend = 0,
444 blend = 0, 446 },
445 }, 447 }
446 } 448 end,
447 end, 449 }
448 } 450 use {
449 use { 451 'https://git.sr.ht/~whynothugo/lsp_lines.nvim',
450 'https://git.sr.ht/~whynothugo/lsp_lines.nvim', 452 disable = true,
451 disable = true, 453 config = function()
452 config = function() 454 require('lsp_lines').setup()
453 require('lsp_lines').setup() 455 vim.diagnostic.config { virtual_lines = false, virtual_text = false }
454 vim.diagnostic.config { virtual_lines = false, virtual_text = false } 456 vim.keymap.set(
455 vim.keymap.set('n', 'g?', function() require('lsp_lines').toggle() end, { desc = 'Toggle LSP diagnostic lines' }) 457 'n',
456 end, 458 'g?',
457 } 459 function() require('lsp_lines').toggle() end,
458 460 { desc = 'Toggle LSP diagnostic lines' }
459 use { 461 )
460 'nvim-telescope/telescope-ui-select.nvim', 462 end,
461 requires = { 'nvim-telescope/telescope.nvim' }, 463 }
462 config = function() 464
463 require('telescope').setup { 465 use {
464 defaults = { 466 'nvim-telescope/telescope-ui-select.nvim',
465 border = {}, 467 requires = { 'nvim-telescope/telescope.nvim' },
466 borderchars = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, 468 config = function()
467 winblend = 0, 469 require('telescope').setup {
468 }, 470 defaults = {
469 extensions = {
470 ['ui-select'] = require('telescope.themes').get_dropdown {
471 border = {}, 471 border = {},
472 borderchars = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, 472 borderchars = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
473 winblend = 0, 473 winblend = 0,
474 }, 474 },
475 }, 475 extensions = {
476 } 476 ['ui-select'] = require('telescope.themes').get_dropdown {
477 require('telescope').load_extension 'ui-select' 477 border = {},
478 end, 478 borderchars = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
479 } 479 winblend = 0,
480 480 },
481 use { 'vimjas/vim-python-pep8-indent', ft = { 'python' } } 481 },
482 482 }
483 use { 483 require('telescope').load_extension 'ui-select'
484 'rebelot/heirline.nvim', 484 end,
485 after = 'espresso-tutti-colori.nvim', 485 }
486 config = function() 486
487 local utils = require 'heirline.utils' 487 use { 'vimjas/vim-python-pep8-indent', ft = { 'python' } }
488 local conditions = require 'heirline.conditions' 488
489 489 use {
490 local colors = require('tutti-colori.colors').setup() 490 'rebelot/heirline.nvim',
491 colors.diag_warn = utils.get_highlight('DiagnosticSignWarn').fg 491 after = 'espresso-tutti-colori.nvim',
492 colors.diag_error = utils.get_highlight('DiagnosticSignError').fg 492 config = function()
493 493 local utils = require 'heirline.utils'
494 require('heirline').load_colors(colors) 494 local conditions = require 'heirline.conditions'
495 495
496 local align = { provider = '%=' } 496 local colors = require('tutti-colori.colors').setup()
497 local space = { provider = ' ' } 497 colors.diag_warn = utils.get_highlight('DiagnosticSignWarn').fg
498 local lbound = { provider = '▊ ', hl = { fg = 'blue', bg = 'bg' } } 498 colors.diag_error = utils.get_highlight('DiagnosticSignError').fg
499 local rbound = { provider = ' ▊', hl = { fg = 'blue', bg = 'bg' } } 499
500 500 require('heirline').load_colors(colors)
501 local FileNameBlock = { 501
502 init = function(self) self.filename = vim.api.nvim_buf_get_name(0) end, 502 local align = { provider = '%=' }
503 } 503 local space = { provider = ' ' }
504 504 local lbound = { provider = '▊ ', hl = { fg = 'blue', bg = 'bg' } }
505 local FileName = { 505 local rbound = { provider = ' ▊', hl = { fg = 'blue', bg = 'bg' } }
506 provider = function(self) 506
507 local filename = vim.fn.fnamemodify(self.filename, ':.') 507 local FileNameBlock = {
508 if filename == '' then return '[No Name]' end 508 init = function(self) self.filename = vim.api.nvim_buf_get_name(0) end,
509 509 }
510 if not conditions.width_percent_below(#filename, 0.25) then filename = vim.fn.pathshorten(filename) end 510
511 511 local FileName = {
512 return filename 512 provider = function(self)
513 end, 513 local filename = vim.fn.fnamemodify(self.filename, ':.')
514 hl = { fg = 'blue' }, 514 if filename == '' then return '[No Name]' end
515 } 515
516 516 if not conditions.width_percent_below(#filename, 0.25) then filename = vim.fn.pathshorten(filename) end
517 local FileFlags = { 517
518 { 518 return filename
519 end,
520 hl = { fg = 'blue' },
521 }
522
523 local FileFlags = {
524 {
525 provider = function()
526 if vim.bo.modified then return ' [+]' end
527 end,
528 hl = { fg = 'green' },
529 },
530 {
531 provider = function()
532 if not vim.bo.modifiable or vim.bo.readonly then return ' RO' end
533 end,
534 hl = { fg = 'orange' },
535 },
536 }
537
538 FileNameBlock = utils.insert(FileNameBlock, FileName, unpack(FileFlags), { provider = '%<' })
539
540 local Ruler = { provider = '%l : %c %P' }
541
542 local Lsp = {
543 condition = conditions.lsp_attached,
544 update = { 'LspAttach', 'LspDetach' },
519 provider = function() 545 provider = function()
520 if vim.bo.modified then return ' [+]' end 546 local names = {}
547 for _, server in pairs(vim.lsp.get_active_clients { bufnr = 0 }) do
548 table.insert(names, server.name)
549 end
550 return table.concat(names, ', ')
521 end, 551 end,
522 hl = { fg = 'green' }, 552 hl = { fg = 'green' },
523 }, 553 }
524 { 554
525 provider = function() 555 local Diagnostics = {
526 if not vim.bo.modifiable or vim.bo.readonly then return ' RO' end 556 condition = conditions.has_diagnostics,
557 init = function(self)
558 self.errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })
559 self.warnings = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN })
527 end, 560 end,
528 hl = { fg = 'orange' }, 561 update = { 'DiagnosticChanged', 'BufEnter' },
529 }, 562 {
530 } 563 provider = function(self) return self.errors > 0 and self.errors .. ' ' end,
531 564 hl = { fg = 'diag_error' },
532 FileNameBlock = utils.insert(FileNameBlock, FileName, unpack(FileFlags), { provider = '%<' }) 565 },
533 566 {
534 local Ruler = { provider = '%l : %c %P' } 567 provider = function(self) return self.warnings > 0 and self.warnings .. ' ' end,
535 568 },
536 local Lsp = { 569 hl = { fg = 'diag_warn' },
537 condition = conditions.lsp_attached, 570 on_click = {
538 update = { 'LspAttach', 'LspDetach' }, 571 callback = function()
539 provider = function() 572 local diagnostics = vim.diagnostic.get(0, { severity = { min = vim.diagnostic.severity.WARN } })
540 local names = {} 573 vim.fn.setqflist(vim.diagnostic.toqflist(diagnostics))
541 for _, server in pairs(vim.lsp.get_active_clients { bufnr = 0 }) do 574 vim.cmd.copen { mods = { split = 'botright' } }
542 table.insert(names, server.name) 575 end,
543 end 576 name = 'heirline_diagnostics',
544 return table.concat(names, ', ') 577 },
545 end, 578 }
546 hl = { fg = 'green' }, 579
547 } 580 local statusline_default = { lbound, FileNameBlock, align, Diagnostics, Lsp, space, Ruler, rbound }
548 581 local statusline_inactive = {
549 local Diagnostics = { 582 condition = function() return not conditions.is_active() end,
550 condition = conditions.has_diagnostics, 583 lbound,
551 init = function(self) 584 FileNameBlock,
552 self.errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR }) 585 align,
553 self.warnings = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN }) 586 rbound,
554 end, 587 }
555 update = { 'DiagnosticChanged', 'BufEnter' }, 588 local statusline = {
556 { 589 fallthrough = false,
557 provider = function(self) return self.errors > 0 and self.errors .. ' ' end, 590 hl = { bg = 'bg' },
558 hl = { fg = 'diag_error' }, 591 statusline_inactive,
559 }, 592 statusline_default,
560 { 593 }
561 provider = function(self) return self.warnings > 0 and self.warnings .. ' ' end, 594
562 }, 595 require('heirline').setup(statusline)
563 hl = { fg = 'diag_warn' }, 596 end,
564 on_click = { 597 }
565 callback = function() 598
566 local diagnostics = vim.diagnostic.get(0, { severity = { min = vim.diagnostic.severity.WARN } }) 599 -- File navigation
567 vim.fn.setqflist(vim.diagnostic.toqflist(diagnostics)) 600 use {
568 vim.cmd.copen { mods = { split = 'botright' } } 601 'elihunter173/dirbuf.nvim',
569 end, 602 opt = true,
570 name = 'heirline_diagnostics', 603 config = function()
571 }, 604 require('dirbuf').setup {
572 } 605 hash_padding = 2,
573 606 show_hidden = true,
574 local statusline_default = { lbound, FileNameBlock, align, Diagnostics, Lsp, space, Ruler, rbound } 607 }
575 local statusline_inactive = { 608 end,
576 condition = function() return not conditions.is_active() end, 609 }
577 lbound, 610
578 FileNameBlock, 611 -- Colorscheme
579 align, 612 use {
580 rbound, 613 'navarasu/onedark.nvim',
581 } 614 disable = true,
582 local statusline = { 615 config = function()
583 fallthrough = false, 616 require('onedark').setup {
584 hl = { bg = 'bg' }, 617 style = 'dark',
585 statusline_inactive, 618 code_style = {
586 statusline_default, 619 comments = 'italic',
587 } 620 },
588 621 ending_tildes = true,
589 require('heirline').setup(statusline) 622 diagnostics = {
590 end, 623 darker = false,
591 } 624 undercurl = false,
592 625 background = false,
593 -- File navigation 626 },
594 use { 627 }
595 'elihunter173/dirbuf.nvim', 628 require('onedark').load()
596 opt = true, 629 local extras = {
597 config = function() 630 TelescopeNormal = { link = 'Pmenu' },
598 require('dirbuf').setup { 631 TelescopeBorder = { link = 'Pmenu' },
599 hash_padding = 2, 632 TelescopePromptBorder = { link = 'Pmenu' },
600 show_hidden = true, 633 TelescopePreviewBorder = { link = 'Pmenu' },
601 } 634 TelescopeResultsBorder = { link = 'Pmenu' },
602 end, 635 TelescopeTitle = { link = 'identifier' },
603 } 636 }
604 637 for name, opt in pairs(extras) do
605 -- Colorscheme 638 vim.api.nvim_set_hl(0, name, opt)
606 use { 639 end
607 'navarasu/onedark.nvim', 640 end,
608 disable = true, 641 }
609 config = function() 642 use {
610 require('onedark').setup { 643 local_plugin 'espresso-tutti-colori.nvim',
611 style = 'dark', 644 config = function()
612 code_style = { 645 require('tutti-colori').setup()
613 comments = 'italic', 646 require('tutti-colori').load()
614 }, 647 end,
615 ending_tildes = true, 648 }
616 diagnostics = { 649
617 darker = false, 650 -- Terminal
618 undercurl = false, 651 use {
619 background = false, 652 'akinsho/nvim-toggleterm.lua',
620 }, 653 config = function()
621 } 654 require('toggleterm').setup {
622 require('onedark').load() 655 size = 15,
623 local extras = { 656 open_mapping = [[<F12>]],
624 TelescopeNormal = { link = 'Pmenu' }, 657 shade_filetypes = { 'none' },
625 TelescopeBorder = { link = 'Pmenu' }, 658 shade_terminals = true,
626 TelescopePromptBorder = { link = 'Pmenu' }, 659 persist_size = true,
627 TelescopePreviewBorder = { link = 'Pmenu' }, 660 direction = 'horizontal',
628 TelescopeResultsBorder = { link = 'Pmenu' }, 661 }
629 TelescopeTitle = { link = 'identifier' }, 662 end,
630 } 663 keys = { [[<F12>]] },
631 for name, opt in pairs(extras) do 664 }
632 vim.api.nvim_set_hl(0, name, opt) 665
633 end 666 -- Integration with external tools
634 end, 667 use {
635 } 668 'glacambre/firenvim',
636 use { 669 run = function() vim.fn['firenvim#install'](0) end,
637 local_plugin 'espresso-tutti-colori.nvim', 670 config = function()
638 config = function() 671 vim.g.firenvim_config = {
639 require('tutti-colori').setup() 672 localSettings = {
640 require('tutti-colori').load() 673 ['.*'] = {
641 end, 674 takeover = 'never',
642 } 675 },
643 676 },
644 -- Terminal 677 }
645 use { 678 end,
646 'akinsho/nvim-toggleterm.lua', 679 }
647 config = function() 680 end,
648 require('toggleterm').setup { 681 config = { snapshot_path = vim.fn.stdpath 'config' },
649 size = 15, 682 }
650 open_mapping = [[<F12>]],
651 shade_filetypes = { 'none' },
652 shade_terminals = true,
653 persist_size = true,
654 direction = 'horizontal',
655 }
656 end,
657 keys = { [[<F12>]] },
658 }
659
660 -- Integration with external tools
661 use {
662 'glacambre/firenvim',
663 run = function() vim.fn['firenvim#install'](0) end,
664 config = function()
665 vim.g.firenvim_config = {
666 localSettings = {
667 ['.*'] = {
668 takeover = 'never',
669 },
670 },
671 }
672 end,
673 }
674 end)
675 683
676 vim.cmd.packadd 'dirbuf.nvim' 684 vim.cmd.packadd 'dirbuf.nvim'
677 685
678 -- Configuration 686 -- Configuration
679 local opt = vim.opt 687 local opt = vim.opt