Skip to content

Commit fa27c47

Browse files
committed
load messages feature to accomodate for overrides by Noice and
the like plugins fixed buffer delete bug improved stacktrace
1 parent e5f012b commit fa27c47

6 files changed

Lines changed: 5070 additions & 41 deletions

File tree

README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
# 💻 Lua console
22

33
**lua-console.nvim** is yet another REPL console to execute Lua, configure Neovim, explore its API and settings.
4-
Acts as a user friendly replacement of Command mode - Messages loop.
4+
Acts as a user friendly replacement of command mode - messages loop and as a handy scratch pad to store and test code gists.
5+
6+
<img src="doc/demo.gif">
57

68
## 💡 Motivation
79

8-
After installing Neovim, it took me some time to configure it, learn its settings, structure and API, while learning Lua in the process.
9-
I got fed up of constantly hitting `:`, typing `lua= command`, then typing `:messages` to see the output, only to find out that a made a typo or a syntax error and retyping the whole thing again, copying the paths from error stacktraces and so on. I needed something better, so there it is.
10+
After installing Neovim, it took me some time to configure it, learn its settings, structure and API, while learning Lua in the process.
11+
I got fed up of constantly hitting `:`, typing `lua= command`, then typing `:messages` to see the output, only to find out that a made a typo or a
12+
syntax error and retyping the whole thing again, copying the paths from error stacktraces and so on. I needed something better, so there it is.
1013

1114
## ✨ Features
1215

1316
- Evaluate single line expressions
1417
- Evaluate visually selected lines of code
15-
- Pretty print Lua objects, including function details and their source path
18+
- Pretty print Lua objects, including function details and their source paths
1619
- Show normal and error output in the console, including output of print(), errors and stacktraces.
1720
- Syntax highlighting and autocompletion
18-
- Load Neovim’s messages into console
21+
- Load Neovim’s messages into console for inspection and copy/paste
22+
- Open links from stacktraces and function sources
1923
- Save / Load console session
24+
- Use as scratch pad for code gists
2025

2126

2227
## 📦 Installation
@@ -29,7 +34,8 @@ return {
2934
lazy = true, keys = "`", opts = {},
3035
}
3136
```
32-
otherwise: `require('lua-console').setup({opts})`
37+
otherwise, install with your favourite package manager and add
38+
`require('lua-console').setup({opts})` somewhere in your config.
3339

3440

3541
## ⚙️ Configuration
@@ -41,7 +47,7 @@ opts = {
4147
buffer = {
4248
prepend_result_with = '=> ',
4349
save_path = vim.fn.stdpath('state') .. '/lua-console.lua',
44-
load_on_start = true -- load saved session on first entry
50+
load_on_start = true -- load saved session on Vim start
4551
},
4652
window = {
4753
-- @field height number Percentage of main window
@@ -50,7 +56,7 @@ opts = {
5056
},
5157
mappings = {
5258
toggle = '`',
53-
eval = '<CR>', -- or <C-J> for <C-Enter>
59+
eval = '<CR>',
5460
clear = 'C',
5561
messages = 'M',
5662
save = 'S',
@@ -63,10 +69,10 @@ opts = {
6369

6470
- Install, hit the mapped key `` ` `` and start exploring.
6571
- Enter code as normal, in insert mode.
66-
- Hit `Enter` in normal mode to evaluate a variable or an expression in the current line.
72+
- Hit `Enter` in normal mode to evaluate a variable, statement or an expression in the current line.
6773
- Visually select a range of lines and press `Enter` to evaluate the code in the range.
74+
- The evaluation of the last line is returned and printed, so no `return` is needed in most cases.
6875
- Use `print()` in your code to output the result into the console. Objects and functions are pretty printed.
69-
- Use `return …` at the end of multiline code to return a result instead of nil.
7076
- Press `M` to load Neovim messages into the console.
7177
- Press `gf` to follow the paths in stack traces and to function sources.
7278
- Use `S` and `L` to save / load the console session to preserve history of your hacking.

0 commit comments

Comments
 (0)