]> gitweb.factorcode.org Git - factor.git/blob - misc/vim/README.md
editors.vim.generate-syntax: Match new generation
[factor.git] / misc / vim / README.md
1 Vim support for Factor
2 ======================
3
4 This directory contains various support files that make editing Factor code
5 more pleasant in Vim.
6
7 ## Installation
8
9 The file-layout exactly matches the Vim runtime structure,
10 so you can install them by copying the contents of this directory
11 into `~/.vim/` or the equivalent path on other platforms
12 (open Vim and type `:help 'runtimepath'` for details).
13
14 ## File organization
15
16 The current set of files is as follows:
17
18 * ftdetect/factor.vim - Teach Vim when to load Factor support files.
19 * ftplugin/factor.vim - Teach Vim to follow the Factor Coding Style guidelines.
20 * ftplugin/factor-docs.vim - Teach Vim about documentation style differences.
21 * plugin/factor.vim - Teach Vim some commands for navigating Factor source code. See below.
22 * syntax/factor.vim - Teach Vim about highlighting Factor source code syntax.
23   * syntax/factor/generated.vim - Syntax highlighting lessons generated from a Factor VM.
24
25 ## Commands
26
27 The `plugin/factor.vim` file implements the following commands for navigating Factor source.
28
29 ### :FactorVocab factor.vocab.name
30
31 Opens the source file implementing the `factor.vocab.name` vocabulary.
32
33 ### :NewFactorVocab factor.vocab.name
34
35 Creates a new factor vocabulary under the working vocabulary root.
36
37 ### :FactorVocabImpl
38
39 Opens the main implementation file for the current vocabulary
40 (name.factor).  The keyboard shortcut `<Leader>fi` is bound to this command.
41
42 ### :FactorVocabDocs
43
44 Opens the documentation file for the current vocabulary
45 (name-docs.factor).  The keyboard shortcut `<Leader>fd` is bound to this command.
46
47 ### :FactorVocabTests
48
49 Opens the unit test file for the current vocabulary
50 (name-tests.factor).  The keyboard shortcut `<Leader>ft` is bound to this command.
51
52 ## Configuration
53
54 In order for the `:FactorVocab` command to work, you'll need to set some variables in your vimrc file.
55
56 ### g:FactorRoot
57
58 This variable should be set to the root of your Factor
59 installation. The default value is `~/factor`.
60
61 ### g:FactorVocabRoots
62
63 This variable should be set to a list of Factor vocabulary roots.
64 The paths may be either relative to g:FactorRoot or absolute paths.
65 The default value is `["core", "basis", "extra", "work"]`.
66
67 ### g:FactorNewVocabRoot
68
69 This variable should be set to the vocabulary root in which
70 vocabularies created with NewFactorVocab should be created.
71 The default value is `work`.
72
73 ## Note
74
75 The `syntax/factor/generated.vim` syntax highlighting file
76 is automatically generated
77 to include the names of all the vocabularies Factor knows about.
78 To regenerate it manually, run the following code in the listener:
79
80     "editors.vim.generate-syntax" run
81
82 or run it from the command line:
83
84     factor -run=editors.vim.generate-syntax