The goal of the blog is to generate a series of Fibonacci numbers (from Start to End) with VIM ---- the best text editor known to human beings.
[For Vim newbies] Oh really you are not using VIM? If you run a Mac or Linux machine, you can open up a terminal, and type in vi anything, then you will see the checkout point as below.
Start:
End:
Vim Magic
Please type in the following characters:
i*<ESC>Ypqak2YGpgJq20@a:%!awk<space>'{print<space>length}'
Bang! Check out what you've got now.
Step by Step Explanation
- i: switch to edit mode
- <ESC>: switch to navigation mode
- Y: yank current line
- p: paste buffer
- qa: record a sequence of operations registered as 'a'
- k: go up by a line
- 2Y: yank 2 lines
- G: go to last line
- p: paste buffer
- gJ: join lines
- q: finish recording
- 20@a: execute 'a' 20 times
- :: open command line
- !awk<space>'{print<space>length}': execute AWK command
Learn Vim
I recommend Learn Vim Progressively for starters. If you want to get little bit more involved, usr_toc is definitely the choice. It is written by Bram Moolenaar, the author of Vim.
Reference:
- https://en.wikipedia.org/wiki/Vim_(text_editor)
- https://en.wikipedia.org/wiki/AWK
- http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/
- http://vimdoc.sourceforge.net/htmldoc/usr_toc.html

"the best text editor know to human beings"
ReplyDeleteI would say "known". lol
Corrected.... Thanks.....
Delete