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 56680033ac11043d6306aa07

Replace and keep the case

Replace all instance of plugin and Plugin to device and Device.

Start file
 def plugin
   
@plugin, @plugin_found_by = [Plugin.find_by_uid(@plugin_id), :uid] unless @plugin
   
@plugin, @plugin_found_by = [Plugin.find_by_aid(@plugin_id), :aid] unless @plugin
   
@plugin
 
end
End file
 def device
   
@device, @device_found_by = [Device.find_by_uid(@device_id), :uid] unless @device
   
@device, @device_found_by = [Device.find_by_uid(@device_id), :uid] unless @device
   
@device
 
end

View Diff

1,4c1,4
<  def plugin
<     @plugin, @plugin_found_by = [Plugin.find_by_uid(@plugin_id), :uid] unless @plugin
<     @plugin, @plugin_found_by = [Plugin.find_by_aid(@plugin_id), :aid] unless @plugin
<     @plugin
---
>  def device
>     @device, @device_found_by = [Device.find_by_uid(@device_id), :uid] unless @device
>     @device, @device_found_by = [Device.find_by_uid(@device_id), :uid] unless @device
>     @device

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 117 remaining solutions by signing in and submitting your own entry
#118 El Achèche ANIS 🇹🇳 / @elacheche - Score: 74 - 12/10/15 @ 20:38
:%s/Plugin/Device/g<CR>:<Up><Left><Left><Left><Left><Left><Left><Left><BS>d<Left><Left><Left><Left><Left><Left><Left><BS>p<End><CR>:<Up><Left><Left><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>ai/<BS>d/uid<End><CR>:wq<CR>

0 comments


Created by: @Benoit_Tgt

118 active golfers, 437 entries

Leaderboard (lowest score wins):
27
#61 - Dimitar Dimitrov / @kurkale6ka

03/09/2016 at 03:34PM

27
#62 - Francois Marais / @maraisf

04/03/2018 at 05:14PM

27
#63 - Mihai / @mihaicristiant

01/16/2019 at 10:47AM

27
#64 - Bitt Faulk / @bittfaulk

03/16/2020 at 09:31PM

27
#65 - vimgolfaccfekxh / @vimgolfaccfekxh

10/30/2022 at 08:53PM

28
#66 - brett / @brettyukich

12/09/2015 at 08:26PM

28
#67 - Etienne Florent / @EtienneFlorent

11/29/2016 at 11:16AM

28
#68 - Ivo Blöchliger / @aigledesalpes

08/23/2019 at 08:45PM

29
#69 - mnx / @mnxx

12/09/2015 at 11:31AM

29
#70 - SundaraRaman / @digital_carver

12/13/2015 at 08:21PM

29
#71 - Ralph Canapa / @ralphcanapa

12/14/2015 at 04:23PM

29
#72 - retro / @tryphopp

01/12/2016 at 05:04AM

29
#73 - Cristian Lupașcu / @clupasq

02/08/2016 at 07:39PM

29
#74 - Carlos A Henríquez Q / @lagunex

03/13/2016 at 05:10PM

29
#75 - Chenut Ludovic / @7Brwa7

03/31/2016 at 12:06PM

29
#76 - lilach adir / @leelaRed

04/04/2016 at 06:12AM

29
#77 - Ben Hill / @KaizenSoze70

05/09/2016 at 04:52PM

29
#78 - TweetDreams / @TweetMusicians

10/15/2016 at 04:06AM

29
#79 - Michał Dytko / @DytkoM

12/23/2016 at 10:57AM

30
#80 - Thomas Lovén / @thomasloven

12/09/2015 at 03:49PM

30
#81 - thlix / @thlix

01/10/2016 at 10:29AM

30
#82 - Pratap Koritala / @pratap_koritala

02/29/2016 at 07:01AM

31
#83 - lorentrogers / @lorentrogers

12/09/2015 at 02:04PM

31
#84 - Samuel Masuy / @samasuy

12/09/2015 at 09:10PM

31
#85 - Holden Lewis / @lonnez90

12/09/2015 at 10:42PM

31
#86 - Paulo H Baumann / @PauloBaumann

12/11/2015 at 03:05PM

31
#87 - M S / @b1790037

03/15/2016 at 08:07PM

31
#88 - Peter Brynza / @v3_1

08/19/2016 at 08:41PM

31
#89 - Gurukandhamoorthi / @Gurukandhamoor1

07/13/2017 at 10:12AM

32
#90 - Alexandre Ignjatovic / @bankair

12/09/2015 at 10:53AM