Browse code

Add editor integrations

Robert Cranston authored on 23/12/2021 11:25:37
Showing 1 changed files

... ...
@@ -68,6 +68,54 @@ options:
68 68
     Print the generated code that is passed to the compiler.
69 69
 ```
70 70
 
71
+### Editor integrations
72
+
73
+#### Vim
74
+
75
+Add the following [Vimscript][] to `.vimrc`:
76
+
77
+```vimscript
78
+autocmd FileType glsl
79
+\ set makeprg=glslrun
80
+```
81
+
82
+[`:make`][] (or [`:Dispatch`][]) runs this configured `makeprg`.
83
+
84
+`:copen` opens the quickfix list.
85
+
86
+[Vimscript]: https://en.wikipedia.org/wiki/Vim_(text_editor)#Vim_script
87
+[`:make`]: https://vimhelp.org/quickfix.txt.html#:make
88
+[`:Dispatch`]: https://github.com/tpope/vim-dispatch
89
+
90
+#### Visual Studio Code
91
+
92
+Add the following [JSON][] task to `.vscode/tasks.json`:
93
+
94
+```json
95
+{
96
+    "version": "2.0.0",
97
+    "tasks": [
98
+        {
99
+            "label": "glslrun",
100
+            "type": "process",
101
+            "command": "glslrun",
102
+            "args": [ "${file}" ],
103
+            "problemMatcher": "$gcc"
104
+        }
105
+    ]
106
+}
107
+```
108
+
109
+<kbd>Ctrl</kbd><kbd>P</kbd> opens the Command Palette in which `task glslrun`
110
+can be typed.
111
+
112
+<kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>\`</kbd> opens the terminal output.
113
+
114
+<kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>M</kbd> opens the list of problems.
115
+
116
+[JSON]: https://en.wikipedia.org/wiki/JSON
117
+[launch configuration]: https://code.visualstudio.com/docs/editor/debugging#_launch-configurations
118
+
71 119
 ## Dependencies
72 120
 
73 121
 For compiling C++:
... ...
@@ -96,6 +144,12 @@ systems have some version), and are highly likely to be installed by default
96 144
 [`sed`]: https://packages.debian.org/sed
97 145
 [`mawk`]: https://packages.debian.org/mawk
98 146
 
147
+## Example
148
+
149
+```glsl
150
+TODO
151
+```
152
+
99 153
 ## License
100 154
 
101 155
 Licensed under the [ISC License][] unless otherwise noted, see the