syntagma
syntagma

Reputation: 24294

Passing parameters to bash from custom Vim commands

I have this custom command inside my .vimrc:

command! Minfo -nargs=1 call s:MappingInfo(<f-args>)

The argument of the command is then passed to the MappingInfo function which "pastes" it to bash command using Vim's execute concatenation.

The function works fine when I execute it using :call MappingInfo("something") but when I try the command: :Minfo something, I get the error: E488: Trailing characters.

How do I fix error?

Upvotes: 1

Views: 308

Answers (1)

chtenb
chtenb

Reputation: 16184

Switch the name and the arguments number:

command! -nargs=1 Minfo call s:MappingInfo(<f-args>)

Upvotes: 3

Related Questions