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 5100ce70326e09000200004a

Saving the hashes(#)

The following file is copied from vimcasts.org(Its only for learning purpose,hope the site owner doesn't mind it), its probably the easiest of challenges.Our goal is to delete every line which doesn't contain a hash signs. The remaining hash signs with numbers are then sorted to get the final output.

Start file
January 2013
#40 Long-range line duplication (6:31)
December 2012
#39 Profiling Vimscript performance (8:09)
November 2012
#38 Writing a custom fold expression (12:07) #37 How to fold (8:49)
August 2012
#36 VimGolf - Prime Numbers (6:53)
May 2011
#35 Fugitive.vim - exploring the history of a git repository (10:04) #34 Fugitive.vim - browsing the git object database (9:45) #33 Fugitive.vim - resolving merge conflicts with vimdiff (11:35)
April 2011
#32 Fugitive.vim - working with the git index (11:41) #31 Fugitive.vim - a complement to command line git (8:27)
February 2011
#30 Undo branching and Gundo.vim (6:30)
January 2011
#29 Aligning text with Tabular.vim (5:11)
November 2010
#28 Refining search patterns with the command-line window (7:51)
October 2010
#27 Synchronizing plugins with git submodules and pathogen (9:24) #26 Bubbling text (6:23)
September 2010
#25 Creating colorschemes for Vim (9:44)
July 2010
#24 Updating your vimrc file on the fly (2:51) #23 Converting HAML to ERB with Vim macros (7:36)
June 2010
#22 Selecting columns with visual block mode (4:21) #21 Converting markdown to structured HTML with a macro (9:25)
May 2010
#20 Running Vim within IRB (4:35) #19 Spell checking (5:42) #18 Formatting text with par (5:12)
April 2010
#17 Hard wrapping text (5:23) #16 Soft wrapping text (4:54) #15 The file explorer (5:36) #14 The :edit command (3:50) #13 Cleaning up with Vim (0:36)
March 2010
#12 Modal editing: undo, redo and repeat (5:26) #11 Using the changelist and jumplist (3:21) #10 Creating the Vimcasts logo as ASCII art (5:47) #9 How to use tabs (5:28)
February 2010
#8 Working with tabs (3:17) #7 Working with windows (5:32) #6 Working with buffers (3:28) #5 Indentation commands (5:41)
January 2010
#4 Tidying whitespace (4:33) #3 Whitespace preferences and filetypes (3:29) #2 Tabs and Spaces (6:22) #1 Show invisibles (2:52)
End file
#1 Show invisibles (2:52) 
#2 Tabs and Spaces (6:22)
#3 Whitespace preferences and filetypes (3:29)
#4 Tidying whitespace (4:33)
#5 Indentation commands (5:41)
#6 Working with buffers (3:28)
#7 Working with windows (5:32)
#8 Working with tabs (3:17)
#9 How to use tabs (5:28)
#10 Creating the Vimcasts logo as ASCII art (5:47)
#11 Using the changelist and jumplist (3:21)
#12 Modal editing: undo, redo and repeat (5:26)
#13 Cleaning up with Vim (0:36)
#14 The :edit command (3:50)
#15 The file explorer (5:36)
#16 Soft wrapping text (4:54)
#17 Hard wrapping text (5:23)
#18 Formatting text with par (5:12)
#19 Spell checking (5:42)
#20 Running Vim within IRB (4:35)
#21 Converting markdown to structured HTML with a macro (9:25)
#22 Selecting columns with visual block mode (4:21)
#23 Converting HAML to ERB with Vim macros (7:36)
#24 Updating your vimrc file on the fly (2:51)
#25 Creating colorschemes for Vim (9:44)
#26 Bubbling text (6:23)
#27 Synchronizing plugins with git submodules and pathogen (9:24)
#28 Refining search patterns with the command-line window (7:51)
#29 Aligning text with Tabular.vim (5:11)
#30 Undo branching and Gundo.vim (6:30)
#31 Fugitive.vim - a complement to command line git (8:27)
#32 Fugitive.vim - working with the git index (11:41)
#33 Fugitive.vim - resolving merge conflicts with vimdiff (11:35)
#34 Fugitive.vim - browsing the git object database (9:45)
#35 Fugitive.vim - exploring the history of a git repository (10:04)
#36 VimGolf - Prime Numbers (6:53)
#37 How to fold (8:49)
#38 Writing a custom fold expression (12:07)
#39 Profiling Vimscript performance (8:09)
#40 Long-range line duplication (6:31)

View Diff

1,22c1,24
<
< January 2013
< #40 Long-range line duplication (6:31)
< December 2012
< #39 Profiling Vimscript performance (8:09)
< November 2012
< #38 Writing a custom fold expression (12:07) #37 How to fold (8:49)
< August 2012
< #36 VimGolf - Prime Numbers (6:53)
< May 2011
< #35 Fugitive.vim - exploring the history of a git repository (10:04) #34 Fugitive.vim - browsing the git object database (9:45) #33 Fugitive.vim - resolving merge conflicts with vimdiff (11:35)
< April 2011
< #32 Fugitive.vim - working with the git index (11:41) #31 Fugitive.vim - a complement to command line git (8:27)
< February 2011
< #30 Undo branching and Gundo.vim (6:30)
< January 2011
< #29 Aligning text with Tabular.vim (5:11)
< November 2010
< #28 Refining search patterns with the command-line window (7:51)
< October 2010
< #27 Synchronizing plugins with git submodules and pathogen (9:24) #26 Bubbling text (6:23)
< September 2010
---
> #1 Show invisibles (2:52)
> #2 Tabs and Spaces (6:22)
> #3 Whitespace preferences and filetypes (3:29)
> #4 Tidying whitespace (4:33)
> #5 Indentation commands (5:41)
> #6 Working with buffers (3:28)
> #7 Working with windows (5:32)
> #8 Working with tabs (3:17)
> #9 How to use tabs (5:28)
> #10 Creating the Vimcasts logo as ASCII art (5:47)
> #11 Using the changelist and jumplist (3:21)
> #12 Modal editing: undo, redo and repeat (5:26)
> #13 Cleaning up with Vim (0:36)
> #14 The :edit command (3:50)
> #15 The file explorer (5:36)
> #16 Soft wrapping text (4:54)
> #17 Hard wrapping text (5:23)
> #18 Formatting text with par (5:12)
> #19 Spell checking (5:42)
> #20 Running Vim within IRB (4:35)
> #21 Converting markdown to structured HTML with a macro (9:25)
> #22 Selecting columns with visual block mode (4:21)
> #23 Converting HAML to ERB with Vim macros (7:36)
> #24 Updating your vimrc file on the fly (2:51)
24,38c26,40
< July 2010
< #24 Updating your vimrc file on the fly (2:51) #23 Converting HAML to ERB with Vim macros (7:36)
< June 2010
< #22 Selecting columns with visual block mode (4:21) #21 Converting markdown to structured HTML with a macro (9:25)
< May 2010
< #20 Running Vim within IRB (4:35) #19 Spell checking (5:42) #18 Formatting text with par (5:12)
< April 2010
< #17 Hard wrapping text (5:23) #16 Soft wrapping text (4:54) #15 The file explorer (5:36) #14 The :edit command (3:50) #13 Cleaning up with Vim (0:36)
< March 2010
< #12 Modal editing: undo, redo and repeat (5:26) #11 Using the changelist and jumplist (3:21) #10 Creating the Vimcasts logo as ASCII art (5:47) #9 How to use tabs (5:28)
< February 2010
< #8 Working with tabs (3:17) #7 Working with windows (5:32) #6 Working with buffers (3:28) #5 Indentation commands (5:41)
< January 2010
< #4 Tidying whitespace (4:33) #3 Whitespace preferences and filetypes (3:29) #2 Tabs and Spaces (6:22) #1 Show invisibles (2:52)
<
---
> #26 Bubbling text (6:23)
> #27 Synchronizing plugins with git submodules and pathogen (9:24)
> #28 Refining search patterns with the command-line window (7:51)
> #29 Aligning text with Tabular.vim (5:11)
> #30 Undo branching and Gundo.vim (6:30)
> #31 Fugitive.vim - a complement to command line git (8:27)
> #32 Fugitive.vim - working with the git index (11:41)
> #33 Fugitive.vim - resolving merge conflicts with vimdiff (11:35)
> #34 Fugitive.vim - browsing the git object database (9:45)
> #35 Fugitive.vim - exploring the history of a git repository (10:04)
> #36 VimGolf - Prime Numbers (6:53)
> #37 How to fold (8:49)
> #38 Writing a custom fold expression (12:07)
> #39 Profiling Vimscript performance (8:09)
> #40 Long-range line duplication (6:31)

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 479 remaining solutions by signing in and submitting your own entry
#480 harry đŸłïžâ€đŸŒˆ / @hdgarrood - Score: 106 - 02/10/13 @ 20:29
:v/#/d<CR>:%s/ #/\r#g<BS>/g<CR>:%sort<CR>/#2<CR>Dggpuo<Esc>p13jkkdd/wh<CR>Duddggjp/whi<CR>ddunnggddunnddgjjggjjp36jVkkkkdggjjjp:wq<CR>

0 comments


Created by: @pradeep6kumar

480 active golfers, 2063 entries

Leaderboard (lowest score wins):
20
#61 - Wistan Chou / @wisty97

08/14/2019 at 06:30PM

20
#62 - MiƂosz Ɓakomy / @foobar01123

08/19/2019 at 11:38AM

20
#63 - Viktor Styrud / @ViktorStyrud

10/16/2019 at 01:24PM

20
#64 - vimgolfer / @vimgolfer7

10/19/2019 at 05:07AM

20
#65 - Mario Olofo / @mario_olofo

10/24/2019 at 07:45PM

20
#66 - countime / @countime1

03/17/2020 at 04:24AM

20
#67 - chocolate / @chocola81394123

12/01/2020 at 01:30AM

20
#68 - hepebexĂš / @hepebexe

01/02/2021 at 11:25PM

20
#69 - Jung Yeon Park / @park_jungy

01/18/2021 at 08:09PM

20
#70 - blabla zincou / @BZincou

04/16/2022 at 11:41PM

20
#71 - russellzhaomao / @russellzhaomao

05/26/2022 at 12:33AM

20
#72 - Janzen / @__Coos

09/27/2022 at 02:35PM

20
#73 - Peppa Pig / @PeppaPigSg

05/21/2024 at 09:11AM

20
#74 - nickGPT / @nickandbro

08/28/2024 at 06:53PM

21
#75 - Victor Ramirez / @virako

01/25/2013 at 02:29AM

21
#76 - Hubba / @HubbaBubbaFett

01/26/2013 at 07:35PM

21
#77 - gnobbles / @gnobbles

03/31/2013 at 04:14AM

21
#78 - LĂĄszlĂł BĂĄcsi / @icanscale

05/07/2013 at 02:49PM

21
#79 - Tom User / @kiryph

05/30/2013 at 01:46PM

21
#80 - James Scriven / @JamesDScriven

07/07/2013 at 11:51AM

21
#81 - Peter Johannson / @PeterJohannson

08/04/2013 at 08:30PM

21
#82 - Michael Coles / @gen_ale_drinker

08/13/2013 at 02:13PM

21
#83 - Barry Nichols / @Barry_Nichols

08/26/2013 at 06:29AM

21
#84 - Dan / @dan_winkler

08/29/2013 at 01:21AM

21
#85 - Arturo Escaip / @arturoescaip

09/03/2013 at 01:25AM

21
#86 - Dimitar Dimitrov / @kurkale6ka

10/18/2013 at 09:22AM

21
#87 - Jonathan Potter / @nTypeRed

11/11/2013 at 08:10PM

21
#88 - Andrew O'Neill / @AndroidOatmeal

12/18/2013 at 03:25PM

21
#89 - Yann Moisan / @YannMoisan

01/01/2014 at 10:05PM

21
#90 - grey wolfs / @grey_wolfs

02/05/2014 at 06:20AM