-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathstan.txt
More file actions
162 lines (111 loc) · 6.92 KB
/
stan.txt
File metadata and controls
162 lines (111 loc) · 6.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
*stan-vim.txt* Vim plugin for the Stan probabilistic programming language.
*stan-vim*
*stan*
`..--::::--..` ~
`-::::::::::::--.` ~
`-:::::::--..`` ~
.::::::-.` ~
-::::::- ```...---- ~
.::::::- ``..---:::::::::::. ~
-:::::-.......---::::::::::::- ~
::::::--...........--::::::::: ~
-:::::::::----.......-:::::::- ~
.:::::::::::::::---..-:::::::. ~
-:::::::::::::--.``.:::::::- ~
.:::::--..````..-::::::::. ~
`......---::::::::::::-` ~
`.-::::::::::::::-.` ~
`..---::---..`` (R) ~
_ _ ~
___| |_ __ _ _ __ __ _(_)_ __ ___ ~
/ __| __/ _` | '_ \ ____\ \ / / | '_ ` _ \ ~
\__ \ || (_| | | | |_____\ V /| | | | | | | ~
|___/\__\__,_|_| |_| \_/ |_|_| |_| |_| ~
===============================================================================
CONTENTS *stan-contents*
1. Introduction.....................................|stan-intro|
2. Installation.....................................|stan-install|
3. Features.........................................|stan-features|
4. License..........................................|stan-license|
5. Contributing.....................................|stan-contrib|
6. Credits..........................................|stan-credits|
===============================================================================
INTRODUCTION *stan-intro*
Vim plugin for the Stan (http://mc-stan.org) probabilistic programming language.
Homepage: https://github.com/eigenfoo/stan-vim
Features include:
* Syntax highlighting of Stan types, keywords and built-in functions.
* Automatic indentation consistent the recommended Stan code style.
* Folding via code indentation.
* Autocompletion of Stan keywords and functions via the Vim built-in
`omnifunc`.
===============================================================================
INSTALLATION *stan-install*
* For Vundle users, place this in your `.vimrc`:
Plugin 'eigenfoo/stan-vim'
then run the following in Vim:
:source %
:PluginInstall
* For Vundle versions < 0.10.2, replace `Plugin` with `Bundle` above.
* For NeoBundle users, replace `Plugin` with `NeoBundle` above.
* For VimPlug users, replace `Plugin` with `Plug` above.
* For Pathogen users, run the following from the terminal:
cd ~/.vim/bundle
git clone https://github.com/eigenfoo/stan-vim
* For manual installation, copy all files into your `~/.vim` directory.
===============================================================================
FEATURES *stan-features*
* stan-vim supports syntax highlighting of Stan types, keywords and built-in
functions, including sampling statements and random number generators. All
syntax is manually defined in `syntax/stan.vim`.
- Note that while strings are supported by Stan (mainly for `print` and
`reject` statements), Stan does not allow the backslash or doublequote
characters in strings. However, stan-vim will still highlight strings with
a backslash character in them.
- Refer to `syntax/stan.vim` for details.
* stan-vim supports automatic indentation consistent the recommended Stan code
style: that is, 2 spaces and no tabs.
- This is achieved by `setlocal expandtab`, and locally setting `tabstop`
and `shiftwidth` variables to 2.
- Furthermore, Vim will reindent when "closing characters" (such as `then`,
`else, and `}`) are entered. This is achieved by locally setting
`indentkeys`.
- Refer to `indent/stan.vim` for details.
* stan-vim supports folding via code indentation: that is, Vim will use code
indentation to determine which lines to fold. Thus, folding is dependent on
the recommended (or at least, consistent) indentation of Stan programs.
- This is achieved by `setlocal foldmethod=indent`.
- Refer to `ftplugin/stan/folding.vim` for details.
* stan-vim supports autocompletion of Stan keywords and functions via Vim's
built-in `omnifunc`.
- Press Ctrl-X Ctrl-O in Insert mode to activate it.
- If you use a separate autocompletion plugin (always recommended!) such as
YouCompleteMe, the plugin will likely make use of this `omnifunc` to offer
completions.
- The autocompletion is achieved by `setlocal
omnifunc=syntaxcomplete#Complete`
- Refer to `ftplugin/stan/autocomplete.vim` for details.
===============================================================================
LICENSE *stan-license*
stan-vim is distributed under the MIT license. See the license file on GitHub:
https://github.com/eigenfoo/stan-vim/blob/master/LICENSE
===============================================================================
CONTRIBUTING *stan-contrib*
stan-vim is developed and maintained in a public repository on GitHub.
https://github.com/eigenfoo/stan-vim
In addition to GitHub, stan-vim is released and distributed on Vim Online.
https://www.vim.org/scripts/script.php?script_id=5835
If you have a bug report, feature request or other question, please file an
issue on GitHub:
https://github.com/eigenfoo/stan-vim/issues
If you would like to send a patch or other code contribution to stan-vim, please
submit a pull request through GitHub:
https://github.com/eigenfoo/stan-vim/pulls
===============================================================================
CREDITS *stan-credits*
* stan-vim contributors:
https://github.com/eigenfoo/stan-vim/graphs/contributors
* Steve Losh for his book, Learn Vimscript the Hard Way
http://learnvimscriptthehardway.stevelosh.com/
* Other Vim plugins for inspiration (specifically, stan.vim, mc-stan.vim and
elm.vim)