When I start vi/vim as
ex, I can use the
-c option to provide the set of ex commands to apply to a file:
echo Yes | ex -sc 's/Y/y/|%p|q!' /dev/stdin yes
But how can I use normal mode commands like the
~ (switch case command) with
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
Based on a comment by @statox, I found a solution:
echo 'Élève' | ex -sc 'norm! g~w' -c '%p|q!' /dev/stdin éLÈVE
norm command allows executing Normal mode commands.
And I had to use two
-c option since, after
norm, the rest of the line is considered part of the normal-mode command to execute.