Challenges: https://www.vimgolf.com/
- Get personal stats of your Played Challenges in a markdown table format
- KdbGolf - useful for parsing files
- Use the shortest command name possible. Check the
help
page for commands. - Omit whitespace where possible.
- Chain commands with
|
delimiter. - Use capital letter motion instead of double letter. E.g. Replace
yy
withY
. - Use
ZZ
to quit vim instead of:x<CR>
or:wq<CR>
. - Macros can be editted.
- Macros are stored into Vim registers, view them with
:reg
. - Assuming the macro is in register
q
, paste the content of registerq
into the buffer using:pu q
. - Inspect and modify the line.
- Copy the macro into the desired register using
"qyy
(whereq
is the desired register here).
- Macros are stored into Vim registers, view them with
- Learn from others' solutions and try to understand the logic behind the solution.
``
: To the position before the latest jump.G
: Goto line [count], default last line, on the first non-blank character.X
: Delete [count] characters before the cursor.gJ
: Join [count] lines, with a minimum of two lines. Don't insert or remove any spaces.+/-
: [count] lines downward/upward, on the first non-blank character linewise.Q
:Ex mode
is useful for chaining multiple commands. Usex/q
to quit.norm
followed by a number does not require a whitespace.
- vim-galore Everything you need to know about Vim
NOTE: Golfing challenges and real world applications are different.
Left | Middle | Right | |
---|---|---|---|
Top | gg | H | |
Middle | 0 / ^ | M | g_ / $ |
Bottom | G | L |
q)sanitize:{"_"sv("_"vs?[x in .Q.an;x;"_"])except enlist""}
q)sanitize"Harder than \"abcd > a b c d\""
"Harder_than_abcd_a_b_c_d"
q)sanitize"대법원 인명용 한자 바인딩(Combine Hangul and Chinese characters)"
"Combine_Hangul_and_Chinese_characters"
A compiled markdown eBook is available! 📖
https://www.vimgolf.com/45533/mau-mauricelim
Played Challenges | Entries | Best score | Best player score | Position | Number of attempts |
---|---|---|---|---|---|
Reorganize Pokémon | 57 | 18 | 18 | #5 / 17 | 10 |
Markdown Blog Editing | 197 | 30 | 36 | #14 / 52 | 3 |
Fix timezone format | 186 | 15 | 15 | #10 / 61 | 5 |
Search different SQL column with similar where clause | 116 | 22 | 22 | #6 / 36 | 6 |
Poorly indented Python comments | 1313 | 15 | 15 | #55 / 220 | 11 |
hello-world-vimgolf | 2490 | 10 | 10 | #341 / 705 | 3 |
Contribute to keyboard mashing | 890 | 17 | 18 | #116 / 270 | 3 |
Reordering Lorem Ipsum | 290 | 13 | 73 | #41 / 66 | 3 |
Fill in the chess board | 956 | 19 | 25 | #63 / 183 | 6 |
Simple, Practical, and Common | 33575 | 22 | 24 | #3116 / 7406 | 3 |
One number per line | 18709 | 14 | 21 | #2581 / 3856 | 3 |
Applying same text modification in several lines | 2869 | 12 | 15 | #542 / 847 | 4 |
remove lines containing the word "reader" | 3574 | 9 | 10 | #857 / 1158 | 2 |
Com(m)a Trouble | 3790 | 12 | 15 | #450 / 857 | 4 |
Box it | 7902 | 21 | 25 | #1044 / 1874 | 5 |
Cool or not? | 829 | 15 | 20 | #166 / 230 | 2 |
Two pairs of cluster of letters creates word | 749 | 17 | 24 | #142 / 178 | 2 |
Just the middle | 11423 | 7 | 8 | #3200 / 4185 | 3 |
Basic renumbering | 5645 | 11 | 11 | #279 / 1263 | 1 |
ninja substitution | 1420 | 14 | 18 | #193 / 267 | 2 |
One to Ten | 2209 | 12 | 12 | #365 / 669 | 1 |
Increment each number | 1023 | 15 | 21 | #183 / 248 | 3 |
simple format (3) | 86 | 34 | 57 | #20 / 24 | 4 |
I forgot quotes | 15967 | 10 | 15 | #2386 / 4174 | 3 |
Words in parens | 12928 | 13 | 14 | #1177 / 3960 | 5 |
Resort and deup a CSV list | 167 | 44 | 48 | #24 / 43 | 6 |
Simple text editing with Vim | 12680 | 13 | 13 | #725 / 3665 | 2 |