Upgrade to Pro — share decks privately, control downloads, hide ads and more …

cmus and vim

cmus and vim

The benefits, usage and tricks with cmus + integration in vim.

Matthias Günther

February 19, 2017
Tweet

More Decks by Matthias Günther

Other Decks in Technology

Transcript

  1. cmus and vim
    Matthias Günther

    View Slide

  2. cmus
    (1)

    View Slide

  3. Benefits
    customizable
    instant startup, even with
    thousands of tracks
    easy to use directory
    browser

    View Slide

  4. Browse file system
    and add tracks
    5 … go into the browse mode
    a … add selection to library
    D … remove selection from
    library

    View Slide

  5. Artist view
    1 … go into the mode
    … to see albums

    View Slide

  6. Library view
    2 … library view (sorted)

    View Slide

  7. Play commands
    (2)

    View Slide

  8. Play commands I
    b … plays next track
    z … plays previous
    c … pause, continue
    x … restart track
    p/P … change order of
    entries next/previous

    View Slide

  9. Play commands II
    +|- … increase, decrease
    sound
    C-f|C-b … page-down,page-
    up
    C-r … repeat current track

    View Slide

  10. Play commands
    statuschanges I
    m … cycle through play
    modus (all, album artist)
    M … switch modes without
    interrupting the currently-
    playing song
    r … repeat the playlist when
    ended (R in statusline)

    View Slide

  11. Play commands
    statuschanges II
    s … shuffle (S in statusline)
    C … toggle continue playing
    the next song (C in
    statusline)

    View Slide

  12. Fill queue and playlist
    y … add the selected song
    to playlist (3)
    e … mark the songs to the
    queue (4) (FIFO)

    View Slide

  13. Useful commands
    (3)

    View Slide

  14. Useful commands I
    :add ~/music … same as ‘a’
    :colorscheme … will change
    the colorscheme
    :clear … will clear the
    current list

    View Slide

  15. Useful commands II
    :save ~/music/
    playlist.lst
    :load ~/music/
    playlist.lst
    :unmark … clean the
    marked songs
    q … quit cmus

    View Slide

  16. Useful commands III
    :invert … select all tracks
    which are not marked
    :prev-view … toggle the
    last two views

    View Slide

  17. config cmus
    in ~/.config/cmus
    rc … configuration
    autosave …

    View Slide

  18. My config
    unbind -f common E
    bind common E run easytag {}
    unbind -f common +
    bind common + vol +5%
    unbind -f common -
    bind common - vol -5%
    # Vim like shortcuts to jump to the next/prev section
    unbind -f common ^N
    bind common ^N player-next
    unbind -f common ^P
    bind common ^P player-prev

    View Slide

  19. Get the cover
    ALBUM_PATH=/$(cmus-remote -Q | grep file | cut -d'/' --complement -s -f1 | rev | \
    cut -d'/' --complement -s -f1 | rev | sed -e 's/\s/\\ /g' | \
    sed -e 's/(/\\(/g' | sed -e 's/)/\\)/g')/cover.jpg
    ALBUM_NAME=$(cmus-remote -Q | grep -w 'tag album' | cut -d'~' --complement -f1 | \
    cut -d' ' --complement -s -f1 | sed -e 's/\s/-/g')
    eval notify-send -i $ALBUM_PATH $ALBUM_NAME
    And the shortcut
    unbind -f common I
    bind common I shell bash ~/.config/cmus/album.sh

    View Slide

  20. vim-cmus
    (4)

    View Slide

  21. vim-cmus I
    :CmusCurrent … shows the
    information of current song
    :CmusPrevious … plays
    previous song
    :CmusNext … plays next
    song

    View Slide

  22. vim-cmus II
    :CmusPause … stop playing
    the current song
    :CmusPlay … continue
    playing song
    :CmusStop … stop playing
    and go to the beginning

    View Slide

  23. Thank you
    (5)

    View Slide

  24. Images I
    (1): https://twitter.com/
    gamesyouloved/
    status/81790750591755468
    8
    (2): https://twitter.com/
    realretroism/
    status/81755907377634508
    8

    View Slide

  25. Images II
    (3): https://twitter.com/
    gamesyouloved/
    status/81679936420721869
    4
    (4): https://twitter.com/
    gamesyouloved/
    status/81637678552917606
    5

    View Slide

  26. Images III
    (5): https://twitter.com/
    gamesyouloved/
    status/81622573839122022
    4

    View Slide