I recently switched to neovim, but ever since my AG usage have acted weird lately. Here is my current .vimrc file.
Here is my neovim init file ~/.config/nvim/init.vim
:
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath=&runtimepath
source ~/.vimrc
let g:python3_host_prog='/Users/abdullah/.pyenv/shims/python3'
let g:python_host_prog='/Users/abdullah/.pyenv/shims/python'
Here are the problems I'm facing:
When I search the current keyword, I get a preview of the results, before actually seeing the results
So suppose I place the cursor ontop of attachClusteredOrders
here
public static function attachClusteredOrders($orders, float $distanceThreshold, int $backtrackDays)
actual behaviour
I get this preview of search results with the prompt to enter a command to continue:
Once I enter Enter, I see this
expected behaviour
I should see the search results directly without having to enter Enter
Note: here is the relevant part from my vimrc on this:
" The Silver Searcher
if executable('ag')
" Use ag over grep
let &grepprg = "ag --nogroup --nocolor --ignore wiki --ignore tags --ignore dist --ignore tests --ignore seeds --ignore migrations -w"
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
" bind K to grep word under cursor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
" command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
" above replaced with
" https://vi.stackexchange.com/a/14939/14510
function! Ag(args) abort
execute "silent! grep!" shellescape(a:args)
cwindow
redraw!
endfunction
When I run my keyboard shortcut to launch AG, nothing happens
actual behaviour
I run my keyboard shortcut to start the AG prompt \ and then I see this
but when I type enter nothing happens. But if I manually type :Ag <query>
and press enter it works just fine!
expected behaviour
The keyboard shortcut should work from the first time
Note: relevant part of my vimrc:
" bind \ (backward slash) to grep shortcut
nnoremap \ :Ag<SPACE>