The shell command can kill chrome process.
ps -ef | grep chrome |awk '{print $2}'| xargs kill
Now I want to map the character -
with above bash command.
nnoremap - :!ps -ef | grep chrome |awk '{print $2}'| xargs kill
It takes no effect, how to map my bash command?
Every pipe has to be escaped. Then append it with <CR>
so you don't have to press enter all the time.
nnoremap - :!ps -ef \| grep chrome \|awk '{print $2}'\| xargs kill<CR>
Note also, that we have a cute little tool to kill'em all. So instead of
ps -ef | grep chrome |awk '{print $2}'| xargs kill
you can do
killall chrome
Your mapping then will be
nnoremap - :!killall chrome<CR>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With