neovim

Personal neovim configuration files
git clone git://gtms.dev/neovim
Log | Files | Refs

grep.lua (383B)


      1 vim.cmd [[
      2 function! GrepOperator(type)
      3   if a:type ==# 'v'
      4       normal! `<v`>y
      5   elseif a:type ==# 'char'
      6       normal! `[v`]y
      7   else
      8       return
      9   endif
     10 
     11   silent execute "grep! -F -- " . shellescape(@@)
     12   copen
     13 endfunction
     14 ]]
     15 
     16 vim.keymap.set('n', '<leader>r', ':set operatorfunc=GrepOperator<cr>g@')
     17 vim.keymap.set('v', '<leader>r', ':<c-u>call GrepOperator(visualmode())<cr>')