summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyohei Uto <im@kyoheiu.dev>2022-11-11 17:54:15 +0900
committerGitHub <noreply@github.com>2022-11-11 17:54:15 +0900
commit51808b831229f5cd2588537dc4445dbf8638d718 (patch)
tree5d4c0f4be85f12d108856e405c6c7401d3188ab5
parent0c373e0e1238c52c6d5ed5b51ed3625523589bd0 (diff)
parent6878b126ffc28b53e3938e6b71513aecd7b3c4bd (diff)
Merge pull request #141 from kyoheiu/developv2.0.0
v2.0.0
-rw-r--r--CHANGELOG.md29
-rw-r--r--Cargo.lock418
-rw-r--r--Cargo.toml5
-rw-r--r--README.md39
-rw-r--r--config.toml46
-rw-r--r--config.yaml63
-rw-r--r--screenshots/sample.gifbin659582 -> 6211416 bytes
-rw-r--r--src/config.rs204
-rw-r--r--src/errors.rs59
-rw-r--r--src/functions.rs14
-rw-r--r--src/help.rs23
-rw-r--r--src/layout.rs338
-rw-r--r--src/main.rs24
-rw-r--r--src/nums.rs22
-rw-r--r--src/run.rs958
-rw-r--r--src/session.rs26
-rw-r--r--src/state.rs666
-rw-r--r--src/term.rs2
18 files changed, 1890 insertions, 1046 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b1238c8..d63f6c8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,10 +2,35 @@
## Notes
-- Text preview color needs to be readable enough, so it's worth rethinking (Now LightBlack).
-
## Unreleased
+## v2.0.0 (2022-11-11)
+
+### Changed
+
+- Migrated to yaml from toml: New config file will be created at the first launch (In this process you should enter the default command name or choose to use \$EDITOR). No more need to keep `config.toml`.
+- Add the fallback when config file cannot be read: In such a case, you can use the default Config.
+- HUGE refactoring overall.
+
+### Added
+
+- Horizontal split, in addtion to the vertical split. To toggle, press `s`.
+- Syntax highlighting (if possible) in previewed texts. To turn on, state `syntax_hightlight = true` in `config.toml`. you can also choose your theme, either from the default theme set or your favorite .tmtheme.
+- Enable scrolling in the preview space. `Alt + j / Up` goes down, `Alt + k` goes up. Experimental and may have some bugs, and with a big text file the perf issue may arise.
+- Search by keyword. Similar to the filter mode, but this feature do not manipulate the item list, just let users jump to the item that matches the keyword, just like Vim's `/`. `n` and `N` after `/` also works.
+- Show permissions on the footer (in unix only).
+
+### Fixed
+
+- Use `exists()` instead of `File::open()` to check whether the item path is valid when moving between direcotries. This allows Windows users to use this app at least with the basic commands.
+- Avoid `unwrap()` / `panic!` as possible and return the proper error.
+
+### Removed
+
+- Removed the filter mode, which is replaced by the keyword search.
+- Removed debug print in `make_config_if_not_exists`
+- Removed `use_full_width` and `item_name_length` in `config.toml`. Will always use full width of the terminal.
+
## v1.3.2 (2022-10-23)
### Added
diff --git a/Cargo.lock b/Cargo.lock
index 4124847..6942e1a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3,6 +3,12 @@
version = 3
[[package]]
+name = "adler"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
+
+[[package]]
name = "android_system_properties"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -18,6 +24,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
+name = "base64"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
+
+[[package]]
+name = "bincode"
+version = "1.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
+dependencies = [
+ "serde",
+]
+
+[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -25,9 +46,15 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bumpalo"
-version = "3.11.0"
+version = "3.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d"
+checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
+
+[[package]]
+name = "cc"
+version = "1.0.74"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574"
[[package]]
name = "cfg-if"
@@ -48,6 +75,16 @@ dependencies = [
]
[[package]]
+name = "codespan-reporting"
+version = "0.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
+dependencies = [
+ "termcolor",
+ "unicode-width",
+]
+
+[[package]]
name = "content_inspector"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -63,6 +100,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
[[package]]
+name = "crc32fast"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
name = "crossterm"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -88,6 +134,50 @@ dependencies = [
]
[[package]]
+name = "cxx"
+version = "1.0.80"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a"
+dependencies = [
+ "cc",
+ "cxxbridge-flags",
+ "cxxbridge-macro",
+ "link-cplusplus",
+]
+
+[[package]]
+name = "cxx-build"
+version = "1.0.80"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827"
+dependencies = [
+ "cc",
+ "codespan-reporting",
+ "once_cell",
+ "proc-macro2",
+ "quote",
+ "scratch",
+ "syn",
+]
+
+[[package]]
+name = "cxxbridge-flags"
+version = "1.0.80"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a"
+
+[[package]]
+name = "cxxbridge-macro"
+version = "1.0.80"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
name = "dirs"
version = "4.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -109,7 +199,7 @@ dependencies = [
[[package]]
name = "felix"
-version = "1.3.2"
+version = "2.0.0"
dependencies = [
"chrono",
"content_inspector",
@@ -118,16 +208,33 @@ dependencies = [
"log",
"natord",
"serde",
+ "serde_yaml",
"simplelog",
- "toml",
+ "syntect",
"walkdir",
]
[[package]]
+name = "flate2"
+version = "1.0.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6"
+dependencies = [
+ "crc32fast",
+ "miniz_oxide",
+]
+
+[[package]]
+name = "fnv"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+
+[[package]]
name = "getrandom"
-version = "0.2.7"
+version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
+checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
dependencies = [
"cfg-if",
"libc",
@@ -135,23 +242,50 @@ dependencies = [
]
[[package]]
+name = "hashbrown"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
+
+[[package]]
name = "iana-time-zone"
-version = "0.1.50"
+version = "0.1.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd911b35d940d2bd0bea0f9100068e5b97b51a1cbe13d13382f132e0365257a0"
+checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765"
dependencies = [
"android_system_properties",
"core-foundation-sys",
+ "iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"winapi",
]
[[package]]
+name = "iana-time-zone-haiku"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca"
+dependencies = [
+ "cxx",
+ "cxx-build",
+]
+
+[[package]]
+name = "indexmap"
+version = "1.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
+dependencies = [
+ "autocfg",
+ "hashbrown",
+]
+
+[[package]]
name = "itoa"
-version = "1.0.3"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
+checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
[[package]]
name = "js-sys"
@@ -164,9 +298,33 @@ dependencies = [
[[package]]
name = "libc"
-version = "0.2.133"
+version = "0.2.137"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966"
+checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
+
+[[package]]
+name = "line-wrap"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9"
+dependencies = [
+ "safemem",
+]
+
+[[package]]
+name = "link-cplusplus"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "linked-hash-map"
+version = "0.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "lock_api"
@@ -194,10 +352,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
+name = "miniz_oxide"
+version = "0.5.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34"
+dependencies = [
+ "adler",
+]
+
+[[package]]
name = "mio"
-version = "0.8.4"
+version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
+checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de"
dependencies = [
"libc",
"log",
@@ -241,9 +408,31 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.15.0"
+version = "1.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
+
+[[package]]
+name = "onig"
+version = "6.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1"
+checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f"
+dependencies = [
+ "bitflags",
+ "libc",
+ "once_cell",
+ "onig_sys",
+]
+
+[[package]]
+name = "onig_sys"
+version = "69.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b829e3d7e9cc74c7e315ee8edb185bf4190da5acde74afd7fc59c35b1f086e7"
+dependencies = [
+ "cc",
+ "pkg-config",
+]
[[package]]
name = "parking_lot"
@@ -257,9 +446,9 @@ dependencies = [
[[package]]
name = "parking_lot_core"
-version = "0.9.3"
+version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
+checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0"
dependencies = [
"cfg-if",
"libc",
@@ -269,10 +458,30 @@ dependencies = [
]
[[package]]
+name = "pkg-config"
+version = "0.3.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
+
+[[package]]
+name = "plist"
+version = "1.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225"
+dependencies = [
+ "base64",
+ "indexmap",
+ "line-wrap",
+ "serde",
+ "time",
+ "xml-rs",
+]
+
+[[package]]
name = "proc-macro2"
-version = "1.0.44"
+version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7bd7356a8122b6c4a24a82b278680c73357984ca2fc79a0f9fa6dea7dced7c58"
+checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
dependencies = [
"unicode-ident",
]
@@ -307,6 +516,24 @@ dependencies = [
]
[[package]]
+name = "regex-syntax"
+version = "0.6.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
+
+[[package]]
+name = "ryu"
+version = "1.0.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
+
+[[package]]
+name = "safemem"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
+
+[[package]]
name = "same-file"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -322,19 +549,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
+name = "scratch"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898"
+
+[[package]]
name = "serde"
-version = "1.0.145"
+version = "1.0.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b"
+checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.145"
+version = "1.0.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c"
+checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
dependencies = [
"proc-macro2",
"quote",
@@ -342,6 +575,30 @@ dependencies = [
]
[[package]]
+name = "serde_json"
+version = "1.0.87"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45"
+dependencies = [
+ "itoa",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "serde_yaml"
+version = "0.9.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d232d893b10de3eb7258ff01974d6ee20663d8e833263c99409d4b13a0209da"
+dependencies = [
+ "indexmap",
+ "itoa",
+ "ryu",
+ "serde",
+ "unsafe-libyaml",
+]
+
+[[package]]
name = "signal-hook"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -390,9 +647,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]]
name = "syn"
-version = "1.0.101"
+version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e90cde112c4b9690b8cbe810cba9ddd8bc1d7472e2cae317b69e9438c1cba7d2"
+checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d"
dependencies = [
"proc-macro2",
"quote",
@@ -400,6 +657,26 @@ dependencies = [
]
[[package]]
+name = "syntect"
+version = "5.0.0"
+source = "git+https://github.com/kyoheiu/syntect#b2dc4fb8ee192f27babb0535eb383b781ab5c8ce"
+dependencies = [
+ "bincode",
+ "bitflags",
+ "flate2",
+ "fnv",
+ "once_cell",
+ "onig",
+ "plist",
+ "regex-syntax",
+ "serde",
+ "serde_json",
+ "thiserror",
+ "walkdir",
+ "yaml-rust",
+]
+
+[[package]]
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -430,36 +707,50 @@ dependencies = [
[[package]]
name = "time"
-version = "0.3.14"
+version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b"
+checksum = "0fab5c8b9980850e06d92ddbe3ab839c062c801f3927c0fb8abd6fc8e918fbca"
dependencies = [
"itoa",
"libc",
"num_threads",
+ "serde",
+ "time-core",
"time-macros",
]
[[package]]
-name = "time-macros"
-version = "0.2.4"
+name = "time-core"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792"
+checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
[[package]]
-name = "toml"
-version = "0.5.9"
+name = "time-macros"
+version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
+checksum = "65bb801831d812c562ae7d2bfb531f26e66e4e1f6b17307ba4149c5064710e5b"
dependencies = [
- "serde",
+ "time-core",
]
[[package]]
name = "unicode-ident"
-version = "1.0.4"
+version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd"
+checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
+
+[[package]]
+name = "unicode-width"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
+
+[[package]]
+name = "unsafe-libyaml"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c1e5fa573d8ac5f1a856f8d7be41d390ee973daf97c806b2c1a465e4e1406e68"
[[package]]
name = "walkdir"
@@ -565,43 +856,72 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
-version = "0.36.1"
+version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
+checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
+ "windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
+
+[[package]]
name = "windows_aarch64_msvc"
-version = "0.36.1"
+version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
+checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
[[package]]
name = "windows_i686_gnu"
-version = "0.36.1"
+version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
+checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
[[package]]
name = "windows_i686_msvc"
-version = "0.36.1"
+version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
+checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
[[package]]
name = "windows_x86_64_gnu"
-version = "0.36.1"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
+checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
[[package]]
name = "windows_x86_64_msvc"
-version = "0.36.1"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
+
+[[package]]
+name = "xml-rs"
+version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
+checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3"
+
+[[package]]
+name = "yaml-rust"
+version = "0.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
+dependencies = [
+ "linked-hash-map",
+]
diff --git a/Cargo.toml b/Cargo.toml
index c7cf8e7..e77cb47 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "felix"
-version = "1.3.2"
+version = "2.0.0"
authors = ["Kyohei Uto <im@kyoheiu.dev>"]
edition = "2021"
description = "tui file manager with vim-like key mapping"
@@ -20,11 +20,12 @@ bench = false
dirs = "4.0.0"
walkdir = "2.3.2"
natord = "1.0.9"
-toml = "0.5.8"
log = "0.4.16"
simplelog = "0.12.0"
content_inspector = "0.2.4"
crossterm = "0.25.0"
+syntect = {git = "https://github.com/kyoheiu/syntect"}
+serde_yaml = "0.9.14"
[dependencies.serde]
version = "1.0.136"
diff --git a/README.md b/README.md
index 981e1bc..54fd898 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[![crates.io](https://img.shields.io/crates/v/felix)](https://crates.io/crates/felix) ![aur:felix-rs](https://img.shields.io/aur/version/felix-rs) ![MSRV](https://img.shields.io/badge/MSRV-1.59.0-orange)
+[![crates.io](https://img.shields.io/crates/v/felix)](https://crates.io/crates/felix) ![aur:felix-rs](https://img.shields.io/aur/version/felix-rs) ![MSRV](https://img.shields.io/badge/MSRV-1.60.0-orange)
# _felix_
@@ -11,15 +11,21 @@ For the detailed document, please see https://kyoheiu.dev/felix.
## New Release
-## v1.3.2 (2022-10-23)
+## v2.0.0 (2022-11-11)
-### Added
+### Changed
-- Add `std::panic::catch_unwind` to manually restore after a panic rewind. This allows the cursor to be restored and the screen cleared when this app panics.
+- Migrated to yaml from toml: New config file will be created at the first launch (In this process you should enter the default command name or choose to use \$EDITOR). No need to keep `config.toml`.
+- Add the fallback when config file cannot be read: In such a case, you can use the default config.
+- HUGE refactoring overall.
-### Fixed
+### Added
-- Fixed: Similar to v1.3.1, attempting to preview a symbolic link to a nonexistent file caused a panic. Now the preview shows `(file not readable)` for such a link.
+- Horizontal split, in addtion to the vertical split. To swtch between them, press `s`.
+- Syntax highlighting (if possible) in previewed texts. To turn on, state `syntax_hightlight: true` in `config.yaml`. you can also choose your theme, either from the default theme set or your favorite .tmtheme.
+- Enable scrolling in the preview space. `Alt + j / Down` goes down, `Alt + Up` goes up. Experimental and may have some bugs. Also, big text files can cause the performance issue.
+- Search by keyword. Similar to the filter mode, but this feature does not manipulate the item list: Just let users jump to the item that matches the keyword, like Vim's `/`. `n` and `N` after `/` also works.
+- Show permissions on the footer (in unix only).
For more details, see `CHANGELOG.md`.
@@ -32,9 +38,9 @@ For more details, see `CHANGELOG.md`.
| MacOS | works |
| Windows | not fully tested yet |
-_For Windows users: From v1.3.0, it can be at least compiled on Windows (see `.github/workflows/install_test.yml`.) If you're interested, Please try the native build and report any problems._
+_For Windows users: From v1.3.0, it can be at least compiled on Windows (see `.github/workflows/install_test.yml`.) If you're interested, please try and report any problems._
-MSRV(Minimum Supported rustc Version): **1.59.0**
+MSRV(Minimum Supported rustc Version): **1.60.0**
## Installation
@@ -94,8 +100,8 @@ Both relative and absolute path available.
## Key Manual
```
-j / Up :Go up.
-k / Down :Go down.
+j / Down :Go down.
+k / Up :Go up.
h / Left :Go to the parent directory if exists.
l / Right / Enter :Open a file or change directory.
o :Open a file in a new window.
@@ -112,11 +118,16 @@ V :Switch to the select mode.
u :Undo put/delete/rename.
Ctrl + r :Redo put/delete/rename.
v :Toggle whether to show the preview.
+s :Toggle between vertical / horizontal split in the preview mode.
+Alt + j / Down :Scroll down the preview text.
+Alt + k / Up :Scroll up the preview text.
backspace :Toggle whether to show hidden items.
t :Toggle the sort order (name <-> modified time).
: :Switch to the shell mode.
c :Switch to the rename mode.
-/ :Switch to the filter mode.
+/ :Search items by the keyword.
+n :Go forward to the item that matches the keyword.
+N :Go backward to the item that matches the keyword.
Esc :Return to the normal mode.
:cd / :z :Go to the home directory.
:z <keyword> :Same as `z <keyword>`.
@@ -136,7 +147,7 @@ Install `chafa` and you can preview images without any configuration.
### Linux
```
-config file : $XDG_CONFIG_HOME/felix/config.toml
+config file : $XDG_CONFIG_HOME/felix/config.yaml
trash directory : $XDG_CONFIG_HOME/felix/trash
log files : \$XDG_CONFIG_HOME/felix/log
```
@@ -144,7 +155,7 @@ log files : \$XDG_CONFIG_HOME/felix/log
### macOS
```
-config file : $HOME/Library/Application Support/felix/config.toml
+config file : $HOME/Library/Application Support/felix/config.yaml
trash directory : $HOME/Library/Application Support/felix/trash
log files : \$HOME/Library/Application Support/felix/log
```
@@ -152,7 +163,7 @@ log files : \$HOME/Library/Application Support/felix/log
### Windows
```
-config file : $PROFILE\AppData\Roaming\felix\config.toml
+config file : $PROFILE\AppData\Roaming\felix\config.yaml
trash directory : $PROFILE\AppData\Roaming\felix\trash
log files : $PROFILE\AppData\Roaming\felix\log
```
diff --git a/config.toml b/config.toml
deleted file mode 100644
index 88105be..0000000
--- a/config.toml
+++ /dev/null
@@ -1,46 +0,0 @@
-# 1.3.2
-
-# (Optional) Default exec command when open files.
-# If not set, will default to $EDITOR
-# default = "nvim"
-
-# (Optional) Whether to use the full width of terminal.
-# If not set, this will be true.
-# use_full_width = true
-
-# (Optional) Set the max length of item name to be displayed.
-# This works only when use_full_width is set to false.
-# If the terminal size is not enough, the length will be changed to fit it.
-# If not set, this will be 30.
-# item_name_length = 30
-
-# (Optional)
-# key (the command you want to use) = [values] (extensions)
-# [exec]
-# feh = [\"jpg\", \"jpeg\", \"png\", \"gif\", \"svg\"]
-# zathura = [\"pdf\"]
-
-# The foreground color of directory, file and symlink.
-# Pick one of the following:
-# Black
-# Red
-# Green
-# Yellow
-# Blue
-# Magenta
-# Cyan
-# White
-# LightBlack
-# LightRed
-# LightGreen
-# LightYellow
-# LightBlue
-# LightMagenta
-# LightCyan
-# LightWhite
-# Rgb(u8, u8, u8)
-# AnsiValue(u8)
-[color]
-dir_fg = "LightCyan"
-file_fg = "LightWhite"
-symlink_fg = "LightYellow"
diff --git a/config.yaml b/config.yaml
new file mode 100644
index 0000000..d81afc7
--- /dev/null
+++ b/config.yaml
@@ -0,0 +1,63 @@
+# v2.0.0
+
+# (Optional)
+# Default exec command when open files.
+# If not set, will default to $EDITOR.
+# default: nvim
+
+# (Optional)
+# key (the command you want to use): [values] (extensions)
+# exec:
+# feh:
+# [jpg, jpeg, png, gif, svg]
+# zathura:
+# [pdf]
+
+# (Optional)
+# Whether to use syntax highlighting in the preview mode.
+# If not set, will default to false.
+# syntax_highlight: true
+
+# (Optional)
+# Default theme for syntax highlighting.
+# Pick one from the following:
+# Base16OceanDark
+# Base16EightiesDark
+# Base16MochaDark
+# Base16OceanLight
+# InspiredGitHub
+# SolarizedDark
+# SolarizedLight
+# If not set, will default to "Base16OceanDark".
+# default_theme: Base16EightiesDark
+
+# (Optional)
+# Path to .tmtheme file for the syntax highlighting.
+# If not set, default_theme will be used.
+# theme_path: "/home/kyohei/.config/felix/monokai.tmtheme"
+
+# The foreground color of directory, file and symlink.
+# Pick one of the following:
+# Black // 0
+# Red // 1
+# Green // 2
+# Yellow // 3
+# Blue // 4
+# Magenta // 5
+# Cyan // 6
+# White // 7
+# LightBlack // 8
+# LightRed // 9
+# LightGreen // 10
+# LightYellow // 11
+# LightBlue // 12
+# LightMagenta // 13
+# LightCyan // 14
+# LightWhite // 15
+# Rgb(u8, u8, u8)
+# AnsiValue(u8)
+# For more details, see https://docs.rs/termion/1.5.6/termion/color/index.html
+color:
+ dir_fg: LightCyan
+ file_fg: LightWhite
+ symlink_fg: LightYellow
diff --git a/screenshots/sample.gif b/screenshots/sample.gif
index 87f0ed3..9a378bf 100644
--- a/screenshots/sample.gif
+++ b/screenshots/sample.gif
Binary files differ
diff --git a/src/config.rs b/src/config.rs
index 7fc9734..7da87c2 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -1,58 +1,74 @@
use super::errors::FxError;
+use super::state::FX_CONFIG_DIR;
+
use serde::Deserialize;
use std::collections::Ha