I use the command :tabe **/<file-name-pattern> all the time to open files in the current directory and subdirs in a new tab in vim. The command enables toggling through similar file names until I find the one I'm looking for. I wanted to map it to a user command such that I'll have less to type, but am kinda new to vim commands and thought I'd ask for help. Here's what I could come up with (mapped to TT):

:command -nargs=1 TT :tabe **/<args>

The idea is mimic the functionality of the above and to type :TT <file-name-pattern> and then toggle with key until the desired file is found. This, uh, didn't work. Any idea how to make this happen? thanks.


Try adding -complete=file to the command:

:command -nargs=1 -complete=file TT :tabe **/args

See ":help :command-complete".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.