So, I had this keymapping for helping me to edit files:
nnoremap <Leader>e :e **/
But this doesn't work with hidden directories. So, I naively added:
nnoremap <Leader>d :e .**/
But this only worked if the root directory was hidden. All the other hidden directory in the directory tree would be ignored.
So, I learnt from :h starstar
that **
is not used as *
. So, I can't do something like [.]?**
. And then I found out :h backtick-expansion
.
I'm doing following which gives me all the files with .vim
extension according to the output of the find
unix command, and I can tab through them.
:e `find . -name '*.vim' -print`
How wonderful! But from :h backtick-expansion
, I see:
:e `find . -name ver\\*.c -print`
The backslashes before the star are required to prevent "ver*.c" to be
expanded by the shell before executing the find program.
So, my questions are
- Why using single quotes after
-name
doesn't require*
to be escaped with backslashes? - When would using single-quotes require escaping with backslashes?
- Is there any obscure part in
backtick-expansion
that I have totally missed? - How would I beautify this stupid mapping?
nnoremap <Leader>o :e `find . -name '' -print`<left><left><left><left><left><left><left><left><left>