Skip to content

Commit f5a3e15

Browse files
committed
✨ Support pandoc, neomutt
1 parent cdea29f commit f5a3e15

File tree

5 files changed

+85
-7
lines changed

5 files changed

+85
-7
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ repos:
7171
- id: markdownlint-cli2
7272
additional_dependencies:
7373
74-
- repo: https://github.com/scop/pre-commit-shfmt
75-
rev: v3.7.0-1
76-
hooks:
77-
- id: shfmt
7874
- repo: https://github.com/psf/black
7975
rev: 23.3.0
8076
hooks:

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@
3333
[![luarocks](https://img.shields.io/luarocks/v/Freed-Wu/prompt-style)](https://luarocks.org/modules/Freed-Wu/prompt-style)
3434

3535
[Powerlevel10k](https://github.com/romkatv/powerlevel10k) style for [luaprompt](https://github.com/dpapavas/luaprompt).
36-
Include REPLs for neovim and luatex.
36+
Include REPLs for:
37+
38+
- [neovim](https://neovim.io)
39+
- [luatex](https://www.luatex.org)
40+
- [pandoc](https://pandoc.org)
41+
- [neomutt](https://neomutt.org)
3742

3843
![luap](https://user-images.githubusercontent.com/32936898/255322845-c4c6e13c-3b39-4315-b09b-206a1a7783ea.png)
3944

@@ -65,7 +70,7 @@ See
6570
yay -S lua{,51,52,53}-prompt-style
6671
```
6772

68-
**NOTE**: neovim, luatex use some specific version of lua.
73+
**NOTE**: REPLs use some specific version of lua.
6974

7075
### [Luarocks](https://luarocks.org/modules/Freed-Wu/prompt-style)
7176

bin/neomuttp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env -S sh -c 'neomutt -Belua-source\\ $0'
2+
local string = require "string"
3+
local package = require "package"
4+
local version = string.gsub(_VERSION, ".* ", "")
5+
local path = package.path
6+
local cpath = package.cpath
7+
package.path = package.path .. ";/usr/share/lua/" .. version .. "/?.lua;/usr/share/lua/" .. version .. "/?/init.lua"
8+
local ext = string.match(package.cpath, '([^.]+)[;|$]')
9+
package.cpath = package.cpath .. ";/usr/lib/lua/" .. version .. "/?." .. ext
10+
11+
local prompt = require "prompt"
12+
prompt.name = 'texlua'
13+
prompt.prompts = { '> ', '>> ' }
14+
prompt.colorize = true
15+
prompt.history = os.getenv('HOME') .. '/.lua_history'
16+
17+
for _, name in ipairs { os.getenv('HOME') .. '/.luaprc.lua',
18+
os.getenv('HOME') .. '/.config/luaprc.lua' } do
19+
local f = io.open(name, "r")
20+
if f ~= nil then
21+
io.close(f)
22+
23+
chunk, message = loadfile(name)
24+
25+
if chunk then
26+
chunk()
27+
else
28+
print(message)
29+
end
30+
31+
break
32+
end
33+
end
34+
35+
package.path = path
36+
package.cpath = cpath
37+
prompt.enter()
38+
-- ex: filetype=lua

bin/pandocp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env -S pandoc -fmarkdown /dev/null --lua-filter
2+
local string = require "string"
3+
local package = require "package"
4+
local version = string.gsub(_VERSION, ".* ", "")
5+
local path = package.path
6+
local cpath = package.cpath
7+
package.path = package.path .. ";/usr/share/lua/" .. version .. "/?.lua;/usr/share/lua/" .. version .. "/?/init.lua"
8+
local ext = string.match(package.cpath, '([^.]+)[;|$]')
9+
package.cpath = package.cpath .. ";/usr/lib/lua/" .. version .. "/?." .. ext
10+
11+
local prompt = require "prompt"
12+
prompt.name = 'pandoc'
13+
prompt.prompts = { '> ', '>> ' }
14+
prompt.colorize = true
15+
prompt.history = os.getenv('HOME') .. '/.lua_history'
16+
17+
for _, name in ipairs { os.getenv('HOME') .. '/.luaprc.lua',
18+
os.getenv('HOME') .. '/.config/luaprc.lua' } do
19+
local f = io.open(name, "r")
20+
if f ~= nil then
21+
io.close(f)
22+
23+
chunk, message = loadfile(name)
24+
25+
if chunk then
26+
chunk()
27+
else
28+
print(message)
29+
end
30+
31+
break
32+
end
33+
end
34+
35+
package.path = path
36+
package.cpath = cpath
37+
prompt.enter()

prompt-style-0.0.1-0.rockspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ build = {
2727
install = {
2828
bin = {
2929
"bin/nvimp",
30-
"bin/texluap"
30+
"bin/texluap",
31+
"bin/pandocp",
32+
"bin/neomuttp"
3133
},
3234
},
3335
}

0 commit comments

Comments
 (0)