diff options
author | Kyohei Uto <im@kyoheiu.dev> | 2023-08-25 06:15:15 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-25 06:15:15 +0900 |
commit | 98c9c7a880207ebf3819e94d34b58cf2e1fef0a2 (patch) | |
tree | d5816793e3f79f979ea678b3ead249394a6b276b | |
parent | 48bec5e22f78885dff3a8e3130b1bffaf5b24c12 (diff) | |
parent | 067a1626659268d4234ed75bdfa1536b4546bffe (diff) |
Merge pull request #235 from kyoheiu/developv2.8.0
v2.8.0
-rw-r--r-- | CHANGELOG.md | 13 | ||||
-rw-r--r-- | Cargo.lock | 251 | ||||
-rw-r--r-- | Cargo.toml | 3 | ||||
-rw-r--r-- | README.md | 38 | ||||
-rw-r--r-- | config.yaml | 36 | ||||
-rw-r--r-- | src/config.rs | 72 | ||||
-rw-r--r-- | src/errors.rs | 10 | ||||
-rw-r--r-- | src/functions.rs | 10 | ||||
-rw-r--r-- | src/help.rs | 13 | ||||
-rw-r--r-- | src/layout.rs | 52 | ||||
-rw-r--r-- | src/run.rs | 318 | ||||
-rw-r--r-- | src/state.rs | 108 |
12 files changed, 395 insertions, 529 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b96ec7e..cdfc61d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,20 @@ ## Unreleased +## v2.8.0 (2023-08-25) + ### Added +- `i{file name}<CR>` to create new file, and `I{dir name}<CR>` to create new directory. +- If zoxide is installed, whenever changing directory inside felix, `zoxide add` will be executed to add the directory or increment its rank in the zoxide database. + - For this, State now has a new field `has_zoxide`, which is checked at startup. + +### Changed +- config's `color` is now optional: By this, all config fields are optional. + - Remove warning message when you launch felix without the config file. +- When opening file by default editor is failed, felix displays more accurate warning: `$EDITOR may not be set, or config file may be invalid.`. -- Create temp file or directory by `af` or `ad` respectively. This feature has to feel like more "modal", so for now I comment out this feature. +### Removed +- Remove `syntect` and syntax highlighting in the preview area. This will improve build and start-up times, and resolve the handling of wide chars such as CJK. ## v2.7.0 (2023-08-05) @@ -41,27 +41,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] -name = "base64" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" - -[[package]] name = "base64ct" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[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" @@ -120,9 +105,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.81" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6b2562119bf28c3439f7f02db99faf0aa1a8cdfe5772a2ee155d32227239f0" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "jobserver", "libc", @@ -290,9 +275,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" [[package]] name = "devtimer" @@ -346,7 +331,7 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "felix" -version = "2.7.0" +version = "2.8.0" dependencies = [ "bwrap", "chrono", @@ -363,7 +348,6 @@ dependencies = [ "serde", "serde_yaml", "simplelog", - "syntect", "tar", "unicode-width", "walkdir", @@ -373,33 +357,27 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "windows-sys", ] [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" 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 = "generic-array" version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -422,12 +400,6 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" @@ -472,22 +444,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown", ] [[package]] @@ -530,21 +492,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] -name = "line-wrap" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" -dependencies = [ - "safemem", -] - -[[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" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -556,9 +503,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "lzma-rs" @@ -670,28 +617,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] -name = "onig" -version = "6.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -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 = "option-ext" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -756,20 +681,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] -name = "plist" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdc0001cfea3db57a2e24bc0d818e9e20e554b5f97fabb9bc231dc240269ae06" -dependencies = [ - "base64", - "indexmap 1.9.3", - "line-wrap", - "quick-xml", - "serde", - "time", -] - -[[package]] name = "proc-macro2" version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -779,19 +690,10 @@ dependencies = [ ] [[package]] -name = "quick-xml" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" -dependencies = [ - "memchr", -] - -[[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -854,24 +756,12 @@ dependencies = [ ] [[package]] -name = "regex-syntax" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" - -[[package]] name = "ryu" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[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" @@ -888,18 +778,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.181" +version = "1.0.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d3e73c93c3240c0bda063c239298e633114c69a888c3e37ca8bb33f343e9890" +checksum = "9f5db24220c009de9bd45e69fb2938f4b6d2df856aa9304ce377b3180f83b7c1" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.181" +version = "1.0.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be02f6cb0cd3a5ec20bbcfbcbd749f57daddb1a0882dc2e46a6c236c90b977ed" +checksum = "5ad697f7e0b65af4983a4ce8f56ed5b357e8d3c36651bf6a7e13639c17b8e670" dependencies = [ "proc-macro2", "quote", @@ -907,23 +797,12 @@ dependencies = [ ] [[package]] -name = "serde_json" -version = "1.0.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] name = "serde_yaml" version = "0.9.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" dependencies = [ - "indexmap 2.0.0", + "indexmap", "itoa", "ryu", "serde", @@ -1013,9 +892,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "2.0.28" +version = "2.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" dependencies = [ "proc-macro2", "quote", @@ -1023,31 +902,10 @@ dependencies = [ ] [[package]] -name = "syntect" -version = "5.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e02b4b303bf8d08bfeb0445cba5068a3d306b6baece1d5582171a9bf49188f91" -dependencies = [ - "bincode", - "bitflags", - "flate2", - "fnv", - "once_cell", - "onig", - "plist", - "regex-syntax", - "serde", - "serde_json", - "thiserror", - "walkdir", - "yaml-rust", -] - -[[package]] name = "tar" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec96d2ffad078296368d46ff1cb309be1c23c513b4ab0e22a45de0185275ac96" +checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" dependencies = [ "filetime", "libc", @@ -1065,18 +923,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.44" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.44" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" dependencies = [ "proc-macro2", "quote", @@ -1085,9 +943,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.25" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea" +checksum = "0bb39ee79a6d8de55f48f2293a830e040392f1c5f16e336bdd1788cd0aadce07" dependencies = [ "deranged", "itoa", @@ -1106,9 +964,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd" +checksum = "733d258752e9303d392b94b75230d07b0b9c489350c69b851fc6c065fde3e8f9" dependencies = [ "time-core", ] @@ -1264,9 +1122,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -1279,65 +1137,56 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "xattr" -version = "0.2.3" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" +checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" dependencies = [ "libc", ] [[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] - -[[package]] name = "zip" version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1,6 +1,6 @@ [package] name = "felix" -version = "2.7.0" +version = "2.8.0" authors = ["Kyohei Uto <im@kyoheiu.dev>"] edition = "2021" description = "tui file manager with vim-like key mapping" @@ -27,7 +27,6 @@ log = "0.4.19" simplelog = "0.12.1" content_inspector = "0.2.4" crossterm = "0.26.1" -syntect = "5.1.0" serde_yaml = "0.9.25" zip = "0.6.6" tar = "0.4.39" @@ -25,6 +25,21 @@ For more detailed document, visit https://kyoheiu.dev/felix. ## New release +## v2.8.0 (2023-08-25) + +### Added +- `i{file name}<CR>` to create new file, and `I{dir name}<CR>` to create new directory. +- If zoxide is installed, whenever changing directory inside felix, `zoxide add` will be executed to add the directory or increment its rank in the zoxide database. + - For this, State now has a new field `has_zoxide`, which is checked at startup. + +### Changed +- config's `color` is now optional: By this, all config fields are optional. + - Remove warning message when you launch felix without the config file. +- When opening file by default editor is failed, felix displays more accurate warning: `$EDITOR may not be set, or config file may be invalid.`. + +### Removed +- Remove `syntect` and syntax highlighting in the preview area. This will improve build and start-up times, and resolve the handling of wide chars such as CJK. + ## v2.7.0 (2023-08-05) ### Changed @@ -49,23 +64,6 @@ For more detailed document, visit https://kyoheiu.dev/felix. - Ability to exit to LWD (last working directory): See Integrations for details. -## v2.4.1 (2023-06-21) - -### Changed - -- Show status bar and registers even if current directory does not contain any item. - -## v2.4.0 (2023-06-14) - -### Added - -- Add registers (unnamed, zero, numbered, named): Now you can view registers by `:reg`, and add items to registers by usual vim command (prefixed by `"`). See the key manual for more details. -- Refactor unpacking command: `e` unpacks / decompresses gz(Gzip), tar.gz, xz(lzma), tar.xz, zst(Zstandard), tar.zst, tar, and zip file format and formats based on it. - -### Removed - -- `:z` - Use `z` instead. - For more details, see `CHANGELOG.md`. <a id="status"></a> @@ -173,6 +171,8 @@ z{keyword}<CR> :Jump to a directory that matches the keyword. (zoxide required) <C-o> :Jump backward. <C-i> :Jump forward. +i{file name}<CR> :Create a new empty file. +I{dir name}<CR> :Create a new empty directory. o :Open item in a new window. e :Unpack archive/compressed file. dd :Delete and yank item. @@ -185,7 +185,7 @@ p :Put yanked item(s) from register zero "Ayy :Append item to register a. "Add :Delete and append item to register a. "ap :Put item(s) from register a. -V :Switch to the linewise visual mode. +V (uppercase) :Switch to the linewise visual mode. - y :In the visual mode, yank selected item(s). - d :In the visual mode, delete and yank selected item(s). - "ay :In the visual mode, yank items to register a. @@ -194,7 +194,7 @@ V :Switch to the linewise visual mode. - "Ad :In the visual mode, delete and append items to register a. u :Undo put/delete/rename. <C-r> :Redo put/delete/rename. -v :Toggle whether to show the preview. +v (lowercase) :Toggle whether to show the preview. s :Toggle between vertical / horizontal split in the preview mode. <Alt-j> / <Alt-<Down>> :Scroll down the preview text. diff --git a/config.yaml b/config.yaml index 36c281c..7e3963c 100644 --- a/config.yaml +++ b/config.yaml @@ -1,16 +1,13 @@ -# (Optional) # Default exec command when opening file. # If not set, will default to $EDITOR. # default: nvim -# (Optional) # Whether to match the behavior of Vim's exit keybindings. # false -> `ZZ` exits without `cd` to LWD(Last Working Directory) While `ZQ` to LWD # true -> vice versa # If not set, will default to false. # match_vim_exit_behavior: false -# (Optional) # key (the command you want to use when opening file): [values] (extensions) # In the key, You can use arguments. # exec: @@ -19,29 +16,6 @@ # 'feh -.': # [jpg, jpeg, png, gif, svg, hdr] -# (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 @@ -62,8 +36,8 @@ # 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 +# Default to LightCyan(dir), LightWhite(file), and LightYellow(symlink). +# color: +# dir_fg: LightCyan +# file_fg: LightWhite +# symlink_fg: LightYellow diff --git a/src/config.rs b/src/config.rs index 95d988f..e730d84 100644 --- a/src/config.rs +++ b/src/config.rs @@ -11,17 +11,14 @@ const CONFIG_FILE_ANOTHER_EXT: &str = "config.yml"; #[allow(dead_code)] const CONFIG_EXAMPLE: &str = r###" -# (Optional) # Default exec command when open files. # If not set, will default to $EDITOR. # default: nvim -# (Optional) # Whether to match the behavior of vim exit keybindings # i.e. `ZQ` exits without cd to LWD (Last Working Directory) while `ZZ` cd to LWD # match_vim_exit_behavior: false -# (Optional) # key (the command you want to use when opening files): [values] (extensions) # In the key, You can use arguments. # exec: @@ -30,29 +27,6 @@ const CONFIG_EXAMPLE: &str = r###" # 'feh -.': # [jpg, jpeg, png, gif, svg, hdr] -# (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: Base16OceanDark - -# (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 @@ -73,11 +47,11 @@ syntax_highlight: true # 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 +# Default to LightCyan(dir), LightWhite(file), and LightYellow(symlink). +# color: +# dir_fg: LightCyan +# file_fg: LightWhite +# symlink_fg: LightYellow "###; #[derive(Deserialize, Debug, Clone)] @@ -85,10 +59,7 @@ pub struct Config { pub default: Option<String>, pub match_vim_exit_behavior: Option<bool>, pub exec: Option<BTreeMap<String, Vec<String>>>, - pub color: ConfigColor, - pub syntax_highlight: Option<bool>, - pub default_theme: Option<DefaultTheme>, - pub theme_path: Option<PathBuf>, + pub color: Option<ConfigColor>, } #[derive(Deserialize, Debug, Clone)] @@ -98,6 +69,16 @@ pub struct ConfigColor { pub symlink_fg: Colorname, } +impl Default for ConfigColor { + fn default() -> Self { + Self { + dir_fg: Colorname::LightCyan, + file_fg: Colorname::LightWhite, + symlink_fg: Colorname::LightYellow, + } + } +} + #[derive(Deserialize, Debug, Clone)] pub enum Colorname { Black, // 0 @@ -120,31 +101,13 @@ pub enum Colorname { AnsiValue(u8), } -#[derive(Deserialize, Debug, Clone)] -pub enum DefaultTheme { - Base16OceanDark, - Base16EightiesDark, - Base16MochaDark, - Base16OceanLight, - InspiredGitHub, - SolarizedDark, - SolarizedLight, -} - impl Default for Config { fn default() -> Self { Self { default: Default::default(), match_vim_exit_behavior: Default::default(), exec: Default::default(), - color: ConfigColor { - dir_fg: Colorname::LightCyan, - file_fg: Colorname::LightWhite, - symlink_fg: Colorname::LightYellow, - }, - syntax_highlight: Default::default(), - default_theme: Default::default(), - theme_path: Default::default(), + color: Some(Default::default()), } } } @@ -210,7 +173,6 @@ pub fn read_config_or_default() -> Result<Config, FxError> { if let Some(config_file) = config_file { read_config(&config_file) } else { - println!("Config file not found: felix launches with default configuration."); Ok(Config::default()) } } diff --git a/src/errors.rs b/src/errors.rs index bb49aa1..34f7b3e 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -9,10 +9,10 @@ pub enum FxError { GetItem, OpenItem(String), OpenNewWindow(String), + DefaultEditor, Yaml(String), WalkDir(String), Encode, - Syntect(String), PutItem(PathBuf), RemoveItem(PathBuf), TooSmallWindowSize, @@ -35,10 +35,10 @@ impl std::fmt::Display for FxError { FxError::GetItem => "Error: Cannot get item info".to_owned(), FxError::OpenItem(s) => s.to_owned(), FxError::OpenNewWindow(s) => s.to_owned(), + FxError::DefaultEditor => "$EDITOR may not be set, or config file may be invalid.".to_owned(), FxError::Yaml(s) => s.to_owned(), FxError::WalkDir(s) => s.to_owned(), FxError::Encode => "Error: Incorrect encoding".to_owned(), - FxError::Syntect(s) => s.to_owned(), FxError::PutItem(s) => format!("Error: Cannot copy -> {:?}", s), FxError::RemoveItem(s) => format!("Error: Cannot remove -> {:?}", s), FxError::TooSmallWindowSize => "Error: Too small window size".to_owned(), @@ -63,12 +63,6 @@ impl From<serde_yaml::Error> for FxError { } } -impl From<syntect::Error> for FxError { - fn from(err: syntect::Error) -> Self { - FxError::Syntect(err.to_string()) - } -} - impl From<walkdir::Error> for FxError { fn from(err: walkdir::Error) -> Self { FxError::WalkDir(err.to_string()) diff --git a/src/functions.rs b/src/functions.rs index d17ce44..ebdbc18 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -428,7 +428,10 @@ mod tests { let sample = r#"Rust is a multi-paradigm, general-purpose programming language that emphasizes performance, type safety, and concurrency. It enforces memory safety—ensuring that all references point to valid memory—without requiring the use of a garbage collector or reference counting present in other memory-safe languages. To simultaneously enforce memory safety and prevent concurrent data races, its "borrow checker" tracks the object lifetime of all references in a program during compilation. Rust borrows ideas from functional programming, including static types, immutability, higher-order functions, and algebraic data types. It is popularized for systems programming."#; for _i in 0..5000 { let formatted = bwrap::wrap_maybrk!(sample, 20); - let formatted = formatted.lines().map(|x| x.to_owned()).collect::<Vec<String>>(); + let formatted = formatted + .lines() + .map(|x| x.to_owned()) + .collect::<Vec<String>>(); assert_eq!(formatted[0], "Rust is a multi-para".to_string()); } } @@ -442,7 +445,10 @@ mod tests { 太平洋戦争中の1943年に東京府と東京市が統合されて、改めて東京都が首都となった。"#; for _i in 0..5000 { let formatted = bwrap::wrap_maybrk!(sample, 20); - let formatted = formatted.lines().map(|x| x.to_owned()).collect::<Vec<String>>(); + let formatted = formatted + .lines() + .map(|x| x.to_owned()) + .collect::<Vec<String>>(); assert_eq!(formatted[0], "東京都心は、かつての".to_string()); } } diff --git a/src/help.rs b/src/help.rs index 6a56a83..5d5e72c 100644 --- a/src/help.rs +++ b/src/help.rs @@ -1,5 +1,5 @@ /// Help text. -pub const HELP: &str = r###"# felix v2.7.0 +pub const HELP: &str = r###"# felix v2.8.0 A simple TUI file manager with vim-like keymapping. ## Usage @@ -25,6 +25,8 @@ z{keyword}<CR> :Jump to a directory that matches the keyword. (zoxide required) <C-o> :Jump backward. <C-i> :Jump forward. +i{file name}<CR> :Create a new empty file. +I{dir name}<CR> :Create a new empty directory. o :Open item in a new window. e :Unpack archive/compressed file. dd :Delete and yank item. @@ -79,22 +81,25 @@ To preview images, you need to install chafa (>= v1.10.0). Please see https://hpjansson.org/chafa/ ## Configuration + +*Both `config.yaml` and `config.yml` work.* + ### Linux -config file : $XDG_CONFIG_HOME/felix/config.yaml +config file : $XDG_CONFIG_HOME/felix/config.yaml(config.yml) trash directory: $XDG_DATA_HOME/felix/trash log files : $XDG_DATA_HOME/felix/log ### macOS On macOS, felix looks for the config file in the following locations: -1. `$HOME/Library/Application Support/felix/config.yaml` +1. `$HOME/Library/Application Support/felix/config.yaml(config.yml)` 2. `$HOME/.config/felix/config.yaml` trash directory: $HOME/Library/Application Support/felix/trash log files : $HOME/Library/Application Support/felix/log ### Windows -config file : $PROFILE\\AppData\\Roaming\\felix\\config.yaml +config file : $PROFILE\\AppData\\Roaming\\felix\\config.yaml(config.yml) tr |