|
|
(One intermediate revision by one other user not shown) |
Line 1: |
Line 1: |
− | <tt>vim</tt> is an [[source code editor|editor]] well-suited to program.
| + | #REDIRECT [[vim]] |
− | | |
− | == configuration ==
| |
− | The <tt>vim</tt> editor experience can be enhanced for editing [[Pascal]] source code files.
| |
− | | |
− | === margin ===
| |
− | The ex-command
| |
− | <syntaxhighlight lang="vim">set colorcolumn=80</syntaxhighlight>
| |
− | will change the background of the 80<sup>th</sup> column.
| |
− | Depending on the <syntaxhighlight lang="vim" inline>tabstop</syntaxhighlight> you may reach it earlier or later.
| |
− | This is just a visual guidance.
| |
− | | |
− | The <syntaxhighlight lang="vim" inline>textwidth</syntaxhighlight> variable will actually thwart insertion of lines longer than a certain width.
| |
− | | |
− | === white characters ===
| |
− | Using
| |
− | <syntaxhighlight lang="vim">set listchars=space:⍽</syntaxhighlight>
| |
− | and then activating the “list mode” <syntaxhighlight lang="vim" inline>:set list</syntaxhighlight>, you can display all space characters with a custom symbol.
| |
− | This uses a different color than the actual character used.
| |
− | | |
− | === navigation ===
| |
− | The [[%|<syntaxhighlight lang="text" inline>%</syntaxhighlight>]] key allows you to jump matching parenthesis and curly braces.
| |
− | However, extra precautions have to be taken for [[Begin|<syntaxhighlight lang="pascal" inline>begin</syntaxhighlight>]] and [[End|<syntaxhighlight lang="pascal" inline>end</syntaxhighlight>]].
| |
− | You have enable the <syntaxhighlight lang="vim" inline>matchit</syntaxhighlight> plugin (cf. <syntaxhighlight lang="vim" inline>:help matchit-install</syntaxhighlight>):
| |
− | <syntaxhighlight lang="vim">packadd! matchit</syntaxhighlight>
| |
− | | |
− | If you like or have to view/edit source code written in SHOUTCASE, you need to add the following configuration setting:
| |
− | <syntaxhighlight lang="vim">let b:match_ignorecase = 1</syntaxhighlight>
| |
− | | |
− | === folding ===
| |
− | Confer <syntaxhighlight lang="vim" inline>:help folding</syntaxhighlight>.
| |
− | | |
− | The [[User: Kai Burghardt|original editor]] of this article recommends manual folds using markers:
| |
− | <syntaxhighlight lang="vim">set foldmethod=marker</syntaxhighlight>
| |
− | This will generate folds on markers.
| |
− | The default markers are <syntaxhighlight lang="text" inline>{{{</syntaxhighlight> and <syntaxhighlight lang="text" inline>}}}</syntaxhighlight> (confer <syntaxhighlight lang="vim" inline>:help foldmarker</syntaxhighlight>).
| |
− | Thus, the following code
| |
− | <syntaxhighlight lang="pascal">
| |
− | // procedure foo(integer, Boolean) {{{
| |
− | procedure foo(const bar: integer; const able: Boolean);
| |
− | begin
| |
− | end;
| |
− | // }}}
| |
− | </syntaxhighlight>
| |
− | will look like
| |
− | <syntaxhighlight lang="text">
| |
− | +-- 5 lines: procedure foo(integer, Boolean) ----------------------------------
| |
− | </syntaxhighlight>
| |
− | when folded.
| |
− | | |
− | | |
− | | |
− | [[Category: Tutorial]]
| |