David542
David542

Reputation: 110093

Escape `#` in a command when opening a url

I am trying to open the following url:

:execute 'silent !open https://github.com/junegunn/fzf#environment-variables'

However, it seems like when I run this command, the # is replaced (again) with the filepath instead of appearing as # literally. How do I prevent this?

Upvotes: 1

Views: 38

Answers (2)

phd
phd

Reputation: 94418

Call escape():

:execute 'silent !open' escape('https://github.com/junegunn/fzf#environment-variables', '#')

Upvotes: 1

that other guy
that other guy

Reputation: 123410

Escape it with a backslash:

:execute 'silent !open https://github.com/junegunn/fzf\#environment-variables'

Upvotes: 3

Related Questions