Linux Today: Linux News On Internet Time.

Scripting the Vim editor, Part 2: User-defined functions

Jul 10, 2009, 06:04 (0 Talkback[s])
(Other stories by Damian Conway)

[ Thanks to An Anonymous Reader for this link. ]

"Ask Haskell or Scheme programmers, and they'll tell you that functions are the most important feature of any serious programming language. Ask C or Perl programmers, and they'll tell you exactly the same thing. Functions provide two essential benefits to the serious programmer:

"They enable complex computational tasks to be subdivided into pieces small enough to fit comfortably into a single human brain.

"They allow those subdivided pieces to be given logical and comprehensible names, so they can be competently manipulated by a single human brain.

"Vimscript is a serious programming language, so it naturally supports the creation of user-defined functions. Indeed, it arguably has better support for user-defined functions than Scheme, C, or Perl. This article explores the various features of Vimscript functions, and show how you can use those features to enhance and extend Vim's built-in functionality in a maintainable way."

Complete Story

Related Stories: