Stop learning alone!

Learn faster and stay on-track by joining this free class with other self-learners.

Register for Learning Vim from the inside now.

Learning Vim from the inside

Open Ended Class

Creator: pbr

Status: Established

Join this class!

Lesson 4: Assignment 3

The danboykis assignment

danboykis wrote: "I most want to explore the scripting language part of vim."

Awesome! Let's get started. Did you know Vim script is considered an actual language? Well, at least according to ohloh it is!

So rather than diving right into the C source code to understand Vim script (and pull our hair out), let's leverage the existing documentation (a.k.a usr_41) and the Internet first.

  • within vim: :help vim-script

Read the help for Vim script end-to-end. Don't scan, read everything and look for surprises. They're there! If you just have to read things in a browser, here's usr_41 online - enjoy.

Questions for you:

  • how many kinds of numbers are there?
  • If I have a string with content ':1,.w firstpart.txt' how do I get Vim script to do that command for me?
  • What does :function do?
  • What does :function make possible within a program?
  • What questions would you have asked students, based on what you learned in usr_41? (and, what are the answers to those questions?)

Now you're ready for an awesome tutorial on Vim script from IBM. Open these IBM DeveloperWorks articles in separate tabs, and read them end-to-end. Having read through the Vim documentation on Vim script, you'll get a LOT more from the articles than you would otherwise.

Finally check out the various FAQs matching 'Vim script' over on Vim the docs


HOMEWORK: What questions do you still have, after having read through all of the above? What are your trying to do with Vim script that you still can't figure out how to do?

SUPER-DUPER EXTRA CREDIT: (worth +100,000,000,000 and my deepest respect) Here's AWK code that solves Sudoku puzzles - port the solution to Vim script, creating a single file which can be used for solving Sudoku puzzles with just Vim.

FOR INSOMNIACS ONLY: There are close to 3000 Vim scripts listed on Vim.org - here's a list sorted by rating - which ones caught your attention? Let us know in this forum thread rather than via homework

WANT TO HELP OUT? After completing this assignment you'll be more than qualified to help improve the text of the VimL script learning guide on wikibooks.org - so go for it! Edit, Correct, Add sections. The part about objects especially needs to be fleshed out and better explained.

Homework Submissions

2 total

predator117 (Self-grade: Outstanding)
Submitted 1 year ago | Permalink | Time spent: 1 minute

thanks i am enjoying the ibm links

pbr (Self-grade: Outstanding)
Submitted 2 years ago | Permalink

So there are some additional VimScript tutorials on the IBM site; enjoy!

http://www.ibm.com/developerworks/linux/library/l-vim-script-1/index.html

http://www.ibm.com/developerworks/linux/library/l-vim-script-2/index.html

http://www.ibm.com/developerworks/linux/library/l-vim-script-3/index.html

http://www.ibm.com/developerworks/linux/library/l-vim-script-4/index.html

http://www.ibm.com/developerworks/linux/library/l-vim-script-5/index.html