< Return to Video

Emacs Rocks! Episode 03: A vimgolf albatross

  • 0:02 - 0:04
    Welcome back to emacs rocks!
  • 0:04 - 0:10
    In this episode we'll take another look at the vimgolf challenge in episode two.
  • 0:10 - 0:14
    These two emacs enthusiasts twittered me last night
  • 0:14 - 0:17
    with an even better solution to the problem
  • 0:17 - 0:21
    let's take a look at what they did
  • 0:21 - 0:25
    okay, I'll just run through it first
  • 0:40 - 0:42
    wow
  • 0:42 - 0:48
    that was ten keystrokes - it's almost like magic
  • 0:50 - 0:53
    the trick being used to shave off another two keystrokes
  • 0:53 - 0:57
    from last nights solution was transpose-lines
  • 0:57 - 1:01
    let's take a look at transpose-char first
  • 1:01 - 1:06
    if I typo like this, I can go back and switch
  • 1:06 - 1:10
    did you see it? switch!
  • 1:10 - 1:13
    but another way of thinking about transpose
  • 1:13 - 1:20
    is that you're actually moving the char forward
  • 1:20 - 1:24
    so that's what's being done with transpose-lines
  • 1:24 - 1:28
    ctrl-x t, and I move typo down
  • 1:28 - 1:31
    so that's what they're doing
  • 1:31 - 1:35
    I start ctrl-x t, ctrl-x t
  • 1:35 - 1:37
    and use that to move the first line down
  • 1:37 - 1:39
    okay, I'll walk through it
  • 1:39 - 1:44
    macro, 9x transpose-line
  • 1:44 - 1:49
    backspace, tab, back to the top
  • 1:49 - 1:54
    done with the macro, 9x repeat macro
  • 1:54 - 1:56
    amazing
  • 1:56 - 1:59
    so, best solution in vim: 17
  • 1:59 - 2:00
    last night: 12
  • 2:00 - 2:03
    today: 10 keystrokes
  • 2:03 - 2:09
    so thanks to Bodil and Christian for an awesome solution
  • 2:10 -
    if you want more of @emacsrocks, just follow me on twitter
Title:
Emacs Rocks! Episode 03: A vimgolf albatross
Description:

http://emacsrocks.com - Rocking emacs tricks and tips screencast.

Follow me on twitter: @emacsrocks

more » « less
Video Language:
English
Duration:
02:15
magnarsveen added a translation

English subtitles

Revisions