Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 50a2bdd4f0ea8a0002000055

Presidential Sorting

Given a nice CSV formatted arrangement of the Presidents of the United States, we need to print out an alphabetical list in pretty columns. Prove that vim can conquer this basic Excel task!

Start file
President,Political Party,Dates in Office
George Washington,,1789_97
John Adams,Federalist,1797_1801
Thomas Jefferson,Democratic-Republican,1801_9
James Madison,Democratic-Republican,1809_17
James Monroe,Democratic-Republican,1817_25
John Quincy Adams,Democratic-Republican,1825_29
Andrew Jackson,Democratic,1829_37
Martin Van Buren,Democratic,1837_41
William Henry Harrison,Whig,1841
John Tyler,Whig,1841_45
James Knox Polk,Democratic,1845_49
Zachary Taylor,Whig,1849_50
Millard Fillmore,Whig,1850_53
Franklin Pierce,Democratic,1853_57
James Buchanan,Democratic,1857_61
Abraham Lincoln,Republican,1861_65
Andrew Johnson,Democratic/National Union,1865_69
Ulysses Simpson Grant,Republican,1869_77
Rutherford Birchard Hayes,Republican,1877_81
James Abram Garfield,Republican,1881
Chester Alan Arthur,Republican,1881_85
Grover Cleveland,Democratic,1885_89
Benjamin Harrison,Republican,1889_93
Grover Cleveland,Democratic,1893_97
William McKinley,Republican,1897_1901
Theodore Roosevelt,Republican,1901_9
William Howard Taft,Republican,1909_13
Woodrow Wilson,Democratic,1913_21
Warren Gamaliel Harding,Republican,1921_23
Calvin Coolidge,Republican,1923_29
Herbert Clark Hoover,Republican,1929_33
Franklin Delano Roosevelt,Democratic,1933_45
Harry S. Truman,Democratic,1945_53
Dwight David Eisenhower,Republican,1953_61
John Fitzgerald Kennedy,Democratic,1961_63
Lyndon Baines Johnson,Democratic,1963_69
Richard Milhous Nixon,Republican,1969_74
Gerald Rudolph Ford,Republican,1974_77
Jimmy Carter,Democratic,1977_81
Ronald Wilson Reagan,Republican,1981_89
George Herbert Walker Bush,Republican,1989_93
Bill Clinton,Democratic,1993_2001
George Walker Bush,Republican,2001_9
Barack Hussein Obama,Democratic,2009_
End file
President                   Political Party            Dates in Office
Abraham Lincoln             Republican                 1861–65
Andrew Jackson              Democratic                 1829–37
Andrew Johnson              Democratic/National Union  1865–69
Barack Hussein Obama        Democratic                 2009–
Benjamin Harrison           Republican                 1889–93
Bill Clinton                Democratic                 1993–2001
Calvin Coolidge             Republican                 1923–29
Chester Alan Arthur         Republican                 1881–85
Dwight David Eisenhower     Republican                 1953–61
Franklin Delano Roosevelt   Democratic                 1933–45
Franklin Pierce             Democratic                 1853–57
George Herbert Walker Bush  Republican                 1989–93
George Walker Bush          Republican                 2001–9
George Washington                                      1789–97
Gerald Rudolph Ford         Republican                 1974–77
Grover Cleveland            Democratic                 1885–89
Grover Cleveland            Democratic                 1893–97
Harry S. Truman             Democratic                 1945–53
Herbert Clark Hoover        Republican                 1929–33
James Abram Garfield        Republican                 1881
James Buchanan              Democratic                 1857–61
James Knox Polk             Democratic                 1845–49
James Madison               Democratic-Republican      1809–17
James Monroe                Democratic-Republican      1817–25
Jimmy Carter                Democratic                 1977–81
John Adams                  Federalist                 1797–1801
John Fitzgerald Kennedy     Democratic                 1961–63
John Quincy Adams           Democratic-Republican      1825–29
John Tyler                  Whig                       1841–45
Lyndon Baines Johnson       Democratic                 1963–69
Martin Van Buren            Democratic                 1837–41
Millard Fillmore            Whig                       1850–53
Richard Milhous Nixon       Republican                 1969–74
Ronald Wilson Reagan        Republican                 1981–89
Rutherford Birchard Hayes   Republican                 1877–81
Theodore Roosevelt          Republican                 1901–9
Thomas Jefferson            Democratic-Republican      1801–9
Ulysses Simpson Grant       Republican                 1869–77
Warren Gamaliel Harding     Republican                 1921–23
William Henry Harrison      Whig                       1841
William Howard Taft         Republican                 1909–13
William McKinley            Republican                 1897–1901
Woodrow Wilson              Democratic                 1913–21
Zachary Taylor              Whig                       1849–50

View Diff

1,45c1,45
< President,Political Party,Dates in Office
< George Washington,,1789_97
< John Adams,Federalist,1797_1801
< Thomas Jefferson,Democratic-Republican,1801_9
< James Madison,Democratic-Republican,1809_17
< James Monroe,Democratic-Republican,1817_25
< John Quincy Adams,Democratic-Republican,1825_29
< Andrew Jackson,Democratic,1829_37
< Martin Van Buren,Democratic,1837_41
< William Henry Harrison,Whig,1841
< John Tyler,Whig,1841_45
< James Knox Polk,Democratic,1845_49
< Zachary Taylor,Whig,1849_50
< Millard Fillmore,Whig,1850_53
< Franklin Pierce,Democratic,1853_57
< James Buchanan,Democratic,1857_61
< Abraham Lincoln,Republican,1861_65
< Andrew Johnson,Democratic/National Union,1865_69
< Ulysses Simpson Grant,Republican,1869_77
< Rutherford Birchard Hayes,Republican,1877_81
< James Abram Garfield,Republican,1881
< Chester Alan Arthur,Republican,1881_85
< Grover Cleveland,Democratic,1885_89
< Benjamin Harrison,Republican,1889_93
< Grover Cleveland,Democratic,1893_97
< William McKinley,Republican,1897_1901
< Theodore Roosevelt,Republican,1901_9
< William Howard Taft,Republican,1909_13
< Woodrow Wilson,Democratic,1913_21
< Warren Gamaliel Harding,Republican,1921_23
< Calvin Coolidge,Republican,1923_29
< Herbert Clark Hoover,Republican,1929_33
< Franklin Delano Roosevelt,Democratic,1933_45
< Harry S. Truman,Democratic,1945_53
< Dwight David Eisenhower,Republican,1953_61
< John Fitzgerald Kennedy,Democratic,1961_63
< Lyndon Baines Johnson,Democratic,1963_69
< Richard Milhous Nixon,Republican,1969_74
< Gerald Rudolph Ford,Republican,1974_77
< Jimmy Carter,Democratic,1977_81
< Ronald Wilson Reagan,Republican,1981_89
< George Herbert Walker Bush,Republican,1989_93
< Bill Clinton,Democratic,1993_2001
< George Walker Bush,Republican,2001_9
< Barack Hussein Obama,Democratic,2009_
---
> President                   Political Party            Dates in Office
> Abraham Lincoln             Republican                 1861–65
> Andrew Jackson              Democratic                 1829–37
> Andrew Johnson              Democratic/National Union  1865–69
> Barack Hussein Obama        Democratic                 2009–
> Benjamin Harrison           Republican                 1889–93
> Bill Clinton                Democratic                 1993–2001
> Calvin Coolidge             Republican                 1923–29
> Chester Alan Arthur         Republican                 1881–85
> Dwight David Eisenhower     Republican                 1953–61
> Franklin Delano Roosevelt   Democratic                 1933–45
> Franklin Pierce             Democratic                 1853–57
> George Herbert Walker Bush  Republican                 1989–93
> George Walker Bush          Republican                 2001–9
> George Washington                                      1789–97
> Gerald Rudolph Ford         Republican                 1974–77
> Grover Cleveland            Democratic                 1885–89
> Grover Cleveland            Democratic                 1893–97
> Harry S. Truman             Democratic                 1945–53
> Herbert Clark Hoover        Republican                 1929–33
> James Abram Garfield        Republican                 1881
> James Buchanan              Democratic                 1857–61
> James Knox Polk             Democratic                 1845–49
> James Madison               Democratic-Republican      1809–17
> James Monroe                Democratic-Republican      1817–25
> Jimmy Carter                Democratic                 1977–81
> John Adams                  Federalist                 1797–1801
> John Fitzgerald Kennedy     Democratic                 1961–63
> John Quincy Adams           Democratic-Republican      1825–29
> John Tyler                  Whig                       1841–45
> Lyndon Baines Johnson       Democratic                 1963–69
> Martin Van Buren            Democratic                 1837–41
> Millard Fillmore            Whig                       1850–53
> Richard Milhous Nixon       Republican                 1969–74
> Ronald Wilson Reagan        Republican                 1981–89
> Rutherford Birchard Hayes   Republican                 1877–81
> Theodore Roosevelt          Republican                 1901–9
> Thomas Jefferson            Democratic-Republican      1801–9
> Ulysses Simpson Grant       Republican                 1869–77
> Warren Gamaliel Harding     Republican                 1921–23
> William Henry Harrison      Whig                       1841
> William Howard Taft         Republican                 1909–13
> William McKinley            Republican                 1897–1901
> Woodrow Wilson              Democratic                 1913–21
> Zachary Taylor              Whig                       1849–50

Solutions

The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!

Check out these helpful resources to improve your Vim skills... Game on.

Unlock 24 remaining solutions by signing in and submitting your own entry
#25 shahanavaz m / @shahanavazm - Score: 111 - 04/03/24 @ 17:25
:2,$sort<CR>q:i%s/^<Esc>A\(.\{-}\),<Esc>..r$/<BS>A/\-<BS>=<Esc>Aprintf("%-38<BS><BS>28s",submatch(1)).<Esc>..xf<Esc>F1r3F-xxxF1r2F8r7<CR>:%s/_/<C-K>-N<CR>ZZ

0 comments


#26 nickGPT / @nickandbro - Score: 111 - 08/28/24 @ 19:29
:2,$sort<CR>q:i%s/^<Esc>A\(.\{-}\),<Esc>..r$/<BS>A/\-<BS>=<Esc>Aprintf("%-38<BS><BS>28s",submatch(1)).<Esc>..xf<Esc>F1r3F-xxxF1r2F8r7<CR>:%s/_/<C-K>-N<CR>ZZ

0 comments


Created by: @mr_ino

26 active golfers, 51 entries

Leaderboard (lowest score wins):
40
#1 - Urtica dioica / @udioica

12/20/2012 at 05:19AM

40
#2 - John Braxler / @braxler

12/22/2014 at 08:18PM

40
#3 - Peppa Pig / @PeppaPi95550250

07/03/2024 at 06:28AM

41
#4 - Kerson Hsiao / @KersonHsiao

11/14/2012 at 05:33AM

44
#5 - jakeroberts / @jakeroberts

05/29/2017 at 04:53PM

44
#6 - galadriel2143 / @galadriel2143

09/14/2017 at 01:50AM

45
#7 - a24f0600 / @a24f0600

11/28/2012 at 05:32PM

45
#8 - Charles H. Leggett / @cleggett

01/16/2015 at 12:39PM

46
#9 - じょんあば / @john_ababa

11/18/2012 at 06:56AM

46
#10 - Marcin Szamotulski / @me_coot

11/18/2012 at 01:38PM

47
#11 - h_east (トロッコ6個) / @h_east

11/15/2012 at 03:00PM

47
#12 - Petro Тrouq / @zulolosi

11/21/2012 at 03:06AM

47
#13 - Robert Goeddel / @f0rdpr3fect

11/13/2015 at 09:02PM

48
#14 - Tanzeel Kazi / @tanzeelkazi

08/14/2020 at 04:37AM

49
#15 - ひめ / @Milly

11/19/2012 at 08:28AM

50
#16 - Matt / @mcr05

12/16/2014 at 09:43AM

51
#17 - Conner McDaniel / @connermcd

11/13/2012 at 11:20PM

52
#18 - Stefan Knudsen / @knud32

06/26/2015 at 06:13AM

53
#19 - hiding / @I_haveno_name

10/20/2013 at 09:15AM

54
#20 - Hubba / @HubbaBubbaFett

11/19/2012 at 04:45PM

56
#21 - Eric Andres / @eric_m_andres

12/05/2012 at 04:09AM

62
#22 - Pete Johns / @johnsyweb

11/24/2012 at 01:37AM

66
#23 - Bitt Faulk / @bittfaulk

03/05/2020 at 07:56PM

80
#24 - luke37842 / @luke37842

05/17/2024 at 12:48PM

111
#25 - shahanavaz m / @shahanavazm

04/03/2024 at 05:25PM

111
#26 - nickGPT / @nickandbro

08/28/2024 at 07:29PM