comparison .chezmoitemplates/init.lua @ 514:f0c94c3f5fd9

Use new user_command api to define commands
author zegervdv <zegervdv@me.com>
date Wed, 29 Dec 2021 11:44:10 +0100
parents 2476af02ba12
children 67a4228c6532
comparison
equal deleted inserted replaced
513:2476af02ba12 514:f0c94c3f5fd9
164 164
165 -- Moving around within lines 165 -- Moving around within lines
166 use { 'wellle/targets.vim', event = 'InsertEnter *' } 166 use { 'wellle/targets.vim', event = 'InsertEnter *' }
167 167
168 -- Searching 168 -- Searching
169 use { 'mhinz/vim-grepper', cmd = { 'Grepper' } } 169 use {
170 'mhinz/vim-grepper',
171 cmd = { 'Grepper', 'Ag' },
172 keys = { { 'n', 'gs' }, { 'x', 'gs' } },
173 config = function()
174 local nmap = vim.keymap.nmap
175 local xmap = vim.keymap.xmap
176
177 vim.g.grepper = {
178 tools = { 'ag', 'hg' },
179 highlight = 1,
180 ag = {
181 grepprg = 'rg --vimgrep',
182 },
183 }
184
185 nmap { 'gs', '<plug>(GrepperOperator)' }
186 xmap { 'gs', '<plug>(GrepperOperator)' }
187 end,
188 setup = function()
189 vim.api.nvim_add_user_command(
190 'Ag',
191 'Grepper -noprompt -tool ag -grepprg rg --vimgrep <args>',
192 { complete = 'file', nargs = '*' }
193 )
194 end,
195 }
170 196
171 -- Keymaps TODO: to be removed when #13823 is merged 197 -- Keymaps TODO: to be removed when #13823 is merged
172 use { 198 use {
173 'tjdevries/astronauta.nvim', 199 'tjdevries/astronauta.nvim',
174 config = function() 200 config = function()
792 end 818 end
793 vim.fn.setqflist(changed, 'r') 819 vim.fn.setqflist(changed, 'r')
794 end) 820 end)
795 end 821 end
796 822
797 vim.cmd [[command! LspRename lua LspRename()]] 823 vim.api.nvim_add_user_command('LspRename', LspRename, {})
798 824
799 vim.diagnostic.config { 825 vim.diagnostic.config {
800 underline = true, 826 underline = true,
801 update_in_insert = false, 827 update_in_insert = false,
802 virtual_text = { severity = { min = vim.diagnostic.severity.WARN }, source = 'always' }, 828 virtual_text = { severity = { min = vim.diagnostic.severity.WARN }, source = 'always' },