32
32
33
33
[ ![ luarocks] ( https://img.shields.io/luarocks/v/Freed-Wu/prompt-style )] ( https://luarocks.org/modules/Freed-Wu/prompt-style )
34
34
35
- [ luaprompt ] ( https://github.com/dpapavas/luaprompt ) is a good REPL of lua.
36
- This project provides :
35
+ This project provides some tools related to
36
+ [ luaprompt ] ( https://github.com/dpapavas/luaprompt ) :
37
37
38
- - A prompt with [ powerlevel10k] ( https://github.com/romkatv/powerlevel10k ) style.
38
+ ## A prompt with [ powerlevel10k] ( https://github.com/romkatv/powerlevel10k ) style
39
39
40
40
![ luap] ( https://user-images.githubusercontent.com/32936898/255322845-c4c6e13c-3b39-4315-b09b-206a1a7783ea.png )
41
41
42
- - A wakatime plugin to statistic how much time you write lua in REPL.
43
-
44
- ![ wakatime] ( https://github.com/wakatime/prompt-style.lua/assets/32936898/b4397806-0ab3-4751-baaa-d9dfed92ace7 )
45
-
46
- Besides lua's REPL, there are many programs written in lua which provide their
47
- REPLs. This project provides some wrapper scripts to use this plugin for them:
48
-
49
- - [ neovim] ( https://neovim.io )
50
- - [ luatex] ( https://www.luatex.org )
51
- - [ pandoc] ( https://pandoc.org )
52
- - [ neomutt] ( https://neomutt.org )
53
-
54
- ![ nvimp] ( https://github.com/wakatime/prompt-style.lua/assets/32936898/8d0b4863-15c6-4966-b8af-219c9c40c1ae )
55
-
56
- Tips: you can skip loading unnecessary plugins in your vimrc by:
57
-
58
- ``` vim
59
- let s:l_flag = 0
60
- for arg in v:argv
61
- if s:l_flag == 1
62
- let g:script_name = fnamemodify(arg, ':t')
63
- break
64
- endif
65
- if arg ==# '-l'
66
- let s:l_flag = 1
67
- endif
68
- endfor
69
- if get(g:, 'script_name', '') ==# 'nvimp'
70
- finish
71
- endif
72
- ```
73
-
74
- ![ texluap] ( https://github.com/wakatime/prompt-style.lua/assets/32936898/96d9f4c1-55fc-4ae3-87b8-7afd29f4ba0e )
75
-
76
- ![ pandocp] ( https://github.com/wakatime/prompt-style.lua/assets/32936898/b556effe-6be7-4cf9-b612-b1283d6de721 )
77
-
78
- ## Usage
79
-
80
42
` ~/.config/luaprc.lua ` :
81
43
82
44
``` lua
83
45
local prompt = require " prompt"
84
- local prompt_style = require " prompt- style"
46
+ local style = require " prompt. style"
85
47
86
- prompt .prompts = { prompt_style .generate_ps1 (), " " }
48
+ prompt .prompts = { style .generate_ps1 (), " " }
87
49
```
88
50
89
- ## Customization
51
+ ## A wakatime plugin to statistic how much time you write lua in REPL
52
+
53
+ ![ wakatime] ( https://github.com/wakatime/prompt-style.lua/assets/32936898/b4397806-0ab3-4751-baaa-d9dfed92ace7 )
90
54
91
55
If there is a git repository, the project name can be achieved by git. Else use
92
56
the base name of current working directory.
93
- You can call ` (require "prompt- style").wakatime("wakatime-cli XXX") ` to
57
+ You can call ` (require "prompt. style").wakatime("wakatime-cli XXX") ` to
94
58
customize it.
95
59
96
60
See
97
61
[ ![ readthedocs] ( https://shields.io/readthedocs/prompt-stylelua )] ( https://prompt-stylelua.readthedocs.io ) .
98
62
63
+ ## REPLs for many programs contains a lua interpreters
64
+
65
+ ### Lua 5.1/LuaJIT
66
+
67
+ #### [ neovim] ( https://neovim.io )
68
+
69
+ ![ cmd] ( https://github.com/user-attachments/assets/26a34d2e-7db9-412c-beb3-87b8598294f9 )
70
+
71
+ ` ~/.config/nvim/init.lua ` :
72
+
73
+ ``` lua
74
+ local l_flag = false
75
+ for _ , arg in ipairs (vim .v .argv ) do
76
+ if l_flag == true then
77
+ vim .g .script_name = vim .fs .basename (arg )
78
+ break
79
+ end
80
+ if arg == " -l" then
81
+ l_flag = true
82
+ end
83
+ end
84
+ if vim .g .script_name == " nvimp" then
85
+ require " prompt" .name = " nvim"
86
+ loadfile (vim .fs .joinpath (os.getenv (" HOME" ), " .config" , " luaprc.lua" ))()
87
+ -- skip loading unnecessary vim plugins
88
+ return
89
+ end
90
+ ```
91
+
92
+ #### luajittex
93
+
94
+ Refer [ luatex] ( #luatex ) .
95
+
96
+ ### Lua 5.3
97
+
98
+ #### luatex
99
+
100
+ ![ texluap] ( https://github.com/wakatime/prompt-style.lua/assets/32936898/96d9f4c1-55fc-4ae3-87b8-7afd29f4ba0e )
101
+
102
+ #### [ neomutt] ( https://neomutt.org )
103
+
104
+ Broken in [ upstream] ( https://github.com/neomutt/neomutt/issues/4328 )
105
+
106
+ ### Lua 5.4
107
+
108
+ #### [ pandoc] ( https://pandoc.org )
109
+
110
+ ![ pandocp] ( https://github.com/wakatime/prompt-style.lua/assets/32936898/b556effe-6be7-4cf9-b612-b1283d6de721 )
111
+
99
112
## Install
100
113
101
114
### [ AUR] ( https://aur.archlinux.org/packages/lua-prompt-style )
104
117
paru -S lua{,51,52,53}-prompt-style
105
118
```
106
119
107
- ** NOTE** : REPLs use some specific version of lua.
108
-
109
120
### [ Luarocks] ( https://luarocks.org/modules/Freed-Wu/prompt-style )
110
121
111
122
``` sh
@@ -116,3 +127,5 @@ luarocks install prompt-style
116
127
117
128
- [ neolua] ( https://github.com/nvim-neorocks/neorocks ) : Another lua interpreter
118
129
based on neovim like ` nvimp ` . It doesn't provide a REPL like lua.
130
+ - [ nlua] ( https://github.com/mfussenegger/nlua ) : Another lua interpreter
131
+ based on neovim like ` nvimp ` . It doesn't provide a REPL like lua.
0 commit comments