Skip to content

Commit 169e1e1

Browse files
authored
Merge branch 'main' into deprecate-buffdo
2 parents 6b14fbc + bc824e5 commit 169e1e1

File tree

2 files changed

+102
-104
lines changed

2 files changed

+102
-104
lines changed

Diff for: .editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true
8+
9+
[*.md]
10+
trim_trailing_whitespace = false

Diff for: README.md

+92-104
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,30 @@ When I was still in college it was common to try multiple programming languages,
1818

1919
```lua
2020
require("lazy").setup({
21-
{"CRAG666/code_runner.nvim", config = true },
21+
{ "CRAG666/code_runner.nvim", config = true },
2222
}
2323
```
2424

2525
- With [packer.nvim](https://github.com/wbthomason/packer.nvim)
2626

2727
```lua
28-
use { 'CRAG666/code_runner.nvim', requires = 'nvim-lua/plenary.nvim' }
28+
use {
29+
'CRAG666/code_runner.nvim',
30+
requires = 'nvim-lua/plenary.nvim'
31+
}
2932
```
3033

31-
Consider using [CRAG666/betterTerm.nvim](https://github.com/CRAG666/betterTerm.nvim)
32-
33-
require("harpoon.term").sendCommand(1, require("code_runner.commands").get_filetype_command() .. "\n")
34-
3534
- With [paq-nvim](https://github.com/savq/paq-nvim)
3635

3736
```lua
38-
require "paq"{'CRAG666/code_runner.nvim'; 'nvim-lua/plenary.nvim';}
37+
require "paq"{
38+
'CRAG666/code_runner.nvim';
39+
'nvim-lua/plenary.nvim';
40+
}
3941
```
4042

43+
Consider using [CRAG666/betterTerm.nvim](https://github.com/CRAG666/betterTerm.nvim)
44+
4145
### Quick start
4246

4347
Add the following line to your init.lua
@@ -73,11 +77,8 @@ Don't use setup if filetype or a json path
7377
- Run in a split
7478
- Run in toggleTerm
7579

76-
##### Help build this feature
77-
78-
The things to do are listed below:
79-
80-
- 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.
8182
8283
### Functions
8384

@@ -112,30 +113,21 @@ vim.keymap.set('n', '<leader>crp', ':CRProjects<CR>', { noremap = true, silent =
112113
- `startinsert`: init in insert mode(default: false)
113114
- `term`: Configurations for the integrated terminal
114115
Fields:
115-
116116
- `position`: Integrated terminal position(for option :h windows, default: `belowright`)
117117
- `size`: Size of the terminal window (default: `8`)
118-
119118
- `float`: Configurations for the float win
120-
Fields:
121-
122-
- `border`: Window border (see ':h nvim_open_win')
119+
- `border`: Window border (see `:h nvim_open_win`)
123120
- `height`
124121
- `width`
125122
- `x`
126123
- `y`
127124
- `border_hl`: (default: FloatBorder)
128125
- `float_hl`: (defult: "Normal")
129-
- `blend`: Transparency (see ':h winblend')
130-
126+
- `blend`: Transparency (see `:h winblend`)
131127
- `before_run_filetype`: Execute before executing a file(type func)
132-
133128
- `filetype_path`: Absolute path to json file config (default: "", use absolute paths)
134-
135129
- `filetype`: If you prefer to use lua instead of json files, you can add your settings by file type here(type table)
136-
137130
- `project_path`: Absolute path to json file config (default: "", use absolute paths)
138-
139131
- `project`: If you prefer to use lua instead of json files, you can add your settings by project here(type table)
140132

141133
### Setup
@@ -147,11 +139,11 @@ require('code_runner').setup {
147139
focus = false,
148140
startinsert = true,
149141
term = {
150-
position = "vert",
151-
size = 8,
152-
},
153-
filetype_path = vim.fn.expand('~/.config/nvim/code_runner.json'),
154-
project_path = vim.fn.expand('~/.config/nvim/project_manager.json')
142+
position = "vert",
143+
size = 8,
144+
},
145+
filetype_path = vim.fn.expand('~/.config/nvim/code_runner.json'),
146+
project_path = vim.fn.expand('~/.config/nvim/project_manager.json')
155147
}
156148
```
157149

@@ -234,37 +226,37 @@ It is important that you know that configuration is given priority in pure lua,
234226
require('code_runner').setup {
235227
mode = "term",
236228
startinsert = true,
237-
term = {
238-
position = "vert",
239-
size = 15,
240-
},
241-
filetype = {
242-
java = {
243-
"cd $dir &&",
244-
"javac $fileName &&",
245-
"java $fileNameWithoutExt"
246-
},
247-
python = "python3 -u",
248-
typescript = "deno run",
249-
rust = {
250-
"cd $dir &&",
251-
"rustc $fileName &&",
252-
"$dir$fileNameWithoutExt"
253-
},
254-
},
255-
project = {
256-
["~/deno/example"] = {
257-
name = "ExapleDeno",
258-
description = "Project with deno using other command",
259-
file_name = "http/main.ts",
260-
command = "deno run --allow-net"
261-
},
262-
["~/cpp/example"] = {
263-
name = "ExapleCpp",
264-
description = "Project with make file",
265-
command = "make buid && cd buid/ && ./compiled_file"
266-
}
267-
},
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+
},
268260
}
269261
```
270262

@@ -288,26 +280,26 @@ The file should look like this(the default file does not exist create it with th
288280
#### Configure with lua files
289281

290282
```lua
291-
..... more config .....
292-
filetype = {
283+
-- ..... more config .....
284+
filetype = {
293285
java = {
294286
"cd $dir &&",
295287
"javac $fileName &&",
296288
"java $fileNameWithoutExt"
297289
},
298-
python = "python3 -u",
299-
typescript = "deno run",
290+
python = "python3 -u",
291+
typescript = "deno run",
300292
rust = {
301293
"cd $dir &&",
302294
"rustc $fileName &&",
303295
"$dir$fileNameWithoutExt"
304296
},
305297
},
306-
..... more config .....
298+
-- ..... more config .....
307299
}
308300
```
309301

310-
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`
311303

312304
#### Variables
313305

@@ -321,12 +313,12 @@ The available variables are the following:
321313

322314
Below is an example of an absolute path and how it behaves depending on the variable:
323315

324-
absolute path: /home/anyuser/current/file.py
316+
absolute path: `/home/anyuser/current/file.py`
325317

326-
- `file` = /home/anyuser/current/file.py
327-
- `fileName` = file.py
328-
- `fileNameWithoutExt` = file
329-
- `dir` = /home/anyuser/current
318+
- `file` = `/home/anyuser/current/file.py`
319+
- `fileName` = `file.py`
320+
- `fileNameWithoutExt` = `file`
321+
- `dir` = `/home/anyuser/current`
330322

331323
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)
332324

@@ -338,19 +330,19 @@ json:
338330

339331
```json
340332
{
341-
....... more ........
342-
"javascript": "node",
343-
"objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt"
333+
# ....... more ........
334+
"javascript": "node",
335+
"objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt"
344336
}
345337
```
346338

347339
lua:
348340

349341
```lua
350342
{
351-
....... more ........
352-
javascript = "node",
353-
["objective-c"] = "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt"
343+
-- ....... more ........
344+
javascript = "node",
345+
["objective-c"] = "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt"
354346
}
355347
```
356348

@@ -388,47 +380,46 @@ The file should look like this(the default file does not exist create it with th
388380
#### Configure with lua files
389381

390382
```lua
391-
..... more config .....
392-
project = {
393-
["~/python/intel_2021_1"] = {
394-
name = "Intel Course 2021",
395-
description = "Simple python project",
396-
file_name = "POO/main.py"
397-
},
398-
["~/deno/example"] = {
399-
name = "ExapleDeno",
400-
description = "Project with deno using other command",
401-
file_name = "http/main.ts",
402-
command = "deno run --allow-net"
403-
},
404-
["~/cpp/example"] = {
405-
name = "ExapleCpp",
406-
description = "Project with make file",
407-
command = "make buid && cd buid/ && ./compiled_file"
408-
}
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+
}
409401
},
410-
..... more config .....
411-
}
402+
-- ..... more config .....
412403
```
413404

414405
There are 3 main ways to configure the execution of a project (found in the example.)
415406

416407
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.
417-
418408
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.
419-
420409
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).
421410

422411
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
423412

424413
#### Projects parameters
425414

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+
426418
- `name`: Project name
427419
- `description`: Project description
428420
- `file_name`: Filename relative to root path
429421
- `command`: Command to run the project. It is possible to use variables exactly the same as we would in `CRFiletype`
430422

431-
warning! : Avoid using all the parameters at the same time. The correct way to use them is shown in the example and described above.
432423

433424
### Queries
434425

@@ -466,9 +457,7 @@ For unknown reasons, leaving a comma in the trailing element in any json file ca
466457
# Inspirations and thanks
467458

468459
- 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)
469-
470460
- [jaq-nvim](https://github.com/is0n/jaq-nvim) some ideas of how to execute commands were taken from this plugin, thank you very much.
471-
472461
- [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
473462

474463
- Thanks to all current and future collaborators, without their contributions this plugin would not be what it is today
@@ -485,9 +474,8 @@ For unknown reasons, leaving a comma in the trailing element in any json file ca
485474

486475
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.
487476

488-
## :warning: Important!
489-
490-
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
491479
492480
# LICENCE
493481

0 commit comments

Comments
 (0)