Commit Graph

556 Commits (main)

Author SHA1 Message Date
Arijit Basu bf354352d5 Upgrade version 2 years ago
Arijit Basu bea0f277bc Add global key bindings that can be overwritten.
- Use `xplr.config.general.global_key_bindings` to define a set of
  key bindings that are available by default in every mode. e.g `esc`
  and `ctrl-c`.
- Remove boilerplate config from `init.lua`.
- Update docs.
2 years ago
Arijit Basu 4c4d3843e9
Avoid using unnecessary prompts
Problem with long paths.
2 years ago
Arijit Basu a2f246f61e
Improve the "duplicate as" prompt 2 years ago
Arijit Basu 27394dd177
Tab completion for "duplicate_as" mode 2 years ago
Arijit Basu 88416d862e
Minor improvement 2 years ago
Arijit Basu 5370cc2e8c Go to path and native auto completion on tab
- BREAKING: Rename mode `create directory` and `create file` to
  `create_directory` and `create_file`.
- Add key binding `gp` to go to a given path from input.
- Add function `fn.builtin.try_complete_path` to auto complete the path
  in input buffer.
- Use `tab` to auto complete path in `rename`, `create_file`,
  `create_directory` and `go_to_path` modes.
- Show different prompts in different modes.

And some cleanup.
2 years ago
Arijit Basu e5576e2990 Fix typo 2 years ago
Arijit Basu e04b0964ae Use 89 chars line length 2 years ago
Arijit Basu 21b8c3e807 Make clippy happy 2 years ago
Arijit Basu 744b68197d Some optimizations 2 years ago
Arijit Basu 02b631bf83 Strict NO_COLOR compliance and some cleanups 2 years ago
Arijit Basu 61d3b1635e Use NO_COLOR to disable OSC 7 2 years ago
Arijit Basu d35a4c58cb Write OSC 7 escaped codes on a the tui backend 2 years ago
Arijit Basu 47f7d51e46 Cleanups 2 years ago
Arijit Basu de856b7870 Implement Write 2 years ago
Arijit Basu 2f9992bf8b OSC 7 fixes
Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2 years ago
Arijit Basu 3c8f6e1b08 Experiment with OSC 7
Ref: https://github.com/wez/wezterm/issues/2054
2 years ago
Arijit Basu 07b2374616
Make the table a little compact 2 years ago
Arijit Basu e655c245c5 Optimize regex search further
No need to compile both regex and iregex.
2 years ago
Arijit Basu f324e976da Compile regex only when required 2 years ago
Arijit Basu 95248ae6d1 Cleanup 2 years ago
Arijit Basu e2cf313ee2 Optimize regex search
Compile regex once and reuse it.
2 years ago
Arijit Basu cb2851875c
Fix mime_essence doc - again 2 years ago
Arijit Basu dc8cb30eb3
Fix mime_essence docs 2 years ago
Arijit Basu cf052d2691
Fix doc 2 years ago
Arijit Basu 6f626d1ba0
Clarify metadata API 2 years ago
Arijit Basu 3da8140bb1
Fix printing unicode 2 years ago
Arijit Basu e006152066 Upgrade version 2 years ago
Arijit Basu 2179be473f Fix docs 2 years ago
Arijit Basu cc5b996db9 Add remove last filter 2 years ago
Arijit Basu d9465f1a57 Display in the table 2 years ago
Arijit Basu 8e1d16b751 Remove merge conflicts 2 years ago
Arijit Basu 37e660e0a6 Improve timestamp support 2 years ago
Shunsuke Mie 626a48cf88 Update init.lua to show a last modification column 2 years ago
Shunsuke Mie 57c29d47c5 Support a column shows time of modification 2 years ago
Arijit Basu 09002d0e65 Add support for null characters as separator
- Use `--read0 -` to read `\0` separated paths from stdin.
- Use `--write0` to write `\0` separated paths to stdout.
- Use `-0` or `--null` to combine `--read0` and `--write0`.
2 years ago
Arijit Basu 86f56cc051 Fix search navigation 2 years ago
Arijit Basu 5f598648a8 Make the prompt not null 2 years ago
Arijit Basu d2390285fb Fix doc 2 years ago
Arijit Basu 1de737cefa Add regex support and dynamic input prompt
- Add new regex filters
  - `RelativePathDoesMatchRegex`
  - `RelativePathDoesNotMatchRegex`
  - `IRelativePathDoesMatchRegex`
  - `IRelativePathDoesNotMatchRegex`
  - `AbsolutePathDoesMatchRegex`
  - `AbsolutePathDoesNotMatchRegex`
  - `IAbsolutePathDoesMatchRegex`
  - `IAbsolutePathDoesNotMatchRegex`
- Search mode now defaults to regex
- Added new message `SetInputPrompt` to set the input prompt
  dynamically.
2 years ago
Arijit Basu 3cfed5aa6f
Improve docs 2 years ago
Arijit Basu 0d12762c1d
Upgrade tui-input to 0.4.0 2 years ago
Arijit Basu a66d5e05d5
Upgrade to tui-input 0.3 2 years ago
Arijit Basu 2bd4346156 Improve CLI help menu 2 years ago
Arijit Basu 6d9d324a7d
Upgrade version 2 years ago
Arijit Basu 171c93dbb1 Fix ansi colors
Also upgrade deps and do some cleanup.
2 years ago
Arijit Basu 6c775d72dc
Bold directories 2 years ago
Arijit Basu f6364b5403 Try a new UI 2 years ago
Arijit Basu 9673eba89c Upgrade version
- Upgrade rust to 1.58.1
- Upgrade rust edition to 2021
- Upgrade xplr packages
2 years ago
Arijit Basu 583f685627
Minor line gap 2 years ago
Arijit Basu aca6127166
Minor fixes 2 years ago
Arijit Basu 0472bc3e66 Auto generate docs 2 years ago
Arijit Basu dfb4854f01
Set cursor position based on prompt 2 years ago
Arijit Basu bfd403c894 Upgrade version 2 years ago
Arijit Basu 3d81a49cec Auto generate messages docs
- Huge refactor.
- Run `python docs/script/generate.py` to generate `docs/en/src/messages.md`.
2 years ago
Arijit Basu 67eca1ecdf
More doc fixes 2 years ago
Arijit Basu 8385b92661
Minor doc improvements 2 years ago
Arijit Basu ca211bb073 Auto generate some API docs from init.lua
This is the beginning of the xplr documentation revolution.

Closes: https://github.com/sayanarijit/xplr/issues/445
2 years ago
Arijit Basu ecc59b1d9d Option to configure wrapping on move
Closes: https://github.com/sayanarijit/xplr/issues/441
2 years ago
Arijit Basu 618ade53ec Document init.lua
Ref: https://github.com/sayanarijit/xplr/issues/445
2 years ago
Arijit Basu 721ffd0216 Support custom `border_type` and `border_style`
This adds support for defining custom border types and border styles.

Example:

```
xplr.config.general.panel_ui.default.border_type = "Thick"
xplr.config.general.panel_ui.default.border_style.fg = "Black"
xplr.config.general.panel_ui.default.border_style.bg = "Gray"
```

Closes: https://github.com/sayanarijit/xplr/issues/448
2 years ago
Arijit Basu 087f3b0d52 Version 0.17.2 2 years ago
Arijit Basu bb65870ee0 CLI for a better "cd on quit"
Use `--print-pwd-as-result` to print the last working directory instead
of the focused or selected nodes, when you quit using the `PrintResultAndQuit`
message (i.e. by pressing `enter`).

This helps with implementing the "cd on quit" functionality using a plain shell
alias.

Example:

```
alias xcd='cd "$(xplr --print-pwd-as-result)"'
```

With this alias set, you can navigate directories using xplr by entering
`xcd` command, and when you quit by pressing enter, you will enter the
directory.

You can of course, quit with plain `Quit` (i.e. by pressing `esc`) to
gracefully cancel "cd on quit".
2 years ago
Arijit Basu e6ea983a8a Add "duplicate as"
Closes https://github.com/sayanarijit/xplr/issues/434
2 years ago
Arijit Basu e2c3251736
Fix focus when creating files in non-$PWD location 2 years ago
Arijit Basu 4ff11c2ef4 Upgrade version 2 years ago
Arijit Basu 24bd6d9f00 Merge the pending changes from #429 2 years ago
Arijit Basu 729b51d674 Create parent directories before creating the file 2 years ago
Tom van Dijk 17f3893198
Debug mode
Features:
- Display debug menu on configuration error
- Configure wether xplr should show the debug menu
    (through `debug_on_error`)
- Open logs in editor
- Redirect people to the issues page on Github.
2 years ago
Arijit Basu cdd60eef4c
Format init.lua consistently 3 years ago
Arijit Basu c89d5a45f1
Fix NixOS tests 3 years ago
Arijit Basu 3142cdd3ec Upgrade version 3 years ago
Arijit Basu 7b9e4deff5 Support passing argument to `LuaEval` and `LuaEvalSilently`
If the argument of `LuaEval` evaluates to a function, xplr will try to
pass Lua Context to it.

Example:

```lua
{ LuaEval = [[function(app) return { { LogInfo = app.pwd } } end]] }
```

Closes: https://github.com/sayanarijit/xplr/issues/394
3 years ago
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 b7d86ae1ec Serialize None to nil
Fixes: https://github.com/sayanarijit/xplr/issues/417
3 years ago
Tom van Dijk b1ac4944ab `help_hide_remaps` -> `hide_remaps_in_help_menu` 3 years ago
Tom van Dijk 263eb5943a Introduce `general.help_hide_remaps` config entry. 3 years ago
Arijit Basu def98de9b3 Upgrade version 3 years ago
Arijit Basu 5b710070a3 Optimize more 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 132b528a5d
Remove trailing `.` in the CLI help menu 3 years ago
Arijit Basu d2c5f49835 Fix CD (try again) 3 years ago
Arijit Basu 296d93a81a Fix linux gnu bin release 3 years ago
Arijit Basu 605b2bc391 Fix CD for musl 3 years ago
Arijit Basu 9d088239ea Upgrade to 0.16.0 3 years ago
Arijit Basu 24637449a3
Improve CLI help 3 years ago
Arijit Basu f78d9e99fd
Remove debug statement and add tests 3 years ago
Arijit Basu 8e00b3e658
Add scroll for the input buffer 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 165d992b75 Fix logs UI
Fixes: https://github.com/sayanarijit/xplr/issues/396
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
Shunsuke Mie f5131b08ab Change to use `PWD` env vairable to get current dir
Fixes 285.
3 years ago
Arijit Basu 00030e44ff Fail if path doesn't exist 3 years ago
Arijit Basu de6f54f9bd Fix bug with selection 3 years ago
Arijit Basu a797d7b1c7 Format & lint code 3 years ago
Arijit Basu 2d7158afc0 Implement support path selection and force focus
Examples:

```bash
xplr $PWD /path/to/select1 path/to/select2

xplr -- $PWD /path/to/select1 path/to/select2

echo -e "$PWD\n/path/to/select1\npath/to/select2" | xplr -

ls -d /path/to/select1 path/to/select2 | xplr $PWD -
```
3 years ago
Arijit Basu 91675e28af Some cleanup 3 years ago
Tom van Dijk 102832c65c Fix suggestions and run clippy 3 years ago
Tom van Dijk 44f05c6e4b Implement --force-focus 3 years ago
Tom van Dijk 3c8de699ca Fix everything @sayanarijit fed back. 3 years ago
Tom van Dijk cbb244f9a0 Implement --select 3 years ago
Shunsuke Mie 05fb583f98 Add a test for pwd_watcher 3 years ago
Shunsuke Mie c5f60951f7 Add tests for explorer
The comment outed test fails randomly.  Change the recusive function
before enableing the test.
3 years ago
Shunsuke Mie 1947d77a33 Change mods name for tests
There are two mod names for test, `test` and `tests`. This commit unites
the name to `tests`. It is commonly used.
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
Arijit Basu 66f5acc482 Fix criterion test 3 years ago
Arijit Basu 3ec870739c Bump version 3 years ago
Arijit Basu 0328eb63c7 Fix selection count
Fixes https://github.com/sayanarijit/xplr/issues/363
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
Arijit Basu 347b9625aa Add padding to custom content titles 3 years ago
Gilad Woloch 402715cdcd Remove trivial `ResolvedNode` methods 3 years ago
Gilad Woloch 95b580203f Introduce `xor` helper 3 years ago
Gilad Woloch 18b784f054 Correct typo 3 years ago
Gilad Woloch 2ef7523bb0 Derive `PartialEq` 3 years ago
Gilad Woloch 46287f6373 Use `Result::is_ok` 3 years ago
Gilad Woloch 45ad449eb3 Avoid unnecessary lambda 3 years ago
Gilad Woloch a2343c05ca Correct `clippy` error 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
Arijit Basu 9982a205db Downgrade version for the docs
Upgrade version when just before making a new release, else the doc will
link to invalid release.
3 years ago
Arijit Basu bec80e98df Improve input reading by eliminating pause
Stop the thread instead of pausing it. This improves the CPU usage and
responsiveness a slightly.
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 e0c1581a0a Optimize silent calls
Silent calls don't need to pause input reading as they are non
interactive and quickly finish execution.
3 years ago
Arijit Basu 5e96d48135 Major release 0.15.0 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 ac1476bc08
Cleanup 3 years ago
Arijit Basu aee49dad78 Support terminal colors in custom layout
Example:

```lua
xplr.config.layouts.builtin.default = {
  CustomContent = {
    title = "custom title",
    body = {
      StaticParagraph = { render = "\x1b[31mcustom body\x1b[0m" },
    },
  },
}
```
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 85cc956792 Fix reading input
Wait for confirmation after sending a message to a thread.

Also, use unwrap() to crash and burn than using unwrap_or_default() when
message passing fails.

It's highly unlikely to happen and also trivial to the core logic. But
let's see the error when it does happen.

Fixes https://github.com/sayanarijit/xplr/issues/301
3 years ago
Arijit Basu 5723acc21b Fix input conversion logic 3 years ago
Arijit Basu e3150798d9 Disable recover mode by default
Closes: https://github.com/sayanarijit/xplr/issues/330
3 years ago
Arijit Basu 14b14bba42 Let's get a hew home - xplr.dev
Thanks to your continued support we're getting a new homepage https://xplr.dev
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 69d3b3af46 Add focus selection UI
Closes: https://github.com/sayanarijit/xplr/issues/322
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 abc7011f56
Test upgrade guild is up to date.
Never miss updating the upgrade guide again
3 years ago
Arijit Basu 7cc8c621ef Update version 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 7b2b29b27d Cleanup - Format Lua code 3 years ago
Arijit Basu af5a99328f Update version 3 years ago
Arijit Basu 35c18a25dc Remove per directory buffer
Closes: https://github.com/sayanarijit/xplr/issues/289
3 years ago
Arijit Basu 7d0605479e Allow dynamic linking to load Lua modules using C
Also upgrade packages.

Closes: https://github.com/sayanarijit/xplr/issues/309
3 years ago
Arijit Basu 865d6930db Use unsafe lua to allow c modules
Closes: https://github.com/sayanarijit/xplr/issues/309
3 years ago
Arijit Basu f1e75caf89 Remove termion dependency
Termion is only used to get TTY which is simple enough to implement.
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 f5aceb1e66 Make the number of visible logs dynamic
It helps to see all the logs when switching to a bigger InputAndLogs
layout.
3 years ago
Arijit Basu db9c926b0c Update version 3 years ago
Arijit Basu b1ce57d68b Recursively clean session path
Fixes: https://github.com/sayanarijit/xplr/issues/293
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 d29f6aed6d Fix StartFifo and ToggleFifo
Also add `xplr.config.general.start_fifo`.

Closes: https://github.com/sayanarijit/xplr/issues/280
3 years ago
Arijit Basu b61bf9dcf2 Increase poll timeout
Ref: https://github.com/sayanarijit/xplr/issues/10
3 years ago
Arijit Basu ed65d85568 Remove auto refresh service
Ref: https://github.com/sayanarijit/xplr/issues/10
3 years ago
Arijit Basu 5c6fd1ef63 Update version 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 f6d1be61d5 Add quit mode and key bindings
`:q<enter>` -> Just quit.
`:qp` -> quit printing pwd.
`:qf` -> quit printing focus.
`:qs` -> quit printing selection.
`:qr` -> quit printing result.

Ref: https://github.com/sayanarijit/xplr/issues/257
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 f1ffc551fc Minor addition 3 years ago
Arijit Basu 844480204c Support specifying read-only mode via CLI argument
Closes: https://github.com/sayanarijit/xplr/issues/22
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 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