Shunsuke Mie
41d1385020
Fix a Node type of directory
...
Fix a issue #364 .
3 years ago
Shunsuke Mie
13d046e6ad
Move definitions runner related functions
...
fn runner() and fn from_cli(cli: Cli) util functions are located to
app.rs. However, those are utils for runner. So this commit change the
functions to runner.rs.
3 years ago
Gilad Woloch
402715cdcd
Remove trivial `ResolvedNode` methods
3 years ago
Gilad Woloch
cc022e85ff
Fix `cargo clippy` warnings and reformat
3 years ago
Gilad Woloch
c399236fd3
Reformat
3 years ago
Gilad Woloch
3f0e479f56
Remove trivial methods
3 years ago
Gilad Woloch
ac1b40799a
Apply `rustfmt`
3 years ago
Gilad Woloch
394c09ae87
Merge normal/reversed cases in `NodeSorterApplicable::apply`
3 years ago
Arijit Basu
dd73220ec8
Support switching modes keeping input buffer.
...
Closes: https://github.com/sayanarijit/xplr/issues/303
3 years ago
Arijit Basu
5eab3c6033
Support defining custom layout for different modes
...
Closes: https://github.com/sayanarijit/xplr/issues/335
3 years ago
Arijit Basu
e3150798d9
Disable recover mode by default
...
Closes: https://github.com/sayanarijit/xplr/issues/330
3 years ago
Arijit Basu
696549e2e5
Remove `config` from CallLuaArg
...
The `Config` object is globally available as `xplr.config`, and thus
it's redundant. Config is read only once, when xplr loads.
Closes https://github.com/sayanarijit/xplr/issues/321
3 years ago
Arijit Basu
3f668c2d04
Improve runner API
...
Some API improvements on top of #324
3 years ago
Tom van Dijk
671d1b11fd
Refactored parts of `runner::Runner` to take a Cli struct, instead of putting everything manually in `Runner`.
3 years ago
Arijit Basu
1756332e5b
Fallback to tempdir if runtime is inaccessible
...
Fixes: https://github.com/sayanarijit/xplr/issues/319
3 years ago
Arijit Basu
1b1032d0bd
Fix missing config error
...
Do not report error when config file is missing and it's not specified
via CLI args.
3 years ago
Arijit Basu
61657a70c7
Add support for loading extra config files
...
Use `-C` / `--extra-config` to load Lua files to overwrite the default
or user defined config.
This helps with integration, where integrating xplr with another tool
requires xplr to overwrite some config, without requiring the users to
install an xplr plugin or update the xplr config.
Example:
```bash
xplr -C one.lua two.lua
# Or
xplr -C one.lua -C two.lua
```
> **WARNING:**
>
> Extra config doesn't require specifying the `version`, hence, it's the
> integration author or the user's responsibility to assert
> compatibility using the globally exposed `version` in the extra config
> files, similar to xplr plugins.
Ref: https://github.com/sayanarijit/xplr/issues/316
3 years ago
Arijit Basu
35c18a25dc
Remove per directory buffer
...
Closes: https://github.com/sayanarijit/xplr/issues/289
3 years ago
Arijit Basu
9070cd9e17
Add more docs
3 years ago
Arijit Basu
6162744bef
Minor improvements
...
Closes: https://github.com/sayanarijit/xplr/issues/305
3 years ago
Arijit Basu
6babfeb3d6
Minor improvements
...
Fixes: https://github.com/sayanarijit/xplr/issues/284
Closes: https://github.com/sayanarijit/xplr/issues/286
Partially fixes: https://github.com/sayanarijit/xplr/issues/285
3 years ago
Arijit Basu
4307ba657a
Fix ToggleSelectionByPath
...
Fixes: https://github.com/sayanarijit/xplr/issues/295
3 years ago
Arijit Basu
329821ca1b
Improve FocusNext and FocusPrevious behavior
...
Closes: https://github.com/sayanarijit/xplr/issues/253
3 years ago
Arijit Basu
4d8f1ef2ef
Fix handling of relative paths
...
Closes: https://github.com/sayanarijit/xplr/issues/255
3 years ago
Arijit Basu
6b03598b5d
Add more quit options
...
Adds the following messages.
- PrintPwdAndQuit
- PrintFocusPathAndQuit
- PrintSelectionAndQuit
Closed: https://github.com/sayanarijit/xplr/issues/257
3 years ago
Arijit Basu
6a70b568bf
Fix FocusPath issue
...
Fixes: https://github.com/sayanarijit/xplr/issues/249
3 years ago
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
902f20aa83
Fix focus jumping
...
Fixes: https://github.com/sayanarijit/xplr/issues/211
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
fc7d205d92
Improve CallLua and CallLuaSilently
...
Pass a custom table, optimized for convenience and speed.
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
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
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
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
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
25a9d03237
Finish porting config.yml to init.lua
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
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