Arijit Basu
f12e1e5290
Fix config path on macOS
...
Also, add `-c` / `--config` CLI option to specify custom config file.
Priority is:
`-c <PATH>` > `~/.config/xplr/init.lua` > `/etc/xplr/init.lua`.
Fixes: https://github.com/sayanarijit/xplr/issues/230
3 years ago
Arijit Basu
1513c325d6
Add option to disable recover mode
...
Use `config.general.disable_recover_mode = true` to disable the recover
mode.
Closes: https://github.com/sayanarijit/xplr/issues/232
3 years ago
Arijit Basu
a2f42ac6fc
Add support for FIFO based previewer
...
Adds basic support for nnn-like FIFO based previewer.
The FIFO can be manager with the following messages:
- StartFifo: /path/to/fifo
- StopFifo
- ToggleFifo: /path/to/fifo
A basic nnn plugin wrapper example:
```lua
-- Usage Example:
--
-- require("nnn_preview_wrapper").setup{
-- plugin_path = os.getenv("HOME") .. "/.config/nnn/plugins/preview-tabbed",
-- fifo_path = "/tmp/xplr.fifo",
-- mode = "action",
-- key = "p",
-- }
--
-- Press `:p` to toggle preview mode.
local function setup(o)
if o.fifo_path == nil then
o.fifo_path = os.getenv("NNN_FIFO")
end
if o.mode == nil then
o.mode = "action"
end
if o.key == nil then
o.key = "p"
end
local enabled = false
local message = nil
os.execute('[ ! -p "' .. o.fifo_path ..'" ] && mkfifo "' .. o.fifo_path .. '"')
xplr.fn.custom.preview_toggle = function(app)
if enabled then
enabled = false
message = "StopFifo"
else
os.execute('NNN_FIFO="' .. o.fifo_path .. '" "'.. o.plugin_path .. '" & ')
enabled = true
message = { StartFifo = o.fifo_path }
end
return { message }
end
xplr.config.modes.builtin[o.mode].key_bindings.on_key[o.key] = {
help = "search with preview",
messages = {
"PopMode",
{ CallLuaSilently = "custom.preview_toggle" },
},
}
end
return { setup = setup }
```
Press `:p` to toggle preview mode.
Closes: https://github.com/sayanarijit/xplr/issues/205
3 years ago
Arijit Basu
2962a8d52d
Further improve the API.
...
This improves the compatibility and adds the ability to introduce
non-breaking changes by using a builder pattern.
Example:
```rust
fn main() {
match xplr::runner(None).and_then(|a| a.run()) {
Ok(Some(out)) => print!("{}", out),
Ok(None) => {}
Err(err) => {
if !err.to_string().is_empty() {
eprintln!("error: {}", err);
};
std::process::exit(1);
}
}
}
```
3 years ago
Arijit Basu
fabcc8e865
Implement CLI arguments
...
Going with custom CLI parsing for minimalism and flexibility.
Closes: https://github.com/sayanarijit/xplr/issues/228
3 years ago
Arijit Basu
a1a1dee4af
Remove --locked
...
Many crates are outdated. One is even yanked. IMO failing build is
better than running with insecure/bad dependencies.
Ref: https://github.com/sayanarijit/xplr/issues/212#issuecomment-855175144
3 years ago
Arijit Basu
9a22c8b423
Fix pgp publishing attempt 4
3 years ago
Arijit Basu
7e35ff42fc
Fix pgp publishing attempt 3
3 years ago
Arijit Basu
6991db8c33
Fix gpg publishing attempt 2
3 years ago
Arijit Basu
c5e97d5bae
Sign releases with pgp
...
Closes: https://github.com/sayanarijit/xplr/issues/131
3 years ago
Arijit Basu
902f20aa83
Fix focus jumping
...
Fixes: https://github.com/sayanarijit/xplr/issues/211
3 years ago
Arijit Basu
36ab821d2c
Upgrade dependencies
...
Closes: https://github.com/sayanarijit/xplr/issues/187
3 years ago
Arijit Basu
7496f5bf8f
Disable mouse by default and bind `:m` to toggle
...
- Make mouse disabled by default.
- Add key binding `:m` to toggle mouse.
Closes: https://github.com/sayanarijit/xplr/issues/206
3 years ago
Arijit Basu
7de0811eaf
No need to "Refresh" explicitly
...
Closes: https://github.com/sayanarijit/xplr/issues/207
3 years ago
Arijit Basu
72a86f8e0e
Polish xplr library API
...
Minor improvements to the xplr library API.
Closes: https://github.com/sayanarijit/xplr/issues/213
3 years ago
Arijit Basu
6412856d73
Improve docs
3 years ago
Arijit Basu
b284124022
Optimize rendering speed by serializing less
...
Serializing to and from Lua value is expensive. Hence, once serialized,
we should reuse the value.
3 years ago
Arijit Basu
fc7d205d92
Improve CallLua and CallLuaSilently
...
Pass a custom table, optimized for convenience and speed.
3 years ago
Arijit Basu
695acf5c1e
Inherit node types config
...
Inherit `node_types` config instead of overwriting it.
Closes: https://github.com/sayanarijit/xplr/issues/200
3 years ago
Arijit Basu
88aedddf53
Fix rustc 1.50 compatibility
3 years ago
Arijit Basu
b4247a7d03
Improve CallLua, mime_essence, permissions
...
Refs:
- https://github.com/sayanarijit/xplr/issues/187
- https://github.com/sayanarijit/xplr/issues/194
- https://github.com/sayanarijit/xplr/issues/195
3 years ago
Arijit Basu
9b02ef3429
Fix "ctrl-i" key for history navigation
...
Unfortunately, "ctrl-i" doesn't work unless "tab" i sremapped to the
key.
3 years ago
Maxim Baz
eef4d92548
Remove extra spaces
3 years ago
Maxim Baz
d51848daf9
Fix typo
3 years ago
Arijit Basu
aa7a441751
Make mode visible in input/logs panel
...
Also, map ":q" to "quit" action.
Ref: https://github.com/sayanarijit/xplr/issues/158
3 years ago
Arijit Basu
db669cdcbf
Remove "remaps:"
...
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
3 years ago
Arijit Basu
cb695fcaa7
Add colorful permissions
...
Ref: https://github.com/sayanarijit/xplr/issues/187
3 years ago
Arijit Basu
91838f88ce
Fix symlink handling
...
- 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
3 years ago
Arijit Basu
b86be16ee3
Make structs public
...
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.
3 years ago
Arijit Basu
74a0ecb922
Fix icons
3 years ago
Arijit Basu
a80bf2d683
Final touches for v0.10.0
3 years ago
Arijit Basu
b99fa927bf
Get out of beta now
3 years ago
Arijit Basu
bfdb7736b9
Simplify pipe reader
...
Make pipe readers and call lua behave in a similar way.
3 years ago
Arijit Basu
84a50a8fde
Add CallLua and CallLuaSilently
...
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`.
3 years ago
Arijit Basu
cdb3560e12
Read input pipe only once when commands execute
...
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.
3 years ago
Arijit Basu
10e874afe7
Fall back to default config when custom config fails
...
When the custom `init.lua` is corrupt, xplr will fall back to default
configuration, logging the encountered error after load.
3 years ago
Arijit Basu
f9d13e5e4c
Fix initial directory sync issue
3 years ago
Arijit Basu
4da481bf5c
Cleanup all the YAML overwriting logics
3 years ago
Arijit Basu
25a9d03237
Finish porting config.yml to init.lua
3 years ago
Arijit Basu
da1d7742f7
Fully migrate to init.lua
...
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
3 years ago
Arijit Basu
0a2f2aeda8
Fix version
3 years ago
Arijit Basu
eb06342523
Update version
3 years ago
Arijit Basu
e977aeb7d3
Fix MacOS error directory not empty
...
With this change, xplr will delete the pipe files when command execution
is over.
3 years ago
Arijit Basu
003e90a7d1
Improve history further
3 years ago
Arijit Basu
97aa2ff8b4
Fix initial focus
3 years ago
Arijit Basu
5b2aee3479
Improve history navigation
...
Make path history behave like jump list and allow jumping back and
forth in the same directory.
3 years ago
Arijit Basu
5c179a9b70
Add optional mouse handler
...
Mouse actions will be enabled on devices that support it.
Because sometimes, scrolling with mouse is the laziest way to navigate.
3 years ago
Arijit Basu
d96e620120
Begin porting config.yml to init.lua
...
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.
3 years ago
Arijit Basu
074e0d1250
Replace handlebars with Lua
...
Replace handlebars with Lua functions by introduction Lua function API.
3 years ago
Arijit Basu
79855dba15
Fix CallSilently
...
Closes: https://github.com/sayanarijit/xplr/issues/163
3 years ago