Quantcast
Channel: Active questions tagged user-commands - Vi and Vim Stack Exchange
Viewing all articles
Browse latest Browse all 60

Intercepting & modifying commands

$
0
0

Is it possible to intercept incoming user commands? For example, if the user executes :echo 'hello', then I would like to compare the string and the command, and change it to execute :echoerr 'hello' instead.

My goal at the end is to intercept commands to check for their uppercase alternative. Vim does not allow lowercase commands as to not conflict with native ones, so I want to intercept commands as they come by and run a check to determine which command to run. For example:

!command Cmd !echo test

If I were to run cmd, Vim would not recognise it as a command. What I want to do is to see if Cmd exists instead, and if so run that command. I would also like to prioritise native commands if there's a conflict.


Viewing all articles
Browse latest Browse all 60

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>