Skip to content
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

File names with colons #1404

Open
mb720 opened this issue Aug 30, 2020 · 0 comments
Open

File names with colons #1404

mb720 opened this issue Aug 30, 2020 · 0 comments

Comments

@mb720
Copy link

mb720 commented Aug 30, 2020

Hi and thanks a lot for ag!

I use fzf with ag to open files in a text editor:

local file=$(ag --hidden --nonumbers --noheading . | fzf | cut -d ':' -f1)
if [ -n "$file" ]; then
  # Use the default editor if it's defined, otherwise Vim
  ${EDITOR:-vim} "$file"
fi

This works fine for most files, but breaks for files with colons in their names. Here's an example setup:

echo "test 1" > file_1 && echo "test 2" > file_2 && echo "Find me" > "file:with:colons"

Typing "Find" and hitting enter, cut turns "file:with:colons:Find me" into "file", which is not the file I intended to open.

I know about ag's --files-with-matches but I do want to see the matched lines in fzf.

Is there a way around this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant