Remaps has been removed to simplify key bindings. With Lua, it's now
possible to remap using basic assignments.
For e.g.
```Lua
xplr.config.modes.builtin.default.key_bindings.on_key["v"] = xplr.config.modes.builtin.default.key_bindings.on_key.space
```
Help menu will auto detect remapped keys and display after removing the
redundant mappings.
Ref: https://github.com/sayanarijit/xplr/discussions/183#discussioncomment-774159
- Broken symlink should display without error.
- Display the symlink destination.
- Fix deleting symlinks pointing to a directory.
Fixes: https://github.com/sayanarijit/xplr/issues/185
Public structs enable automatec documentation.
xplr is not (yet) a library. Even it want to become one, making fields
private is probably not the right way.
This works:
```lua
xplr.fn.custom.ping = function(app)
print("What's your name?")
local name = io.read()
os.execute('read -p "Hello ' .. name .. ', you are in ' .. app.pwd .. '"')
return {
{ LogSuccess = "pong" },
}
end
```
Then it can be called via `CallLua: custom.ping`.
The initial idea was to enable other tools to control `xplr` via the
input pipe. However, so far I didn't feel the need to use this feature.
And even if there is any need, it's much better to implement ad-hoc
services instead of wasting cpu resources.
This PR aims to fully migrate `config.yml` to `init.lua`
Also, use `builtin.foo_func` instead of `xplr.fn.builtin.foo_func`.
Similarly, use `custom.foo_func` instead of `xplr.fn.custom.foo_func`.
Closes: https://github.com/sayanarijit/xplr/issues/160
This commit begins porting of `config.yml` to `init.lua`.
As of now, it's not be possible to do the complete migration
because of how lua and yaml handles `null`/`nil` value.
So, we will need to completely deprecate `config.yml` in order to do the
complete migration.
Use `remaps: {key: null}` to un-map a key.
Also,
- `gx` will now open only the file under focus.
- `:sx` will open the selected files.
And other minor improvements.
Discussion: https://github.com/sayanarijit/xplr/discussions/146
The input poll timeout needs to stay low, else xplr will panic when you
spawn a subshell and start typing immediately.
From the `top` command, it didn't show any noticeable overhead.
Stay in the current mode when key input is not recognised. It's better
to do nothing than doing something wrong, at least when dealing with
important files and folders.
- Optimize by avoiding cloning the whole app in each iteration of the main
loop.
- Increase the input poll timeout from 1 to 200. This works because the
poll will not apply to key hold.
- Do not read input pipe if it hasn't been modified.