Reputation: 11
I am using Vim to create Markdown files. For relative links like:
- [Configure AWS with Role Credentials](/group/product/latest/operations/cloud-providers/configure-aws-cloud-provider-roles)
I'd like to be able to check for the directory/file in the link and see if it exists across a range of directories.
I was wanting to use something like:
:vim 'word' **./*.md | copen
which is what i use to find words/phrases across directories. Is there a way to do something like this, from the Vim command line?
Upvotes: 1
Views: 242
Reputation: 5852
For searching, a lot of Vim users install libraries like Ack, The Silver Searcher (AKA Ag
), or RipGrep (AKA Rg
). These can be run via the command line or with library-specific Vim plugins.
If searching the word with vanilla Vim is your goal, you could use :grep
or :vimgrep
. Enter command mode with shift
+ :
, and then search:
:grep word **/*.md
Where word
is your word and **/*.md
is the directory where your markdown files are stored. Adjust the asterisks to include more directories.
Matches would be available in the Quickfix List, which you can see with :cw
, also command mode.
:vimgrep
and :grep
are powerful; check out :help :vimgrep
and :help :grep
to learn more.
Upvotes: 2