0

If I want to map a key to a certain command and I don't want the command to echo in the command line, I can do the following:

:nnoremap <silent> <leader>N <... command ...>

But can the same be done with abbreviations? I didn't see anything relating to this in the manual, so I was wondering if it's even possible to prevent the abbreviation command from appearing in the command line.

  • Your question is a bit confusing, considering you can't even add abbreviations in normal mode? How do you imagine this to work? – Martin Tournoij Mar 24 at 4:13
  • @MartinTournoij I'm sorry, I just realized that my question was confusing after I found the solution to it!. The reason is that I was executing an abbreviation command with execute, and it was displaying the abbreviation command in the command line every time it ran. By adding silent execute I stopped this behavior. Thanks for you attention! – SalmonKiller Mar 24 at 4:58
0

I managed to get an abbrev command to work without displaying it in the command line by wrapping it into a silent execute "normal! < iabbrev command here >". Without silent, the command passed to normal! will display in the command line, but by putting it into silent prevents any messages from appearing in message history.

  • You shouldnt need normal! ; `silent execute 'iabbrev <lhs> <rhs>' should do it. But you also don’t need execute unless your building the abbreviation from strings. – D. Ben Knoble Mar 24 at 14:11

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.