Commit Graph

439 Commits

Author SHA1 Message Date
Arijit Basu
24bd6d9f00 Merge the pending changes from #429 2022-01-11 12:27:07 +05:30
Arijit Basu
729b51d674 Create parent directories before creating the file 2022-01-10 15:47:42 +05:30
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.
2021-12-30 13:21:34 +01:00
Arijit Basu
cdd60eef4c
Format init.lua consistently 2021-12-12 15:28:15 +05:30
Arijit Basu
c89d5a45f1
Fix NixOS tests 2021-12-11 21:56:52 +05:30
Arijit Basu
3142cdd3ec Upgrade version 2021-12-11 21:20:54 +05:30
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
2021-12-11 21:10:01 +05:30
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
2021-12-11 19:37:40 +05:30
Arijit Basu
b7d86ae1ec Serialize None to nil
Fixes: https://github.com/sayanarijit/xplr/issues/417
2021-11-20 04:39:33 +05:30
Tom van Dijk
b1ac4944ab help_hide_remaps -> hide_remaps_in_help_menu 2021-11-17 13:26:20 +05:30
Tom van Dijk
263eb5943a Introduce general.help_hide_remaps config entry. 2021-11-17 13:26:20 +05:30
Arijit Basu
def98de9b3 Upgrade version 2021-11-15 18:12:03 +05:30
Arijit Basu
5b710070a3 Optimize more 2021-11-15 18:08:03 +05:30
Arijit Basu
41c387542f Fix auto jumping on cursor when visiting large dir 2021-11-15 18:08:03 +05:30
Arijit Basu
7c7351c2e8 Optimize optimization hack 2021-11-15 18:08:03 +05:30
Arijit Basu
5211e4fa40 Fix Lua API performance by caching
Fixes: https://github.com/sayanarijit/xplr/issues/412
2021-11-15 18:08:03 +05:30
Arijit Basu
132b528a5d
Remove trailing . in the CLI help menu 2021-11-11 10:17:24 +05:30
Arijit Basu
d2c5f49835 Fix CD (try again) 2021-11-10 10:24:59 +05:30
Arijit Basu
296d93a81a Fix linux gnu bin release 2021-11-10 10:03:31 +05:30
Arijit Basu
605b2bc391 Fix CD for musl 2021-11-10 09:30:26 +05:30
Arijit Basu
9d088239ea Upgrade to 0.16.0 2021-11-10 08:08:29 +05:30
Arijit Basu
24637449a3
Improve CLI help 2021-11-07 11:55:47 +05:30
Arijit Basu
f78d9e99fd
Remove debug statement and add tests 2021-11-07 09:14:33 +05:30
Arijit Basu
8e00b3e658
Add scroll for the input buffer 2021-11-06 07:36:14 +05:30
Arijit Basu
b0c91a954e
Improve update_input_buffer 2021-11-05 18:05:04 +05:30
Arijit Basu
074217f21e Fix issue with input buffer 2021-11-05 18:07:20 +05:30
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.
2021-11-05 17:54:17 +05:30
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
2021-11-05 17:01:19 +05:30
Arijit Basu
165d992b75 Fix logs UI
Fixes: https://github.com/sayanarijit/xplr/issues/396
2021-11-05 15:26:13 +05:30
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.
2021-11-05 15:12:50 +05:30
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.
2021-11-05 13:59:26 +05:30
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
2021-11-05 10:20:30 +05:30
Shunsuke Mie
f5131b08ab Change to use PWD env vairable to get current dir
Fixes 285.
2021-11-01 19:55:28 +05:30
Arijit Basu
00030e44ff Fail if path doesn't exist 2021-10-30 16:26:11 +05:30
Arijit Basu
de6f54f9bd Fix bug with selection 2021-10-30 16:26:11 +05:30
Arijit Basu
a797d7b1c7 Format & lint code 2021-10-30 16:26:11 +05:30
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 -
```
2021-10-30 16:26:11 +05:30
Arijit Basu
91675e28af Some cleanup 2021-10-30 16:26:11 +05:30
Tom van Dijk
102832c65c Fix suggestions and run clippy 2021-10-30 16:26:11 +05:30
Tom van Dijk
44f05c6e4b Implement --force-focus 2021-10-30 16:26:11 +05:30
Tom van Dijk
3c8de699ca Fix everything @sayanarijit fed back. 2021-10-30 16:26:11 +05:30
Tom van Dijk
cbb244f9a0 Implement --select 2021-10-30 16:26:11 +05:30
Shunsuke Mie
05fb583f98 Add a test for pwd_watcher 2021-10-27 20:27:19 +05:30
Shunsuke Mie
c5f60951f7 Add tests for explorer
The comment outed test fails randomly.  Change the recusive function
before enableing the test.
2021-10-24 20:03:48 +05:30
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.
2021-10-24 17:32:17 +05:30
Arijit Basu
4e1580e91f Some cleanups 2021-10-24 11:39:29 +05:30
Shunsuke Mie
41d1385020 Fix a Node type of directory
Fix a issue #364.
2021-10-24 11:39:29 +05:30
Arijit Basu
66f5acc482 Fix criterion test 2021-10-24 11:22:50 +05:30
Arijit Basu
3ec870739c Bump version 2021-10-24 10:37:02 +05:30
Arijit Basu
0328eb63c7 Fix selection count
Fixes https://github.com/sayanarijit/xplr/issues/363
2021-10-22 12:42:35 +05:30
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.
2021-10-17 21:11:52 +05:30
Arijit Basu
347b9625aa Add padding to custom content titles 2021-10-07 14:00:56 +05:30
Gilad Woloch
402715cdcd Remove trivial ResolvedNode methods 2021-10-06 20:18:11 +05:30
Gilad Woloch
95b580203f Introduce xor helper 2021-10-06 20:18:11 +05:30
Gilad Woloch
18b784f054 Correct typo 2021-10-06 20:18:11 +05:30
Gilad Woloch
2ef7523bb0 Derive PartialEq 2021-10-06 20:18:11 +05:30
Gilad Woloch
46287f6373 Use Result::is_ok 2021-10-06 20:18:11 +05:30
Gilad Woloch
45ad449eb3 Avoid unnecessary lambda 2021-10-06 20:18:11 +05:30
Gilad Woloch
a2343c05ca Correct clippy error 2021-10-06 13:24:56 +05:30
Gilad Woloch
cc022e85ff Fix cargo clippy warnings and reformat 2021-10-06 13:24:56 +05:30
Gilad Woloch
c399236fd3 Reformat 2021-10-06 13:24:56 +05:30
Gilad Woloch
3f0e479f56 Remove trivial methods 2021-10-06 13:24:56 +05:30
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.
2021-10-06 05:40:22 +05:30
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.
2021-10-05 23:28:32 +05:30
Gilad Woloch
ac1b40799a Apply rustfmt 2021-10-05 20:30:50 +05:30
Gilad Woloch
394c09ae87 Merge normal/reversed cases in NodeSorterApplicable::apply 2021-10-05 20:30:50 +05:30
Arijit Basu
e0c1581a0a Optimize silent calls
Silent calls don't need to pause input reading as they are non
interactive and quickly finish execution.
2021-10-05 16:50:17 +05:30
Arijit Basu
5e96d48135 Major release 0.15.0 2021-10-05 16:08:12 +05:30
Arijit Basu
dd73220ec8 Support switching modes keeping input buffer.
Closes: https://github.com/sayanarijit/xplr/issues/303
2021-10-05 14:34:49 +05:30
Arijit Basu
ac1476bc08
Cleanup 2021-10-05 14:03:32 +05:30
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" },
    },
  },
}
```
2021-10-05 13:52:28 +05:30
Arijit Basu
5eab3c6033 Support defining custom layout for different modes
Closes: https://github.com/sayanarijit/xplr/issues/335
2021-10-05 13:22:45 +05:30
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
2021-10-04 20:14:16 +05:30
Arijit Basu
5723acc21b Fix input conversion logic 2021-10-04 11:32:13 +05:30
Arijit Basu
e3150798d9 Disable recover mode by default
Closes: https://github.com/sayanarijit/xplr/issues/330
2021-09-28 22:12:32 +05:30
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
2021-09-23 14:49:10 +05:30
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
2021-09-22 18:56:41 +05:30
Arijit Basu
69d3b3af46 Add focus selection UI
Closes: https://github.com/sayanarijit/xplr/issues/322
2021-09-22 07:59:24 +05:30
Arijit Basu
3f668c2d04 Improve runner API
Some API improvements on top of #324
2021-09-17 09:33:55 +05:30
Tom van Dijk
671d1b11fd Refactored parts of runner::Runner to take a Cli struct, instead of putting everything manually in Runner. 2021-09-17 09:01:39 +05:30
Arijit Basu
1756332e5b Fallback to tempdir if runtime is inaccessible
Fixes: https://github.com/sayanarijit/xplr/issues/319
2021-09-02 10:11:14 +05:30
Arijit Basu
1b1032d0bd Fix missing config error
Do not report error when config file is missing and it's not specified
via CLI args.
2021-09-02 10:11:14 +05:30
Arijit Basu
abc7011f56
Test upgrade guild is up to date.
Never miss updating the upgrade guide again
2021-08-27 09:42:33 +05:30
Arijit Basu
7cc8c621ef Update version 2021-08-27 09:20:49 +05:30
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
2021-08-23 11:44:58 +05:30
Arijit Basu
7b2b29b27d Cleanup - Format Lua code 2021-07-31 15:32:55 +05:30
Arijit Basu
af5a99328f Update version 2021-07-29 23:28:31 +05:30
Arijit Basu
35c18a25dc Remove per directory buffer
Closes: https://github.com/sayanarijit/xplr/issues/289
2021-07-29 23:19:41 +05:30
Arijit Basu
7d0605479e Allow dynamic linking to load Lua modules using C
Also upgrade packages.

Closes: https://github.com/sayanarijit/xplr/issues/309
2021-07-29 21:45:45 +05:30
Arijit Basu
865d6930db Use unsafe lua to allow c modules
Closes: https://github.com/sayanarijit/xplr/issues/309
2021-07-29 21:45:45 +05:30
Arijit Basu
f1e75caf89 Remove termion dependency
Termion is only used to get TTY which is simple enough to implement.
2021-07-29 20:36:12 +05:30
Arijit Basu
9070cd9e17 Add more docs 2021-07-20 22:18:43 +05:30
Arijit Basu
6162744bef Minor improvements
Closes: https://github.com/sayanarijit/xplr/issues/305
2021-07-20 14:53:53 +05:30
Arijit Basu
f5aceb1e66 Make the number of visible logs dynamic
It helps to see all the logs when switching to a bigger InputAndLogs
layout.
2021-07-06 10:20:46 +05:30
Arijit Basu
db9c926b0c Update version 2021-07-05 12:08:53 +05:30
Arijit Basu
b1ce57d68b Recursively clean session path
Fixes: https://github.com/sayanarijit/xplr/issues/293
2021-07-05 11:46:22 +05:30
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
2021-07-05 11:32:47 +05:30
Arijit Basu
4307ba657a Fix ToggleSelectionByPath
Fixes: https://github.com/sayanarijit/xplr/issues/295
2021-07-05 10:42:56 +05:30
Arijit Basu
d29f6aed6d Fix StartFifo and ToggleFifo
Also add `xplr.config.general.start_fifo`.

Closes: https://github.com/sayanarijit/xplr/issues/280
2021-06-24 15:21:21 +05:30
Arijit Basu
b61bf9dcf2 Increase poll timeout
Ref: https://github.com/sayanarijit/xplr/issues/10
2021-06-22 10:20:10 +05:30
Arijit Basu
ed65d85568 Remove auto refresh service
Ref: https://github.com/sayanarijit/xplr/issues/10
2021-06-21 13:00:35 +05:30
Arijit Basu
5c6fd1ef63 Update version 2021-06-16 14:43:40 +05:30
Arijit Basu
329821ca1b Improve FocusNext and FocusPrevious behavior
Closes: https://github.com/sayanarijit/xplr/issues/253
2021-06-16 14:38:54 +05:30
Arijit Basu
4d8f1ef2ef Fix handling of relative paths
Closes: https://github.com/sayanarijit/xplr/issues/255
2021-06-16 14:29:36 +05:30
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
2021-06-16 13:59:33 +05:30
Arijit Basu
6b03598b5d Add more quit options
Adds the following messages.

- PrintPwdAndQuit
- PrintFocusPathAndQuit
- PrintSelectionAndQuit

Closed: https://github.com/sayanarijit/xplr/issues/257
2021-06-16 13:59:33 +05:30
Arijit Basu
6a70b568bf Fix FocusPath issue
Fixes: https://github.com/sayanarijit/xplr/issues/249
2021-06-08 23:42:03 +05:30
Arijit Basu
f1ffc551fc Minor addition 2021-06-06 14:27:10 +05:30
Arijit Basu
844480204c Support specifying read-only mode via CLI argument
Closes: https://github.com/sayanarijit/xplr/issues/22
2021-06-06 14:13:39 +05:30
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
2021-06-06 13:50:43 +05:30
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
2021-06-06 12:40:13 +05:30
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
2021-06-06 12:29:08 +05:30
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);
        }
    }
}
```
2021-06-06 10:59:48 +05:30
Arijit Basu
fabcc8e865 Implement CLI arguments
Going with custom CLI parsing for minimalism and flexibility.

Closes: https://github.com/sayanarijit/xplr/issues/228
2021-06-05 13:11:54 +05:30
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
2021-06-05 09:03:43 +05:30
Arijit Basu
9a22c8b423 Fix pgp publishing attempt 4 2021-06-05 08:31:50 +05:30
Arijit Basu
7e35ff42fc Fix pgp publishing attempt 3 2021-06-05 08:23:03 +05:30
Arijit Basu
6991db8c33 Fix gpg publishing attempt 2 2021-06-05 08:06:42 +05:30
Arijit Basu
c5e97d5bae Sign releases with pgp
Closes: https://github.com/sayanarijit/xplr/issues/131
2021-06-05 07:42:39 +05:30
Arijit Basu
902f20aa83 Fix focus jumping
Fixes: https://github.com/sayanarijit/xplr/issues/211
2021-06-04 23:02:15 +05:30
Arijit Basu
36ab821d2c Upgrade dependencies
Closes: https://github.com/sayanarijit/xplr/issues/187
2021-06-04 21:52:25 +05:30
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
2021-06-04 19:16:45 +05:30
Arijit Basu
7de0811eaf No need to "Refresh" explicitly
Closes: https://github.com/sayanarijit/xplr/issues/207
2021-06-04 18:12:56 +05:30
Arijit Basu
72a86f8e0e Polish xplr library API
Minor improvements to the xplr library API.

Closes: https://github.com/sayanarijit/xplr/issues/213
2021-06-04 17:38:49 +05:30
Arijit Basu
6412856d73 Improve docs 2021-05-28 10:03:22 +05:30
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.
2021-05-28 08:20:24 +05:30
Arijit Basu
fc7d205d92 Improve CallLua and CallLuaSilently
Pass a custom table, optimized for convenience and speed.
2021-05-27 10:35:57 +05:30
Arijit Basu
695acf5c1e Inherit node types config
Inherit `node_types` config instead of overwriting it.

Closes: https://github.com/sayanarijit/xplr/issues/200
2021-05-27 08:51:47 +05:30
Arijit Basu
88aedddf53 Fix rustc 1.50 compatibility 2021-05-25 16:24:37 +05:30
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
2021-05-25 14:52:04 +05:30
Arijit Basu
9b02ef3429 Fix "ctrl-i" key for history navigation
Unfortunately, "ctrl-i" doesn't work unless "tab" i sremapped to the
key.
2021-05-24 16:23:01 +05:30
Maxim Baz
eef4d92548 Remove extra spaces 2021-05-24 15:34:29 +05:30
Maxim Baz
d51848daf9 Fix typo 2021-05-24 15:18:38 +05:30
Arijit Basu
aa7a441751 Make mode visible in input/logs panel
Also, map ":q" to "quit" action.

Ref: https://github.com/sayanarijit/xplr/issues/158
2021-05-24 13:09:22 +05:30
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
2021-05-24 12:02:44 +05:30
Arijit Basu
cb695fcaa7 Add colorful permissions
Ref: https://github.com/sayanarijit/xplr/issues/187
2021-05-24 10:26:27 +05:30
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
2021-05-23 20:36:14 +05:30
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.
2021-05-23 10:16:45 +05:30
Arijit Basu
74a0ecb922 Fix icons 2021-05-23 10:16:45 +05:30
Arijit Basu
a80bf2d683 Final touches for v0.10.0 2021-05-23 07:32:30 +05:30
Arijit Basu
b99fa927bf Get out of beta now 2021-05-22 23:35:37 +05:30
Arijit Basu
bfdb7736b9 Simplify pipe reader
Make pipe readers and call lua behave in a similar way.
2021-05-22 21:08:21 +05:30
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`.
2021-05-22 21:08:21 +05:30
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.
2021-05-22 19:04:52 +05:30
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.
2021-05-22 16:17:03 +05:30
Arijit Basu
f9d13e5e4c Fix initial directory sync issue 2021-05-22 14:46:16 +05:30
Arijit Basu
4da481bf5c Cleanup all the YAML overwriting logics 2021-05-22 14:25:27 +05:30
Arijit Basu
25a9d03237 Finish porting config.yml to init.lua 2021-05-22 14:25:27 +05:30
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
2021-05-22 14:25:27 +05:30
Arijit Basu
0a2f2aeda8 Fix version 2021-05-22 01:15:16 +05:30