January 2015
Beginner to intermediate
85 pages
1h 58m
English
Let’s now expand OpenMPC to display the entire playlist from mpc. For now, we’ll have the function call mpc to get the playlist and then display that in a new split window. Modify the code to look like this:
| plugin.1/mpc/plugin/mpc.vim | |
| Line 1 | function! OpenMPC() |
| - | let cmd = "mpc --format '%position% %artist% / %album% / %title%' playlist" |
| - | let playlist = split(system(cmd), '\n') |
| - | |
| 5 | new |
| - | |
| - | for track in playlist |
| - | if(playlist[0] == track) |
| - | execute "normal! I" . track |
| 10 | else |
| - | call append(line('$'), track) |
| - | endif |
| - | endfor |
| - | endfunction |
And now let’s quickly go over this before we try it out.
On line 3 we define a List, playlist, to store the result of our mpc call. We ...
Read now
Unlock full access