]> gitweb.factorcode.org Git - factor.git/blob - misc/vim/README.md
12cd1a51f697d7ac2e3f594bb889888e64c7a3ab
[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
10 structure, so you can install them by copying the contents of this directory
11 into `~/.vim/` or the equivalent path on other platforms (Open Vim and type
12 `: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 * plugin/factor.vim - Teach Vim some commands for navigating Factor source code. See below.
21 * syntax/factor.vim - Syntax highlighting for Factor code.
22
23 ## Commands
24
25 The `plugin/factor.vim` file implements the following commands for navigating Factor source.
26
27 ### :FactorVocab factor.vocab.name
28
29 Opens the source file implementing the `factor.vocab.name` vocabulary.
30
31 ### :NewFactorVocab factor.vocab.name
32
33 Creates a new factor vocabulary under the working vocabulary root.
34
35 ### :FactorVocabImpl
36
37 Opens the main implementation file for the current vocabulary
38 (name.factor).  The keyboard shortcut `<Leader>fi` is bound to this command.
39
40 ### :FactorVocabDocs
41
42 Opens the documentation file for the current vocabulary
43 (name-docs.factor).  The keyboard shortcut `<Leader>fd` is bound to this command.
44
45 ### :FactorVocabTests
46
47 Opens the unit test file for the current vocabulary
48 (name-tests.factor).  The keyboard shortcut `<Leader>ft` is bound to this command.
49
50 ## Configuration
51
52 In order for the `:FactorVocab` command to work, you'll need to set some variables in your vimrc file.
53
54 ### g:FactorRoot
55
56 This variable should be set to the root of your Factor
57 installation. The default value is `~/factor`.
58
59 ### g:FactorVocabRoots
60
61 This variable should be set to a list of Factor vocabulary roots.
62 The paths may be either relative to g:FactorRoot or absolute paths.
63 The default value is `["core", "basis", "extra", "work"]`.
64
65 ### g:FactorNewVocabRoot
66
67 This variable should be set to the vocabulary root in which
68 vocabularies created with NewFactorVocab should be created.
69 The default value is `work`.
70
71 ## Note
72
73 The syntax-highlighting file is automatically generated to include the
74 names of all the vocabularies Factor knows about. To regenerate it manually,
75 run the following code in the listener:
76
77     "editors.vim.generate-syntax" run
78
79 or run it from the command line:
80
81     factor -run=editors.vim.generate-syntax