Comments (10)
Makes sense. Had to move to another plugin just because of this option.
from ferret.
Recently I switched to CtrlSF. It gives me more options and Edit Mode (which is more user-friendly in most of the cases).
from ferret.
Wow, CtrlSF is pretty impressive.
I'm going to close this for now as it's not a pain point that I feel. If anybody wants to fix it, I think these are the options:
- Use dispatch.vim, which doesn't jump to the first match by default (this is what I do).
- If you don't want to use dispatch.vim, you could patch the
cexpr
call in Ferret to becgetexpr
instead (make it a configuration option if you want), and then useg:FerretQFHandler
to implement any custom behavior that you want (likecopen | wincmd p
or whatever).
I'd be open to pull requests.
from ferret.
I don't remember the code well, but I guess you set 'grepprg'
and 'grepformat'
- if so you'd just have to put an exclamation mark after the final grep
.
from ferret.
Yeah @ntnn, something like that. I quickly hacked a sample up in 47ca7cd to show one way of doing it (too flakey to actually merge). We're using cexpr
under the covers but switching to :grep
would indeed enable a pretty straightforward switch to :grep!
.
from ferret.
Thanks for quick response!
from ferret.
Hello @wincent,
Sorry to bump this closed issue, but is there something we could do to help to get 47ca7cd merged? Sometimes it's annoying to close the current buffer every time I do an :Ack
and the result is not the first one listed.
Thanks for this great project.
from ferret.
@kriansa: yeah, I think we can merge something like that (will need to redo it it no longer applies cleanly). Lots of edge cases to deal with, but it will have to be something like this:
diff --git a/autoload/ferret/private/shared.vim b/autoload/ferret/private/shared.vim
index 14ad5a1..ff1d929 100644
--- a/autoload/ferret/private/shared.vim
+++ b/autoload/ferret/private/shared.vim
@@ -1,19 +1,43 @@
" Copyright 2015-present Greg Hurrell. All rights reserved.
" Licensed under the terms of the BSD 2-clause license.
+" Convenience function to get/sanitize the current g:FerretAutojump setting.
+function! s:autojump()
+ let l:autojump=get(g:, 'FerretAutojump', 1)
+ if l:autojump != 0 && l:autojump != 1 && l:autojump != 2
+ let l:autojump=0
+ endif
+ return l:autojump
+endfunction
+
function! ferret#private#shared#finalize_search(output, ack)
let l:original_errorformat=&errorformat
+ let l:autojump=s:autojump()
+ if a:ack
+ let l:prefix='c' " Will use cexpr, cgetexpr.
+ let l:handler=get(g:, 'FerretQFHandler', 'botright copen')
+ let l:post='qf'
+ else
+ let l:prefix='l' " Will use lexpr, lgetexpr.
+ let l:handler=get(g:, 'FerretLLHandler', 'lopen')
+ let l:post='location'
+ endif
try
let &errorformat=g:FerretFormat
- if a:ack
- call s:swallow('cexpr a:1', a:output)
- execute get(g:, 'FerretQFHandler', 'botright cwindow')
- call ferret#private#post('qf')
+ if l:autojump == 2 " Show listing and jump to first result.
+ call s:swallow(l:prefix . 'expr a:1', a:output)
else
- call s:swallow('lexpr a:1', a:output)
- execute get(g:, 'FerretLLHandler', 'lwindow')
- call ferret#private#post('location')
+ call s:swallow(l:prefix . 'getexpr a:1', a:output)
endif
+ let l:before=winnr()
+ execute l:handler
+ if l:autojump != 1 " Show listing, but don't jump anywhere.
+ let l:after=winnr()
+ if l:before != l:after
+ execute l:before . 'wincmd w'
+ end
+ endif
+ call ferret#private#post(l:post)
finally
let &errorformat=l:original_errorformat
endtry
from ferret.
Ok, so I pushed something to the "next" branch. Will let it bake there for a while before merging to master.
from ferret.
Thank you for your quick response!
from ferret.
Related Issues (20)
- Implement :Lacks, analogous to :Acks but applying to the location-list HOT 3
- ferret make <cword> not working. HOT 4
- allow umap key as feature HOT 1
- FerretAckWord should pass -w option by default HOT 2
- Add a binding to reload the quickfix window
- Autocompleting a directory does not include trailing slash HOT 2
- how to show full path ? HOT 4
- Add a function that prompts for a search query HOT 2
- Port to Lua HOT 3
- Individual overrides HOT 2
- :Black command shadows vim-black :Black (main command) HOT 2
- Case insensitvie search HOT 4
- ripgrep 13.0.0 breaks search in neovim HOT 2
- key mapping HOT 7
- Ferret fails to search string using non ascii character HOT 3
- Ripgrep 13 search stuck when using options in neovim HOT 4
- Delete quickfix/loclist to empty will cause ferret#private#qf_delete error HOT 3
- nvim v0.7.0 error HOT 4
- Tons of duplicate results that don't show up in `rg` HOT 6
- Async not used in Vim HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ferret.