You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider using [CRAG666/betterTerm.nvim](https://github.com/CRAG666/betterTerm.nvim)
44
+
41
45
### Quick start
42
46
43
47
Add the following line to your init.lua
@@ -69,25 +73,21 @@ Don't use setup if filetype or a json path
69
73
- Toggle runner
70
74
- Reload runner
71
75
- Run in a Float window
72
-
- Run in a buffer
73
76
- Run in a tab
74
77
- Run in a split
75
78
- Run in toggleTerm
76
79
77
-
##### Help build this feature
78
-
79
-
The things to do are listed below:
80
-
81
-
- Open an issue to know if it is worth implementing this function and if there are people interested in its existence
80
+
> **Note**
81
+
> If you want implement a new feature open an issue to know if it is worth implementing it and if there are people interested.
82
82
83
83
### Functions
84
84
85
85
All run commands allow restart. So, for example, if you use a command that does not have hot reload, you can call a command again and it will close the previous one and start again.
86
86
87
87
-`:RunCode` - Runs based on file type, first checking if belongs to project, then if filetype mapping exists
88
88
-`:RunCode <A_key_here>` - Execute command from its key in current directory.
89
-
-`:RunFile <mode>` - Run the current file(optionally you can select an opening mode: {"toggle", "float", "tab", "toggleterm", "buf"}, default: "term").
90
-
-`:RunProject <mode>` - Run the current project(If you are in a project otherwise you will not do anything, (optionally you can select an opening mode: {"toggle", "float", "tab", "toggleterm", "buf"}, default: "term").
89
+
-`:RunFile <mode>` - Run the current file(optionally you can select an opening mode: {"toggle", "float", "tab", "toggleterm"}, default: "term").
90
+
-`:RunProject <mode>` - Run the current project(If you are in a project otherwise you will not do anything, (optionally you can select an opening mode: {"toggle", "float", "tab", "toggleterm"}, default: "term").
91
91
-`:RunClose` - Close runner
92
92
-`:CRFiletype` - Open json with supported files(Use only if you configured with json files).
93
93
-`:CRProjects` - Open json with list of projects(Use only if you configured with json files).
@@ -235,37 +226,37 @@ It is important that you know that configuration is given priority in pure lua,
235
226
require('code_runner').setup {
236
227
mode="term",
237
228
startinsert=true,
238
-
term= {
239
-
position="vert",
240
-
size=15,
241
-
},
242
-
filetype= {
243
-
java= {
244
-
"cd $dir &&",
245
-
"javac $fileName &&",
246
-
"java $fileNameWithoutExt"
247
-
},
248
-
python="python3 -u",
249
-
typescript="deno run",
250
-
rust= {
251
-
"cd $dir &&",
252
-
"rustc $fileName &&",
253
-
"$dir$fileNameWithoutExt"
254
-
},
255
-
},
256
-
project= {
257
-
["~/deno/example"] = {
258
-
name="ExapleDeno",
259
-
description="Project with deno using other command",
260
-
file_name="http/main.ts",
261
-
command="deno run --allow-net"
262
-
},
263
-
["~/cpp/example"] = {
264
-
name="ExapleCpp",
265
-
description="Project with make file",
266
-
command="make buid && cd buid/ && ./compiled_file"
267
-
}
268
-
},
229
+
term= {
230
+
position="vert",
231
+
size=15,
232
+
},
233
+
filetype= {
234
+
java= {
235
+
"cd $dir &&",
236
+
"javac $fileName &&",
237
+
"java $fileNameWithoutExt"
238
+
},
239
+
python="python3 -u",
240
+
typescript="deno run",
241
+
rust= {
242
+
"cd $dir &&",
243
+
"rustc $fileName &&",
244
+
"$dir$fileNameWithoutExt"
245
+
},
246
+
},
247
+
project= {
248
+
["~/deno/example"] = {
249
+
name="ExapleDeno",
250
+
description="Project with deno using other command",
251
+
file_name="http/main.ts",
252
+
command="deno run --allow-net"
253
+
},
254
+
["~/cpp/example"] = {
255
+
name="ExapleCpp",
256
+
description="Project with make file",
257
+
command="make buid && cd buid/ && ./compiled_file"
258
+
}
259
+
},
269
260
}
270
261
```
271
262
@@ -289,26 +280,26 @@ The file should look like this(the default file does not exist create it with th
289
280
#### Configure with lua files
290
281
291
282
```lua
292
-
..... moreconfig .....
293
-
filetype= {
283
+
--..... more config .....
284
+
filetype= {
294
285
java= {
295
286
"cd $dir &&",
296
287
"javac $fileName &&",
297
288
"java $fileNameWithoutExt"
298
289
},
299
-
python="python3 -u",
300
-
typescript="deno run",
290
+
python="python3 -u",
291
+
typescript="deno run",
301
292
rust= {
302
293
"cd $dir &&",
303
294
"rustc $fileName &&",
304
295
"$dir$fileNameWithoutExt"
305
296
},
306
297
},
307
-
..... moreconfig .....
298
+
--..... more config .....
308
299
}
309
300
```
310
301
311
-
if you want to add some other language or some other command follow this structure "key": "commans"
302
+
if you want to add some other language or some other command follow this structure `key`: `commans`
312
303
313
304
#### Variables
314
305
@@ -322,12 +313,12 @@ The available variables are the following:
322
313
323
314
Below is an example of an absolute path and how it behaves depending on the variable:
324
315
325
-
absolute path: /home/anyuser/current/file.py
316
+
absolute path: `/home/anyuser/current/file.py`
326
317
327
-
-`file` = /home/anyuser/current/file.py
328
-
-`fileName` = file.py
329
-
-`fileNameWithoutExt` = file
330
-
-`dir` = /home/anyuser/current
318
+
-`file` = `/home/anyuser/current/file.py`
319
+
-`fileName` = `file.py`
320
+
-`fileNameWithoutExt` = `file`
321
+
-`dir` = `/home/anyuser/current`
331
322
332
323
Remember that if you don't want to use variables you can use vim [filename-modifiers](http://vimdoc.sourceforge.net/htmldoc/cmdline.html#filename-modifiers)
@@ -389,47 +380,46 @@ The file should look like this(the default file does not exist create it with th
389
380
#### Configure with lua files
390
381
391
382
```lua
392
-
..... moreconfig .....
393
-
project= {
394
-
["~/python/intel_2021_1"] = {
395
-
name="Intel Course 2021",
396
-
description="Simple python project",
397
-
file_name="POO/main.py"
398
-
},
399
-
["~/deno/example"] = {
400
-
name="ExapleDeno",
401
-
description="Project with deno using other command",
402
-
file_name="http/main.ts",
403
-
command="deno run --allow-net"
404
-
},
405
-
["~/cpp/example"] = {
406
-
name="ExapleCpp",
407
-
description="Project with make file",
408
-
command="make buid && cd buid/ && ./compiled_file"
409
-
}
383
+
--..... more config .....
384
+
project= {
385
+
["~/python/intel_2021_1"] = {
386
+
name="Intel Course 2021",
387
+
description="Simple python project",
388
+
file_name="POO/main.py"
389
+
},
390
+
["~/deno/example"] = {
391
+
name="ExapleDeno",
392
+
description="Project with deno using other command",
393
+
file_name="http/main.ts",
394
+
command="deno run --allow-net"
395
+
},
396
+
["~/cpp/example"] = {
397
+
name="ExapleCpp",
398
+
description="Project with make file",
399
+
command="make buid && cd buid/ && ./compiled_file"
400
+
}
410
401
},
411
-
..... moreconfig .....
412
-
}
402
+
-- ..... more config .....
413
403
```
414
404
415
405
There are 3 main ways to configure the execution of a project (found in the example.)
416
406
417
407
1. Use the default command defined in the filetypes file (see `:CRFiletype`or check your confi lua). In order to do that it is necessary to define file_name.
418
-
419
408
2. Use a different command than the one set in `CRFiletype` or your config lua. In this case, the file_name and command must be provided.
420
-
421
409
3. Use a command to run the project. It is only necessary to define command(You do not need to write navigate to the root of the project, because automatically the plugin is located in the root of the project).
422
410
423
411
Note: Don't forget to name your projects because if you don't do so code runner will fail as it uses the name for the buffer name
424
412
425
413
#### Projects parameters
426
414
415
+
> **Warning**
416
+
> Avoid using all the parameters at the same time. The correct way to use them is shown in the example and described above.
417
+
427
418
-`name`: Project name
428
419
-`description`: Project description
429
420
-`file_name`: Filename relative to root path
430
421
-`command`: Command to run the project. It is possible to use variables exactly the same as we would in `CRFiletype`
431
422
432
-
warning! : Avoid using all the parameters at the same time. The correct way to use them is shown in the example and described above.
433
423
434
424
### Queries
435
425
@@ -467,9 +457,7 @@ For unknown reasons, leaving a comma in the trailing element in any json file ca
467
457
# Inspirations and thanks
468
458
469
459
- The idea of this project comes from the vscode plugin [code_runner](https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner) You can even copy your configuration and pass it to this plugin, as they are the same in the way of defining commands associated with [filetypes](https://github.com/CRAG666/code_runner.nvim#add-support-for-more-file-types)
470
-
471
460
-[jaq-nvim](https://github.com/is0n/jaq-nvim) some ideas of how to execute commands were taken from this plugin, thank you very much.
472
-
473
461
-[FTerm.nvim](https://github.com/numToStr/FTerm.nvim) Much of how this README.md is structured was blatantly stolen from this plugin, thank you very much
474
462
475
463
- Thanks to all current and future collaborators, without their contributions this plugin would not be what it is today
@@ -486,9 +474,8 @@ For unknown reasons, leaving a comma in the trailing element in any json file ca
486
474
487
475
Your help is needed to make this plugin the best of its kind, be free to contribute, criticize (don't be soft) or contribute ideas. All PR's are welcome.
488
476
489
-
## :warning: Important!
490
-
491
-
If you have any ideas to improve this project, do not hesitate to make a request, if problems arise, try to solve them and publish them. Don't be so picky I did this in one afternoon
477
+
> **Note**
478
+
> If you have any ideas to improve this project, do not hesitate to make a request, if problems arise, try to solve them and publish them. Don't be so picky I did this in one afternoon
0 commit comments