Arijit Basu
8f5e5491f2
Optimize change directory performance
...
This PR breaks the custom layout renderer API by deprecating the
following heavyweight fields in the Lua Context passed to the renderer
functions.
The following fields are being deprecated:
- app.directory_buffer
- app.history
- app.last_modes
However, there's no change in the Lua Context passed to the functions
called via `CallLua*` messages.
Closes: https://github.com/sayanarijit/xplr/issues/418
3 years ago
Arijit Basu
41c387542f
Fix auto jumping on cursor when visiting large dir
3 years ago
Arijit Basu
7c7351c2e8
Optimize optimization hack
3 years ago
Arijit Basu
5211e4fa40
Fix Lua API performance by caching
...
Fixes: https://github.com/sayanarijit/xplr/issues/412
3 years ago
Arijit Basu
f78d9e99fd
Remove debug statement and add tests
3 years ago
Arijit Basu
b0c91a954e
Improve update_input_buffer
3 years ago
Arijit Basu
074217f21e
Fix issue with input buffer
3 years ago
Arijit Basu
48ab6eac21
Add on_function key handler
...
This adds `on_function` handler to handle F1-F12 keys.
This also fixes issues with previously added handlers and adds a
checklist for future additions.
3 years ago
Arijit Basu
6a3b26cc18
Add support for LuaEval(Silently) messages
...
This PR adds support for quickly executing arbitrary lua functions,
without needing to define a function.
Example:
```lua
xplr.config.modes.builtin.default.key_bindings.on_key["#"] = {
help = "test",
messages = {
{ LuaEvalSilently = [[return { { LogInfo = "foo" } }]] },
{ LuaEval = [[return { { LogInfo = io.read() } }]] },
},
}
```
Partly closes: https://github.com/sayanarijit/xplr/issues/394
3 years ago
Arijit Basu
05c2f7aa68
Support more control over input buffer
...
This PR adds a new message: `UpdateInputBuffer: InputOperation`
This makes it possible to perform cursor based input operations without
needing input from the keyboard.
3 years ago
Arijit Basu
b45a553a0c
Add more keyboard input handlers
...
This PR adds 3 more keyboard input handlers:
- on_alphanumeric
- on_character
- on_navigation
Also updates documentation.
3 years ago
Arijit Basu
ca6cefb1c1
Use tui-input to handle input buffer
...
New message: `UpdateInputBufferFromKey` to replace most
`BufferInputFromKey` usage.
This adds more functionalities to the input buffer and reduces
boilerplate code.
This commit also deprecates `config.general.cursor` as the cursor will
be set by the terminal from now.
Repo: https://github.com/sayanarijit/tui-input
3 years ago
Arijit Basu
de6f54f9bd
Fix bug with selection
3 years ago
Arijit Basu
a797d7b1c7
Format & lint code
3 years ago
Tom van Dijk
3c8de699ca
Fix everything @sayanarijit fed back.
3 years ago
Arijit Basu
4e1580e91f
Some cleanups
3 years ago
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