Commit Graph

121 Commits

Author SHA1 Message Date
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
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
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
69d3b3af46 Add focus selection UI
Closes: https://github.com/sayanarijit/xplr/issues/322
2021-09-22 07:59:24 +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
9070cd9e17 Add more docs 2021-07-20 22:18:43 +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
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
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
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
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
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
a80bf2d683 Final touches for v0.10.0 2021-05-23 07:32:30 +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
074e0d1250 Replace handlebars with Lua
Replace handlebars with Lua functions by introduction Lua function API.
2021-05-21 16:28:06 +05:30
Arijit Basu
8e98da5004 Add support for un-mapping keys.
Use `remaps: {key: null}` to un-map a key.

Also,
- `gx` will now open only the file under focus.
- `:sx` will open the selected files.

And other minor improvements.

Discussion: https://github.com/sayanarijit/xplr/discussions/146
2021-05-14 23:11:18 +05:30
Arijit Basu
7588620c8f Hind logs when switching to input mode
Ref: https://github.com/sayanarijit/xplr/pull/143#issuecomment-840069000
2021-05-13 13:33:23 +05:30
Arijit Basu
c68bd96253 Add reckless mode
Pressing an invalid key will take you to the "reckless" mode. All you
need to do is calm down, escape that mode, and try again.

Closes: https://github.com/sayanarijit/xplr/issues/142
2021-05-13 13:33:23 +05:30
Arijit Basu
7c5468cabe Fix exploring and escaping paths
This PR targets 2 pain points.

1. The `Explore` message was async, which caused some unexpected
   behavior. This was fixed by splitting `Explore` into `ExplorePwd`,
   `ExplorePwdAsync` and `ExploreParentsAsync`. `ExploreParentsAsync`
   is similar to the former `Explore`, which is mainly used when loading
   `xplr` for the first time. However, what we'll be using frequently
   are `ExplorePwd` and `ExplorePwdAsync` messages.

2. Files with spaces caused some unexpected behavior. This was fixed by
   escaping the paths properly. This also fixed focusing of a file after
   creating or renaming it.

Anothor breaking change is that `XPLR_PIPE_FOCUS_OUT` has been removed.
`XPLR_FOCUS_PATH` is all we need. So, the rule of thumb is if a variable
contains one liner value, it can be used directly from the env vars.
Variables that can contain multi-line values, will be exposed via the
pipes.

Minor changes are

- Add `switch_mode` mode to the global key binding help menu
- Moved some UI related code from config.rs to ui.rs.
- Fixed compilation issue on `rustc 1.50.0`.
2021-05-09 23:23:46 +05:30
Arijit Basu
38812e733b Improve config inheritance for layout UI
With this commit, users will be able to define the common configuration
as super config and inherit from them in each layout.
2021-05-08 17:11:44 +05:30
Arijit Basu
fd92d8ee01 Make modifiers more intuitive
It's difficult to calculate the bits for adding and removing modifiers.
With this commit, we be will use words `Bold`, `Italic` instead of `bits: x`.
2021-05-08 12:44:08 +05:30
Arijit Basu
59b55ee192 Add more UI styling options
With this commit, the following can be done:

- Define layout constraints based on screen size and relative panel
  size.
- Define borders.
- Define panel style.
- Define panel title and title style.
2021-05-08 12:44:08 +05:30
Arijit Basu
cfa82cf99f Fix margin overwriting logic 2021-05-08 12:44:08 +05:30
Arijit Basu
b8df831248 Add Nothing layout config inheritance workaround
Any layouts will default to `Nothing` which resembles blank screen.
However, they will be overwritten when there is a more specific layout
available either in the super config or in the sub config.
2021-05-08 12:44:08 +05:30
Arijit Basu
b3e6679b50 Add feature dynamic UI
Now, users can change the UI layout via the `SwitchLayout{Builtin|Custom}`
message, or by using key `ctrl-w`.

There are 3 default layout options -

- default
- no_help
- no_selection
- no_help_no_selection

Also, the initial mode and the initial layout can be specified in the
config.

Closes: https://github.com/sayanarijit/xplr/issues/107
2021-05-08 12:44:08 +05:30
Arijit Basu
8ddc000895 Make config private 2021-04-26 12:45:07 +05:30
Arijit Basu
2470827aac Organize tests 2021-04-26 12:45:07 +05:30
Arijit Basu
f38398e900 Make internals private 2021-04-26 12:45:07 +05:30
Arijit Basu
871a4c79aa
Fix divide by zero error 2021-04-22 11:50:43 +05:30
Arijit Basu
ca13ebb193 Added inode size
Also supports sorting by inode size.

Closes: https://github.com/sayanarijit/xplr/issues/84
2021-04-19 14:48:45 +05:30
Arijit Basu
b53f0c21bb Improve read-only mode
Do not include non-read-only actions in the in read-only mode. i.e. do
not display non-read-only actions in help menu.

Ref: https://github.com/sayanarijit/xplr/issues/22
2021-04-19 14:33:42 +05:30
Arijit Basu
e70fa57228 Fix selection
Fixes: https://github.com/sayanarijit/xplr/issues/81
2021-04-19 00:58:04 +05:30
Arijit Basu
a8896740c8 Add sorting support
Also improve filtering.

Closes: https://github.com/sayanarijit/xplr/issues/58
2021-04-18 16:14:17 +05:30
Arijit Basu
3ab9bcb4c9 Fix UI style priority
Fixes: https://github.com/sayanarijit/xplr/issues/68
2021-04-15 15:55:06 +05:30
Arijit Basu
1dba3d5e8e Fix overwriting of default config.
This fixes the overwriting of default configuration.

Also, add tests to validate the new logic.

Fixes: https://github.com/sayanarijit/xplr/issues/68
2021-04-15 13:55:42 +05:30
Arijit Basu
d0342260fe Add support for NO_COLOR
Also, add `general.logs` to the config.

Ref: https://no-color.org/
2021-04-14 08:38:00 +05:30
Arijit Basu
af1cda5762 Better symlink support
Closes: https://github.com/sayanarijit/xplr/issues/37
2021-04-13 08:48:50 +05:30
Arijit Basu
ea42b1969a Improve scrolling behaviour
Closes: https://github.com/sayanarijit/xplr/issues/54
2021-04-12 21:51:59 +05:30
Arijit Basu
f247acf626 Fix remap behaviour and help menu
Remapping a key should overwrite default. Also, remapped keys shouldn't
be redundantly visible in help menu.

Also, display log time.
2021-04-11 22:22:36 +05:30
Arijit Basu
055c1083d6 Support easier key remaps
Also,

- Add key binding `~` to go to homedir.
- Add customizable cursor and prompts.
- Improve the help menus.
2021-04-11 21:15:01 +05:30
Arijit Basu
080e1686f3 Improve version compatibility
From this version, xplr won't annoy the users to visit the upgrade guide
when there is no need.

Also, users will only get upgrade related notification when it is
there is one.
2021-04-11 21:15:01 +05:30
Arijit Basu
3598be0f19 Improve config defaults
- Rename `custom` field for node metadata to `meta`.
- Move `icon` to `meta.icon`.
- Rename `normal_ui` to `default_ui`.
- Rename `filetypes` to `node_types`.
- Split `modes` into `modes.builtin` and `modes.custom`.
- Add the missing `create file` mode.
- Rename `focused_ui` to `focus_ui`.
- Make `general.table.header` non-nullable.
- Add support for incremental configuration updates.

Ref: https://github.com/sayanarijit/xplr/issues/45
2021-04-11 21:15:01 +05:30
Arijit Basu
588a50af7e Add support for custom metadata for table row UI
Example:

```yaml
filetypes:
  directory:
    custom:
      foo: bar
     ...
```

Where `foo` and `bar` can be anything string.

It can be accessed with the `{{{custom.foo}}}` variable.
2021-04-09 11:57:24 +05:30
Arijit Basu
dba8631911 Add CI/CD gh actions
Mostly stolen from https://github.com/Rigellute/spotify-tui.
2021-04-05 12:32:40 +05:30
Arijit Basu
b98812fe06
Fix "Input" case 2021-04-03 21:38:09 +05:30
Arijit Basu
500f15bd32
Make UI lowercase 2021-04-03 21:35:50 +05:30
Arijit Basu
af8a637030
Logging, testing and other improvements 2021-04-03 11:32:05 +05:30
Arijit Basu
7cbb9d2baf
Saner key bindings 2021-04-02 19:56:18 +05:30
Arijit Basu
56d63a2316
Move, Copy, Create, Delete 2021-04-02 16:12:10 +05:30
Arijit Basu
f43ba87a2b
Finish Selected -> Selection renaming 2021-04-02 07:45:00 +05:30
Arijit Basu
8a6da63936
Rename selected -> selection 2021-04-02 07:40:51 +05:30
Arijit Basu
2c56b80fde
Minor fixes 2021-04-01 22:34:12 +05:30
Arijit Basu
3572d26b95
Too big of a rewrite 2021-04-01 15:17:24 +05:30
Arijit Basu
98920637f9
Number input 2021-03-15 14:49:30 +05:30
Arijit Basu
d3f88a1fa5
Display mode in help menu title 2021-03-06 10:11:59 +05:30
Arijit Basu
669151c70e
Show help menu 2021-03-04 20:12:47 +05:30
Arijit Basu
044b7860a1
Fixed fzf search added pwd shell option
Now I can finally use it to replace nnn
2021-03-03 00:15:21 +05:30
Arijit Basu
2e551ce38d
Support for command action 2021-03-02 14:24:43 +05:30
Arijit Basu
f9c3edee06
Not yet doing what it's supposed to 2021-03-01 16:53:04 +05:30