Comments (10)
The vim-rooter plugin does the trick, thanks @danihodovic
from vim-ags.
Currently that's not the case by default. But, you can specify the directory in the command as the last parameter like so :Ags search-term /my/root/dir
. You would have to enter the full path, for example ~/my/dir
would not work.
from vim-ags.
I'm not a vimscript wizard but this seems to be working for me. It searches within a git repo regardless of where your :pwd is.
nnoremap <leader>ag :AgsWrapper
command! -nargs=* -complete=file AgsWrapper call AgsWrapper(<q-args>, '')
" This function wraps :Ags with by providing the git root folder if inside a git repo.
" It also uses -t for ag which seraches inside .gitignore folders
function! AgsWrapper(args, cmd)
let root = systemlist('git rev-parse --show-toplevel')[0]
" If not in a git repo, search from here
if v:shell_error > 0
execute 'Ags' a:args
else
execute 'Ags' a:args l:root '-t'
endif
endfu!
from vim-ags.
Yes I think that will work. But, I'm not sure it should be part of the plugin as it could confuse some people if they are expecting to search within a particular directory. On the other hand I could add it and put it behind an option maybe disabled by default.
from vim-ags.
@gabesoft I don't think so either. I was mostly posting in case someone else runs into the same issue and searches the issues.
I do however think it would be nice to expose an option to do this as per https://github.com/rking/ag.vim#configuration
from vim-ags.
Thanks @dani-h that makes sense. I'll add an option similar to ag.vim
when I get a chance.
from vim-ags.
from vim-ags.
Is this feature request still open?
It would be very useful to have this feature so it's a +1 for me.
from vim-ags.
@atropo You might want to look at https://github.com/airblade/vim-rooter
from vim-ags.
@atropo yes this is still open. I haven't had a chance to work on it. But, it's on my list as soon as other stuff clears up.
from vim-ags.
Related Issues (20)
- What's the difference between this plugin and CtrlSF HOT 1
- How can I return back to SearchView from Edit Mode HOT 1
- Why can't I add lines to the edit view? HOT 1
- Lightline integration on readme HOT 2
- Problems getting search to follow symlinks HOT 4
- replace breaks format
- [Neovim] add async support? HOT 5
- reuse last window behavior HOT 4
- default mapping for next/prev result HOT 2
- Regression for searches with spaces? HOT 2
- Open a file in a new tab HOT 5
- Optionally populate location/quickfix list HOT 3
- Edit mode HOT 3
- [Question] Mapping :Ags HOT 1
- Can't cancel long searches HOT 1
- Can't open files from search results
- Add folding markers
- Search results on new MacBook includes color encodings HOT 1
- file name encoding problem 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 vim-ags.