Reputation: 1653
In vim, I want to do something like so
function! ModuleFile()
let $module = input("Module of file> ")
:e **/${module}_
endfunction
map <Leader>e :call ModuleFile()<CR>
What I expect is that for example, if I type for the module "ABC", I would get this commandline in vim:
:e **/ABC_
and then subsequently typing new text, like "name_of_file", would get me:
:e **/ABC_name_of_file
and finally pressing Enter would execute the command. The point of this is to be able to get tab completions.
Upvotes: 1
Views: 329
Reputation: 79155
No need for sigils in vim script, ${...}
or $var
is for environment variables.
function! ModuleFile()
let module = input("Module of file> ")
let name = input("Search pattern> ")
execute 'args **/' . module . '_' . name
endfunction
map <Leader>e :call ModuleFile()<CR>
After your comment what you want is probably:
map <leader>e :args **/<c-r>=input("Module of file: ") . '_' . input("Search pattern: ")<cr>
Upvotes: 2