Mercurial > dotfiles
annotate .chezmoitemplates/init.lua @ 782:31605398117a
fix: handle opening files not under vcs
author | zegervdv <zegervdv@me.com> |
---|---|
date | Fri, 28 Apr 2023 07:12:49 +0200 |
parents | 405ff835995a |
children | 335b1f5c242d |
rev | line source |
---|---|
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1 -- |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
2 -- Neovim dotfiles |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
3 -- |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
4 -- |
582 | 5 local home = os.getenv 'HOME' |
600
24b0dd06381b
Enable collapsed statements for stylua
Zeger Van de Vannet <zegervdv@me.com>
parents:
599
diff
changeset
|
6 if home == nil then home = os.getenv 'USERPROFILE' end |
579 | 7 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
8 -- Bootstrap lazy |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
9 local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
10 if not vim.loop.fs_stat(lazypath) then |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
11 vim.fn.system { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
12 'git', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
13 'clone', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
14 '--filter=blob:none', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
15 'https://github.com/folke/lazy.nvim.git', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
16 '--branch=stable', -- latest stable release |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
17 lazypath, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
18 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
19 end |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
20 vim.opt.rtp:prepend(lazypath) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
21 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
22 -- Set leader to space |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
23 vim.g.mapleader = ' ' |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
24 |
761
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
25 require('lazy').setup({ |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
26 -- General plugins |
761
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
27 'tpope/vim-sensible', |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
28 { 'tpope/vim-repeat' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
29 { 'tpope/vim-rsi' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
30 { 'sgur/vim-editorconfig' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
31 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
32 'ojroques/nvim-osc52', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
33 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
34 require('osc52').setup { trim = true } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
35 local copy = function(lines, _) require('osc52').copy(table.concat(lines, '\n')) end |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
36 local paste = function() return { vim.fn.split(vim.fn.getreg '', '\n'), vim.fn.getregtype '' } end |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
37 vim.g.clipboard = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
38 name = 'osc52', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
39 copy = { ['+'] = copy, ['*'] = copy }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
40 paste = { ['+'] = paste, ['*'] = paste }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
41 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
42 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
43 }, |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
44 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
45 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
46 'tpope/vim-eunuch', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
47 cmd = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
48 'Delete', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
49 'Unlink', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
50 'Move', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
51 'Rename', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
52 'Mkdir', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
53 'Chmod', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
54 'Cfind', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
55 'Clocate', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
56 'Lfind', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
57 'Llocate', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
58 'SudoEdit', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
59 'SudoWrite', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
60 'Wall', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
61 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
62 }, |
487
0252f9494d64
Remove deferred loading of packer plugins
Zeger Van de Vannet <zegervdv@me.com>
parents:
486
diff
changeset
|
63 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
64 -- Smooth scrolling |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
65 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
66 'karb94/neoscroll.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
67 config = function() require('neoscroll').setup {} end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
68 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
69 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
70 -- Library with lua functions |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
71 { 'nvim-lua/plenary.nvim' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
72 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
73 -- Spelling/autocorrection |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
74 { 'tpope/vim-abolish' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
75 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
76 -- Git/VCS |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
77 { 'vim-scripts/gitignore' }, |
649
cc06db32b946
Source local plugins if available
zegervdv <zegervdv@me.com>
parents:
648
diff
changeset
|
78 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
79 { 'tpope/vim-git', ft = { 'gitcommit', 'gitrebase' } }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
80 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
81 'sindrets/diffview.nvim', |
761
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
82 dev = true, |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
83 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
84 require('diffview').setup { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
85 use_icons = false, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
86 icons = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
87 folder_closed = '+', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
88 folder_open = '-', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
89 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
90 signs = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
91 fold_closed = '+', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
92 fold_open = '-', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
93 done = '✓', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
94 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
95 hg_cmd = { 'chg' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
96 view = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
97 merge_tool = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
98 layout = 'diff4_mixed', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
99 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
100 }, |
777
7876fd87d41e
feat: do not show untracked files by default in diffview.nvim
zegervdv <zegervdv@me.com>
parents:
775
diff
changeset
|
101 default_args = { |
7876fd87d41e
feat: do not show untracked files by default in diffview.nvim
zegervdv <zegervdv@me.com>
parents:
775
diff
changeset
|
102 DiffviewOpen = { '--untracked-files=no' }, |
7876fd87d41e
feat: do not show untracked files by default in diffview.nvim
zegervdv <zegervdv@me.com>
parents:
775
diff
changeset
|
103 }, |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
104 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
105 local wk = require 'which-key' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
106 wk.register { ['<leader>d'] = { name = 'Diffview' } } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
107 vim.keymap.set('n', '<leader>do', '<cmd>DiffviewOpen<CR>', { desc = 'Open Diffview' }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
108 vim.keymap.set('n', '<leader>df', '<cmd>DiffviewFileHistory %<CR>', { desc = 'Show history for current file' }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
109 vim.keymap.set('n', '<leader>dh', ':DiffviewFileHistory ', { desc = 'Show history' }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
110 vim.keymap.set('n', '<leader>dc', '<cmd>DiffviewClose<CR>', { desc = 'Close Diffview window' }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
111 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
112 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
113 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
114 -- Comments |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
115 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
116 'numToStr/Comment.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
117 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
118 local ft = require 'Comment.ft' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
119 ft.systemverilog = { '//%s', '/*%s*/' } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
120 ft.verilog = { '//%s', '/*%s*/' } |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
121 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
122 require('Comment').setup { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
123 padding = true, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
124 sticky = true, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
125 ignore = '^(%s*)$', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
126 mappings = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
127 basic = true, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
128 extra = true, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
129 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
130 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
131 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
132 keys = { |
764 | 133 { 'gc', mode = 'n', desc = 'Comment toggle' }, |
134 { 'gb', mode = 'n', desc = 'Comment Block toggle' }, | |
135 { 'gc', mode = 'v', desc = 'Comment toggle' }, | |
136 { 'gb', mode = 'v', desc = 'Comment block toggle' }, | |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
137 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
138 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
139 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
140 -- Parentheses etc |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
141 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
142 'kylechui/nvim-surround', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
143 config = function() require('nvim-surround').setup() end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
144 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
145 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
146 'windwp/nvim-autopairs', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
147 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
148 local npairs = require 'nvim-autopairs' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
149 local Rule = require 'nvim-autopairs.rule' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
150 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
151 local cmp = require 'nvim-autopairs.completion.cmp' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
152 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
153 require('cmp').event:on('confirm_done', cmp.on_confirm_done()) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
154 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
155 npairs.setup { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
156 ignored_next_char = string.gsub([[ [%w%%%'%[%.] ]], '%s+', ''), |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
157 enable_afterquote = false, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
158 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
159 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
160 npairs.add_rules { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
161 Rule(' ', ' '):with_pair(function(opts) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
162 local pair = opts.line:sub(opts.col - 1, opts.col) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
163 return vim.tbl_contains({ '()', '[]', '{}' }, pair) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
164 end), |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
165 Rule('( ', ' )') |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
166 :with_pair(function() return false end) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
167 :with_move(function(opts) return opts.prev_char:match '.%)' ~= nil end) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
168 :use_key ')', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
169 Rule('{ ', ' }') |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
170 :with_pair(function() return false end) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
171 :with_move(function(opts) return opts.prev_char:match '.%}' ~= nil end) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
172 :use_key '}', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
173 Rule('[ ', ' ]') |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
174 :with_pair(function() return false end) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
175 :with_move(function(opts) return opts.prev_char:match '.%]' ~= nil end) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
176 :use_key ']', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
177 } |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
178 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
179 npairs.get_rule('`'):with_pair(function() return vim.bo.filetype ~= 'systemverilog' end) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
180 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
181 npairs.get_rule("'")[1]:with_pair(function() return vim.bo.filetype ~= 'systemverilog' end) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
182 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
183 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
184 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
185 -- Moving around within lines |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
186 { 'wellle/targets.vim', event = 'InsertEnter *' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
187 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
188 -- Search |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
189 -- Opening files |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
190 { 'wsdjeg/vim-fetch' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
191 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
192 -- session management |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
193 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
194 'folke/persistence.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
195 event = 'BufReadPre', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
196 config = function() require('persistence').setup() end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
197 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
198 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
199 -- Indent lines |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
200 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
201 'lukas-reineke/indent-blankline.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
202 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
203 vim.g.indent_blankline_buftype_exclude = { 'terminal', 'help', 'nofile' } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
204 vim.g.indent_blankline_show_first_indent_level = false |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
205 vim.g.indent_blankline_char = '│' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
206 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
207 }, |
487
0252f9494d64
Remove deferred loading of packer plugins
Zeger Van de Vannet <zegervdv@me.com>
parents:
486
diff
changeset
|
208 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
209 -- Increment/decrement |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
210 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
211 'zegervdv/nrpattern.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
212 branch = 'lua', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
213 dependencies = 'tpope/vim-repeat', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
214 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
215 local nrpattern = require 'nrpattern' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
216 local defaults = require 'nrpattern.default' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
217 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
218 defaults[{ 'input', 'output' }] = { priority = 12, filetypes = { 'verilog', 'systemverilog' } } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
219 defaults[{ "'1", "'0" }] = { priority = 9, filetypes = { 'verilog', 'systemverilog' } } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
220 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
221 nrpattern.setup(defaults) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
222 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
223 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
224 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
225 -- Tmux |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
226 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
227 'numtostr/navigator.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
228 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
229 require('Navigator').setup { auto_save = 'current', disable_on_zoom = true } |
487
0252f9494d64
Remove deferred loading of packer plugins
Zeger Van de Vannet <zegervdv@me.com>
parents:
486
diff
changeset
|
230 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
231 local nmap = function(lhs, rhs, opts) return vim.keymap.set('n', lhs, rhs, opts) end |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
232 nmap('<c-h>', require('Navigator').left, { silent = true }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
233 nmap('<c-j>', require('Navigator').down, { silent = true }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
234 nmap('<c-k>', require('Navigator').up, { silent = true }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
235 nmap('<c-l>', require('Navigator').right, { silent = true }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
236 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
237 }, |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
238 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
239 -- Keymap help |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
240 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
241 'folke/which-key.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
242 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
243 require('which-key').setup { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
244 plugins = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
245 spelling = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
246 enabled = true, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
247 suggestions = 20, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
248 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
249 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
250 triggers = { '<leader>', 'g', '<c-w>', '"', '`', 'z' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
251 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
252 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
253 }, |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
254 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
255 -- Completion/snippets/LSP |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
256 { 'neovim/nvim-lspconfig' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
257 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
258 'hrsh7th/nvim-cmp', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
259 dependencies = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
260 'hrsh7th/cmp-buffer', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
261 'hrsh7th/cmp-nvim-lsp', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
262 'saadparwaiz1/cmp_luasnip', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
263 'hrsh7th/cmp-path', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
264 'hrsh7th/cmp-cmdline', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
265 'hrsh7th/cmp-nvim-lsp-signature-help', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
266 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
267 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
268 local cmp = require 'cmp' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
269 local luasnip = require 'luasnip' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
270 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
271 local has_words_before = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
272 local line, col = unpack(vim.api.nvim_win_get_cursor(0)) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
273 return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
274 end |
482 | 275 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
276 cmp.setup { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
277 snippet = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
278 expand = function(args) luasnip.lsp_expand(args.body) end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
279 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
280 mapping = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
281 ['<C-p>'] = { i = cmp.mapping.select_prev_item() }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
282 ['<C-n>'] = { i = cmp.mapping.select_next_item() }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
283 ['<C-d>'] = { i = cmp.mapping.scroll_docs(-4) }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
284 ['<C-y>'] = { i = cmp.mapping.complete() }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
285 ['<C-e>'] = { i = cmp.mapping.close() }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
286 ['<CR>'] = { i = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace } }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
287 ['<C-k>'] = { i = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace } }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
288 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
289 sources = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
290 { name = 'nvim_lsp' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
291 { name = 'nvim_lsp_signature_help' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
292 { name = 'buffer', keyword_length = 5 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
293 { name = 'luasnip' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
294 { name = 'path' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
295 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
296 experimental = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
297 native_menu = false, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
298 ghost_text = true, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
299 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
300 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
301 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
302 cmp.setup.cmdline(':', { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
303 mapping = cmp.mapping.preset.cmdline { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
304 ['<C-p>'] = { c = cmp.mapping.select_prev_item() }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
305 ['<C-n>'] = { c = cmp.mapping.select_next_item() }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
306 ['<C-y>'] = { c = cmp.mapping.complete() }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
307 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
308 sources = cmp.config.sources({ |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
309 { name = 'path' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
310 }, { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
311 { name = 'cmdline', keyword_length = 4 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
312 }), |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
313 }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
314 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
315 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
316 { |
762
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
317 'nvim-treesitter/nvim-treesitter', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
318 config = function() |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
319 require 'nvim-treesitter.highlight' |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
320 |
762
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
321 require('nvim-treesitter.configs').setup { |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
322 ensure_installed = { |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
323 'python', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
324 'lua', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
325 'verilog', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
326 'json', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
327 'yaml', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
328 'bash', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
329 'dockerfile', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
330 'c', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
331 'cpp', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
332 'regex', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
333 'markdown', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
334 'rst', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
335 'beancount', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
336 }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
337 indent = { |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
338 enable = false, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
339 }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
340 highlight = { |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
341 enable = true, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
342 disable = { 'systemverilog', 'verilog' }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
343 }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
344 incremental_selection = { |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
345 enable = true, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
346 keymaps = { |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
347 init_selection = 'gnn', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
348 node_incremental = 'grn', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
349 scope_incremental = 'grc', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
350 node_decremental = 'grm', |
734
485de5dc7ef2
feat: configure fold/folder icons for diffview
zegervdv <zegervdv@me.com>
parents:
733
diff
changeset
|
351 }, |
762
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
352 }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
353 refactor = { |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
354 highlight_definitions = { enable = true }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
355 smart_rename = { enable = true, keymaps = { smart_rename = 'gsr' } }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
356 navigation = { |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
357 enable = true, |
762
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
358 keymaps = { goto_definition = 'gnd', list_definitions = 'gnD' }, |
734
485de5dc7ef2
feat: configure fold/folder icons for diffview
zegervdv <zegervdv@me.com>
parents:
733
diff
changeset
|
359 }, |
762
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
360 }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
361 textobjects = { |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
362 move = { |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
363 enable = true, |
762
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
364 goto_next_start = { [']]'] = '@block.outer' }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
365 goto_previous_start = { ['[['] = '@block.outer' }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
366 goto_next_end = { [']['] = '@block.outer' }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
367 goto_previous_end = { ['[]'] = '@block.outer' }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
368 }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
369 select = { |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
370 enable = true, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
371 lookahead = true, |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
372 keymaps = { |
762
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
373 ['af'] = '@function.outer', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
374 ['if'] = '@function.inner', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
375 ['ab'] = '@block.outer', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
376 ['ib'] = '@block.inner', |
715
28900bda2334
feat: enable 4 way diff in diffview
zegervdv <zegervdv@me.com>
parents:
714
diff
changeset
|
377 }, |
28900bda2334
feat: enable 4 way diff in diffview
zegervdv <zegervdv@me.com>
parents:
714
diff
changeset
|
378 }, |
762
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
379 }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
380 playground = { enable = true, disable = {}, updatetime = 25, persist_queries = false }, |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
381 } |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
382 end, |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
383 }, |
762
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
384 'nvim-treesitter/nvim-treesitter-refactor', |
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
385 'nvim-treesitter/nvim-treesitter-textobjects', |
763
04b8d569ff9d
fix: use cmd to lazy load on command
zegervdv <zegervdv@me.com>
parents:
762
diff
changeset
|
386 { 'nvim-treesitter/playground', cmd = 'TSPlaygroundToggle' }, |
778
405ff835995a
feat: enable autosnippets for luasnip
zegervdv <zegervdv@me.com>
parents:
777
diff
changeset
|
387 { 'L3MON4D3/luasnip', config = function() require('luasnip').setup { enable_autosnippets = true } end }, |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
388 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
389 'rmagatti/goto-preview', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
390 config = function() require('goto-preview').setup {} end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
391 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
392 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
393 'jose-elias-alvarez/null-ls.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
394 dependencies = 'nvim-lua/plenary.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
395 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
396 { 'folke/neodev.nvim', version = '2.5.x' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
397 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
398 'smjonas/inc-rename.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
399 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
400 require('inc_rename').setup { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
401 post_hook = function(result) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
402 local changed = {} |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
403 for uri, changes in pairs(result.changes or result.documentChanges) do |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
404 local bufnr = vim.uri_to_bufnr(uri) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
405 for _, edits in ipairs(changes) do |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
406 table.insert(changed, { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
407 bufnr = bufnr, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
408 lnum = edits.range.start.line + 1, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
409 col = edits.range.start.character + 1, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
410 text = vim.api.nvim_buf_get_lines(bufnr, edits.range.start.line, edits.range.start.line + 1, false)[1], |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
411 }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
412 end |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
413 end |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
414 vim.fn.setqflist(changed, 'r') |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
415 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
416 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
417 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
418 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
419 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
420 'joechrisellis/lsp-format-modifications.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
421 dependencies = { 'nvim-lua/plenary.nvim' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
422 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
423 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
424 'vigoux/notifier.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
425 config = function() require('notifier').setup { status_width = 70 } end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
426 }, |
739 | 427 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
428 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
429 'ThePrimeagen/refactoring.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
430 dependencies = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
431 'nvim-lua/plenary.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
432 'nvim-treesitter/nvim-treesitter', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
433 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
434 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
435 local refactoring = require 'refactoring' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
436 local wk = require 'which-key' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
437 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
438 refactoring.setup {} |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
439 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
440 wk.register { ['<leader>r'] = { name = 'Refactoring' } } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
441 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
442 local maps = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
443 { mode = 'v', key = 'e', name = 'Extract Function' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
444 { mode = 'v', key = 'f', name = 'Extract Function To File' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
445 { mode = 'v', key = 'v', name = 'Extract Variable' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
446 { mode = 'v', key = 'i', name = 'Inline Variable' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
447 { mode = 'n', key = 'b', name = 'Extract Block' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
448 { mode = 'n', key = 'bf', name = 'Extract Block To File' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
449 { mode = 'n', key = 'i', name = 'Inline Variable' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
450 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
451 for _, map in ipairs(maps) do |
739 | 452 vim.keymap.set( |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
453 map.mode, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
454 '<leader>r' .. map.key, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
455 function() refactoring.refactor(map.name) end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
456 { desc = map.name, silent = true, expr = false } |
739 | 457 ) |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
458 end |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
459 vim.keymap.set( |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
460 'n', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
461 '<leader>rpp', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
462 function() refactoring.debug.printf { below = false } end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
463 { desc = 'Add debug print statement', silent = true } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
464 ) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
465 vim.keymap.set( |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
466 'n', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
467 '<leader>rpv', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
468 function() refactoring.debug.print_var { normal = true } end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
469 { desc = 'Print variable', silent = true } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
470 ) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
471 vim.keymap.set( |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
472 'v', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
473 '<leader>rpv', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
474 function() refactoring.debug.print_var() end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
475 { desc = 'Print variable', silent = true } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
476 ) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
477 vim.keymap.set( |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
478 'n', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
479 '<leader>rpc', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
480 function() refactoring.debug.cleanup {} end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
481 { desc = 'Clean up debug prints', silent = true } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
482 ) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
483 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
484 }, |
746
cc66c8f2d548
feat: replace vim-grepper with fzf-lua and some mappings
zegervdv <zegervdv@me.com>
parents:
744
diff
changeset
|
485 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
486 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
487 'ibhagwan/fzf-lua', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
488 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
489 local fzf = require 'fzf-lua' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
490 fzf.setup { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
491 winopts = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
492 border = 'single', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
493 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
494 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
495 fzf.register_ui_select() |
746
cc66c8f2d548
feat: replace vim-grepper with fzf-lua and some mappings
zegervdv <zegervdv@me.com>
parents:
744
diff
changeset
|
496 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
497 local grep_opts = function(pattern) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
498 local utils = require 'fzf-lua.utils' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
499 local config = require 'fzf-lua.config' |
746
cc66c8f2d548
feat: replace vim-grepper with fzf-lua and some mappings
zegervdv <zegervdv@me.com>
parents:
744
diff
changeset
|
500 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
501 local args = utils.input 'rg opts> ' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
502 local rg_opts = config.globals.grep.rg_opts .. ' ' .. args |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
503 local opts = config.normalize_opts({ rg_opts = rg_opts }, config.globals.grep) |
746
cc66c8f2d548
feat: replace vim-grepper with fzf-lua and some mappings
zegervdv <zegervdv@me.com>
parents:
744
diff
changeset
|
504 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
505 opts.search = pattern |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
506 fzf.live_grep(opts) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
507 end |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
508 local get_selected_word = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
509 local start_pos = vim.fn.getpos "'[" |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
510 local end_pos = vim.fn.getpos "']" |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
511 local start_line = math.min(start_pos[2], end_pos[2]) - 1 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
512 local end_line = math.max(start_pos[2], end_pos[2]) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
513 local start_col = math.min(start_pos[3], end_pos[3]) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
514 local end_col = math.max(start_pos[3], end_pos[3]) |
746
cc66c8f2d548
feat: replace vim-grepper with fzf-lua and some mappings
zegervdv <zegervdv@me.com>
parents:
744
diff
changeset
|
515 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
516 local line = vim.api.nvim_buf_get_lines(0, start_line, end_line, true) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
517 return line[1]:sub(start_col, end_col) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
518 end |
746
cc66c8f2d548
feat: replace vim-grepper with fzf-lua and some mappings
zegervdv <zegervdv@me.com>
parents:
744
diff
changeset
|
519 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
520 vim.keymap.set({ 'n' }, '<leader>fg', function() grep_opts() end, { desc = 'Live grep prompting for options' }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
521 vim.keymap.set({ 'n' }, '<leader>ff', function() fzf.files() end, { desc = 'Search for files' }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
522 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
523 function _G.__live_grep(motion) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
524 local word = get_selected_word() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
525 fzf.live_grep { search = word } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
526 end |
620 | 527 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
528 vim.keymap.set({ 'x', 'n' }, 'gs', function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
529 vim.o.operatorfunc = 'v:lua.__live_grep' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
530 return 'g@' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
531 end, { expr = true, desc = 'Live grep for word' }) |
487
0252f9494d64
Remove deferred loading of packer plugins
Zeger Van de Vannet <zegervdv@me.com>
parents:
486
diff
changeset
|
532 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
533 function _G.__live_grep_opts(motion) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
534 local word = get_selected_word() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
535 grep_opts(word) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
536 end |
706 | 537 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
538 vim.keymap.set({ 'x', 'n' }, 'gt', function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
539 vim.o.operatorfunc = 'v:lua.__live_grep_opts' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
540 return 'g@' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
541 end, { expr = true, desc = 'Live grep for word with options' }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
542 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
543 }, |
605
2828b29de182
switch to heirline as status line
zegervdv <zegervdv@me.com>
parents:
604
diff
changeset
|
544 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
545 { 'vimjas/vim-python-pep8-indent', ft = { 'python' } }, |
487
0252f9494d64
Remove deferred loading of packer plugins
Zeger Van de Vannet <zegervdv@me.com>
parents:
486
diff
changeset
|
546 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
547 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
548 'rebelot/heirline.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
549 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
550 local utils = require 'heirline.utils' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
551 local conditions = require 'heirline.conditions' |
706 | 552 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
553 local colors |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
554 if os.getenv 'DARKMODE' then |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
555 colors = require('catppuccin.palettes').get_palette 'macchiato' |
765
d6e944feec8d
feat: update light colorscheme settings
zegervdv <zegervdv@me.com>
parents:
764
diff
changeset
|
556 colors.diag_warn = utils.get_highlight('DiagnosticSignWarn').fg |
d6e944feec8d
feat: update light colorscheme settings
zegervdv <zegervdv@me.com>
parents:
764
diff
changeset
|
557 colors.diag_error = utils.get_highlight('DiagnosticSignError').fg |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
558 else |
765
d6e944feec8d
feat: update light colorscheme settings
zegervdv <zegervdv@me.com>
parents:
764
diff
changeset
|
559 colors = { |
d6e944feec8d
feat: update light colorscheme settings
zegervdv <zegervdv@me.com>
parents:
764
diff
changeset
|
560 blue = '#2f6f9f', |
d6e944feec8d
feat: update light colorscheme settings
zegervdv <zegervdv@me.com>
parents:
764
diff
changeset
|
561 green = '#73b00a', |
d6e944feec8d
feat: update light colorscheme settings
zegervdv <zegervdv@me.com>
parents:
764
diff
changeset
|
562 orange = '#e9a700', |
d6e944feec8d
feat: update light colorscheme settings
zegervdv <zegervdv@me.com>
parents:
764
diff
changeset
|
563 diag_warn = '#e9a700', |
d6e944feec8d
feat: update light colorscheme settings
zegervdv <zegervdv@me.com>
parents:
764
diff
changeset
|
564 diag_error = '#f93232', |
d6e944feec8d
feat: update light colorscheme settings
zegervdv <zegervdv@me.com>
parents:
764
diff
changeset
|
565 } |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
566 end |
487
0252f9494d64
Remove deferred loading of packer plugins
Zeger Van de Vannet <zegervdv@me.com>
parents:
486
diff
changeset
|
567 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
568 require('heirline').load_colors(colors) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
569 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
570 local align = { provider = '%=' } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
571 local space = { provider = ' ' } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
572 local lbound = { provider = '▊ ', hl = { fg = 'blue', bg = 'bg' } } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
573 local rbound = { provider = ' ▊', hl = { fg = 'blue', bg = 'bg' } } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
574 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
575 local FileNameBlock = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
576 init = function(self) self.filename = vim.api.nvim_buf_get_name(0) end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
577 } |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
578 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
579 local FileName = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
580 provider = function(self) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
581 local filename = vim.fn.fnamemodify(self.filename, ':.') |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
582 if filename == '' then return '[No Name]' end |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
583 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
584 if not conditions.width_percent_below(#filename, 0.25) then filename = vim.fn.pathshorten(filename) end |
609 | 585 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
586 return filename |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
587 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
588 hl = { fg = 'blue' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
589 } |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
590 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
591 local FileFlags = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
592 { |
605
2828b29de182
switch to heirline as status line
zegervdv <zegervdv@me.com>
parents:
604
diff
changeset
|
593 provider = function() |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
594 if vim.bo.modified then return ' [+]' end |
487
0252f9494d64
Remove deferred loading of packer plugins
Zeger Van de Vannet <zegervdv@me.com>
parents:
486
diff
changeset
|
595 end, |
605
2828b29de182
switch to heirline as status line
zegervdv <zegervdv@me.com>
parents:
604
diff
changeset
|
596 hl = { fg = 'green' }, |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
597 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
598 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
599 provider = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
600 if not vim.bo.modifiable or vim.bo.readonly then return ' RO' end |
706 | 601 end, |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
602 hl = { fg = 'orange' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
603 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
604 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
605 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
606 FileNameBlock = utils.insert(FileNameBlock, FileName, unpack(FileFlags), { provider = '%<' }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
607 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
608 local Ruler = { provider = '%l : %c %P' } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
609 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
610 local Lsp = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
611 condition = conditions.lsp_attached, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
612 update = { 'LspAttach', 'LspDetach' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
613 provider = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
614 local names = {} |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
615 for _, server in pairs(vim.lsp.get_active_clients { bufnr = 0 }) do |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
616 table.insert(names, server.name) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
617 end |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
618 return table.concat(names, ', ') |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
619 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
620 hl = { fg = 'green' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
621 } |
605
2828b29de182
switch to heirline as status line
zegervdv <zegervdv@me.com>
parents:
604
diff
changeset
|
622 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
623 local Diagnostics = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
624 condition = conditions.has_diagnostics, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
625 init = function(self) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
626 self.errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
627 self.warnings = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
628 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
629 update = { 'DiagnosticChanged', 'BufEnter' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
630 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
631 provider = function(self) return self.errors > 0 and self.errors .. ' ' end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
632 hl = { fg = 'diag_error' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
633 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
634 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
635 provider = function(self) return self.warnings > 0 and self.warnings .. ' ' end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
636 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
637 hl = { fg = 'diag_warn' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
638 on_click = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
639 callback = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
640 local diagnostics = vim.diagnostic.get(0, { severity = { min = vim.diagnostic.severity.WARN } }) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
641 vim.fn.setqflist(vim.diagnostic.toqflist(diagnostics)) |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
642 vim.cmd.copen { mods = { split = 'botright' } } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
643 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
644 name = 'heirline_diagnostics', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
645 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
646 } |
725
624d8036f5ae
feat: add window number to inactive window and a mapping to select it
zegervdv <zegervdv@me.com>
parents:
724
diff
changeset
|
647 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
648 local Window = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
649 provider = function() return '- ' .. vim.api.nvim_win_get_number(0) .. ' -' end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
650 hl = { fg = 'blue' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
651 } |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
652 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
653 local statusline_default = { lbound, FileNameBlock, align, Diagnostics, Lsp, space, Ruler, rbound } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
654 local statusline_inactive = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
655 condition = function() return not conditions.is_active() end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
656 lbound, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
657 FileNameBlock, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
658 align, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
659 Window, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
660 rbound, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
661 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
662 local statusline = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
663 fallthrough = false, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
664 hl = { bg = 'bg' }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
665 statusline_inactive, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
666 statusline_default, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
667 } |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
668 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
669 require('heirline').setup { statusline = statusline } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
670 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
671 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
672 |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
673 -- File navigation |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
674 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
675 'elihunter173/dirbuf.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
676 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
677 require('dirbuf').setup { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
678 hash_padding = 2, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
679 show_hidden = true, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
680 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
681 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
682 }, |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
683 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
684 -- Colorscheme |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
685 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
686 'zegervdv/espresso-tutti-colori.nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
687 cond = not os.getenv 'DARKMODE', |
761
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
688 dev = true, |
765
d6e944feec8d
feat: update light colorscheme settings
zegervdv <zegervdv@me.com>
parents:
764
diff
changeset
|
689 config = function() vim.cmd.colorscheme 'espresso_tutti_colori' end, |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
690 priority = 1000, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
691 lazy = false, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
692 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
693 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
694 'catppuccin/nvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
695 name = 'catppuccin', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
696 cond = not not os.getenv 'DARKMODE', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
697 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
698 require('catppuccin').setup { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
699 flavour = 'macchiato', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
700 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
701 vim.cmd.colorscheme 'catppuccin-macchiato' |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
702 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
703 priority = 1000, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
704 lazy = false, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
705 }, |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
706 |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
707 -- Integration with external tools |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
708 { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
709 'glacambre/firenvim', |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
710 build = function() vim.fn['firenvim#install'](0) end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
711 config = function() |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
712 vim.g.firenvim_config = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
713 localSettings = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
714 ['.*'] = { |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
715 takeover = 'never', |
582 | 716 }, |
760
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
717 }, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
718 } |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
719 end, |
b64652ec91cb
feat: migrate to lazy.nvim plugin manager
zegervdv <zegervdv@me.com>
parents:
757
diff
changeset
|
720 }, |
761
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
721 }, { |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
722 dev = { |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
723 path = '~/Projects', |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
724 fallback = true, |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
725 }, |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
726 ui = { |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
727 icons = { |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
728 cmd = '⌘', |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
729 config = '🛠', |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
730 event = '📅', |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
731 ft = '📂', |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
732 init = '⚙', |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
733 keys = '🗝', |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
734 plugin = '🔌', |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
735 runtime = '💻', |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
736 source = '📄', |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
737 start = '🚀', |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
738 task = '📌', |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
739 lazy = '💤 ', |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
740 }, |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
741 }, |
ec5b57266af2
feat: add lazy-lock.json as a symlink
zegervdv <zegervdv@me.com>
parents:
760
diff
changeset
|
742 }) |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
743 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
744 -- Configuration |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
745 vim.opt.backspace = { 'indent', 'eol', 'start' } -- Backspace everything |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
746 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
747 vim.opt.autoread = true -- Read changed files |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
748 vim.opt.hidden = true -- Allow to move away from modified files |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
749 vim.opt.autowriteall = true -- Write changes when losing focus |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
750 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
751 -- Visuals |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
752 vim.opt.number = true |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
753 vim.opt.relativenumber = true |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
754 vim.opt.scrolloff = 4 |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
755 vim.opt.showcmd = true -- Show incomplete commands while typing |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
756 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
757 vim.opt.termguicolors = true |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
758 vim.opt.background = 'dark' |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
759 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
760 vim.opt.showmatch = true -- Highligh matching braces |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
761 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
762 vim.opt.wrap = true -- Wrap lines |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
763 vim.opt.wrapmargin = 2 -- Stay 2 chars from side |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
764 vim.opt.textwidth = 79 |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
765 vim.opt.colorcolumn = '81' -- Show indication of 81 chars |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
766 vim.opt.linebreak = true -- Smarter wrapping |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
767 vim.opt.breakindent = true -- Indent wrapped lines to same level |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
768 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
769 vim.opt.fixendofline = true -- Add EOL when missing |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
770 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
771 vim.opt.expandtab = true -- Add spaces when pressing tab |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
772 vim.opt.tabstop = 2 -- Tab is 2 spaces |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
773 vim.opt.shiftwidth = 2 -- Shift per 2 spaces |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
774 vim.opt.shiftround = true -- Round shifts to allign (1 space + tab = 2 spaces) |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
775 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
776 -- Searching and substitute |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
777 vim.opt.magic = true -- Enable regexes |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
778 vim.opt.hlsearch = true -- Highlight all matches |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
779 vim.opt.incsearch = true -- Show matches while typing |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
780 vim.opt.ignorecase = true |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
781 vim.opt.smartcase = true -- When search pattern contains cases, be case sensitive |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
782 vim.opt.gdefault = true -- Use global flag for substitute: replace all matches on line |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
783 vim.opt.inccommand = 'nosplit' -- Show live replacements directly in text |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
784 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
785 vim.opt.autoindent = true |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
786 vim.opt.cindent = true -- C-syntax based indenting |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
787 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
788 vim.opt.updatetime = 300 -- Faster triggering of CursorHold events |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
789 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
790 vim.opt.errorbells = false -- Don't you beep to me |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
791 vim.opt.title = false -- Don't set the shell title |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
792 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
793 vim.opt.history = 1000 -- Remember last commands |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
794 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
795 vim.opt.wildmenu = true -- Command completion |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
796 vim.opt.wildmode = 'longest:full,full' |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
797 vim.opt.shortmess:append 'c' -- Hide ins-completion messages |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
798 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
799 vim.opt.ttyfast = true -- fast terminal |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
800 vim.opt.lazyredraw = true |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
801 vim.opt.ttimeoutlen = -1 -- Minimum timeout |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
802 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
803 vim.opt.diffopt:append 'iwhite' -- Ignore whitespace in diffs |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
804 vim.opt.diffopt:append 'internal' -- Internal diff engine |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
805 vim.opt.diffopt:append 'algorithm:patience' -- Use patience algorithm |
775
951fb526b510
feat: enable new linematch diffopt
zegervdv <zegervdv@me.com>
parents:
765
diff
changeset
|
806 vim.opt.diffopt:append 'linematch:60' -- Second order diff to align lines |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
807 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
808 vim.opt.tags = { '.git/tags', 'tags' } |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
809 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
810 vim.opt.path:append '**' -- Recursively search current directory |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
811 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
812 vim.opt.formatoptions = { |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
813 c = true, -- Wrap comments |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
814 r = true, -- Continue comments |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
815 o = true, -- Insert comment with o/O |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
816 q = true, -- Format comments with gq |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
817 n = true, -- Indent numbered lists |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
818 [2] = true, -- Indent from 2nd line of paragraph |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
819 [1] = true, -- Don't break before one letter words |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
820 } |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
821 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
822 vim.opt.signcolumn = 'yes' -- Always show signcolumn |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
823 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
824 vim.opt.cursorline = true |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
825 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
826 vim.opt.startofline = false -- When moving try to keep cursor in column |
543
15d6c097f1c9
set nostartofline to keep cursor in same column when scrolling
zegervdv <zegervdv@me.com>
parents:
541
diff
changeset
|
827 |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
828 -- Show certain characters |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
829 vim.opt.list = true |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
830 vim.opt.listchars = { trail = '·', extends = '>', precedes = '<', nbsp = '+', tab = '▸ ' } |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
831 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
832 vim.opt.sessionoptions:remove 'options' -- Remove options from saved sessions (reload from config) |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
833 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
834 vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
835 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
836 vim.opt.splitright = true -- Open new splits to right |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
837 vim.opt.virtualedit = 'block' -- Enable block editting |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
838 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
839 vim.opt.conceallevel = 0 -- Disable conceal |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
840 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
841 vim.opt.pastetoggle = '<F2>' -- Enable paste mode |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
842 |
648
c5ed13440614
Set and optionally create backup and undo dirs
zegervdv <zegervdv@me.com>
parents:
646
diff
changeset
|
843 local optdir = function(path) |
c5ed13440614
Set and optionally create backup and undo dirs
zegervdv <zegervdv@me.com>
parents:
646
diff
changeset
|
844 local Path = require 'plenary.path' |
c5ed13440614
Set and optionally create backup and undo dirs
zegervdv <zegervdv@me.com>
parents:
646
diff
changeset
|
845 local full_path = Path:new(vim.fn.stdpath 'cache' .. '/' .. path) |
c5ed13440614
Set and optionally create backup and undo dirs
zegervdv <zegervdv@me.com>
parents:
646
diff
changeset
|
846 if not full_path:exists() then full_path:mkdir { parents = true } end |
c5ed13440614
Set and optionally create backup and undo dirs
zegervdv <zegervdv@me.com>
parents:
646
diff
changeset
|
847 return full_path .. '//' |
c5ed13440614
Set and optionally create backup and undo dirs
zegervdv <zegervdv@me.com>
parents:
646
diff
changeset
|
848 end |
c5ed13440614
Set and optionally create backup and undo dirs
zegervdv <zegervdv@me.com>
parents:
646
diff
changeset
|
849 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
850 vim.opt.undofile = true -- Persistently remember undos |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
851 vim.opt.undolevels = 1000 |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
852 vim.opt.undodir = optdir 'undo' |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
853 vim.opt.swapfile = false -- Disable swap files |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
854 vim.opt.backup = true -- Keep backups |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
855 vim.opt.backupdir = optdir 'backup' |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
856 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
857 -- Files to ignore from completion |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
858 vim.opt.wildignore:append { |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
859 '*/tmp/*', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
860 '*.so', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
861 '*.swp', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
862 '*.zip', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
863 '*.o', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
864 '*.bin', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
865 '*.elf', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
866 '*.hex', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
867 '*.eps', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
868 '.git/*', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
869 '*.dup', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
870 '.hg/**', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
871 '*.orig', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
872 '*.*~', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
873 } |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
874 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
875 vim.opt.mouse = { |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
876 n = true, -- Normal mode |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
877 i = true, -- Insert mode |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
878 c = true, -- Commandline mode |
738
d63750fc240f
feat: enable visual selection with mouse
zegervdv <zegervdv@me.com>
parents:
737
diff
changeset
|
879 v = true, -- Visual mode |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
880 } |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
881 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
882 vim.opt.fillchars:append { |
606 | 883 diff = '╱', |
884 } | |
885 | |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
886 vim.opt.jumpoptions:append { 'view' } |
633
9f040a50eac8
add view to jumpoptions to preserve view when mark was set
zegervdv <zegervdv@me.com>
parents:
632
diff
changeset
|
887 |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
888 vim.opt.foldmethod = 'expr' |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
889 vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
890 vim.opt.foldnestmax = 3 |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
891 vim.opt.foldminlines = 1 |
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
892 vim.opt.foldtext = |
463 | 893 [[substitute(getline(v:foldstart),'\\t',repeat('\ ',&tabstop),'g').'...'.trim(getline(v:foldend)) . ' (' . (v:foldend - v:foldstart + 1) . ' lines)']] |
726
2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
zegervdv <zegervdv@me.com>
parents:
725
diff
changeset
|
894 vim.opt.foldenable = false |
463 | 895 |
616 | 896 function _G.qftf(info) |
897 local items | |
898 local ret = {} | |
899 if info.quickfix == 1 then | |
762
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
900 items = vim.fn.getqflist({ id = info.id, items = 0 }).items |
616 | 901 else |
762
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
902 items = vim.fn.getloclist(info.winid, { id = info.id, items = 0 }).items |
616 | 903 end |
904 local limit = 31 | |
905 local fnameFmt1, fnameFmt2 = '%-' .. limit .. 's', '…%.' .. (limit - 1) .. 's' | |
906 local validFmt = '%s │%5d:%-3d│%s %s' | |
907 for i = info.start_idx, info.end_idx do | |
908 local e = items[i] | |
909 local fname = '' | |
910 local str | |
911 if e.valid == 1 then | |
912 if e.bufnr > 0 then | |
762
67df970646c1
fix: clean up after lazy migration
zegervdv <zegervdv@me.com>
parents:
761
diff
changeset
|
913 fname = vim.fn.bufname(e.bufnr) |
616 | 914 if fname == '' then |
915 fname = '[No Name]' | |
916 else | |
917 fname = fname:gsub('^' .. vim.env.HOME, '~') | |
918 end | |
919 -- char in fname may occur more than 1 width, ignore this issue in order to keep performance | |
920 if #fname <= limit then | |
921 fname = fnameFmt1:format(fname) | |
922 else | |
923 fname = fnameFmt2:format(fname:sub(1 - limit)) | |
924 end | |
925 end | |
926 local lnum = e.lnum > 99999 and -1 or e.lnum | |
927 local col = e.col > 999 and -1 or e.col | |
928 local qtype = e.type == '' and '' or ' ' .. e.type:sub(1, 1):upper() | |
929 str = validFmt:format(fname, lnum, col, qtype, e.text) | |
930 else | |
931 str = e.text | |
932 end | |
933 table.insert(ret, str) | |
934 end | |
935 return ret | |
936 end | |
937 | |
938 vim.o.qftf = '{info -> v:lua._G.qftf(info)}' | |
939 | |
520
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
940 -- Clean up terminal codes from strings |
600
24b0dd06381b
Enable collapsed statements for stylua
Zeger Van de Vannet <zegervdv@me.com>
parents:
599
diff
changeset
|
941 local t = function(str) return vim.api.nvim_replace_termcodes(str, true, true, true) end |
520
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
942 |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
943 -- General keymaps |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
944 local map = vim.keymap.set |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
945 |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
946 -- Move while in insert mode |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
947 map('i', '<C-f>', '<right>') |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
948 |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
949 -- Keep search matches centered |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
950 map('n', 'n', 'nzzzv') |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
951 map('n', 'N', 'Nzzzv') |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
952 |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
953 -- Very magic search patterns |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
954 map({ 'n', 'v' }, '/', '/\\v') |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
955 |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
956 -- Move through long lines as breaks |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
957 map('n', 'j', '(v:count ? "j" : "gj")', { expr = true }) |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
958 map('n', 'k', '(v:count ? "k" : "gk")', { expr = true }) |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
959 |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
960 -- Command line search for commands |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
961 map('c', '<c-n>', '<down>') |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
962 map('c', '<c-p>', '<up>') |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
963 |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
964 -- Clear highlighs |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
965 map('n', '<leader>l', '<cmd>noh<CR>', { silent = true }) |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
966 |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
967 -- Reselect last selection |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
968 map('n', 'gV', '`[v`]') |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
969 |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
970 -- Use backspace as normal in visual mode |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
971 map('v', '<BS>', 'x', { remap = true }) |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
972 |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
973 -- Keep selection when indenting |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
974 local keep_visual_selection = function(cmd) |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
975 return function() |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
976 vim.opt.smartindent = false |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
977 if vim.fn.mode() == 'V' then |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
978 return cmd .. t ':set smartindent<CR>gv' |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
979 else |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
980 return cmd .. t ':set smartindent<CR>' |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
981 end |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
982 end |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
983 end |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
984 map('v', '>', keep_visual_selection '>', { expr = true, silent = true, desc = 'Indent right while keeping selection' }) |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
985 map('v', '<', keep_visual_selection '<', { expr = true, silent = true, desc = 'Indent left while keeping selection' }) |
f845e2eba7e3
Use new keymap lua function to set keymaps
zegervdv <zegervdv@me.com>
parents:
519
diff
changeset
|
986 |
574
8b04d5ffd210
Clean up unused functions and mappings
zegervdv <zegervdv@me.com>
parents:
570
diff
changeset
|
987 -- Do not move on * |
8b04d5ffd210
Clean up unused functions and mappings
zegervdv <zegervdv@me.com>
parents:
570
diff
changeset
|
988 map('n', '*', function() |
8b04d5ffd210
Clean up unused functions and mappings
zegervdv <zegervdv@me.com>
parents:
570
diff
changeset
|
989 local view = vim.fn.winsaveview() |
613 | 990 vim.cmd.normal { '*', bang = true } |
574
8b04d5ffd210
Clean up unused functions and mappings
zegervdv <zegervdv@me.com>
parents:
570
diff
changeset
|
991 vim.fn.winrestview(view) |
599
1def7efdc619
Add trouble.nvim for diagnostics overview
Zeger Van de Vannet <zegervdv@me.com>
parents:
594
diff
changeset
|
992 end, { |
1def7efdc619
Add trouble.nvim for diagnostics overview
Zeger Van de Vannet <zegervdv@me.com>
parents:
594
diff
changeset
|
993 silent = true, |
1def7efdc619
Add trouble.nvim for diagnostics overview
Zeger Van de Vannet <zegervdv@me.com>
parents:
594
diff
changeset
|
994 desc = 'Search word under cursor without moving to first results', |
1def7efdc619
Add trouble.nvim for diagnostics overview
Zeger Van de Vannet <zegervdv@me.com>
parents:
594
diff
changeset
|
995 }) |
574
8b04d5ffd210
Clean up unused functions and mappings
zegervdv <zegervdv@me.com>
parents:
570
diff
changeset
|
996 |
627 | 997 map('x', 'p', [[ p:if v:register == '"'<Bar>let @@=@0<Bar>endif<CR> ]], { silent = true }) |
998 | |
574
8b04d5ffd210
Clean up unused functions and mappings
zegervdv <zegervdv@me.com>
parents:
570
diff
changeset
|
999 map('n', '<UP>', ':cprev<CR>', { desc = 'Go to previous error/match' }) |
8b04d5ffd210
Clean up unused functions and mappings
zegervdv <zegervdv@me.com>
parents:
570
diff
changeset
|
1000 map('n', '<DOWN>', ':cnext<CR>', { desc = 'Go to next error/match' }) |
8b04d5ffd210
Clean up unused functions and mappings
zegervdv <zegervdv@me.com>
parents:
570
diff
changeset
|
1001 map('n', '<LEFT>', ':cpf<CR>', { desc = 'Go to previous error/match in previous file' }) |
8b04d5ffd210
Clean up unused functions and mappings
zegervdv <zegervdv@me.com>
parents:
570
diff
changeset
|
1002 map('n', '<RIGHT>', ':cnf<CR>', { desc = 'Go to next error/match in next file' }) |
8b04d5ffd210
Clean up unused functions and mappings
zegervdv <zegervdv@me.com>
parents:
570
diff
changeset
|
1003 |
627 | 1004 map('t', '<C-h>', '<C-\\><C-n><C-w>h') |
1005 map('t', '<C-j>', '<C-\\><C-n><C-w>j') | |
1006 map('t', '<C-k>', '<C-\\><C-n><C-w>k') | |
1007 map('t', '<C-l>', '<C-\\><C-n><C-w>l') | |
1008 | |
1009 map('c', '<CR>', function() | |
1010 local cmdline = vim.fn.getcmdline() | |
1011 if cmdline == 'ls' or cmdline == 'buffers' or cmdline == 'files' then return '<CR>:b' end | |
1012 return '<CR>' | |
1013 end, { expr = true }) | |
1014 | |
732
18a9b8ccddc3
feat: map escape to clean up screen in normal mode
zegervdv <zegervdv@me.com>
parents:
731
diff
changeset
|
1015 -- Clean up screen |
18a9b8ccddc3
feat: map escape to clean up screen in normal mode
zegervdv <zegervdv@me.com>
parents:
731
diff
changeset
|
1016 map('n', '<ESC>', function() |
18a9b8ccddc3
feat: map escape to clean up screen in normal mode
zegervdv <zegervdv@me.com>
parents:
731
diff
changeset
|
1017 vim.cmd.nohlsearch() |
18a9b8ccddc3
feat: map escape to clean up screen in normal mode
zegervdv <zegervdv@me.com>
parents:
731
diff
changeset
|
1018 vim.cmd.cclose() |
18a9b8ccddc3
feat: map escape to clean up screen in normal mode
zegervdv <zegervdv@me.com>
parents:
731
diff
changeset
|
1019 vim.cmd.lclose() |
18a9b8ccddc3
feat: map escape to clean up screen in normal mode
zegervdv <zegervdv@me.com>
parents:
731
diff
changeset
|
1020 end, { desc = 'Clean up screen' }) |
18a9b8ccddc3
feat: map escape to clean up screen in normal mode
zegervdv <zegervdv@me.com>
parents:
731
diff
changeset
|
1021 |
627 | 1022 -- Special highlighting |
1023 vim.cmd.match { 'ErrorMsg', [[ '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' ]] } | |
1024 | |
489 | 1025 local au = require 'au' |
1026 | |
1027 -- Highlight yanked text | |
600
24b0dd06381b
Enable collapsed statements for stylua
Zeger Van de Vannet <zegervdv@me.com>
parents:
599
diff
changeset
|
1028 au.TextYankPost = function() vim.highlight.on_yank { timeout = 120 } end |
489 | 1029 |
1030 -- Automatic cursorline | |
1031 au.group('cline', { | |
1032 { | |
1033 'WinEnter', | |
1034 '*', | |
620 | 1035 function() |
1036 if vim.bo.buftype ~= 'nofile' then vim.opt_local.cursorline = true end | |
1037 end, | |
489 | 1038 }, |
1039 { | |
1040 'WinLeave', | |
1041 '*', | |
600
24b0dd06381b
Enable collapsed statements for stylua
Zeger Van de Vannet <zegervdv@me.com>
parents:
599
diff
changeset
|
1042 function() vim.opt_local.cursorline = false end, |
489 | 1043 }, |
1044 }) | |
1045 | |
1046 -- Save files on focus lost | |
1047 au.FocusLost = function() | |
613 | 1048 if not vim.o.readonly and vim.api.nvim_buf_get_name(0) ~= '' then vim.cmd.wa() end |
489 | 1049 end |
1050 | |
1051 -- Equalize splits after resizing | |
1052 au.VimResized = [[ exe "normal! \<c-w>=" ]] | |
1053 | |
1054 -- Reload diffs after editing | |
1055 au.BufWritePost = function() | |
613 | 1056 if vim.o.diff then vim.cmd.diffupdate() end |
489 | 1057 end |
1058 | |
691 | 1059 -- Open file at last position |
1060 au.BufReadPost = function() | |
1061 if vim.bo.filetype ~= 'gitcommit' and vim.fn.line '\'"' > 0 and vim.fn.line '\'"' <= vim.fn.line '$' then | |
1062 vim.cmd.normal { 'g`"', bang = true } | |
1063 end | |
1064 end | |
1065 | |
1066 -- Remove netrw buffers | |
1067 au.FileType = { 'netrw', 'setlocal bufhidden=delete' } | |
1068 | |
696
22efd3b888f8
feat: enable spellchecking for select filetypes
zegervdv <zegervdv@me.com>
parents:
691
diff
changeset
|
1069 -- Enable spelling |
22efd3b888f8
feat: enable spellchecking for select filetypes
zegervdv <zegervdv@me.com>
parents:
691
diff
changeset
|
1070 au.FileType = { { 'python', 'systemverilog', 'verilog', 'txt', 'lua' }, function() vim.opt_local.spell = true end } |
22efd3b888f8
feat: enable spellchecking for select filetypes
zegervdv <zegervdv@me.com>
parents:
691
diff
changeset
|
1071 |
627 | 1072 -- Terminal |
1073 au.group('enter_term', { | |
1074 { 'TermOpen', '*', 'startinsert!' }, | |
1075 { | |
1076 'BufEnter', | |
1077 '*', | |
1078 function() | |
1079 if vim.bo.buftype == 'terminal' then vim.cmd.startinsert { bang = true } end | |
1080 end, | |
1081 }, | |
1082 { | |
1083 'BufLeave', | |
1084 '*', | |
1085 function() | |
1086 if vim.bo.buftype == 'terminal' then vim.cmd.stopinsert { bang = true } end | |
1087 end, | |
1088 }, | |
1089 }) | |
1090 | |
691 | 1091 -- Color number categories in reports and logs |
1092 au({ 'BufNewFile', 'BufRead', 'BufEnter' }, { | |
1093 '*.rpt,*.log', | |
1094 function() | |
1095 vim.cmd.syntax { 'match', 'String', [["\v<\d{1,3}>"]] } | |
1096 vim.cmd.syntax { 'match', 'Statement', [["\v<\d{4,6}>"]] } | |
1097 vim.cmd.syntax { 'match', 'Function', [["\v<\d{7,9}>"]] } | |
1098 | |
1099 vim.cmd.syntax { 'match', 'Number', [["\v<0+>"]] } | |
1100 | |
1101 vim.cmd.syntax { 'match', 'Error', [["\v\c^error:"]] } | |
1102 | |
1103 vim.wo.wrap = false | |
1104 end, | |
1105 }) | |
1106 | |
688
6e98364a5a28
chore: convert chezmoi autocmds to lua
zegervdv <zegervdv@me.com>
parents:
665
diff
changeset
|
1107 -- Apply changes in chezmoi managed files |
6e98364a5a28
chore: convert chezmoi autocmds to lua
zegervdv <zegervdv@me.com>
parents:
665
diff
changeset
|
1108 au.group('chezmoi', { |
6e98364a5a28
chore: convert chezmoi autocmds to lua
zegervdv <zegervdv@me.com>
parents:
665
diff
changeset
|
1109 { 'BufWritePost', os.getenv 'HOME' .. '/.local/share/chezmoi/*', 'silent !chezmoi apply --source-path %' }, |
6e98364a5a28
chore: convert chezmoi autocmds to lua
zegervdv <zegervdv@me.com>
parents:
665
diff
changeset
|
1110 { |
6e98364a5a28
chore: convert chezmoi autocmds to lua
zegervdv <zegervdv@me.com>
parents:
665
diff
changeset
|
1111 'BufWritePost', |
6e98364a5a28
chore: convert chezmoi autocmds to lua
zegervdv <zegervdv@me.com>
parents:
665
diff
changeset
|
1112 os.getenv 'HOME' .. '/.local/share/chezmoi/.chezmoitemplates/init.lua', |
6e98364a5a28
chore: convert chezmoi autocmds to lua
zegervdv <zegervdv@me.com>
parents:
665
diff
changeset
|
1113 'silent !chezmoi apply --source-path $HOME/.local/share/chezmoi/dot_config/nvim/init.lua.tmpl', |
6e98364a5a28
chore: convert chezmoi autocmds to lua
zegervdv <zegervdv@me.com>
parents:
665
diff
changeset
|
1114 }, |
6e98364a5a28
chore: convert chezmoi autocmds to lua
zegervdv <zegervdv@me.com>
parents:
665
diff
changeset
|
1115 }) |
6e98364a5a28
chore: convert chezmoi autocmds to lua
zegervdv <zegervdv@me.com>
parents:
665
diff
changeset
|
1116 |
558 | 1117 -- Snippets |
1118 local ls = require 'luasnip' | |
1119 -- Expand snippet or jump to next placeholder | |
1120 vim.keymap.set({ 'i', 's' }, '<c-k>', function() | |
741
aef7dab2b0e5
feat: only jump snippets if inside one
zegervdv <zegervdv@me.com>
parents:
740
diff
changeset
|
1121 if ls.expand_or_locally_jumpable() then ls.expand_or_jump() end |
561
6f07ecae3810
Create Ag command in config step
Zeger Van de Vannet <zegervdv@me.com>
parents:
560
diff
changeset
|
1122 end, { |
6f07ecae3810
Create Ag command in config step
Zeger Van de Vannet <zegervdv@me.com>
parents:
560
diff
changeset
|
1123 silent = true, |
6f07ecae3810
Create Ag command in config step
Zeger Van de Vannet <zegervdv@me.com>
parents:
560
diff
changeset
|
1124 }) |
558 | 1125 |
1126 -- Go back to previous placeholder | |
1127 vim.keymap.set({ 'i', 's' }, '<c-j>', function() | |
600
24b0dd06381b
Enable collapsed statements for stylua
Zeger Van de Vannet <zegervdv@me.com>
parents:
599
diff
changeset
|
1128 if ls.jumpable(-1) then ls.jump(-1) end |
561
6f07ecae3810
Create Ag command in config step
Zeger Van de Vannet <zegervdv@me.com>
parents:
560
diff
changeset
|
1129 end, { |
6f07ecae3810
Create Ag command in config step
Zeger Van de Vannet <zegervdv@me.com>
parents:
560
diff
changeset
|
1130 silent = true, |
6f07ecae3810
Create Ag command in config step
Zeger Van de Vannet <zegervdv@me.com>
parents:
560
diff
changeset
|
1131 }) |
558 | 1132 |
1133 -- Toggle options in snippets | |
1134 vim.keymap.set('i', '<c-l>', function() | |
600
24b0dd06381b
Enable collapsed statements for stylua
Zeger Van de Vannet <zegervdv@me.com>
parents:
599
diff
changeset
|
1135 if ls.choice_active() then ls.change_choice() end |
558 | 1136 end) |
1137 | |
724
e442bbd36b87
feat: copy current file path relative to repo root and line nr to clipboard
zegervdv <zegervdv@me.com>
parents:
722
diff
changeset
|
1138 -- Copy the current file and line number |
e442bbd36b87
feat: copy current file path relative to repo root and line nr to clipboard
zegervdv <zegervdv@me.com>
parents:
722
diff
changeset
|
1139 -- inspired by https://github.com/diegoulloao/nvim-file-location |
e442bbd36b87
feat: copy current file path relative to repo root and line nr to clipboard
zegervdv <zegervdv@me.com>
parents:
722
diff
changeset
|
1140 vim.keymap.set('n', '<leader>cp', function() |
e442bbd36b87
feat: copy current file path relative to repo root and line nr to clipboard
zegervdv <zegervdv@me.com>
parents:
722
diff
changeset
|
1141 local Path = require 'plenary.path' |
e442bbd36b87
feat: copy current file path relative to repo root and line nr to clipboard
zegervdv <zegervdv@me.com>
parents:
722
diff
changeset
|
1142 local current_file = Path:new(vim.fn.expand '%') |
e442bbd36b87
feat: copy current file path relative to repo root and line nr to clipboard
zegervdv <zegervdv@me.com>
parents:
722
diff
changeset
|
1143 local root = |
e442bbd36b87
feat: copy current file path relative to repo root and line nr to clipboard
zegervdv <zegervdv@me.com>
parents:
722
diff
changeset
|
1144 vim.fs.dirname(vim.fs.find({ '.hg', '.git' }, { path = tostring(current_file:parent()), upward = true })[1]) |
e442bbd36b87
feat: copy current file path relative to repo root and line nr to clipboard
zegervdv <zegervdv@me.com>
parents:
722
diff
changeset
|
1145 local current_line = vim.fn.line '.' |
e442bbd36b87
feat: copy current file path relative to repo root and line nr to clipboard
zegervdv <zegervdv@me.com>
parents:
722
diff
changeset
|
1146 require('osc52').copy(current_file:make_relative(root) .. ':' .. current_line) |
e442bbd36b87
feat: copy current file path relative to repo root and line nr to clipboard
zegervdv <zegervdv@me.com>
parents:
722
diff
changeset
|
1147 vim.notify 'Copied file path and line number' |
e442bbd36b87
feat: copy current file path relative to repo root and line nr to clipboard
zegervdv <zegervdv@me.com>
parents:
722
diff
changeset
|
1148 end, { desc = 'Yank current path and line number' }) |
e442bbd36b87
feat: copy current file path relative to repo root and line nr to clipboard
zegervdv <zegervdv@me.com>
parents:
722
diff
changeset
|
1149 |
725
624d8036f5ae
feat: add window number to inactive window and a mapping to select it
zegervdv <zegervdv@me.com>
parents:
724
diff
changeset
|
1150 -- Navigate between open windows |
624d8036f5ae
feat: add window number to inactive window and a mapping to select it
zegervdv <zegervdv@me.com>
parents:
724
diff
changeset
|
1151 for i = 1, 6 do |
624d8036f5ae
feat: add window number to inactive window and a mapping to select it
zegervdv <zegervdv@me.com>
parents:
724
diff
changeset
|
1152 vim.keymap.set('n', '<leader>' .. i, i .. '<c-w>w', { desc = 'Go to window ' .. i }) |
624d8036f5ae
feat: add window number to inactive window and a mapping to select it
zegervdv <zegervdv@me.com>
parents:
724
diff
changeset
|
1153 end |
624d8036f5ae
feat: add window number to inactive window and a mapping to select it
zegervdv <zegervdv@me.com>
parents:
724
diff
changeset
|
1154 |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1155 -- LSP config |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1156 local lsp = require 'lspconfig' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1157 local null_ls = require 'null-ls' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1158 |
690
424764c7f51a
feat: disable autoformatting, force null-ls formatting in some cases
zegervdv <zegervdv@me.com>
parents:
688
diff
changeset
|
1159 local lsp_formatting = function(bufnr) |
424764c7f51a
feat: disable autoformatting, force null-ls formatting in some cases
zegervdv <zegervdv@me.com>
parents:
688
diff
changeset
|
1160 vim.lsp.buf.format { |
424764c7f51a
feat: disable autoformatting, force null-ls formatting in some cases
zegervdv <zegervdv@me.com>
parents:
688
diff
changeset
|
1161 filter = function(client) |
424764c7f51a
feat: disable autoformatting, force null-ls formatting in some cases
zegervdv <zegervdv@me.com>
parents:
688
diff
changeset
|
1162 local force_null_ls = { 'lua', 'beancount' } |
424764c7f51a
feat: disable autoformatting, force null-ls formatting in some cases
zegervdv <zegervdv@me.com>
parents:
688
diff
changeset
|
1163 if vim.tbl_contains(force_null_ls, vim.bo.filetype) then return client.name == 'null-ls' end |
424764c7f51a
feat: disable autoformatting, force null-ls formatting in some cases
zegervdv <zegervdv@me.com>
parents:
688
diff
changeset
|
1164 return true |
424764c7f51a
feat: disable autoformatting, force null-ls formatting in some cases
zegervdv <zegervdv@me.com>
parents:
688
diff
changeset
|
1165 end, |
424764c7f51a
feat: disable autoformatting, force null-ls formatting in some cases
zegervdv <zegervdv@me.com>
parents:
688
diff
changeset
|
1166 bufnr = bufnr, |
424764c7f51a
feat: disable autoformatting, force null-ls formatting in some cases
zegervdv <zegervdv@me.com>
parents:
688
diff
changeset
|
1167 } |
424764c7f51a
feat: disable autoformatting, force null-ls formatting in some cases
zegervdv <zegervdv@me.com>
parents:
688
diff
changeset
|
1168 end |
424764c7f51a
feat: disable autoformatting, force null-ls formatting in some cases
zegervdv <zegervdv@me.com>
parents:
688
diff
changeset
|
1169 |
718
451632dcb1dd
feat: add lsp-format-modifications
zegervdv <zegervdv@me.com>
parents:
716
diff
changeset
|
1170 local on_attach = function(client, bufnr) |
600
24b0dd06381b
Enable collapsed statements for stylua
Zeger Van de Vannet <zegervdv@me.com>
parents:
599
diff
changeset
|
1171 local nmap = function(lhs, rhs, opts) return vim.keymap.set('n', lhs, rhs, opts) end |
462
676d7ef5fecb
Use tagfunc to query LSP for definitions
zegervdv <zegervdv@me.com>
parents:
460
diff
changeset
|
1172 |
722
20256729c355
fix: use current bufnr for formatting
zegervdv <zegervdv@me.com>
parents:
720
diff
changeset
|
1173 local opts = { silent = true, buffer = bufnr } |
20256729c355
fix: use current bufnr for formatting
zegervdv <zegervdv@me.com>
parents:
720
diff
changeset
|
1174 |
20256729c355
fix: use current bufnr for formatting
zegervdv <zegervdv@me.com>
parents:
720
diff
changeset
|
1175 nmap('gp', require('goto-preview').goto_preview_definition, opts) |
20256729c355
fix: use current bufnr for formatting
zegervdv <zegervdv@me.com>
parents:
720
diff
changeset
|
1176 nmap('gP', require('goto-preview').close_all_win, opts) |
462
676d7ef5fecb
Use tagfunc to query LSP for definitions
zegervdv <zegervdv@me.com>
parents:
460
diff
changeset
|
1177 |
722
20256729c355
fix: use current bufnr for formatting
zegervdv <zegervdv@me.com>
parents:
720
diff
changeset
|
1178 nmap('gd', vim.lsp.buf.declaration, opts) |
20256729c355
fix: use current bufnr for formatting
zegervdv <zegervdv@me.com>
parents:
720
diff
changeset
|
1179 nmap('K', vim.lsp.buf.hover, opts) |
20256729c355
fix: use current bufnr for formatting
zegervdv <zegervdv@me.com>
parents:
720
diff
changeset
|
1180 nmap('gD', vim.lsp.buf.implementation, opts) |
20256729c355
fix: use current bufnr for formatting
zegervdv <zegervdv@me.com>
parents:
720
diff
changeset
|
1181 nmap('1gD', vim.lsp.buf.type_definition, opts) |
20256729c355
fix: use current bufnr for formatting
zegervdv <zegervdv@me.com>
parents:
720
diff
changeset
|
1182 nmap('gr', vim.lsp.buf.references, opts) |
20256729c355
fix: use current bufnr for formatting
zegervdv <zegervdv@me.com>
parents:
720
diff
changeset
|
1183 nmap('g0', vim.lsp.buf.document_symbol, opts) |
20256729c355
fix: use current bufnr for formatting
zegervdv <zegervdv@me.com>
parents:
720
diff
changeset
|
1184 nmap('ga', vim.lsp.buf.code_action, opts) |
513 | 1185 |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1186 vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' }) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1187 vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' }) |
718
451632dcb1dd
feat: add lsp-format-modifications
zegervdv <zegervdv@me.com>
parents:
716
diff
changeset
|
1188 |
757 | 1189 if client.name == 'lua_ls' then |
729
58fc7cc955d1
feat: disable sumneko formatting
zegervdv <zegervdv@me.com>
parents:
728
diff
changeset
|
1190 client.server_capabilities.documentFormattingProvider = false |
58fc7cc955d1
feat: disable sumneko formatting
zegervdv <zegervdv@me.com>
parents:
728
diff
changeset
|
1191 client.server_capabilities.documentRangeFormattingProvider = false |
58fc7cc955d1
feat: disable sumneko formatting
zegervdv <zegervdv@me.com>
parents:
728
diff
changeset
|
1192 end |
58fc7cc955d1
feat: disable sumneko formatting
zegervdv <zegervdv@me.com>
parents:
728
diff
changeset
|
1193 |
718
451632dcb1dd
feat: add lsp-format-modifications
zegervdv <zegervdv@me.com>
parents:
716
diff
changeset
|
1194 if client.supports_method 'textDocument/rangeFormatting' then |
451632dcb1dd
feat: add lsp-format-modifications
zegervdv <zegervdv@me.com>
parents:
716
diff
changeset
|
1195 local root = vim.fs.find({ '.git', '.hg' }, { path = client.config.root_dir }) |
451632dcb1dd
feat: add lsp-format-modifications
zegervdv <zegervdv@me.com>
parents:
716
diff
changeset
|
1196 local vcs = 'git' |
782
31605398117a
fix: handle opening files not under vcs
zegervdv <zegervdv@me.com>
parents:
778
diff
changeset
|
1197 if root and #root > 0 then vcs = vim.fs.basename(root[1]):sub(2) end |
718
451632dcb1dd
feat: add lsp-format-modifications
zegervdv <zegervdv@me.com>
parents:
716
diff
changeset
|
1198 |
451632dcb1dd
feat: add lsp-format-modifications
zegervdv <zegervdv@me.com>
parents:
716
diff
changeset
|
1199 vim.notify('Enabled modification formatting via ' .. vcs .. ' using ' .. client.name, vim.log.levels.INFO) |
451632dcb1dd
feat: add lsp-format-modifications
zegervdv <zegervdv@me.com>
parents:
716
diff
changeset
|
1200 local lsp_format_modifications = require 'lsp-format-modifications' |
719
08baa6419e7d
fix: pass vcs config to format-modifications attach function
zegervdv <zegervdv@me.com>
parents:
718
diff
changeset
|
1201 lsp_format_modifications.attach(client, bufnr, { format_on_save = false, vcs = vcs }) |
722
20256729c355
fix: use current bufnr for formatting
zegervdv <zegervdv@me.com>
parents:
720
diff
changeset
|
1202 nmap('<c-p>', function() lsp_format_modifications.format_modifications_current_buffer() end, opts) |
718
451632dcb1dd
feat: add lsp-format-modifications
zegervdv <zegervdv@me.com>
parents:
716
diff
changeset
|
1203 elseif client.supports_method 'textDocument/formatting' then |
722
20256729c355
fix: use current bufnr for formatting
zegervdv <zegervdv@me.com>
parents:
720
diff
changeset
|
1204 nmap('<c-p>', function() lsp_formatting(bufnr) end, opts) |
718
451632dcb1dd
feat: add lsp-format-modifications
zegervdv <zegervdv@me.com>
parents:
716
diff
changeset
|
1205 end |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1206 end |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1207 |
704
c78a2c1388e9
fix: update cmp-nvim-lsp capabilities config
zegervdv <zegervdv@me.com>
parents:
703
diff
changeset
|
1208 local capabilities = require('cmp_nvim_lsp').default_capabilities() |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1209 capabilities.textDocument.completion.completionItem.snippetSupport = true |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1210 capabilities.textDocument.completion.completionItem.resolveSupport = { |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1211 properties = { |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1212 'documentation', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1213 'detail', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1214 'additionalTextEdits', |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1215 }, |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1216 } |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1217 |
532
e932c2076dba
Add esbonio language server for sphinx docs
Zeger Van de Vannet <zegervdv@me.com>
parents:
529
diff
changeset
|
1218 local root_dir = require('lspconfig.util').root_pattern('.git', '.hg') |
e932c2076dba
Add esbonio language server for sphinx docs
Zeger Van de Vannet <zegervdv@me.com>
parents:
529
diff
changeset
|
1219 |
e932c2076dba
Add esbonio language server for sphinx docs
Zeger Van de Vannet <zegervdv@me.com>
parents:
529
diff
changeset
|
1220 lsp.pyright.setup { on_attach = on_attach, capabilities = capabilities, root_dir = root_dir } |
646 | 1221 lsp.bashls.setup { on_attach = on_attach, capabilities = capabilities } |
532
e932c2076dba
Add esbonio language server for sphinx docs
Zeger Van de Vannet <zegervdv@me.com>
parents:
529
diff
changeset
|
1222 |
e932c2076dba
Add esbonio language server for sphinx docs
Zeger Van de Vannet <zegervdv@me.com>
parents:
529
diff
changeset
|
1223 lsp.esbonio.setup { |
e932c2076dba
Add esbonio language server for sphinx docs
Zeger Van de Vannet <zegervdv@me.com>
parents:
529
diff
changeset
|
1224 on_attach = on_attach, |
e932c2076dba
Add esbonio language server for sphinx docs
Zeger Van de Vannet <zegervdv@me.com>
parents:
529
diff
changeset
|
1225 capabilities = capabilities, |
e932c2076dba
Add esbonio language server for sphinx docs
Zeger Van de Vannet <zegervdv@me.com>
parents:
529
diff
changeset
|
1226 root_dir = root_dir, |
e932c2076dba
Add esbonio language server for sphinx docs
Zeger Van de Vannet <zegervdv@me.com>
parents:
529
diff
changeset
|
1227 -- Assume esbonio is installed with --user |
579 | 1228 cmd = { home .. '/.local/bin/esbonio' }, |
532
e932c2076dba
Add esbonio language server for sphinx docs
Zeger Van de Vannet <zegervdv@me.com>
parents:
529
diff
changeset
|
1229 } |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1230 |
581 | 1231 lsp.clangd.setup { |
1232 on_attach = on_attach, | |
1233 capabilities = capabilities, | |
1234 root_dir = root_dir, | |
1235 } | |
1236 | |
638 | 1237 local bean_file = os.getenv 'BEAN_FILE' |
1238 if bean_file then | |
1239 lsp.beancount.setup { | |
1240 on_attach = on_attach, | |
1241 capabilities = capabilities, | |
1242 root_dir = root_dir, | |
1243 init_options = { | |
1244 journal_file = bean_file, | |
1245 }, | |
1246 } | |
1247 local helpers = require 'null-ls.helpers' | |
1248 local bean_format = { | |
1249 name = 'bean-format', | |
1250 filetypes = { 'beancount' }, | |
1251 method = null_ls.methods.FORMATTING, | |
1252 generator = helpers.formatter_factory { | |
1253 command = 'bean-format', | |
1254 args = { '-w', '80' }, | |
1255 to_stdin = true, | |
1256 }, | |
1257 } | |
1258 null_ls.register { bean_format } | |
1259 end | |
1260 | |
512
fc7a15e47e72
update null-ls config to remove lspconfig dependency
zegervdv <zegervdv@me.com>
parents:
511
diff
changeset
|
1261 null_ls.setup { |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1262 sources = { |
607
9a7fe4a97873
wrap lines at 100 chars with black
Zeger Van de Vannet <zegervdv@me.com>
parents:
606
diff
changeset
|
1263 null_ls.builtins.formatting.black.with { extra_args = { '--line-length', '100' } }, |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1264 null_ls.builtins.formatting.stylua, |
623
5cceedc51955
Add cbfmt and markdown/rst tree sitters
zegervdv <zegervdv@me.com>
parents:
622
diff
changeset
|
1265 null_ls.builtins.formatting.cbfmt, |
502 | 1266 null_ls.builtins.diagnostics.shellcheck, |
509
80b42722bfa8
Add prettier formatting to null-ls
zegervdv <zegervdv@me.com>
parents:
503
diff
changeset
|
1267 null_ls.builtins.formatting.prettier, |
622 | 1268 null_ls.builtins.code_actions.gitrebase, |
730 | 1269 null_ls.builtins.hover.printenv, |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1270 }, |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1271 on_attach = on_attach, |
512
fc7a15e47e72
update null-ls config to remove lspconfig dependency
zegervdv <zegervdv@me.com>
parents:
511
diff
changeset
|
1272 root_dir = require('null-ls.utils').root_pattern('.hg', '.git', 'stylua.toml'), |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1273 } |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1274 |
713
45c34cfecc3e
feat: enable full neodev options in chezmoi folder
zegervdv <zegervdv@me.com>
parents:
706
diff
changeset
|
1275 require('neodev').setup { |
45c34cfecc3e
feat: enable full neodev options in chezmoi folder
zegervdv <zegervdv@me.com>
parents:
706
diff
changeset
|
1276 override = function(root_dir, options) |
751
04683b4f8df3
fix: handle chezmoi directory after neodev updates
zegervdv <zegervdv@me.com>
parents:
750
diff
changeset
|
1277 if root_dir:find 'chezmoi' then |
713
45c34cfecc3e
feat: enable full neodev options in chezmoi folder
zegervdv <zegervdv@me.com>
parents:
706
diff
changeset
|
1278 options.enabled = true |
45c34cfecc3e
feat: enable full neodev options in chezmoi folder
zegervdv <zegervdv@me.com>
parents:
706
diff
changeset
|
1279 options.runtime = true |
45c34cfecc3e
feat: enable full neodev options in chezmoi folder
zegervdv <zegervdv@me.com>
parents:
706
diff
changeset
|
1280 options.types = true |
45c34cfecc3e
feat: enable full neodev options in chezmoi folder
zegervdv <zegervdv@me.com>
parents:
706
diff
changeset
|
1281 options.plugins = true |
45c34cfecc3e
feat: enable full neodev options in chezmoi folder
zegervdv <zegervdv@me.com>
parents:
706
diff
changeset
|
1282 end |
45c34cfecc3e
feat: enable full neodev options in chezmoi folder
zegervdv <zegervdv@me.com>
parents:
706
diff
changeset
|
1283 end, |
45c34cfecc3e
feat: enable full neodev options in chezmoi folder
zegervdv <zegervdv@me.com>
parents:
706
diff
changeset
|
1284 } |
749 | 1285 |
757 | 1286 lsp.lua_ls.setup { |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1287 lspconfig = { |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1288 cmd = { 'lua-language-server' }, |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1289 on_attach = on_attach, |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1290 capabilities = capabilities, |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1291 settings = { |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1292 Lua = { |
703
50c025a59b95
fix: update lua-dev to neodev config
zegervdv <zegervdv@me.com>
parents:
702
diff
changeset
|
1293 completion = { |
50c025a59b95
fix: update lua-dev to neodev config
zegervdv <zegervdv@me.com>
parents:
702
diff
changeset
|
1294 callSnippet = 'Replace', |
50c025a59b95
fix: update lua-dev to neodev config
zegervdv <zegervdv@me.com>
parents:
702
diff
changeset
|
1295 }, |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1296 }, |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1297 }, |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1298 }, |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1299 } |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1300 |
466
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1301 vim.diagnostic.config { |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1302 underline = true, |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1303 update_in_insert = false, |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1304 virtual_text = { severity = { min = vim.diagnostic.severity.WARN }, source = 'always' }, |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1305 severity_sort = true, |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1306 } |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1307 |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1308 vim.fn.sign_define('DiagnosticSignError', { texthl = 'DiagnosticSignError', linehl = '', numhl = '', text = '▎' }) |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1309 vim.fn.sign_define('DiagnosticSignWarn', { |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1310 texthl = 'DiagnosticSignWarn', |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1311 linehl = '', |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1312 numhl = '', |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1313 text = '▎', |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1314 }) |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1315 vim.fn.sign_define('DiagnosticSignInfo', { |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1316 texthl = 'DiagnosticSignInfo', |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1317 linehl = '', |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1318 numhl = '', |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1319 text = '▎', |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1320 }) |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1321 vim.fn.sign_define('DiagnosticSignHint', { texthl = 'DiagnosticSignHint', linehl = '', numhl = '', text = '▎' }) |
899cded39cd3
Update Diagnostic highlighting after api changes
Zeger Van de Vannet <zegervdv@me.com>
parents:
465
diff
changeset
|
1322 |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1323 -- Try importing local config |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1324 local ok, localconfig = pcall(require, 'localconfig') |
600
24b0dd06381b
Enable collapsed statements for stylua
Zeger Van de Vannet <zegervdv@me.com>
parents:
599
diff
changeset
|
1325 if ok then localconfig.setup { on_attach = on_attach, capabilities = capabilities } end |