From 6ec4e28ad6e9bf10e042d4773f742517f2067133 Mon Sep 17 00:00:00 2001 From: fiplox Date: Wed, 21 Jun 2023 17:00:59 +0200 Subject: [PATCH] chore: create cmd the lua way --- lua/config/settings.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/config/settings.lua b/lua/config/settings.lua index 6d3fb56..37f0d41 100644 --- a/lua/config/settings.lua +++ b/lua/config/settings.lua @@ -28,6 +28,7 @@ opt.grepprg = 'rg --vimgrep --no-heading --smart-case --hidden' opt.grepformat = '%f:%l:%c:%m' vim.api.nvim_create_user_command('Cd', 'lcd %:p:h', { nargs = 0 }) +vim.api.nvim_create_user_command('Grep', 'silent grep! | TroubleToggle quickfix', { nargs = '+' }) local ignore_buftype = { 'quickfix', 'nofile', 'help' } local ignore_filetype = { 'gitcommit', 'gitrebase', 'svn', 'hgcommit' } @@ -61,7 +62,7 @@ local function run() if win_last_line == buff_last_line then -- Set line to last line edited vim.cmd [[normal! g`"]] - -- Try to center + -- Try to center elseif buff_last_line - last_line > ((win_last_line - win_first_line) / 2) - 1 then vim.cmd [[normal! g`"zz]] else @@ -74,5 +75,3 @@ vim.api.nvim_create_autocmd({ 'BufWinEnter', 'FileType' }, { group = vim.api.nvim_create_augroup('nvim-lastplace', {}), callback = run, }) - -vim.cmd("command! -nargs=+ Grep execute 'silent grep! ' | copen")