January 2015
Beginner to intermediate
85 pages
1h 58m
English
Our OpenMPC function gets the current track by running mpc current, with the --format argument. This is a shell command, and in VimL we can use the system function to call shell commands.
system works like Vim’s bang command (:!). You might be familiar with using that command to execute a shell command from inside Vim:
| | :!date |
| | Sat Oct 18 19:35:53 CDT 2014 |
| | Press ENTER or type command to continue |
In like manner, system takes a String command to run and executes it. It then returns the command’s output to us as another String.
Now notice how we display the command’s output. In the previous chapter we made a lot of use of :echo to echo messages to the user. In OpenMPC, we’re using another echoing command: :echomsg ...
Read now
Unlock full access