New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make :Ag not match file names, only the file content #346
Comments
Try this: command! -bang -nargs=* Ag call fzf#vim#ag(<q-args>, {'options': '--delimiter : --nth 4..'}, <bang>0) |
It looks like magic, but works beautifully, thanks @junegunn! |
I'm trying to figure out how to run that command on startup. Any tips? |
Put it in your .vimrc @mbylstra |
|
Is it possible to combine this with my current Ag tweaks? command! -bang -nargs=* Ag
\ call fzf#vim#ag(<q-args>,
\ {'options': '--delimiter : --nth 4..'}, " Can't add this
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ <bang>0)
|
@junegunn could you please help, is it possible to combine preview options with search only by files with Ag? |
So you have to write fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}, 'up:60%') |
@junegunn Thank you so much, you've saved my day! |
@junegunn i used the method you described above but im experiencing some strange behavior. i want to have 2 options:
Im noticing that with my current config, this only works some in some projects, but not others. and on occasion, it will only allow me to use option 2 once in a project, and every time afterwards it goes back to the default behavior. do you have any idea why this is? here is my config:
EDIT: added video to demonstrate issue |
Thanks for this! Can anyone care to explain (briefly) what this exactly does? |
Basically, the If you look at the results of |
Can anyone help me write the equivalent for Ripgrep? This:
Gives me the error |
@danamkaplan I got it working with the following command:
Got that from Line 52 in 359a80e
Ag .
|
Oh just noticed this has also been suggested at #714 (comment) |
Thank's! |
This made my Preview window disappear. How can I bring it back with this options? EDIT command! -bang -nargs=* Ag call fzf#vim#ag(<q-args>, fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}), <bang>0) |
I become bothered by the :Rg command matching filenames in the list of search results returned by ripgrep. It has some uses, but most of the time it makes it harder to find a good match (try searching for 'keybindings' in this repo for example). I've set up three mappings calling different variants of the Rg command: <leader>// : ripgrep results filtered by fzf, not matching filenames <leader>/? : reload ripgrep results when query is updated <leader>/f : call the standard Rg function (with filename matching) Resources: - junegunn/fzf#1109 (comment) - https://github.com/junegunn/fzf.vim#example-rg-command-with-preview-window - https://github.com/junegunn/fzf.vim#example-advanced-ripgrep-integration - junegunn/fzf.vim#346 (comment)
# [4.0.0](v3.0.0...v4.0.0) (2021-03-25) ### Bug Fixes * **arch:** remove opacity digits from xresources ([82fa1b0](82fa1b0)), closes [#dd292d3](https://github.com/eliasnorrby/dotfiles/issues/dd292d3) * **arch:** use correct package for xinput ([c63c076](c63c076)) * **bspwm:** update class used for tmux rule ([a4bd3a3](a4bd3a3)) * **fzf:** change binding for sort toggle ([2f0e0d0](2f0e0d0)) * **fzf:** do not use sudo for yay ([3bfab25](3bfab25)) * **fzf:** fix fuzzy args on MacOS ([5a8f1a1](5a8f1a1)) * **fzf:** source keybindings depending on os ([b3be4c1](b3be4c1)) * **gcloud:** eliminate subshells from env.zsh ([ae66e51](ae66e51)) * **git:** add main to gbpurge exclusion ([55d0b79](55d0b79)) * **intellij:** disable easymotion ([df4830f](df4830f)) * **intellij:** fix windowing on arch ([d497130](d497130)) * **java:** call java version alias separately ([c3b8549](c3b8549)) * **java:** move java aliases to macos block ([ba17866](ba17866)) * **provision:** add check to aur package install ([43efba3](43efba3)) * **provision:** add missing gcloud key root configs ([b5999b3](b5999b3)) * **provision:** fix mktemp spelling ([ac9d1e4](ac9d1e4)) * **provision:** remove do_defaults from setup-linux ([7a14498](7a14498)) * **provision:** set npm prefix in extra-packages ([a329819](a329819)) * **provision:** use coc-nvim's flags on extension install ([076affe](076affe)) * **provision:** use new cask upgrade command ([bc78304](bc78304)) * **scripts:** juggle find arguments ([66350b0](66350b0)) * **ssh:** add macos config file ([ab78e6e](ab78e6e)) * **tmux:** remove load average symbol ([f498251](f498251)) * **vim:** update coc eslint config key ([0d55559](0d55559)) * **work:** patch vpn settings for macos ([8080b21](8080b21)) * **xkb:** add shebang to setup-keybindings.sh ([c2021c9](c2021c9)) * **xkb:** kill xcape before calling ([607cb94](607cb94)) ### Features * **alacritty:** add glyph offsets on arch ([a82c501](a82c501)) * **alacritty:** bind paste ([9b68142](9b68142)) * **alacritty:** create tmux_alacritty wrapper ([622c9f1](622c9f1)) * **alacritty:** make theme setter work on all platforms ([c0ade4a](c0ade4a)) * **alacritty:** make use of alacritty config imports ([6e1dc93](6e1dc93)), closes [#38](#38) * **alacritty:** use ~ for config imports ([31dad08](31dad08)), closes [#38](#38) * **alacritty:** use a brighter bright black ([0a09db3](0a09db3)) * **alacritty:** use mononoki font ([aa384ca](aa384ca)) * **arch:** add additional keyserver ([2d5e09c](2d5e09c)) * **arch:** add focus_or_run script ([eec2ca1](eec2ca1)) * **arch:** add Xresources ([68358be](68358be)) * **arch:** set mouse sensitivity with xinput ([c805c91](c805c91)) * **bspwm:** launch dunst on startup ([f0736d1](f0736d1)) * **bspwm:** open chrome on desktop 6 ([f1015f6](f1015f6)) * **bspwm:** set active color to cyan ([3e04baa](3e04baa)) * **cli:** conditionally link different boomrcs ([8a6c3b1](8a6c3b1)) * **dunst:** add topic config ([b6ce8de](b6ce8de)) * **dunst:** rewrite default config ([b7a8468](b7a8468)) * **feh:** create topic config ([6cfba4d](6cfba4d)) * **fzf:** add pf alias for fuzzy pacman search ([b91bb02](b91bb02)) * **fzf:** enlarge pacman preview window ([71f4043](71f4043)) * **fzf:** filter chromium's history ([941a8fe](941a8fe)) * **fzf:** remove file path completion binding ([1ca4f5c](1ca4f5c)) * **fzf:** source completion ([9afad20](9afad20)) * **picom:** add background blurring ([86a6a3d](86a6a3d)) * **picom:** add shadows ([36a78c7](36a78c7)) * **picom:** enable vsync ([7871c05](7871c05)) * **picom:** experiment with fading ([59a950a](59a950a)) * **picom:** run with --experimental-backends ([d6127a3](d6127a3)) * **picom:** slightly reduce alacritty transparency ([e3fac8a](e3fac8a)) * **picom:** use the glx backend ([5fa0c24](5fa0c24)) * **polybar:** hide polybar in bspwm fullscreen ([545e44a](545e44a)) * **polybar:** modify example config ([95f51db](95f51db)) * **polybar:** update module icons ([a6b999a](a6b999a)) * **provision:** add optional condition to links ([2c8f15f](2c8f15f)) * **provision:** add rename option to topic links ([742657a](742657a)) * **provision:** become for pacman ([4934760](4934760)) * **provision:** install ansible roles in post ([a8d9d8c](a8d9d8c)) * **provision:** install aur packages ([c9cae53](c9cae53)) * **rofi:** add topic config ([1fe4167](1fe4167)) * **rofi:** launch rofi with super + space ([5085388](5085388)) * **rofi:** use dank mono font ([7c06945](7c06945)) * **sxhkd:** focus or run alacritty ([e2e6d21](e2e6d21)) * **sxhkd:** focus or run chromium ([040ff9c](040ff9c)) * **sxhkd:** map hyper + {1-9} to tmux windows ([254af0f](254af0f)) * **tmux:** choose copy tool based on platform ([91a4d50](91a4d50)) * **vim:** make cursorline light blue ([d0560cb](d0560cb)) * **vim:** use unnamedplus for clipboard ([5cd5c30](5cd5c30)) * **vscode:** conditionally set vscode_home ([93cae5f](93cae5f)) * **xkb:** add topic config ([cfa6b7f](cfa6b7f)) * **xkb:** map right alt to hyper key (mod3) ([0c41084](0c41084)) * **zsh:** remove '/' from WORDCHARS ([4b95c63](4b95c63)) * add become key to topic config ([798738f](798738f)) * **alacritty:** use some transparency ([7e42ee5](7e42ee5)) * **arch:** add and autostart dropbox ([659dcd9](659dcd9)) * **arch:** add topic base/arch ([ae6be72](ae6be72)) * **arch:** add topic config ([e191329](e191329)) * **arch:** create wrapper script for spotify ([05faf26](05faf26)), closes [/github.com/baskerville/bspwm/issues/291#issuecomment-145329416](https://github.com//github.com/baskerville/bspwm/issues/291/issues/issuecomment-145329416) * **arch:** enable kafka topic ([c213e5d](c213e5d)) * **arch:** handle focus of withdrawn windows ([afe0962](afe0962)) * **arch:** improve focus_or_run.sh ([0546b90](0546b90)) * **arch:** make aur buider a system user ([ec28d99](ec28d99)) * **bspm:** remove example config defaults ([796b3c4](796b3c4)) * **bspwm:** add 1password desktop rule ([689eac8](689eac8)) * **bspwm:** add checks for dependencies ([47ed18e](47ed18e)) * **bspwm:** add desktop rule for slack ([2eed97a](2eed97a)) * **bspwm:** add intellij desktop rule ([0b0b33e](0b0b33e)) * **bspwm:** add topic config ([07f76be](07f76be)) * **bspwm:** add topic wm/bspwm ([f8a6c2b](f8a6c2b)) * **bspwm:** make use of multiple monitors ([f8126d4](f8126d4)) * **bspwm:** reduce window gap to 10 ([d66c0f5](d66c0f5)) * **bspwm:** update for triple monitor setup ([16d0cfd](16d0cfd)) * **bspwm:** update window rules ([d2a125b](d2a125b)) * **bspwmrc:** configure monitors with xrandr ([01b1ab2](01b1ab2)) * **dotnet:** add lang/dotnet topic ([4decabc](4decabc)) * **dunst:** only show notifications on main monitor ([9db7f7b](9db7f7b)) * **emacs:** set font based on _os ([c1fa2b0](c1fa2b0)) * **fzf:** add fuzzy argument selection ([ebd53b7](ebd53b7)) * **gcloud:** source path and completion ([4568545](4568545)) * **git:** add gl and glnr aliases ([1f83273](1f83273)) * **git:** add gprd function ([641cf78](641cf78)) * **git:** add grv alias ([801f574](801f574)) * **hammerspoon:** add rider app mapping ([72ecb57](72ecb57)) * **hammerspoon:** add umlauts to app mode ([b7c2c04](b7c2c04)) * **intellij:** add compile project mapping ([b654e0c](b654e0c)) * **intellij:** add go mapping for file outline ([bfcde52](bfcde52)) * **intellij:** add hide coverage mapping ([9d74f44](9d74f44)) * **intellij:** add keybinds for navigating changes ([22aae08](22aae08)) * **intellij:** add mapping to create class ([d5fdf21](d5fdf21)) * **intellij:** add mapping to insert semicolon ([bc0e519](bc0e519)) * **intellij:** add mappings for hippie completion ([b651f3f](b651f3f)) * **intellij:** default to no line numbers ([f925564](f925564)) * **intellij:** harmonize ]d / ]e mappings ([66ba046](66ba046)) * **intellij:** map double space to GotoFile ([dd77421](dd77421)) * **intellij:** refine line number toggles ([6adb51f](6adb51f)) * **intellij:** revamp window closing mappings ([c4272d3](c4272d3)) * **intellij:** sort sections alphabetically ([16acda6](16acda6)) * **intellij:** switch to intellij ultimate ([7136da5](7136da5)) * **intellij:** try to mimic unimpaired's ]<space> ([350c5be](350c5be)) * **java:** rework JAVA_HOME env ([6de7264](6de7264)) * **kubernetes:** add aliases.zsh ([c87e801](c87e801)) * **macos:** add balenaetcher ([c350b2e](c350b2e)) * **macos:** enable kafka topic ([19b6660](19b6660)) * **node:** add npm to pacman_packages ([9e643fe](9e643fe)) * **node:** create a dir for global npm packages ([e80888d](e80888d)) * **picom:** add topic config ([1073b6a](1073b6a)) * **picom:** launch picom on login ([ebbec14](ebbec14)) * **picom:** make emacs transparent ([a9280bd](a9280bd)) * **polybar:** add alsa module ([4a79612](4a79612)) * **polybar:** add suspend to power menu ([c1ccbd9](c1ccbd9)) * **polybar:** add topic config ([1371137](1371137)) * **polybar:** add topic panel/polybar ([b972739](b972739)) * **polybar:** add vpn modules ([ef3f6c7](ef3f6c7)) * **polybar:** blacklist num lock indicator ([1a8b444](1a8b444)) * **polybar:** hide the tray ([88fead9](88fead9)) * **polybar:** join vpn modules ([bbd34ad](bbd34ad)) * **polybar:** try to make tray behave ([83657d1](83657d1)) * **polybar:** use desktop %name% for labels ([cc48586](cc48586)) * **polybar:** use mononoki font ([14ab7a2](14ab7a2)) * **polybar:** use systemctl poweroff ([ff7634e](ff7634e)) * **provision:** add custom setup script for linux ([15230d6](15230d6)) * **provision:** add platform check to update-all ([6090cea](6090cea)) * **provision:** add support for pacman packages ([4538dfc](4538dfc)) * **provision:** check for executables in post-install ([1be0e93](1be0e93)) * **provision:** create ssh config dirs ([cd75749](cd75749)) * **provision:** ensure list of dirs exist ([80b82c8](80b82c8)) * **provision:** install coc extensions in post ([c3a4aa6](c3a4aa6)) * **provision:** make setup-linux executable ([d3ee543](d3ee543)) * **scripts:** add update-remote.sh ([80823a1](80823a1)) * **scripts:** add work to git changes dirs ([e4fc645](e4fc645)) * **shell:** remove newline from _os helper ([a031eab](a031eab)) * **ssh:** add topic config ([b57b658](b57b658)) * **ssh:** include configs in config.d ([10e6e1a](10e6e1a)) * **ssh:** remove lifetime of unlocked keys ([af79d33](af79d33)) * **ssh:** use keychain ([8ce01b6](8ce01b6)) * **sxhkd:** add 1password keybind ([46b64a1](46b64a1)) * **sxhkd:** add binding to launch konsole ([641c5e3](641c5e3)) * **sxhkd:** add intellij keybind ([42a2e19](42a2e19)) * **sxhkd:** add slack keybind ([c370db2](c370db2)) * **sxhkd:** add topic config ([f76c89b](f76c89b)) * **sxhkd:** add topic keyboard/sxhkd ([e8f6602](e8f6602)) * **sxhkd:** add wallpaper swap keybind ([5b391bf](5b391bf)) * **sxhkd:** launch emacs with hyper + s ([347d84d](347d84d)) * **sxhkd:** launch ranger with hyper + r ([b74fc27](b74fc27)) * **sxhkd:** launch spotify with hyper + u ([6dd0847](6dd0847)) * **sxhkd:** quit apps with super + q ([7ac3118](7ac3118)) * **sxhkd:** use super + p to pin window ([2c47aa1](2c47aa1)) * **tmux:** add binding to highlight last link ([d4de5ba](d4de5ba)) * **tmux:** add scratch and dotfiles bindings ([6906b40](6906b40)) * **tmux:** add session list to status and keybinds ([ff3518a](ff3518a)) * **tmux:** disable active pane highlighting ([46d2999](46d2999)) * **tmux:** do not use session id for switching ([e4ba48a](e4ba48a)) * **tmux:** move session prompt to keybind ([8668943](8668943)) * **tmux:** relocate status elements ([0477fe6](0477fe6)) * **tmux:** skip the initial rename session prompt ([8fdbf62](8fdbf62)) * **vim:** add coc-groovy to coc-extensions ([4a3d3a3](4a3d3a3)) * **vim:** add CursorColumn highlight ([b172cb0](b172cb0)) * **vim:** add keybind to search project for selection ([dc90052](dc90052)) * **vim:** add keybind to toggle diff of windows ([af16609](af16609)) * **vim:** add scrollbind toggle ([4142c57](4142c57)) * **vim:** add tabular plugin ([ef9bb8e](ef9bb8e)) * **vim:** add vlog alias ([a82daa6](a82daa6)) * **vim:** brighten fzf's border ([8f53e36](8f53e36)) * **vim:** disable double cmdheight ([b479208](b479208)) * **vim:** enable coc-explorer file icons ([300c608](300c608)) * **vim:** map leader , to :History ([856ef05](856ef05)) * **vim:** update project-wide search functions ([9cef954](9cef954)), closes [/github.com/junegunn/fzf/issues/1109#issuecomment-339983902](https://github.com//github.com/junegunn/fzf/issues/1109/issues/issuecomment-339983902) [/github.com/junegunn/fzf.vim/issues/346#issuecomment-288483704](https://github.com//github.com/junegunn/fzf.vim/issues/346/issues/issuecomment-288483704) * **vim:** use editorconfig for shfmt settings ([67f34a6](67f34a6)), closes [#32](#32) * **vim:** use standard tabline ([f0bf112](f0bf112)) * **work:** add base/work topic ([41adbdd](41adbdd)) * **work:** add vpn connection scripts ([a7d9c89](a7d9c89)) * **work:** add vpn_disconnect and provision sudo ([00ff1d0](00ff1d0)) * **zsh:** add chx and ns aliases ([5c754cb](5c754cb)) * **zsh:** add fuzzy ascii art font picker ([90525d6](90525d6)) * **zsh:** add sudoedit alias ([d74e781](d74e781)) * **zsh:** only attach to tmux on macos ([e38eaac](e38eaac)) * **zsh:** only use gls on macos ([2f5969a](2f5969a)) * **zsh:** remove . from WORDCHARS ([53ee31a](53ee31a)) * **zsh:** remove line numbers from fzf preview ([a4754c9](a4754c9)) * **zsh:** start ssh-agent on launch ([8181d45](8181d45)) * **zsh:** switch yq implementation on arch ([438f929](438f929)) * add linux.config.yml ([c891af2](c891af2)) * add pacman_packages to topics ([069ae0c](069ae0c)) * refactor!: rename root.config.yml ([c9cead7](c9cead7)) ### BREAKING CHANGES * Instead of a singular root.config.yml, use <os>.config.yml's. This will force an update to the CLI.
Solution found here: junegunn/fzf.vim#346
- Grep result foramt - `<file>:<line>:<column>:<content>` - https://stackoverflow.com/questions/59885329/how-to-exclude-file-name-from-fzf-filtering-after-ripgrep-search-results - junegunn/fzf.vim#346 (comment) Signed-off-by: flavono123 <flavono123@gmail.com>
Since there is a command
:Files
that can search files by name, I'd like to configure:Ag
to only look at the file contents, not at the file names.I'll demostrate my case below, my question is: can this be achieved today, maybe with some configuration?
To see why this is an annoying issue, create a file called
demo.txt
, put 20 lines each having a random number, and on the 21st line writedemo
. Then use:Ag demo
to search for this string.Expected: you find only one occurrence.
Actual: you also find 20 irrelevant occurrences.
The text was updated successfully, but these errors were encountered: