From Lazarus wiki
Revision as of 17:23, 1 February 2021 by Kai Burghardt (talk | contribs) (add some vim information)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

vim is an editor well-suited to program.


The vim editor experience can be enhanced for editing Pascal source code files.


The ex-command

set colorcolumn=80

will change the background of the 80th column. Depending on the tabstop you may reach it earlier or later. This is just a visual guidance.

The textwidth variable will actually thwart insertion of lines longer than a certain width.

white characters


set listchars=space:⍽

and then activating the “list mode” :set list, you can display all space characters with a custom symbol. This uses a different color than the actual character used.


The % key allows you to jump matching parenthesis and curly braces. However, extra precautions have to be taken for begin and end. You have enable the matchit plugin (cf. :help matchit-install):

packadd! matchit

If you like or have to view/edit source code written in SHOUTCASE, you need to add the following configuration setting:

let b:match_ignorecase = 1


Confer :help folding.

The original editor of this article recommends manual folds using markers:

set foldmethod=marker

This will generate folds on markers. The default markers are {{{ and }}} (confer :help foldmarker). Thus, the following code

// procedure foo(integer, Boolean) {{{
procedure foo(const bar: integer; const able: Boolean);
// }}}

will look like

+--  5 lines: procedure foo(integer, Boolean) ----------------------------------

when folded.