mirror of https://github.com/jarun/nnn.git
Compare commits
554 Commits
Author | SHA1 | Date |
---|---|---|
Arun | e27d059552 | |
NRK | 4f3662cf88 | |
Arun | 9e95578c22 | |
NRK | 78b9677abd | |
Arun Prakash Jana | 55137600e0 | |
Arun Prakash Jana | be6988d1c8 | |
Arun Prakash Jana | 191e77ec5d | |
Arun Prakash Jana | 46b5255814 | |
Arun | 2fb7490bf0 | |
Arun | d61c983dd0 | |
NRK | e60be2eaa2 | |
NRK | 72ee94ed6e | |
Oktay Imanzade | b20886a29c | |
Arun | ad04944bdf | |
François Bechet | 133c0d329b | |
Arun | 5853ac8e48 | |
Martin Ziemer | 28d993a8e8 | |
Arun | 22aa1455a6 | |
KlzXS | 7806d5d371 | |
Arun | 5456ba4582 | |
c79cea05 | 297b85492f | |
Arun Prakash Jana | f71b1309a9 | |
Arun | eb66598145 | |
KlzXS | 3d6777920a | |
Arun | 4a9587a5e6 | |
KlzXS | b392dd3723 | |
Arun | 0f62c6258a | |
João F. (BeyondMagic/koetemagie) | 2a442ec30c | |
Michel DHOOGE | 5b05c8b9b1 | |
90 | eb3888cb09 | |
Arun Prakash Jana | 94aeaccdbd | |
NRK | 0738f39cf0 | |
Antonio Mancera Gamez | e76d7bbf1d | |
Arun | f2a8648861 | |
Arun | 82f9e544f2 | |
me | 3d2caf861d | |
João F. (BeyondMagic/koetemagie) | eb775914af | |
Arun | 5595d93d29 | |
Arun | bb650eb9dd | |
me | ab718387c2 | |
Jeff Davis | 3849430ebc | |
Arun | f2a909dafd | |
Arun | 404eed5fc7 | |
me | 9aaf9491ad | |
Arun | 485079d3ec | |
me | bca441e00f | |
NRK | 60eabb6170 | |
NRK | 3665541dac | |
Arun | 744a7554ef | |
blissful | c0b3cc8689 | |
blissful | 703d349389 | |
Arun Prakash Jana | 9259170afd | |
Arun | 2f22afcacc | |
luukvbaal | 4009e211f3 | |
Luuk van Baal | 3160442f0c | |
Abhinav Lakhani | 9ff81ca1f9 | |
CronyAkatsuki | 8e8289373a | |
Arun | 1051d7213d | |
Luuk van Baal | f8f6d6a482 | |
Arun | 7f63bef4d6 | |
black | bfb46159a1 | |
Arun | f3397d5ea4 | |
NRK | 336ec8be5d | |
J-Kappes | afe84862ff | |
Arun | 3176eaa85c | |
NRK | 4d5e29c3dd | |
NRK | 6d6fc3419e | |
Arun Prakash Jana | 9b921761b6 | |
Arun | 09bf8fe469 | |
blissful | 3b3ad9ccc6 | |
Arun Prakash Jana | dd07aeb703 | |
Arun Prakash Jana | 9c7c7284c0 | |
Arun | ba439084c5 | |
Xerillic | 06d8da9052 | |
Arun | ed59aa2ac3 | |
umaranis | a06af824ee | |
Xerillic | 66447d52a7 | |
Syed Umar Anis | 547508aa78 | |
Arun Prakash Jana | d72ab3497a | |
Arun Prakash Jana | 2472554e9a | |
Arun Prakash Jana | 785dd3ddf1 | |
Arun Prakash Jana | 33126ee813 | |
Arun | d8c1c99e45 | |
Syed Umar Anis | b28f209c84 | |
Arun | 1ba85825c5 | |
Arun | 66f636de13 | |
Tadeas Uhlir | e500179188 | |
Quan Tong | d220c50773 | |
Arun Prakash Jana | 186f9d01ea | |
Arun Prakash Jana | 693ba757c0 | |
Arun Prakash Jana | 3539e5c1b1 | |
Arun | d65a095d9b | |
ANtlord | dedf0554e5 | |
Arun | b835cfcc2a | |
Anomalocaridid | 80bbf76b5b | |
Anomalocaridid | 5723023491 | |
Anomalocaridid | 280068c5da | |
Arun | 53e4fec75b | |
NRK | db8b61866b | |
Arun | 26d5b5c614 | |
Arun | 899fd5b4cf | |
JingMatrix | e6ce7a614e | |
NRK | 5e3ee08e64 | |
NRK | 4c2ce0a84d | |
Arun | 0dfc6881b4 | |
Luuk van Baal | 05990dc9e5 | |
Arun | fb6e7403cf | |
NRK | b2b830e69d | |
Arun | 4149a2619d | |
Aseem Athale | aed2725cb3 | |
Arun | 04d9f6738d | |
Arun | e013a867da | |
Arun | ed58e07a98 | |
NRK | 16899bda53 | |
Arun | 4c0305f11c | |
leo-arch | 4babedc3e4 | |
NRK | ddcf331205 | |
Delgan | bd4a4454fe | |
Arun | aaf60b93d7 | |
Arun | 145ea41490 | |
Arun | 29779acc57 | |
Delgan | a7262eb4ee | |
Jasper | fb3a648756 | |
UnleashedMarf | 9be3ee9abf | |
UnleashedMarf | d873eb393d | |
Arun Prakash Jana | efd5bc9db1 | |
Arun | 737ebaa9ef | |
J. Brock | 95183fbef8 | |
Arun | fe96bd6bc7 | |
Luuk van Baal | 20e944f5e5 | |
Arun Prakash Jana | 5d81aeb477 | |
Arun | 8fd1822ca6 | |
NRK | 20725b0b4d | |
Arun | 6a8d74a43a | |
Luuk van Baal | d3b5d0e49d | |
musjj | 432b0755d3 | |
Arun | 621dbba02e | |
spfanning | 63891578d7 | |
Arun Prakash Jana | 8a1dce888a | |
Arun Prakash Jana | 9319b638e7 | |
Arun Prakash Jana | 6dd8cf8b4d | |
Arun | 18b5371d08 | |
Kian-Meng Ang | 3d1bc6e8e5 | |
Arun | 79007074f7 | |
yosh | 98d3b2135d | |
Arun | a3759abd4e | |
NRK | 57882ffab7 | |
Arun Prakash Jana | c4678e3116 | |
Arun | 03ae86cca4 | |
Arun | 15e55f5e18 | |
Arun | 2af79c9ad2 | |
Henri Bourcereau | eaffd311d4 | |
NRK | 003228afba | |
birik | 8b8e3eb522 | |
Arun | 9656c809d2 | |
Henri Bourcereau | 69882b3bff | |
NRK | 3a30211e6c | |
Arun | 2a38132012 | |
NRK | 8dbd9da0cc | |
NRK | a59a91c312 | |
amalgame21 | 1dc4c96139 | |
Arun | 9503703517 | |
Luuk van Baal | 675e50c941 | |
Arun | a4745272db | |
Jacob Moena | 2dc7f19be0 | |
NRK | bc6a09475d | |
Arun Prakash Jana | b874da395c | |
Arun | b49cc28d80 | |
NRK | 8c23c3da4e | |
Arun | f1c85b977a | |
NRK | 4867fa2bc7 | |
NRK | 9cc4b66868 | |
NRK | 8ad5c87107 | |
Arun | 9357825b34 | |
Luuk van Baal | fc26493602 | |
Arun | ade477e705 | |
Luuk van Baal | 08d2ba0b5d | |
Arun Prakash Jana | bbfb16db42 | |
Arun | d7bfe38728 | |
Luuk van Baal | 80c07741e5 | |
Arun | 3739aab578 | |
Nizamuddin Sulieman | 70204a2d0f | |
Nizamuddin Sulieman | 1ad6d30a36 | |
Nizamuddin Sulieman | 0ac8b7aa54 | |
Arun Prakash Jana | 58b77411c8 | |
Arun | d0631707fc | |
Fernando Ramos | c4c720a59a | |
Arun | 326e76b9d0 | |
Luuk van Baal | 778d6617b1 | |
Arun Prakash Jana | 33827109d5 | |
Arun Prakash Jana | 4f95796ede | |
Arun Prakash Jana | b80e047d50 | |
Arun Prakash Jana | ad4ecb19cb | |
Arun Prakash Jana | 03e0531e81 | |
Arun | 786ecf9fc2 | |
Arun | 1a5a7da8eb | |
Arun | d4575e99c8 | |
NRK | ca8fcf454a | |
KlzXS | 867726d870 | |
KlzXS | 7abfb77a13 | |
KlzXS | 827e84a56f | |
KlzXS | 8d21e5e832 | |
Arun Prakash Jana | 6b94911bc9 | |
Arun Prakash Jana | 653cab9dff | |
Arun Prakash Jana | f9295780ef | |
Arun Prakash Jana | cac5b9ba33 | |
Arun Prakash Jana | df05f593de | |
Arun Prakash Jana | 243301603e | |
Arun | f9281c8eab | |
Arun | 428c652d36 | |
KlzXS | 8a1e32d9eb | |
KlzXS | 1a2f783b75 | |
KlzXS | 6c23fdfd5f | |
Arun | fef3c673cd | |
NRK | 1887cd1a77 | |
Arun | 12aedd521d | |
NRK | cf68675478 | |
Arun | 2b6fb3f388 | |
Léo Villeveygoux | dac5fb0af9 | |
Arun Prakash Jana | 789449a464 | |
Arun | fa62b08243 | |
Arun Prakash Jana | dd214c50f3 | |
NRK | fb5b2e5e64 | |
Raffaele Mancuso | c9b384f009 | |
N-R-K | 2000ed5080 | |
8B411 | a51437ff16 | |
Arun Prakash Jana | e236bd0b3a | |
Raffaele Mancuso | 1b5cfbca3d | |
Arun Prakash Jana | 1688b07d0e | |
Arun | 4d54490433 | |
KlzXS | 87627a6e08 | |
Arun Prakash Jana | 17ed380b57 | |
Arun Prakash Jana | 38d7090e64 | |
Arun Prakash Jana | 824e7a2c18 | |
Arun Prakash Jana | 2e84716e76 | |
Arun Prakash Jana | e8bc59a816 | |
Arun Prakash Jana | 32a6a63f44 | |
Arun Prakash Jana | cf46da60d9 | |
Arun Prakash Jana | 1a04e813be | |
Arun Prakash Jana | 02dec98bf8 | |
Arun Prakash Jana | 608fbb4ad7 | |
Arun Prakash Jana | d4c3e52f2f | |
Arun Prakash Jana | 93de728eab | |
Arun Prakash Jana | c9dbae0586 | |
Arun Prakash Jana | b6bfc740ce | |
Arun Prakash Jana | 28ea6e0f36 | |
Arun Prakash Jana | 2a673b4eb1 | |
Arun Prakash Jana | cd145b982d | |
Arun Prakash Jana | 92a0158f93 | |
Arun Prakash Jana | 0c234060bf | |
Arun | 07c5590db3 | |
Sijmen J. Mulder | 2fc9d518d1 | |
Arun Prakash Jana | 1de825b5bb | |
Arun Prakash Jana | fbf9279973 | |
Arun Prakash Jana | 7330e6642b | |
Darukutsu | 4bb7ffcd4a | |
Arun | 3359b8f7cd | |
LGTM Migrator | 66fd131f2d | |
Arun | a1477c2668 | |
NRK | f13b527a93 | |
NRK | 83c4c880cc | |
daru | e7abf87c54 | |
Darukutsu | e80ba2e44a | |
Arun | 2a4231ea89 | |
NRK | 985f6537ce | |
NRK | 080a061969 | |
NRK | ff27d9ee14 | |
nblock | b511506fa3 | |
Arun | f89ba77516 | |
Arun | 0c4180f2d8 | |
NRK | e5074ebc83 | |
NRK | b00700ce4d | |
Dean G | 38b7282050 | |
Arun | 31b83ef1f0 | |
Luuk van Baal | bc4233767a | |
Arun Prakash Jana | 59eed597c2 | |
Arun Prakash Jana | de3ad1b146 | |
Christian Rackerseder | c24ede2d4a | |
Arun Prakash Jana | 0907895865 | |
Arun | 1cefc326e3 | |
Patrick | a7ce7bb36c | |
Patrick | c9c74dd753 | |
Patrick | 3dac035819 | |
Arun | f6edcc41b9 | |
pataquets | 78019a758e | |
Arun | 23f8c37094 | |
Luuk van Baal | 4f57e0df37 | |
Arun Prakash Jana | f56a8caf65 | |
Arun | 340ba19098 | |
NRK | f8ee991254 | |
Arun | d49ddd1331 | |
NRK | 29a5992dee | |
Arun | ad62463b48 | |
Luuk van Baal | 95e1d56ee4 | |
Arun Prakash Jana | a335f94d05 | |
Arun Prakash Jana | a937bc0a4c | |
Arun | 92873352e0 | |
NRK | e57bb26295 | |
Arun | 7086d030f0 | |
KlzXS | 65dec55e23 | |
Arun Prakash Jana | ab9d8bee89 | |
Arun Prakash Jana | 926c4014b3 | |
Arun Prakash Jana | a7ebc7858a | |
Arun Prakash Jana | e8acae3274 | |
Arun Prakash Jana | 21eebbb003 | |
Arun Prakash Jana | f530b2ca18 | |
Arun Prakash Jana | e298f7eeaf | |
Arun Prakash Jana | e73b57c78a | |
Arun Prakash Jana | 49a0d9d02c | |
Arun Prakash Jana | b76cea3a34 | |
Arun Prakash Jana | 83825a7d11 | |
Arun Prakash Jana | 22db656b8d | |
Arun | 07c1e8e655 | |
NRK | 61e1356fbd | |
N-R-K | f618b78866 | |
Arun Prakash Jana | f2a38b0e22 | |
Arun Prakash Jana | 0988268a61 | |
Tharindu Abeydeera | 98287158aa | |
Arun | e2e1d80d58 | |
NRK | e6b6466c49 | |
Arun Prakash Jana | f415924c7e | |
Arun Prakash Jana | ab0dc52c49 | |
Arun | f829afe60b | |
NRK | fe9c1bbb3a | |
NRK | 63a254951d | |
Arun | aab5ab53a5 | |
NRK | 12f5faa10d | |
NRK | f1932967e2 | |
Arun Prakash Jana | 197717ce68 | |
Arun | 117025c1a4 | |
Arun | 0381db1875 | |
NRK | e98d9288d2 | |
NRK | c3a42f0d92 | |
NRK | 3b09fd1c75 | |
Luuk van Baal | 3fb9cc1e5a | |
Arun Prakash Jana | d95755cce1 | |
Arun Prakash Jana | 12b5416b2c | |
Arun Prakash Jana | a937265833 | |
Anomalocaridid | f2c7495f50 | |
Arun Prakash Jana | b0580905f2 | |
Arun Prakash Jana | b75a22f72d | |
Arun Prakash Jana | b752744ca0 | |
Arun Prakash Jana | db7cb4da1e | |
Luuk van Baal | 910763441d | |
Arun Prakash Jana | b658f324c2 | |
Arun Prakash Jana | 3f4efbefe4 | |
Arun | c09ac1c174 | |
Luuk van Baal | a3cef1611d | |
Arun | f4116a5f42 | |
Jie | a7f243beed | |
Arun Prakash Jana | 8520fe5a0a | |
Arun | a998938b9d | |
NRK | fd69fc2dca | |
NRK | 7121a6fe43 | |
happy wang | dc2cfe78cd | |
Arun | 96cfd3a41a | |
NRK | 0df6eebea0 | |
NRK | 744e9aaf70 | |
NRK | 1d347b1ce9 | |
NRK | 2df0cbd08b | |
Arun | b9a1f1747f | |
Luuk van Baal | 0ab9189bc5 | |
Arun Prakash Jana | 52f4ee5aee | |
Arun | 5ace352d2c | |
Luuk van Baal | 3e84c275ba | |
Arun Prakash Jana | 89bd541562 | |
Arun Prakash Jana | 02d48a9144 | |
Arun | c69067b502 | |
NRK | af5cdca043 | |
NRK | eb66cb5d11 | |
Arun Prakash Jana | 6c197f5f02 | |
Arun Prakash Jana | 2130e1b33a | |
Arun Prakash Jana | 0c626d49a6 | |
Arun Prakash Jana | d898d174f5 | |
Arun Prakash Jana | 581e629c20 | |
Arun Prakash Jana | 56f96c3d0a | |
Arun Prakash Jana | 51f2fde0e6 | |
Arun | 40f75e9c38 | |
Luuk van Baal | 5b5a62bb0d | |
Arun Prakash Jana | 1b31f5cf9b | |
Arun Prakash Jana | 783ea754f7 | |
Arun | c02605a907 | |
Luuk van Baal | fbd6f69f25 | |
Arun Prakash Jana | 19b2ea324a | |
Arun Prakash Jana | 03fc3b99c5 | |
Arun Prakash Jana | e104b749be | |
Arun Prakash Jana | 8fb7feb61c | |
Arun Prakash Jana | 49f21ae013 | |
Göran Gustafsson | 4baee859f8 | |
Arun Prakash Jana | de004d944e | |
Arun | 4784587024 | |
Luuk van Baal | 6fc8f63c0d | |
Arun | 88306e2d9c | |
Arun | 4c6c06b743 | |
Göran Gustafsson | 5023abe2df | |
Göran Gustafsson | 93db9bb2be | |
Arun | 46a5092eee | |
NRK | 5ae3891ee5 | |
Arun | 01ab453cff | |
Luuk van Baal | 3072aa7891 | |
Arun | 0499998e2a | |
Luuk van Baal | bb604bdf1d | |
Arun Prakash Jana | a70ad9c480 | |
Arun Prakash Jana | 10e2d37d0f | |
Arun Prakash Jana | 85be28c019 | |
Arun | d859e81444 | |
Arun | 33ec6dece4 | |
Luuk van Baal | 4c974f286c | |
N-R-K | 1e98e2e126 | |
Arun | f8b8e77be9 | |
Luuk van Baal | 0095948d8d | |
Arun Prakash Jana | d618922177 | |
Arun Prakash Jana | 4337214f50 | |
Arun Prakash Jana | 31a273fdd0 | |
Arun | c2a2a9dee7 | |
Luuk van Baal | 8cdeddeb4a | |
Arun | 772fd30fa0 | |
Luuk van Baal | ae36d30b66 | |
Arun Prakash Jana | 14e80c3872 | |
Arun Prakash Jana | 8175571952 | |
Arun Prakash Jana | 3a50be93fd | |
Arun Prakash Jana | ec7692bb9e | |
Arun | e4c2cb9fd4 | |
Arun Prakash Jana | 8d83af811f | |
Dan Baz | ef5d90f4bb | |
Arun Prakash Jana | ec076f5886 | |
Arun | 81f96ecc1e | |
luukvbaal | ed7afd2dd1 | |
Arun | ab8505efa4 | |
cain-dev | b3f16e7671 | |
Arun Prakash Jana | f6783c2065 | |
Arun | a3fbda02d7 | |
NRK | ba72fca69a | |
Arun | e1e47f909f | |
NRK | 6f332e5260 | |
Arun Prakash Jana | c23125ba50 | |
Arun Prakash Jana | 0a67c5d657 | |
Arun Prakash Jana | af94c7704f | |
Desmond Kabus | b45be9bc5b | |
Arun Prakash Jana | 18a6a010cf | |
Patrick | 4ddd048feb | |
Arun Prakash Jana | fd998b3045 | |
Arun Prakash Jana | 3f58f6111c | |
Arun | 4366247441 | |
Luuk van Baal | 7793cb8b5c | |
Arun Prakash Jana | cc965d1c2d | |
Arun Prakash Jana | dc16ca2340 | |
Arun Prakash Jana | 6b9f8f3666 | |
Arun | 15243186c5 | |
SlIdE42 | 0812c7afac | |
Arun Prakash Jana | be4460c1da | |
Arun Prakash Jana | eb42f7a948 | |
Arun Prakash Jana | 2c5cb4c5aa | |
Arun | a555a7d122 | |
NRK | d0bf2abb37 | |
Arun | 59cf883437 | |
JingMatrix | 5bc75ef4fd | |
Arun | bb875cd5e7 | |
Paolo Capriotti | 4220f4e2eb | |
Arun Prakash Jana | d66492ac10 | |
Arun Prakash Jana | 88e9122c79 | |
Arun Prakash Jana | 5745597fd5 | |
Arun | 0a7742089a | |
JingMatrix | 0a59005acd | |
Arun | 81226db24e | |
NRK | 72ecf6c4b8 | |
Arun | 675016eb55 | |
NRK | 9be6c1a5e2 | |
Arun Prakash Jana | d38841d5f3 | |
Arun | 136549b1ba | |
NRK | c3534bd7e0 | |
Arun Prakash Jana | 57d212c3ca | |
Arun Prakash Jana | 66639c6053 | |
Arun | b718d6d305 | |
Arun | 994bc80e82 | |
daru | 633a9ca8e1 | |
daru | d1de515532 | |
Darukutsu | cd2445607b | |
Darukutsu | 83b6d6aff7 | |
NRK | 2fedc92efc | |
Arun Prakash Jana | 953643b9f1 | |
Arun | 816680ed01 | |
NRK | a8e9d279ac | |
Arun | cb410e25d8 | |
NRK | 799b8fd378 | |
Arun | 30bd6a4e33 | |
KlzXS | 184f134c9e | |
Arun Prakash Jana | 23b54ba0cf | |
Arun | 866612bfda | |
NRK | ff1c1eb2e1 | |
Arun | fbb2172627 | |
NRK | 24db74fd7b | |
NRK | ffd0468f67 | |
Arun Prakash Jana | e67587204b | |
Arun Prakash Jana | aa2147f3ef | |
Arun Prakash Jana | e140e34483 | |
Arun Prakash Jana | fe4ea8a029 | |
Arun | bfa2d4fce5 | |
Luuk van Baal | ecad3e0524 | |
Arun | b8b0bab426 | |
Arun | 9c6ce560f1 | |
Anomalocaridid | efa960d022 | |
lwnctd | 49aa4dabf1 | |
Arun | 2eadf35fa0 | |
NRK | 04181084c0 | |
Arun | dcf3a35cd5 | |
NRK | e2b856904d | |
Arun Prakash Jana | 693df568e0 | |
Arun | 3368a7905b | |
NRK | 02d6feb9b9 | |
NRK | 1608c8763f | |
NRK | 78c0d54400 | |
Arun | e44f8d3fcc | |
Arun | 282266705e | |
Patrick | fe0608116a | |
Arun Prakash Jana | 0fb7a25612 | |
Arun Prakash Jana | b69f838fb8 | |
Luuk van Baal | beafeaaea2 | |
Luuk van Baal | a3d660b673 | |
NRK | ac86fbed0f | |
Luuk van Baal | 48bcc929e8 | |
Luuk van Baal | 06bf4f5dce | |
KlzXS | 3be2dd8390 | |
NRK | ce58aab6b2 | |
NRK | 62f1004836 | |
NRK | d215a9c61d | |
NRK | c234c05b3d | |
NRK | f7298efa99 | |
NRK | 9a26739132 | |
NRK | 23edf571a7 | |
Arun Prakash Jana | 892e4c0082 | |
Arun Prakash Jana | bd6e7e8147 | |
Arun | ecfe819a73 | |
Luuk van Baal | b851b58e83 | |
Arun | 2c31615256 | |
Luuk van Baal | 95f709f86a | |
Arun | a1b15eb766 | |
Arun | 48e478bb90 | |
Luuk van Baal | 8ba43edffc | |
NRK | 7aef60a9d5 | |
Luuk van Baal | e0c1ed273f | |
Arun | 40b2250209 | |
Arun | eb62775852 | |
yeetologist | c147414bc7 | |
Arun Prakash Jana | 1e8b8d14ff | |
KlzXS | 8f2e17303e | |
Arun | 1bc234b0eb | |
NRK | bd8faa2dd8 | |
NRK | 578e6d1aaa | |
NRK | f7091f78e5 | |
Arun | c87b67e073 | |
Omar Polo | fb3d3ab0ef | |
Omar Polo | deead97e23 | |
Arun Prakash Jana | 8ec2fe7f81 |
|
@ -3,10 +3,11 @@ version: 2
|
|||
jobs:
|
||||
compile:
|
||||
docker:
|
||||
- image: ubuntu:20.04
|
||||
- image: ubuntu:22.04
|
||||
working_directory: ~/nnn
|
||||
environment:
|
||||
CI_FORCE_TEST: 1
|
||||
parallelism: 4
|
||||
steps:
|
||||
- run:
|
||||
command: |
|
||||
|
@ -14,24 +15,14 @@ jobs:
|
|||
DEBIAN_FRONTEND="noninteractive" TZ="America/New_York" apt-get -y install tzdata
|
||||
apt install -y --no-install-recommends software-properties-common wget gpg-agent shellcheck
|
||||
apt install -y --no-install-recommends git make pkg-config libncurses-dev libreadline-dev
|
||||
apt install -y --no-install-recommends gcc-7 gcc-8 gcc-9 gcc-10
|
||||
apt install -y --no-install-recommends clang-6.0 clang-7 clang-8 clang-9 clang-10 clang-11 clang-tidy-11
|
||||
apt install -y --no-install-recommends gcc-9 gcc-10 gcc-11 gcc-12
|
||||
apt install -y --no-install-recommends clang-11 clang-12 clang-13 clang-14 clang-15 clang-tidy-15
|
||||
- checkout
|
||||
- run:
|
||||
command: |
|
||||
export CFLAGS=-Werror
|
||||
make clean
|
||||
echo
|
||||
echo "########## gcc-7 ##########"
|
||||
CC=gcc-7 make strip
|
||||
ls -l nnn
|
||||
make clean
|
||||
echo
|
||||
echo "########## gcc-8 ##########"
|
||||
CC=gcc-8 make strip
|
||||
ls -l nnn
|
||||
make clean
|
||||
echo
|
||||
echo "########## gcc-9 ##########"
|
||||
CC=gcc-9 make strip
|
||||
ls -l nnn
|
||||
|
@ -42,28 +33,13 @@ jobs:
|
|||
ls -l nnn
|
||||
make clean
|
||||
echo
|
||||
echo "########## clang-6 ##########"
|
||||
CC=clang-6.0 make strip
|
||||
echo "########## gcc-11 ##########"
|
||||
CC=gcc-11 make strip
|
||||
ls -l nnn
|
||||
make clean
|
||||
echo
|
||||
echo "########## clang-7 ##########"
|
||||
CC=clang-7 make strip
|
||||
ls -l nnn
|
||||
make clean
|
||||
echo
|
||||
echo "########## clang-8 ##########"
|
||||
CC=clang-8 make strip
|
||||
ls -l nnn
|
||||
make clean
|
||||
echo
|
||||
echo "########## clang-9 ##########"
|
||||
CC=clang-9 make strip
|
||||
ls -l nnn
|
||||
make clean
|
||||
echo
|
||||
echo "########## clang-10 ##########"
|
||||
CC=clang-10 make strip
|
||||
echo "########## gcc-12 ##########"
|
||||
CC=gcc-12 make strip
|
||||
ls -l nnn
|
||||
make clean
|
||||
echo
|
||||
|
@ -72,10 +48,25 @@ jobs:
|
|||
ls -l nnn
|
||||
make clean
|
||||
echo
|
||||
echo "########## clang-tidy-11 ##########"
|
||||
clang-tidy-11 src/* -- -I/usr/include -I/usr/include/ncursesw
|
||||
echo "########## clang-12 ##########"
|
||||
CC=clang-12 make strip
|
||||
ls -l nnn
|
||||
make clean
|
||||
echo
|
||||
echo "########## clang-13 ##########"
|
||||
CC=clang-13 make strip
|
||||
ls -l nnn
|
||||
make clean
|
||||
echo
|
||||
echo "########## clang-14 ##########"
|
||||
CC=clang-14 make strip
|
||||
ls -l nnn
|
||||
make clean
|
||||
echo
|
||||
echo "########## clang-tidy-15 ##########"
|
||||
clang-tidy-15 src/* -- -I/usr/include -I/usr/include/ncursesw
|
||||
echo "########## shellcheck ##########"
|
||||
find plugins/ -type f -not -name "*.md" -exec shellcheck -e SC1090,SC2230 {} +
|
||||
find plugins/ -type f ! \( -name "*.md" -o -name "*-mac" \) -exec shellcheck {} +
|
||||
|
||||
package-and-publish:
|
||||
machine: true
|
||||
|
@ -101,13 +92,13 @@ jobs:
|
|||
- run:
|
||||
name: "publish to GitHub"
|
||||
command: |
|
||||
go get github.com/tcnksm/ghr
|
||||
go install github.com/tcnksm/ghr@latest
|
||||
ghr -t ${GITHUB_API_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -replace ${CIRCLE_TAG} ./dist/
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
|
||||
test:
|
||||
CircleCI:
|
||||
jobs: &all-tests
|
||||
- compile
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ If we need more information and there is no communication from the bug reporter
|
|||
- [ ] Custom desktop opener (if applicable):
|
||||
- [ ] Program options used:
|
||||
- [ ] Configuration options set:
|
||||
- [ ] Plugins are installed
|
||||
- [ ] Issue exists on `nnn` master
|
||||
|
||||
#### Exact steps to reproduce the issue
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
contact_links:
|
||||
- name: Idea, Enhancement, Question, Support
|
||||
url: https://github.com/jarun/nnn/discussions
|
||||
about: If you have a question, need support or want to discuss new ideas then please open a discussion thread.
|
|
@ -1,29 +0,0 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
---
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
|
||||
A clear and concise description of what the problem is.
|
||||
|
||||
**Describe the solution you'd like**
|
||||
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
|
||||
A clear and concise description of any alternative solutions or features you've
|
||||
considered.
|
||||
|
||||
**Additional context**
|
||||
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
||||
**Consider contributing**
|
||||
|
||||
Please consider contributing the feature back to `nnn`.
|
||||
|
||||
Feel free to discuss in the ToDo list thread. We are more than happy to help.
|
|
@ -1,4 +1,4 @@
|
|||
name: ci
|
||||
name: GitHubCI
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -27,11 +27,23 @@ jobs:
|
|||
env:
|
||||
CC: clang
|
||||
run: |
|
||||
brew update
|
||||
brew install llvm
|
||||
# see: https://github.com/actions/setup-python/issues/577
|
||||
brew update || true
|
||||
brew install llvm || true
|
||||
brew unlink python@3.11 && brew link python@3.11
|
||||
export PATH="/usr/local/opt/llvm/bin:$PATH"
|
||||
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
|
||||
export CFLAGS="$CFLAGS -Werror"
|
||||
make clean
|
||||
make
|
||||
make clean
|
||||
clang-tidy src/* -- -I/usr/include
|
||||
ubuntu-patches:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Compile patches with gcc
|
||||
env:
|
||||
CC: gcc
|
||||
run: |
|
||||
make checkpatches
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
schedule:
|
||||
- cron: "11 23 * * 3"
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ cpp, python ]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
queries: +security-and-quality
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
if: ${{ matrix.language == 'cpp' || matrix.language == 'python' }}
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
with:
|
||||
category: "/language:${{ matrix.language }}"
|
|
@ -1,3 +1,5 @@
|
|||
*.o
|
||||
*.dSYM
|
||||
nnn
|
||||
src/icons-generated*.h
|
||||
src/icons-hash-gen
|
||||
|
|
129
CHANGELOG
129
CHANGELOG
|
@ -1,3 +1,130 @@
|
|||
nnn v4.9 Elixir
|
||||
2023-08-27
|
||||
|
||||
- config option `NNN_ARCHMNT` to specify archive mounter utility
|
||||
- key <kbd>^y</kbd> to jump to next young file
|
||||
- filter adjustment when opening context from plugin
|
||||
- properly update mode after `chmod`
|
||||
- pre-fill selected file name to create link if sel is preferred over hovered
|
||||
- fix crash when `PWD` is empty
|
||||
- make `quitcd.bash_zsh` POSIX-compliant
|
||||
- `nmount` - support `udiskctl` as default
|
||||
- `preview-tui` - support wezterm split size percentage
|
||||
- `preview-tui` - move to bash for environment manipulation through arrays
|
||||
- `fzopen` - handle empty selection
|
||||
- `finder` - use default path to find
|
||||
- add icons for `djvu` files
|
||||
- support Nerd Fonts v3.0.0 and above (older versions are broken by v3.0.0)
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
nnn v4.8 Spritz
|
||||
2023-04-13
|
||||
|
||||
- show total size (key <kbd>S</kbd>) of non-filtered selection in a directory
|
||||
- fix tilde (~) handling in file name
|
||||
- plugin `.nmv` now respects `-u` flag
|
||||
- env var `$NNN_PREFER_SELECTION` exported to all plugins
|
||||
- support for wezterm in `preview-tui`
|
||||
- create new file or directory (tree) on startup
|
||||
- run command as plugin now supports exported variables
|
||||
- use `"$nnn"` anywhere when running command as plugin
|
||||
- set defaults for some prompts on <kbd>Enter</kbd>
|
||||
- improve archive, rename and create new workflows
|
||||
- optimize link creation
|
||||
- allow overwriting regular files on new empty file creation
|
||||
- add patch for colemak keyboard (existing renamed to colemak-dh)
|
||||
- add correct check for Wayland in clipboard plugins
|
||||
- add quitcd script for nushell
|
||||
- plugin `kdeconnect` - send multiple files
|
||||
- plugin `preview-tui`: add `chafa` as preferred image viewer, multiple fixes
|
||||
- plugin `nmount` - misc. improvements
|
||||
- add icon for jxl files
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
nnn v4.7 Cuba libre
|
||||
2022-11-24
|
||||
|
||||
|
||||
- fix <kbd>^N</kbd> not working sometimes (#1449)
|
||||
- fix file remove confirmation prompt
|
||||
- bring back `atool` as the default archive handler
|
||||
- add option `-B` to use `bsdtar` as the archive utility
|
||||
- find and list mode improvements
|
||||
ntinue even if max paths/data size limit is exceeded
|
||||
eed improvements
|
||||
pport listing maximum 16K paths of 64 MiB of data
|
||||
- key <kbd>J</kbd> to jump to an entry or relative offset from current entry
|
||||
- prefill the hard link creation prompt when there's a single target (#1507)
|
||||
- documented workaround for docker container crash (#1407, #1476)
|
||||
- plugin `imgview`: handle arguments as strings (#1509)
|
||||
- plugin `wallpaper`: support Wayland (#1512)
|
||||
- plugin `upload`: handle selection using `ffsend` (#1523)
|
||||
- add Rust icons (#1502)
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
nnn v4.6 Absinthe
|
||||
2022-07-26
|
||||
|
||||
- icon handling overhaul (#1432, #1436)
|
||||
- better performance, memory usage and reduced binary size
|
||||
- emoji support for supporting distros and terminals (#1346)
|
||||
- open the target directory of symlinked bookmarks (#1353)
|
||||
- enable show hidden when a hidden file is passed as argument
|
||||
- add Colemak-DH layout keybinds to patch framework (#1421)
|
||||
- set `bsdtar` as the default archive utility
|
||||
- support 4 byte unicode keybinds (#1428)
|
||||
- enable directory auto-enter during filter operation (`-A` to disable)
|
||||
- enable filter prompt inside the bookmark/plugin dirs
|
||||
- show volume usage information in help
|
||||
- add new icon colors for mp4 and flac files
|
||||
- use `stat -x` for file details on *BSD and macOS (#1389)
|
||||
- interpret suffix `$nnn` when paging (#1355)
|
||||
- disable key <kbd>e</kbd> (edit file) in explorer mode (#1394)
|
||||
- fix double order chars on filter case match change
|
||||
- `.cbcp`: more verbose message on paste without a selection
|
||||
- plugin `preview-tui`: scale-up kitty previews
|
||||
- plugin `preview-tui`: account for ueberzug offset
|
||||
- plugin `preview-tui`: support `SPLIT_SIZE` for preview pane (#1431)
|
||||
- plugin `autojump`: support z.lua
|
||||
- new Makefile target `shellcheck` to verify plugins
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
nnn v4.5 Cachaça
|
||||
2022-04-26
|
||||
|
||||
- disable filter info if file details (option `-i`) enabled
|
||||
- open previous active context on context quit
|
||||
- switch <kbd>^J</kbd> and <kbd>+</kbd> functionality:
|
||||
- <kbd>+</kbd>: toggle file selection
|
||||
- <kbd>^J</kbd>: toggle auto-jump on file open
|
||||
- allow symlink creation with name `@` to a single file (#1345)
|
||||
- clear selection on successful operation at native prompt with "%j" (#1330)
|
||||
- reverse timestamps of entries modified/created within 5 minutes
|
||||
- avoid using non-portable `xargs` flags on macOS (#1299)
|
||||
- quitcd script for Elvish shell > 0.17.0 (#1344)
|
||||
- plugin `openall` to open selected files together (#1333)
|
||||
- plugin `gitroot` to jump to git root directory from a subtree
|
||||
- plugin `gsconnect` to send the selected files to Android using gsconnect
|
||||
- icon for opus and webp files
|
||||
- `preview-tui` - fix gif conversion and whitespace name
|
||||
- `preview-tui` - add support for windows terminal split
|
||||
- `preview-tui` - djvu file previews
|
||||
- `nuke` - add support for `imv` when named _imv_
|
||||
- `gsconnect` - support connection to multiple devices
|
||||
- export `NNN_INCLUDE_HIDDEN` to plugins (#1308)
|
||||
- respect `NNN_TRASH` in `.nmv` (#1306)
|
||||
- add GNU sed as a dependency with support for env var `SED`
|
||||
- use bold `>` to point at current entry in detail mode
|
||||
- add 2 spaces after icons for better visibility
|
||||
- documentation refresh
|
||||
- make option `O_NOSORT` to load directories unsorted on entry
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
nnn v4.4 Tequila
|
||||
2021-11-23
|
||||
|
||||
|
@ -35,7 +162,7 @@ nnn v4.3 Martini
|
|||
- add `bookmarks` directory for flexible symlinked bookmarks
|
||||
- new key <kbd>B</kbd> to add a symlinked bookmark for current dir
|
||||
- special variables `$dN`, `$fN` available for plugins/prompt/shell to access
|
||||
dir/hovered file in each conext
|
||||
dir/hovered file in each context
|
||||
- config `NNN_ORDER` to set directory-specific ordering
|
||||
- show/hide hidden files as per context state in plugin based batch rename
|
||||
- retain search filter history for plugin `finder`
|
||||
|
|
2
LICENSE
2
LICENSE
|
@ -2,7 +2,7 @@ BSD 2-Clause License
|
|||
|
||||
Copyright (c) 2014-2016, Lazaros Koromilas <lostd@2f30.org>
|
||||
Copyright (c) 2014-2016, Dimitris Papastamos <sin@2f30.org>
|
||||
Copyright (c) 2016-2021, Arun Prakash Jana <engineerarun@gmail.com>
|
||||
Copyright (c) 2016-2023, Arun Prakash Jana <engineerarun@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
98
Makefile
98
Makefile
|
@ -21,18 +21,23 @@ O_NOFIFO := 0 # no FIFO previewer support
|
|||
O_CTX8 := 0 # enable 8 contexts
|
||||
O_ICONS := 0 # support icons-in-terminal
|
||||
O_NERD := 0 # support icons-nerdfont
|
||||
O_EMOJI := 0 # support emoji
|
||||
O_QSORT := 0 # use Alexey Tourbin's QSORT implementation
|
||||
O_BENCH := 0 # benchmark mode (stops at first user input)
|
||||
O_NOSSN := 0 # disable session support
|
||||
O_NOUG := 0 # disable user, group name in status bar
|
||||
O_NOX11 := 0 # disable X11 integration
|
||||
O_MATCHFLTR := 0 # allow filters without matches
|
||||
O_NOSORT := 0 # disable sorting entries on dir load
|
||||
|
||||
# User patches
|
||||
O_COLEMAK := 0 # change key bindings to colemak compatible layout
|
||||
O_GITSTATUS := 0 # add git status to detail view
|
||||
O_NAMEFIRST := 0 # print file name first, add uid and guid to detail view
|
||||
O_RESTOREPREVIEW := 0 # add preview pipe to close and restore preview pane
|
||||
|
||||
T_ICONS := 0 # test if multiple icons options are set and fail
|
||||
|
||||
# convert targets to flags for backwards compatibility
|
||||
ifneq ($(filter debug,$(MAKECMDGOALS)),)
|
||||
O_DEBUG := 1
|
||||
|
@ -47,7 +52,7 @@ endif
|
|||
|
||||
ifeq ($(strip $(O_DEBUG)),1)
|
||||
CPPFLAGS += -DDEBUG
|
||||
CFLAGS += -g
|
||||
CFLAGS += -g3
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(O_NORL)),1)
|
||||
|
@ -68,6 +73,8 @@ ifeq ($(strip $(O_NOLC)),1)
|
|||
$(info *** Ignoring O_NOLC since O_ICONS is set ***)
|
||||
else ifeq ($(strip $(O_NERD)),1)
|
||||
$(info *** Ignoring O_NOLC since O_NERD is set ***)
|
||||
else ifeq ($(strip $(O_EMOJI)),1)
|
||||
$(info *** Ignoring O_NOLC since O_EMOJI is set ***)
|
||||
else
|
||||
CPPFLAGS += -DNOLC
|
||||
endif
|
||||
|
@ -90,11 +97,30 @@ ifeq ($(strip $(O_CTX8)),1)
|
|||
endif
|
||||
|
||||
ifeq ($(strip $(O_ICONS)),1)
|
||||
CPPFLAGS += -DICONS
|
||||
ICONS_INCLUDE = icons-generated-icons-in-term.h
|
||||
CPPFLAGS += -DICONS_IN_TERM -DICONS_INCLUDE=\"$(ICONS_INCLUDE)\"
|
||||
ifeq ($(strip $(T_ICONS)),1)
|
||||
$(error Choose only one system for icons (O_ICONS, O_NERD or O_EMOJI))
|
||||
endif
|
||||
T_ICONS := 1
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(O_NERD)),1)
|
||||
CPPFLAGS += -DNERD
|
||||
ICONS_INCLUDE = icons-generated-nerd.h
|
||||
CPPFLAGS += -DNERD -DICONS_INCLUDE=\"$(ICONS_INCLUDE)\"
|
||||
ifeq ($(strip $(T_ICONS)),1)
|
||||
$(error Choose only one system for icons (O_ICONS, O_NERD or O_EMOJI))
|
||||
endif
|
||||
T_ICONS := 1
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(O_EMOJI)),1)
|
||||
ICONS_INCLUDE = icons-generated-emoji.h
|
||||
CPPFLAGS += -DEMOJI -DICONS_INCLUDE=\"$(ICONS_INCLUDE)\"
|
||||
ifeq ($(strip $(T_ICONS)),1)
|
||||
$(error Choose only one system for icons (O_ICONS, O_NERD or O_EMOJI))
|
||||
endif
|
||||
T_ICONS := 1
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(O_QSORT)),1)
|
||||
|
@ -121,6 +147,10 @@ ifeq ($(strip $(O_MATCHFLTR)),1)
|
|||
CPPFLAGS += -DMATCHFLTR
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(O_NOSORT)),1)
|
||||
CPPFLAGS += -DNOSORT
|
||||
endif
|
||||
|
||||
ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
|
||||
CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw)
|
||||
LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs ncursesw)
|
||||
|
@ -151,6 +181,7 @@ DESKTOPFILE = misc/desktop/nnn.desktop
|
|||
LOGOSVG = misc/logo/logo.svg
|
||||
LOGO64X64 = misc/logo/logo-64x64.png
|
||||
|
||||
COLEMAK = patches/colemak
|
||||
GITSTATUS = patches/gitstatus
|
||||
NAMEFIRST = patches/namefirst
|
||||
RESTOREPREVIEW = patches/restorepreview
|
||||
|
@ -170,9 +201,25 @@ ifneq ($(MACOS_BELOW_1012),)
|
|||
CPPFLAGS += -DMACOS_BELOW_1012
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(O_DEBUG)),1)
|
||||
HEADERS += src/dbg.h
|
||||
endif
|
||||
ifeq ($(strip $(O_QSORT)),1)
|
||||
HEADERS += src/qsort.h
|
||||
endif
|
||||
ifeq ($(strip $(O_EMOJI)),1)
|
||||
HEADERS += src/icons.h src/$(ICONS_INCLUDE)
|
||||
endif
|
||||
ifeq ($(strip $(O_NERD)),1)
|
||||
HEADERS += src/icons.h src/$(ICONS_INCLUDE)
|
||||
endif
|
||||
ifeq ($(strip $(O_ICONS)),1)
|
||||
HEADERS += src/icons.h src/$(ICONS_INCLUDE) src/icons-in-terminal.h
|
||||
endif
|
||||
|
||||
all: $(BIN)
|
||||
|
||||
$(BIN): $(SRC) $(HEADERS)
|
||||
$(BIN): $(SRC) $(HEADERS) Makefile
|
||||
@$(MAKE) --silent prepatch
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(GETTIME_C) $< $(LDLIBS)
|
||||
@$(MAKE) --silent postpatch
|
||||
|
@ -182,6 +229,10 @@ debug: $(BIN)
|
|||
norl: $(BIN)
|
||||
nolc: $(BIN)
|
||||
|
||||
src/$(ICONS_INCLUDE): src/icons-hash.c src/icons.h src/icons-in-terminal.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DICONS_GENERATE -o src/icons-hash-gen src/icons-hash.c
|
||||
./src/icons-hash-gen > $@
|
||||
|
||||
install-desktop: $(DESKTOPFILE)
|
||||
$(INSTALL) -m 0755 -d $(DESTDIR)$(DESKTOPPREFIX)
|
||||
$(INSTALL) -m 0644 $(DESKTOPFILE) $(DESTDIR)$(DESKTOPPREFIX)
|
||||
|
@ -222,12 +273,18 @@ static:
|
|||
# static binary with patched nerd font support
|
||||
make O_STATIC=1 O_NERD=1 strip
|
||||
mv $(BIN) $(BIN)-nerd-static
|
||||
# static binary with emoji support
|
||||
make O_STATIC=1 O_EMOJI=1 strip
|
||||
mv $(BIN) $(BIN)-emoji-static
|
||||
|
||||
musl:
|
||||
cp misc/musl/musl-static-ubuntu.sh .
|
||||
./musl-static-ubuntu.sh 1
|
||||
rm ./musl-static-ubuntu.sh
|
||||
|
||||
shellcheck:
|
||||
find ./plugins/ -type f -not -name "*.md" -exec shellcheck {} +
|
||||
|
||||
dist:
|
||||
mkdir -p nnn-$(VERSION)
|
||||
$(CP) -r $(DISTFILES) nnn-$(VERSION)
|
||||
|
@ -249,6 +306,7 @@ upload-local: sign static musl
|
|||
upx -qqq $(BIN)-static
|
||||
upx -qqq $(BIN)-icons-static
|
||||
upx -qqq $(BIN)-nerd-static
|
||||
upx -qqq $(BIN)-emoji-static
|
||||
# upload static binary
|
||||
tar -zcf $(BIN)-static-$(VERSION).x86_64.tar.gz $(BIN)-static
|
||||
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=$(BIN)-static-$(VERSION).x86_64.tar.gz' \
|
||||
|
@ -264,6 +322,11 @@ upload-local: sign static musl
|
|||
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=$(BIN)-nerd-static-$(VERSION).x86_64.tar.gz' \
|
||||
-H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/x-sharedlib' \
|
||||
--upload-file $(BIN)-nerd-static-$(VERSION).x86_64.tar.gz
|
||||
# upload emoji compiled static binary
|
||||
tar -zcf $(BIN)-emoji-static-$(VERSION).x86_64.tar.gz $(BIN)-emoji-static
|
||||
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=$(BIN)-emoji-static-$(VERSION).x86_64.tar.gz' \
|
||||
-H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/x-sharedlib' \
|
||||
--upload-file $(BIN)-emoji-static-$(VERSION).x86_64.tar.gz
|
||||
# upload musl static binary
|
||||
tar -zcf $(BIN)-musl-static-$(VERSION).x86_64.tar.gz $(BIN)-musl-static
|
||||
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=$(BIN)-musl-static-$(VERSION).x86_64.tar.gz' \
|
||||
|
@ -271,32 +334,41 @@ upload-local: sign static musl
|
|||
--upload-file $(BIN)-musl-static-$(VERSION).x86_64.tar.gz
|
||||
|
||||
clean:
|
||||
$(RM) -f $(BIN) nnn-$(VERSION).tar.gz *.sig $(BIN)-static $(BIN)-static-$(VERSION).x86_64.tar.gz $(BIN)-icons-static $(BIN)-icons-static-$(VERSION).x86_64.tar.gz $(BIN)-nerd-static $(BIN)-nerd-static-$(VERSION).x86_64.tar.gz $(BIN)-musl-static $(BIN)-musl-static-$(VERSION).x86_64.tar.gz
|
||||
$(RM) -f $(BIN) nnn-$(VERSION).tar.gz *.sig $(BIN)-static $(BIN)-static-$(VERSION).x86_64.tar.gz $(BIN)-icons-static $(BIN)-icons-static-$(VERSION).x86_64.tar.gz $(BIN)-nerd-static $(BIN)-nerd-static-$(VERSION).x86_64.tar.gz $(BIN)-emoji-static $(BIN)-emoji-static-$(VERSION).x86_64.tar.gz $(BIN)-musl-static $(BIN)-musl-static-$(VERSION).x86_64.tar.gz src/icons-hash-gen src/icons-generated-*.h
|
||||
|
||||
checkpatches:
|
||||
./patches/check-patches.sh
|
||||
|
||||
prepatch:
|
||||
ifeq ($(strip $(O_NAMEFIRST)),1)
|
||||
patch --forward --strip=1 --input=$(NAMEFIRST)/mainline.diff
|
||||
patch --forward $(PATCH_OPTS) --strip=1 --input=$(NAMEFIRST)/mainline.diff
|
||||
ifeq ($(strip $(O_GITSTATUS)),1)
|
||||
patch --forward --strip=1 --input=$(GITSTATUS)/namefirst.diff
|
||||
patch --forward $(PATCH_OPTS) --strip=1 --input=$(GITSTATUS)/namefirst.diff
|
||||
endif
|
||||
else ifeq ($(strip $(O_GITSTATUS)),1)
|
||||
patch --forward --strip=1 --input=$(GITSTATUS)/mainline.diff
|
||||
patch --forward $(PATCH_OPTS) --strip=1 --input=$(GITSTATUS)/mainline.diff
|
||||
endif
|
||||
ifeq ($(strip $(O_RESTOREPREVIEW)),1)
|
||||
patch --forward --strip=1 --input=$(RESTOREPREVIEW)/mainline.diff
|
||||
patch --forward $(PATCH_OPTS) --strip=1 --input=$(RESTOREPREVIEW)/mainline.diff
|
||||
endif
|
||||
ifeq ($(strip $(O_COLEMAK)),1)
|
||||
patch --forward $(PATCH_OPTS) --strip=1 --input=$(COLEMAK)/mainline.diff
|
||||
endif
|
||||
|
||||
postpatch:
|
||||
ifeq ($(strip $(O_NAMEFIRST)),1)
|
||||
ifeq ($(strip $(O_GITSTATUS)),1)
|
||||
patch --reverse --strip=1 --input=$(GITSTATUS)/namefirst.diff
|
||||
patch --reverse $(PATCH_OPTS) --strip=1 --input=$(GITSTATUS)/namefirst.diff
|
||||
endif
|
||||
patch --reverse --strip=1 --input=$(NAMEFIRST)/mainline.diff
|
||||
patch --reverse $(PATCH_OPTS) --strip=1 --input=$(NAMEFIRST)/mainline.diff
|
||||
else ifeq ($(strip $(O_GITSTATUS)),1)
|
||||
patch --reverse --strip=1 --input=$(GITSTATUS)/mainline.diff
|
||||
patch --reverse $(PATCH_OPTS) --strip=1 --input=$(GITSTATUS)/mainline.diff
|
||||
endif
|
||||
ifeq ($(strip $(O_RESTOREPREVIEW)),1)
|
||||
patch --reverse --strip=1 --input=$(RESTOREPREVIEW)/mainline.diff
|
||||
patch --reverse $(PATCH_OPTS) --strip=1 --input=$(RESTOREPREVIEW)/mainline.diff
|
||||
endif
|
||||
ifeq ($(strip $(O_COLEMAK)),1)
|
||||
patch --reverse $(PATCH_OPTS) --strip=1 --input=$(COLEMAK)/mainline.diff
|
||||
endif
|
||||
|
||||
skip: ;
|
||||
|
|
19
README.md
19
README.md
|
@ -58,13 +58,14 @@ Runs on the Pi, [Termux](https://www.youtube.com/embed/AbaauM7gUJw) (Android), L
|
|||
- Disk usage analyzer (block/apparent)
|
||||
- File picker, (neo)vim plugin
|
||||
- Navigation
|
||||
- *Type-to-nav* mode with dir auto-select
|
||||
- Filter with automatic dir entry on unique match
|
||||
- *Type-to-nav* (turbo navigation/always filter) mode
|
||||
- Contexts (_aka_ tabs/workspaces) with custom colors
|
||||
- Sessions, bookmarks with hotkeys; mark and visit a dir
|
||||
- Sessions, bookmarks, mark and visit a dir
|
||||
- Remote mounts (needs `sshfs`, `rclone`)
|
||||
- Familiar shortcuts (arrows, <kbd>~</kbd>, <kbd>-</kbd>, <kbd>@</kbd>), quick look-up
|
||||
- `cd` on quit (*easy* shell integration)
|
||||
- Auto-advance on opening files
|
||||
- Proceed to next file on file open and selection
|
||||
- Search
|
||||
- Instant filtering with *search-as-you-type*
|
||||
- Regex (POSIX/PCRE) and string (default) filters
|
||||
|
@ -79,7 +80,7 @@ Runs on the Pi, [Termux](https://www.youtube.com/embed/AbaauM7gUJw) (Android), L
|
|||
- Preview hovered files in FIFO-based previewer
|
||||
- Open with desktop opener or specify a custom opener
|
||||
- File-specific colors (or minimal _dirs in context color_)
|
||||
- Icons (customize and compile-in)
|
||||
- Icons and Emojis support (customize and compile-in)
|
||||
- Plugin for image, video and audio thumbnails
|
||||
- Create, list, extract (to), mount (FUSE based) archives
|
||||
- Option to open all text files in `$EDITOR`
|
||||
|
@ -89,6 +90,7 @@ Runs on the Pi, [Termux](https://www.youtube.com/embed/AbaauM7gUJw) (Android), L
|
|||
- FreeDesktop compliant trash utility integration
|
||||
- Cross-dir file/all/range selection
|
||||
- Create (with parents), rename, duplicate files and dirs
|
||||
- Create new file or directory (tree) on startup
|
||||
- Batch renamer for selection or dir
|
||||
- List input stream of file paths from stdin or plugin
|
||||
- Copy (as), move (as), delete, archive, link selection
|
||||
|
@ -102,7 +104,7 @@ Runs on the Pi, [Termux](https://www.youtube.com/embed/AbaauM7gUJw) (Android), L
|
|||
|
||||
## Quickstart
|
||||
|
||||
1. [Install](https://github.com/jarun/nnn/wiki/Usage) `nnn` and the deps you need.
|
||||
1. [Install](https://github.com/jarun/nnn/wiki/Usage) `nnn` and the dependencies you need.
|
||||
2. The desktop opener is default. Use `-e` to open text files in the terminal. Optionally [open detached](https://github.com/jarun/nnn/wiki/Basic-use-cases#detached-text).
|
||||
3. Configure [`cd` on quit](https://github.com/jarun/nnn/wiki/Basic-use-cases#configure-cd-on-quit).
|
||||
4. [Sync subshell `$PWD`](https://github.com/jarun/nnn/wiki/Basic-use-cases#sync-subshell-pwd) to `nnn`.
|
||||
|
@ -140,6 +142,7 @@ Don't memorize! Arrows, <kbd>/</kbd>, <kbd>q</kbd> suffice. <kbd>Tab</kbd> creat
|
|||
- LinuxLinks [[1](https://www.linuxlinks.com/nnn-fast-and-flexible-file-manager/)] [[2](https://www.linuxlinks.com/bestconsolefilemanagers/)] [[3](https://www.linuxlinks.com/excellent-system-tools-nnn-portable-terminal-file-manager/)]
|
||||
- [Linux Magazine; FOSSPicks](https://www.linux-magazine.com/Issues/2017/205/FOSSPicks/(offset)/15)
|
||||
- [Make Tech Easier](https://www.maketecheasier.com/nnn-file-manager-terminal/)
|
||||
- [Opensource.com](https://opensource.com/article/22/12/linux-file-manager-nnn)
|
||||
- [Open Source For You](https://www.opensourceforu.com/2019/12/nnn-this-feature-rich-terminal-file-manager-will-enhance-your-productivity/)
|
||||
- [PCLinuxOS Magazine Issue June 2021](https://pclosmag.com/html/Issues/202106/page08.html)
|
||||
- [Suckless Rocks](https://suckless.org/rocks/)
|
||||
|
@ -149,14 +152,14 @@ Don't memorize! Arrows, <kbd>/</kbd>, <kbd>q</kbd> suffice. <kbd>Tab</kbd> creat
|
|||
|
||||
## Developers
|
||||
|
||||
- [Arun Prakash Jana](https://github.com/jarun) (Copyright © 2016-2021)
|
||||
- [Arun Prakash Jana](https://github.com/jarun) (Copyright © 2016-2023)
|
||||
- [0xACE](https://github.com/0xACE)
|
||||
- [Anna Arad](https://github.com/annagrram)
|
||||
- [KlzXS](https://github.com/KlzXS)
|
||||
- [Léo Villeveygoux](https://github.com/leovilok)
|
||||
- [Luuk van Baal](https://github.com/luukvbaal)
|
||||
- [N-R-K](https://github.com/N-R-K)
|
||||
- [NRK](https://codeberg.org/NRK)
|
||||
- [Sijmen J. Mulder](https://github.com/sjmulder)
|
||||
- and other contributors
|
||||
|
||||
Visit the [ToDo list](https://github.com/jarun/nnn/issues/1219) to contribute or see the features in progress.
|
||||
Visit the [Tracker](https://github.com/jarun/nnn/issues/1546) thread for a list of features in progress and anything up for grabs. Feel free to [discuss](https://github.com/jarun/nnn/discussions) new ideas or enhancement requests.
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
# Contributing
|
||||
Contributions to nnn are welcome! There's always an open issue with the current ToDo list, which contains the proposed features for the next release you can get your hands on. Any small changes or ideas should go in there, rather than in a separate issue.
|
||||
|
||||
Before suggesting changes, please read a bit about [the design principles nnn follows](https://github.com/jarun/nnn/wiki#design), and make sure you aren't breaking any of them.
|
||||
Before suggesting changes, please read a bit about [the design principles nnn follows](https://github.com/jarun/nnn/wiki/concepts#design), and make sure you aren't breaking any of them.
|
||||
|
||||
Feel free to join the [Discussions](https://github.com/jarun/nnn/discussions). We highly recommended a discussion before raising a PR.
|
||||
|
||||
## Coding standard
|
||||
|
||||
`nnn` follows the Linux kernel coding style closely. The C source code uses TABs and the plugins use 4 spaces for indentation.
|
||||
|
||||
CI runs `shellcheck` on plugins. Please watch out for any failures if you are modifying/adding a plugin.
|
||||
- Code changes should not break the patch framework. Please run `make checkpatches` to ensure.
|
||||
- Run `make shellcheck` if adding/modifying plugins.
|
||||
|
||||
CI runs patch framework sanity test and `shellcheck`. Please watch out for any failures after raising the PR.
|
||||
|
||||
## Resources
|
||||
The [wiki](https://github.com/jarun/nnn/wiki/Developer-guides) has some resources for developers you might be interested in: building, debugging...
|
||||
|
|
|
@ -15,6 +15,7 @@ _nnn ()
|
|||
-a
|
||||
-A
|
||||
-b
|
||||
-B
|
||||
-c
|
||||
-C
|
||||
-d
|
||||
|
|
|
@ -12,8 +12,9 @@ else
|
|||
end
|
||||
|
||||
complete -c nnn -s a -d 'auto-create NNN_FIFO'
|
||||
complete -c nnn -s A -d 'disable dir auto-select'
|
||||
complete -c nnn -s A -d 'disable dir auto-enter'
|
||||
complete -c nnn -s b -r -d 'bookmark key to open' -x -a '(echo $NNN_BMS | awk -F: -v RS=\; \'{print $1"\t"$2}\')'
|
||||
complete -c nnn -s B -d 'use bsdtar for archives'
|
||||
complete -c nnn -s c -d 'cli-only opener'
|
||||
complete -c nnn -s C -d 'color by context'
|
||||
complete -c nnn -s d -d 'start in detail mode'
|
||||
|
@ -24,8 +25,8 @@ complete -c nnn -s f -d 'use readline history file'
|
|||
complete -c nnn -s g -d 'regex filters'
|
||||
complete -c nnn -s H -d 'show hidden files'
|
||||
complete -c nnn -s i -d 'show current file info'
|
||||
complete -c nnn -s J -d 'no auto-proceed on select'
|
||||
complete -c nnn -s K -d 'detect key collision'
|
||||
complete -c nnn -s J -d 'no auto-advance on selection'
|
||||
complete -c nnn -s K -d 'detect key collision and exit'
|
||||
complete -c nnn -s l -r -d 'lines to move per scroll'
|
||||
complete -c nnn -s n -d 'start in type-to-nav mode'
|
||||
complete -c nnn -s o -d 'open files only on Enter'
|
||||
|
|
|
@ -10,8 +10,9 @@ setopt localoptions noshwordsplit noksharrays
|
|||
local -a args
|
||||
args=(
|
||||
'(-a)-a[auto-create NNN_FIFO]'
|
||||
'(-A)-A[disable dir auto-select]'
|
||||
'(-A)-A[disable dir auto-enter]'
|
||||
'(-b)-b[bookmark key to open]:key char'
|
||||
'(-B)-B[use bsdtar for archives]'
|
||||
'(-c)-c[cli-only opener]'
|
||||
'(-C)-C[color by context]'
|
||||
'(-d)-d[start in detail mode]'
|
||||
|
@ -22,13 +23,13 @@ args=(
|
|||
'(-g)-g[regex filters]'
|
||||
'(-H)-H[show hidden files]'
|
||||
'(-i)-i[show current file info]'
|
||||
'(-J)-J[no auto-proceed on select]'
|
||||
'(-K)-K[detect key collision]'
|
||||
'(-J)-J[no auto-advance on selection]'
|
||||
'(-K)-K[detect key collision and exit]'
|
||||
'(-l)-l[lines to move per scroll]:val'
|
||||
'(-n)-n[start in type-to-nav mode]'
|
||||
'(-o)-o[open files only on Enter]'
|
||||
'(-p)-p[copy selection to file]:file name'
|
||||
'(-P)-P[plugin key to runn]:key char'
|
||||
'(-P)-P[plugin key to run]:key char'
|
||||
'(-Q)-Q[disable quit confirmation]'
|
||||
'(-r)-r[show cp, mv progress (Linux-only)]'
|
||||
'(-R)-R[disable rollover at edges]'
|
||||
|
|
|
@ -12,7 +12,7 @@ Cygwin, WSL, Haiku and works seamlessly with DEs and GUI utilities.
|
|||
|
||||
Visit the Wiki for concepts, program usage, how-tos and troubleshooting."
|
||||
HOMEPAGE="https://github.com/jarun/nnn"
|
||||
COPYRIGHT="2016-2021 Arun Prakash Jana"
|
||||
COPYRIGHT="2016-2023 Arun Prakash Jana"
|
||||
LICENSE="BSD (2-clause)"
|
||||
REVISION="1"
|
||||
SOURCE_URI="git://github.com/jarun/nnn.git"
|
||||
|
|
|
@ -9,10 +9,10 @@ resource app_signature "application/x-vnd.Jarun-nnn";
|
|||
|
||||
resource app_version {
|
||||
major = 4,
|
||||
middle = 4,
|
||||
middle = 9,
|
||||
minor = 0,
|
||||
|
||||
variety = B_APPV_FINAL,
|
||||
variety = B_APPV_DEVELOPMENT,
|
||||
internal = 0,
|
||||
|
||||
short_info = "nnn",
|
||||
|
|
|
@ -24,7 +24,7 @@ int clock_gettime(clockid_t clk_id, struct timespec *tp)
|
|||
double diff = (mach_absolute_time() - mt_timestart) * mt_timebase;
|
||||
tp->tv_sec = diff * MT_NANO;
|
||||
tp->tv_nsec = diff - (tp->tv_sec * MT_GIGA);
|
||||
} else { // other clk_ids are mapped to the coresponding mach clock_service
|
||||
} else { // other clk_ids are mapped to the corresponding mach clock_service
|
||||
clock_serv_t cclock;
|
||||
mach_timespec_t mts;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
typedef int clockid_t;
|
||||
|
||||
/* the mach kernel uses struct mach_timespec, so struct timespec
|
||||
is loaded from <sys/_types/_timespec.h> for compatability */
|
||||
is loaded from <sys/_types/_timespec.h> for compatibility */
|
||||
// struct timespec { time_t tv_sec; long tv_nsec; };
|
||||
|
||||
int clock_gettime(clockid_t clk_id, struct timespec *tp);
|
||||
|
|
|
@ -40,7 +40,7 @@ git checkout v0.3.2
|
|||
if [ ! -d "./libs" ]; then
|
||||
mkdir libs
|
||||
else
|
||||
rm -vf libs/*
|
||||
rm -vf -- libs/*
|
||||
fi
|
||||
make CC=musl-gcc CFLAGS=-O3 LDFLAGS=-static all-static -j$(($(nproc)+1))
|
||||
cp -v libcurses/libcurses.a libterminfo/libterminfo.a libs/
|
||||
|
@ -57,7 +57,7 @@ make CC=musl-gcc CFLAGS=-O3 LDFLAGS=-static -j$(($(nproc)+1))
|
|||
|
||||
# Compile nnn
|
||||
cd ..
|
||||
[ -e "./netbsd-curses" ] || rm "$BIN"
|
||||
[ -e "./netbsd-curses" ] || rm -- "$BIN"
|
||||
musl-gcc -O3 -DNORL -DNOMOUSE -std=c11 -Wall -Wextra -Wshadow -I./netbsd-curses/libcurses -I./musl-fts -o "$BIN" src/nnn.c -Wl,-Bsymbolic-functions -lpthread -L./netbsd-curses/libs -lcurses -lterminfo -static -L./musl-fts/.libs -lfts
|
||||
strip "$BIN"
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
n ()
|
||||
{
|
||||
# Block nesting of nnn in subshells
|
||||
[ "${NNNLVL:-0}" -eq 0 ] || {
|
||||
echo "nnn is already running"
|
||||
return
|
||||
}
|
||||
|
||||
# The behaviour is set to cd on quit (nnn checks if NNN_TMPFILE is set)
|
||||
# If NNN_TMPFILE is set to a custom path, it must be exported for nnn to
|
||||
# see. To cd on quit only on ^G, remove the "export" and make sure not to
|
||||
# use a custom path, i.e. set NNN_TMPFILE *exactly* as follows:
|
||||
# NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
|
||||
export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
|
||||
|
||||
# Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn
|
||||
# stty start undef
|
||||
# stty stop undef
|
||||
# stty lwrap undef
|
||||
# stty lnext undef
|
||||
|
||||
# The command builtin allows one to alias nnn to n, if desired, without
|
||||
# making an infinitely recursive alias
|
||||
command nnn "$@"
|
||||
|
||||
[ ! -f "$NNN_TMPFILE" ] || {
|
||||
. "$NNN_TMPFILE"
|
||||
rm -f -- "$NNN_TMPFILE" > /dev/null
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
n ()
|
||||
{
|
||||
# Block nesting of nnn in subshells
|
||||
if [ -n $NNNLVL ] && [ "${NNNLVL:-0}" -ge 1 ]; then
|
||||
echo "nnn is already running"
|
||||
return
|
||||
fi
|
||||
|
||||
# The behaviour is set to cd on quit (nnn checks if NNN_TMPFILE is set)
|
||||
# To cd on quit only on ^G, either remove the "export" as in:
|
||||
# NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
|
||||
# (or, to a custom path: NNN_TMPFILE=/tmp/.lastd)
|
||||
# or, export NNN_TMPFILE after nnn invocation
|
||||
export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
|
||||
|
||||
# Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn
|
||||
# stty start undef
|
||||
# stty stop undef
|
||||
# stty lwrap undef
|
||||
# stty lnext undef
|
||||
|
||||
nnn "$@"
|
||||
|
||||
if [ -f "$NNN_TMPFILE" ]; then
|
||||
. "$NNN_TMPFILE"
|
||||
rm -f "$NNN_TMPFILE" > /dev/null
|
||||
fi
|
||||
}
|
|
@ -1,8 +1,9 @@
|
|||
# NOTE: set NNN_TMPFILE correctly if you use 'XDG_CONFIG_HOME'
|
||||
|
||||
# The behaviour is set to cd on quit (nnn checks if NNN_TMPFILE is set)
|
||||
# To cd on quit only on ^G, set NNN_TMPFILE after nnn invocation
|
||||
# A custom path can also be set e.g. set NNN_TMPFILE=/tmp/.lastd
|
||||
# If NNN_TMPFILE is set to a custom path, it must be exported for nnn to see.
|
||||
# To cd on quit only on ^G, set NNN_TMPFILE after the nnn invocation, and make
|
||||
# sure not to use a custom path.
|
||||
set NNN_TMPFILE=~/.config/nnn/.lastd
|
||||
|
||||
# Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn
|
||||
|
@ -11,4 +12,6 @@ set NNN_TMPFILE=~/.config/nnn/.lastd
|
|||
# stty lwrap undef
|
||||
# stty lnext undef
|
||||
|
||||
alias n 'nnn; source "$NNN_TMPFILE"; rm -f "$NNN_TMPFILE"'
|
||||
# The backslash allows one to alias n to nnn if desired without making an
|
||||
# infinitely recursive alias
|
||||
alias n '\nnn; source "$NNN_TMPFILE"; rm -f -- "$NNN_TMPFILE"'
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
# Append this file to ~/.elvish/rc.elv (Elvish > 0.17.0)
|
||||
|
||||
use path
|
||||
|
||||
fn n {|@a|
|
||||
# Block nesting of nnn in subshells
|
||||
if (has-env NNNLVL) {
|
||||
try {
|
||||
if (>= $E:NNNLVL 1) {
|
||||
echo "nnn is already running"
|
||||
return
|
||||
}
|
||||
} catch e {
|
||||
nop
|
||||
}
|
||||
}
|
||||
|
||||
# The behaviour is set to cd on quit (nnn checks if NNN_TMPFILE is set)
|
||||
# If NNN_TMPFILE is set to a custom path, it must be exported for nnn to
|
||||
# see.
|
||||
if (has-env XDG_CONFIG_HOME) {
|
||||
set-env NNN_TMPFILE $E:XDG_CONFIG_HOME/nnn/.lastd
|
||||
} else {
|
||||
set-env NNN_TMPFILE $E:HOME/.config/nnn/.lastd
|
||||
}
|
||||
|
||||
# Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn
|
||||
# stty start undef
|
||||
# stty stop undef
|
||||
# stty lwrap undef
|
||||
# stty lnext undef
|
||||
|
||||
# The e: prefix allows one to alias n to nnn if desired without making an
|
||||
# infinitely recursive alias
|
||||
e:nnn $@a
|
||||
|
||||
if (path:is-regular $E:NNN_TMPFILE) {
|
||||
eval (slurp < $E:NNN_TMPFILE)
|
||||
rm -- $E:NNN_TMPFILE
|
||||
}
|
||||
}
|
|
@ -4,18 +4,15 @@
|
|||
|
||||
function n --wraps nnn --description 'support nnn quit and change directory'
|
||||
# Block nesting of nnn in subshells
|
||||
if test -n "$NNNLVL"
|
||||
if [ (expr $NNNLVL + 0) -ge 1 ]
|
||||
echo "nnn is already running"
|
||||
return
|
||||
end
|
||||
if test -n "$NNNLVL" -a "$NNNLVL" -ge 1
|
||||
echo "nnn is already running"
|
||||
return
|
||||
end
|
||||
|
||||
# The behaviour is set to cd on quit (nnn checks if NNN_TMPFILE is set)
|
||||
# To cd on quit only on ^G, remove the "-x" as in:
|
||||
# set NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd"
|
||||
# (or, to a custom path: set NNN_TMPFILE "/tmp/.lastd")
|
||||
# or, export NNN_TMPFILE after nnn invocation
|
||||
# If NNN_TMPFILE is set to a custom path, it must be exported for nnn to
|
||||
# see. To cd on quit only on ^G, remove the "-x" from both lines below,
|
||||
# without changing the paths.
|
||||
if test -n "$XDG_CONFIG_HOME"
|
||||
set -x NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd"
|
||||
else
|
||||
|
@ -28,10 +25,12 @@ function n --wraps nnn --description 'support nnn quit and change directory'
|
|||
# stty lwrap undef
|
||||
# stty lnext undef
|
||||
|
||||
nnn $argv
|
||||
# The command function allows one to alias this function to `nnn` without
|
||||
# making an infinitely recursive alias
|
||||
command nnn $argv
|
||||
|
||||
if test -e $NNN_TMPFILE
|
||||
source $NNN_TMPFILE
|
||||
rm $NNN_TMPFILE
|
||||
rm -- $NNN_TMPFILE
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
# Run nnn with dynamic changing directory to the environment.
|
||||
#
|
||||
# $env.XDG_CONFIG_HOME sets the home folder for `nnn` folder and its $env.NNN_TMPFILE variable.
|
||||
# See manual NNN(1) for more information.
|
||||
#
|
||||
# Import module using `use quitcd.nu n` to have `n` command in your context.
|
||||
export def --env n [
|
||||
...args : string # Extra flags to launch nnn with.
|
||||
--selective = false # Change directory only when exiting via ^G.
|
||||
] -> nothing {
|
||||
|
||||
# The behaviour is set to cd on quit (nnn checks if $env.NNN_TMPFILE is set).
|
||||
# Hard-coded to its respective behaviour in `nnn` source-code.
|
||||
let nnn_tmpfile = $env
|
||||
| default '~/.config/' 'XDG_CONFIG_HOME'
|
||||
| get 'XDG_CONFIG_HOME'
|
||||
| path join 'nnn/.lastd'
|
||||
| path expand
|
||||
|
||||
# Launch nnn. Add desired flags after `^nnn`, ex: `^nnn -eda ...$args`,
|
||||
# or make an alias `alias n = n -eda`.
|
||||
if $selective {
|
||||
^nnn ...$args
|
||||
} else {
|
||||
NNN_TMPFILE=$nnn_tmpfile ^nnn ...$args
|
||||
}
|
||||
|
||||
if ($nnn_tmpfile | path exists) {
|
||||
# Remove <cd '> from the first part of the string and the last single quote <'>.
|
||||
# Fix post-processing of nnn's given path that escapes its single quotes with POSIX syntax.
|
||||
let path = open $nnn_tmpfile | str substring 4..-1 | str replace --all `'\''` `'`
|
||||
|
||||
^rm -- $nnn_tmpfile
|
||||
|
||||
cd $path
|
||||
}
|
||||
}
|
166
nnn.1
166
nnn.1
|
@ -1,4 +1,4 @@
|
|||
.Dd Nov 23, 2021
|
||||
.Dd Aug 27, 2023
|
||||
.Dt NNN 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -23,15 +23,29 @@ is a performance-optimized, feature-packed fork of noice
|
|||
.Em http://git.2f30.org/noice/
|
||||
with seamless desktop integration, simplified navigation,
|
||||
.Em type-to-nav
|
||||
mode with auto select, disk usage analyzer mode, bookmarks,
|
||||
mode with dir auto-enter, disk usage analyzer mode, bookmarks,
|
||||
contexts, application launcher, familiar navigation shortcuts,
|
||||
subshell spawning and much more. It remains a simple and
|
||||
efficient file manager that stays out of your way.
|
||||
.Pp
|
||||
.Nm
|
||||
opens the current working directory by default if
|
||||
opens the current working directory if
|
||||
.Ar PATH
|
||||
is not specified.
|
||||
is not specified. If
|
||||
.Ar PATH
|
||||
is specified and it exists,
|
||||
.Nm
|
||||
will open it. If the
|
||||
.Ar PATH
|
||||
doesn't exist and ends with a \fB/\fR,
|
||||
.Nm
|
||||
will attempt to create the directory tree and open it. Otherwise,
|
||||
.Ar PATH
|
||||
is considered a path to a regular file and
|
||||
.Nm
|
||||
attempts to create the complete directory tree to the file, open
|
||||
the parent directory and prompt to create the new file in it with
|
||||
the base filename.
|
||||
.Sh KEYBINDS
|
||||
.Pp
|
||||
Press
|
||||
|
@ -45,14 +59,17 @@ to see the list of keybinds.
|
|||
supports the following options:
|
||||
.Pp
|
||||
.Fl a
|
||||
auto-setup temporary NNN_FIFO (described in ENVIRONMENT section)
|
||||
auto-setup temporary \fBNNN_FIFO\fR (described in \fIENVIRONMENT\fR section)
|
||||
.Pp
|
||||
.Fl A
|
||||
disable directory auto-select in type-to-nav mode
|
||||
disable directory auto-enter on unique filter match
|
||||
.Pp
|
||||
.Fl "b key"
|
||||
specify bookmark key to open
|
||||
.Pp
|
||||
.Fl B
|
||||
use bsdtar for archives (default: atool)
|
||||
.Pp
|
||||
.Fl c
|
||||
indicates that the opener is a cli-only opener (overrides -e)
|
||||
.Pp
|
||||
|
@ -88,10 +105,11 @@ supports the following options:
|
|||
show current file information in info bar (may be slow)
|
||||
.Pp
|
||||
.Fl J
|
||||
disable auto-proceed on select
|
||||
disable auto-advance on selection
|
||||
(eg. selecting an entry will no longer move cursor to the next entry)
|
||||
.Pp
|
||||
.Fl K
|
||||
test for keybind collision
|
||||
test for keybind collision and exit
|
||||
.Pp
|
||||
.Fl "l val"
|
||||
number of lines to move per mouse wheel scroll
|
||||
|
@ -113,10 +131,11 @@ supports the following options:
|
|||
.Pp
|
||||
.Fl r
|
||||
show cp, mv progress
|
||||
(Linux-only, needs advcpmv; '^T' shows the progress on BSD/macOS)
|
||||
(Linux-only, needs \fIadvcpmv\fR; '^T' shows the progress on BSD/macOS)
|
||||
.Pp
|
||||
.Fl R
|
||||
disable rollover at edges
|
||||
disable rollover at edges (eg. pressing \fIdown\fR while on the last
|
||||
entry will no longer move cursor to the first entry and vice\-versa)
|
||||
.Pp
|
||||
.Fl "s name"
|
||||
load a session by name
|
||||
|
@ -129,7 +148,7 @@ supports the following options:
|
|||
.Pp
|
||||
.Fl "T key"
|
||||
sort order
|
||||
keys: 'a'u / 'd'u / 'e'xtension / 'r'everse / 's'ize / 't'ime / 'v'ersion
|
||||
keys: 'a'pparent disk usage / 'd'isk usage / 'e'xtension / 'r'everse / 's'ize / 't'ime / 'v'ersion
|
||||
capitalize to reverse (except 'r')
|
||||
.Pp
|
||||
.Fl u
|
||||
|
@ -142,8 +161,8 @@ supports the following options:
|
|||
show version and exit
|
||||
.Pp
|
||||
.Fl x
|
||||
show notis on selection cp, mv, rm completion
|
||||
copy path to system clipboard on select
|
||||
show notifications on selection cp, mv, rm completion (requires \fI.ntfy\fR plugin)
|
||||
copy path to system clipboard on selection (requires \fI.cbcp\fR plugin)
|
||||
show xterm title (if non-picker mode)
|
||||
.Pp
|
||||
.Fl h
|
||||
|
@ -199,6 +218,10 @@ Filters are strings (or regex patterns) to find matching entries in the current
|
|||
directory instantly (\fIsearch-as-you-type\fR). Matches are case-insensitive by
|
||||
default. The last filter in each context is persisted at runtime or in saved
|
||||
sessions.
|
||||
.br
|
||||
When there's a unique match and it's a directory,
|
||||
.Nm
|
||||
auto enters the directory. Use the relevant program option to disable this.
|
||||
.Pp
|
||||
Special keys at filter prompt:
|
||||
.Bd -literal
|
||||
|
@ -207,7 +230,7 @@ Special keys at filter prompt:
|
|||
-------- + ---------------------------------------
|
||||
^char | Usual keybind functionality
|
||||
Esc | Exit filter prompt but skip dir refresh
|
||||
Alt+Esc | Exit filter prompt and refresh dir
|
||||
Alt+Esc | Unfilter, quit context
|
||||
-------- + ---------------------------------------
|
||||
.Ed
|
||||
.Pp
|
||||
|
@ -226,6 +249,20 @@ Special keys at \fBempty filter prompt\fR:
|
|||
------ + ---------------------------------------
|
||||
.Ed
|
||||
.Pp
|
||||
Common regex use cases:
|
||||
.Pp
|
||||
(1) To list all matches starting with the filter expression,
|
||||
start the expression with a '^' (caret) symbol.
|
||||
.br
|
||||
(2) Type '\\.mkv' to list all MKV files.
|
||||
.br
|
||||
(3) Use '.*' to match any character (\fIsort of\fR fuzzy search).
|
||||
.br
|
||||
(4) Exclude filenames having 'nnn' (compiled with PCRE lib): '^(?!nnn)'
|
||||
.Pp
|
||||
In the \fBtype-to-nav\fR mode directories are opened in filter
|
||||
mode, allowing continuous navigation.
|
||||
.Pp
|
||||
Additional special keys at \fBempty filter prompt\fR
|
||||
in \fBtype-to-nav\fR mode:
|
||||
.Bd -literal
|
||||
|
@ -233,7 +270,7 @@ in \fBtype-to-nav\fR mode:
|
|||
Key | Function
|
||||
------ + ------------------------
|
||||
' | Go to first non-dir file
|
||||
+ | Toggle auto-advance
|
||||
+ | Toggle file selection
|
||||
, | Mark CWD
|
||||
- | Go to last visited dir
|
||||
. | Show hidden files
|
||||
|
@ -246,25 +283,6 @@ in \fBtype-to-nav\fR mode:
|
|||
~ | Go HOME
|
||||
------ + ------------------------
|
||||
.Ed
|
||||
.Pp
|
||||
Common regex use cases:
|
||||
.Pp
|
||||
(1) To list all matches starting with the filter expression,
|
||||
start the expression with a '^' (caret) symbol.
|
||||
.br
|
||||
(2) Type '\\.mkv' to list all MKV files.
|
||||
.br
|
||||
(3) Use '.*' to match any character (\fIsort of\fR fuzzy search).
|
||||
.br
|
||||
(4) Exclude filenames having 'nnn' (compiled with PCRE lib): '^(?!nnn)'
|
||||
.Pp
|
||||
In the \fItype-to-nav\fR mode directories are opened in filter
|
||||
mode, allowing continuous navigation.
|
||||
.br
|
||||
When there's a unique match and it's a directory,
|
||||
.Nm
|
||||
auto selects the directory and enters it in this mode. Use the relevant
|
||||
program option to disable this behaviour.
|
||||
.Sh SELECTION
|
||||
.Nm
|
||||
allows file selection across directories and contexts!
|
||||
|
@ -299,6 +317,11 @@ To edit the selection use the _edit selection_ key. Editing doesn't end the
|
|||
selection mode. You can add more files to the selection and edit the list
|
||||
again. If no file is selected in the current session, this option attempts
|
||||
to list the selection file.
|
||||
.Pp
|
||||
.Nm
|
||||
can show the total size of non-filtered selected files listed in a
|
||||
directory. For directories, only the size of the directory is added by
|
||||
default. To add the size of the contents of a directory, switch to du mode.
|
||||
.Sh FIND AND LIST
|
||||
There are two ways to search and list:
|
||||
.Pp
|
||||
|
@ -308,7 +331,7 @@ There are two ways to search and list:
|
|||
.Pp
|
||||
File paths must be NUL-separated ('\\0'). Paths and can be relative to the
|
||||
current directory or absolute. Invalid paths in the input are ignored. Input
|
||||
limit is 65,536 paths or 256 MiB of data.
|
||||
processing limit is 16,384 paths or 64 MiB (max_paths x max_path_len) of data.
|
||||
.Pp
|
||||
To list the input stream, start
|
||||
.Nm
|
||||
|
@ -330,7 +353,7 @@ Handy bash/zsh shell function to list files by mime-type in current directory:
|
|||
|
||||
list ()
|
||||
{
|
||||
find . -maxdepth 1 | file -if- | grep "$1" | awk -F: '{printf "%s\0", $1}' | nnn
|
||||
find . -maxdepth 1 | file -if- | grep "$1" | awk -F: '{printf "%s%c", $1, 0}' | nnn
|
||||
}
|
||||
.Ed
|
||||
.Pp
|
||||
|
@ -343,6 +366,24 @@ file. Press '-' to return to the listing dir. Press 'Enter' to open the symlink.
|
|||
.Pp
|
||||
Listing input stream can be scripted. It can be extended to pick (option -p)
|
||||
selected entries from the listed results.
|
||||
.Sh BOOKMARKS
|
||||
There are 2 ways (can be used together) to manage bookmarks.
|
||||
.Pp
|
||||
(1) Bookmark keys: See \fBNNN_BMS\fR under \fIENVIORNMENT\fR section on how to set
|
||||
bookmark keys.
|
||||
|
||||
The select bookmark key \fIb\fR lists all the bookmark keys set in \fBNNN_BMS\fR
|
||||
in the bookmarks prompt.
|
||||
.Pp
|
||||
(2) Symlinked bookmarks: A symlinked bookmark to the current directory can
|
||||
be created with the \fIB\fR key (or manually under ~/.config/nnn/bookmarks).
|
||||
|
||||
Pressing 'Enter' at the bookmarks prompt takes to this directory.
|
||||
If \fBNNN_BMS\fR is not set, the select bookmark key directly opens it.
|
||||
.Pp
|
||||
On entering a bookmark, the directory where the select bookmark key was
|
||||
pressed is set as the previous directory. Press '-' to return to it.
|
||||
.Pp
|
||||
.Sh UNITS
|
||||
The minimum file size unit is byte (B). The rest are K, M, G, T, P, E, Z, Y
|
||||
(powers of 1024), same as the default units in \fIls\fR.
|
||||
|
@ -369,6 +410,8 @@ separated by \fI;\fR:
|
|||
export NNN_BMS="d:$HOME/Docs;u:/home/user/Cam Uploads;D:$HOME/Downloads/"
|
||||
.Ed
|
||||
.Pp
|
||||
These bookmarks are listed in the help and config screen (key ?).
|
||||
.Pp
|
||||
\fBNNN_PLUG:\fR directly executable plugins as \fIkey_char:plugin\fR pairs
|
||||
separated by \fI;\fR:
|
||||
.Bd -literal
|
||||
|
@ -383,50 +426,51 @@ separated by \fI;\fR:
|
|||
.Ed
|
||||
.Pp
|
||||
To assign keys to arbitrary non-background cli commands and invoke like
|
||||
plugins, add \fI!\fR before the command.
|
||||
plugins, add \fB!\fR before the command.
|
||||
.Bd -literal
|
||||
export NNN_PLUG='x:!chmod +x $nnn;g:!git log;s:!smplayer $nnn'
|
||||
export NNN_PLUG='x:!chmod +x "$nnn";g:!git log;s:!smplayer "$nnn"'
|
||||
|
||||
To pick and run an unassigned plugin, press \fBEnter\fR at the plugin prompt.
|
||||
To run a plugin at startup, use the option `-P` followed by the plugin key.
|
||||
|
||||
NOTES:
|
||||
1. Use single quotes for $NNN_PLUG so $nnn is not interpreted
|
||||
2. (Again) add \fB!\fR before the command
|
||||
3. To disable directory refresh after running a \fIcommand as plugin\fR,
|
||||
1. Place $nnn (or exported variables) in double quotes (\fB"$nnn"\fR)
|
||||
2. Use single quotes for $NNN_PLUG so "$nnn" is not interpreted
|
||||
3. (Again) add \fB!\fR before the command
|
||||
4. To disable directory refresh after running a \fIcommand as plugin\fR,
|
||||
prefix with \fB-!\fR
|
||||
4. To skip user confirmation after command execution, suffix with \fB*\fR
|
||||
5. To skip user confirmation after command execution, suffix with \fB*\fR
|
||||
Note: Do not use \fB*\fR with programs those run and exit e.g. cat
|
||||
|
||||
export NNN_PLUG='y:-!sync*'
|
||||
|
||||
5. To run a \fIGUI app as plugin\fR, add a \fB&\fR after \fB!\fR
|
||||
Note: \fI$nnn\fR must be the last argument in this case.
|
||||
6. To run a \fIGUI app as plugin\fR, add a \fB&\fR after \fB!\fR.
|
||||
|
||||
export NNN_PLUG='m:-!&mousepad $nnn'
|
||||
export NNN_PLUG='m:-!&mousepad "$nnn"'
|
||||
|
||||
6. To show the output of run-and-exit commands which do not need user input,
|
||||
7. To show the output of run-and-exit commands which do not need user input,
|
||||
add \fB|\fR (pipe) after \fB!\fR
|
||||
Note: This option is incompatible with \fB&\fR (terminal output is masked
|
||||
for GUI programs) and ignores \fB*\fR (output is already paged for user)
|
||||
for GUI programs) and ignores \fB*\fR (output is already paged for user).
|
||||
|
||||
export NNN_PLUG='m:-!|mediainfo $nnn;t:-!|tree -ps;l:-!|ls -lah --group-directories-first'
|
||||
export NNN_PLUG='m:-!|mediainfo "$nnn";t:-!|tree -ps;l:-!|ls -lah --group-directories-first'
|
||||
|
||||
EXAMPLES:
|
||||
------------------------------------ + -------------------------------------------------
|
||||
Key:Command | Description
|
||||
------------------------------------ + -------------------------------------------------
|
||||
c:!convert $nnn png:- | xclip -sel \ | Copy image to clipboard
|
||||
clipboard -t image/png* |
|
||||
e:-!sudo -E vim $nnn* | Edit file as root in vim
|
||||
c:!convert "$nnn" png:- | xclip | Copy image to clipboard
|
||||
-sel clipboard -t image/png* |
|
||||
C:!cp -rv "$nnn" "$nnn".cp* | Create a copy of the hovered file
|
||||
e:-!sudo -E vim "$nnn"* | Edit file as root in vim
|
||||
g:-!git diff | Show git diff
|
||||
h:-!hx $nnn* | Open hovered file in hx hex editor
|
||||
k:-!fuser -kiv $nnn* | Interactively kill process(es) using hovered file
|
||||
h:-!hx "$nnn"* | Open hovered file in hx hex editor
|
||||
k:-!fuser -kiv "$nnn"* | Interactively kill process(es) using hovered file
|
||||
l:-!git log | Show git log
|
||||
n:-!vi /home/user/Dropbox/dir/note* | Take quick notes in a synced file/dir of notes
|
||||
p:-!less -iR $nnn* | Page through hovered file in less
|
||||
s:-!&smplayer -minigui $nnn | Play hovered media file, even unfinished download
|
||||
x:!chmod +x $nnn | Make the hovered file executable
|
||||
p:-!less -iR "$nnn"* | Page through hovered file in less
|
||||
s:-!&smplayer -minigui "$nnn" | Play hovered media file, even unfinished download
|
||||
x:!chmod +x "$nnn" | Make the hovered file executable
|
||||
y:-!sync* | Flush cached writes
|
||||
------------------------------------ + -------------------------------------------------
|
||||
|
||||
|
@ -440,6 +484,8 @@ separated by \fI;\fR:
|
|||
NOTE: Sort keys can be a/d/e/r/s/t/v (see program option -T).
|
||||
Capitalize to reverse (except 'r').
|
||||
Path must be absolute.
|
||||
|
||||
Timestamps for entries modified/created within 5 minutes are shown in reverse.
|
||||
.Ed
|
||||
.Pp
|
||||
\fBNNN_COLORS:\fR string of color numbers for each context, e.g.:
|
||||
|
@ -494,6 +540,11 @@ separated by \fI;\fR:
|
|||
NOTE: Non-default formats may require a third-party utility.
|
||||
.Ed
|
||||
.Pp
|
||||
\fBNNN_ARCHMNT:\fR optional archive mounter utility (default: archivemount).
|
||||
.Bd -literal
|
||||
export NNN_ARCHIVE='fuse-archive'
|
||||
.Ed
|
||||
.Pp
|
||||
\fBNNN_SSHFS:\fR specify custom sshfs command with options:
|
||||
.Bd -literal
|
||||
export NNN_SSHFS='sshfs -o reconnect,idmap=user,cache_timeout=3600'
|
||||
|
@ -515,6 +566,9 @@ separated by \fI;\fR:
|
|||
.Ed
|
||||
.Pp
|
||||
\fBNNN_SEL:\fR absolute path to custom selection file.
|
||||
.Bd -literal
|
||||
export NNN_SEL='/tmp/.sel'
|
||||
.Ed
|
||||
.Pp
|
||||
\fBNNN_FIFO:\fR path of a named pipe to write the hovered file path:
|
||||
.Bd -literal
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
|
||||
This directory contains sizable user submitted patches that were rejected from mainline as they tend to be more subjective in nature.
|
||||
|
||||
The patches will be adapted on each release when necessary (v4.1 onwards). Each patch can be applied through its respective make variable during compilation. In case inter-patch merge conflicts occur, a compatability patch is provided and will automatically be applied.
|
||||
The patches will be adapted on each release when necessary (v4.1 onwards). Each patch can be applied through its respective make variable during compilation. In case inter-patch merge conflicts occur, a compatibility patch is provided and will automatically be applied.
|
||||
|
||||
## List of patches
|
||||
|
||||
| Patch (a-z) | Description | Make var |
|
||||
| --- | --- | --- |
|
||||
| colemak | Key bindings for Colemak keyboard layout | `O_COLEMAK` |
|
||||
| gitstatus | Add git status column to the detail view. Provides command line flag `-G` to show column in normal mode. | `O_GITSTATUS` |
|
||||
| namefirst | Print filenames first in the detail view. Print user/group columns when a directory contains different users/groups. | `O_NAMEFIRST` |
|
||||
| restorepreview | Add pipe to close and restore [`preview-tui`](https://github.com/jarun/nnn/blob/master/plugins/preview-tui) for internal undetached edits (<kbd>e</kbd> key)| `O_RESTOREPREVIEW` |
|
||||
|
@ -14,3 +16,15 @@ The patches will be adapted on each release when necessary (v4.1 onwards). Each
|
|||
To apply a patch, use the corresponding make variable, e.g.:
|
||||
|
||||
make O_NAMEFIRST=1
|
||||
|
||||
When contributing/adding a new patch, make sure to add the make variable to the patches array in `./misc/test/check-patches.sh` as well so that patch failures can be easily tested.
|
||||
|
||||
## Resolving patch conflicts
|
||||
|
||||
Patch conflicts can be checked locally by running `make checkpatches` or by running `./patches/check-patches.sh` manually.
|
||||
|
||||
Whenever patch conflicts occur on the latest master, pull requests resolving them are welcome. Let's say a conflict occurs in the `restorepreview` patch. The best way to resolve this conflict would be something along the lines of:
|
||||
|
||||
- Ensure you're on latest master and run `PATCH_OPTS="--merge" make O_RESTOREPREVIEW=1`. This will generate the conflict markers in `src/nnn.c`.
|
||||
- Next edit `src/nnn.c`, resolve the conflicts around the conflict markers(`<<<<<<<`), and save.
|
||||
- Then run `git diff > patch.diff && sed -i -e "/^$/{r patch.diff" -e "q;}" patches/restorepreview/mainline.diff` to update the patch.
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Usage: ./misc/test/check-patches.sh
|
||||
#
|
||||
# Bash script that checks for any of the patches failing to apply.
|
||||
# Read patches/README.md for more information.
|
||||
|
||||
export PATCH_OPTS="--merge"
|
||||
patches=("O_COLEMAK" "O_GITSTATUS" "O_NAMEFIRST" "O_RESTOREPREVIEW")
|
||||
z=$(( 1 << ${#patches[@]} ))
|
||||
pid=$$
|
||||
ret=0
|
||||
trap 'ret=1' SIGUSR1
|
||||
|
||||
for ((n=1; n < z; ++n)); do
|
||||
for ((i=0; i < ${#patches[@]}; ++i)); do
|
||||
printf "%s=%d " "${patches[$i]}" "$(( (n & (1 << i)) != 0 ))"
|
||||
done | tee "/dev/stderr" | (
|
||||
make clean -s
|
||||
if ! xargs make 2>&1; then
|
||||
echo "[FAILED]" >&2
|
||||
kill -SIGUSR1 "$pid"
|
||||
else
|
||||
echo "[SUCCESS]" >&2
|
||||
fi
|
||||
git restore src
|
||||
) >/dev/null
|
||||
done
|
||||
exit "$ret"
|
|
@ -0,0 +1,134 @@
|
|||
diff --git a/src/nnn.c b/src/nnn.c
|
||||
index d7c53166..bb7ff3e8 100644
|
||||
--- a/src/nnn.c
|
||||
+++ b/src/nnn.c
|
||||
@@ -5149,12 +5149,12 @@ static void show_help(const char *path)
|
||||
"2(___n))\n"
|
||||
"0\n"
|
||||
"1NAVIGATION\n"
|
||||
- "9Up k Up%16PgUp ^U Page up\n"
|
||||
- "9Dn j Down%14PgDn ^D Page down\n"
|
||||
+ "9Up e Up%16PgUp ^U Page up\n"
|
||||
+ "9Dn n Down%14PgDn ^D Page down\n"
|
||||
"9Lt h Parent%12~ ` @ - ~, /, start, prev\n"
|
||||
- "5Ret Rt l Open%20' First file/match\n"
|
||||
- "9g ^A Top%21J Jump to entry/offset\n"
|
||||
- "9G ^E End%20^J Toggle auto-advance on open\n"
|
||||
+ "5Ret Rt i Open%20' First file/match\n"
|
||||
+ "9g ^E Top%21J Jump to entry/offset\n"
|
||||
+ "9G ^N End%20^J Toggle auto-advance on open\n"
|
||||
"8B (,) Book(mark)%11b ^/ Select bookmark\n"
|
||||
"a1-4 Context%11(Sh)Tab Cycle/new context\n"
|
||||
"62Esc ^Q Quit%19^y Next young\n"
|
||||
@@ -5162,27 +5162,27 @@ static void show_help(const char *path)
|
||||
"cq Quit context\n"
|
||||
"0\n"
|
||||
"1FILTER & PROMPT\n"
|
||||
- "c/ Filter%17^N Toggle type-to-nav\n"
|
||||
+ "c/ Filter%17^K Toggle type-to-nav\n"
|
||||
"aEsc Exit prompt%12^L Toggle last filter\n"
|
||||
"c. Toggle hidden%05Alt+Esc Unfilter, quit context\n"
|
||||
"0\n"
|
||||
"1FILES\n"
|
||||
- "9o ^O Open with%15n Create new/link\n"
|
||||
+ "9o ^O Open with%15c Create new/link\n"
|
||||
"9f ^F File stats%14d Detail mode toggle\n"
|
||||
"b^R Rename/dup%14r Batch rename\n"
|
||||
- "cz Archive%17e Edit file\n"
|
||||
+ "cz Archive%17y Edit file\n"
|
||||
"c* Toggle exe%14> Export list\n"
|
||||
"6Space + (Un)select%12m-m Select range/clear\n"
|
||||
"ca Select all%14A Invert sel\n"
|
||||
"9p ^P Copy here%12w ^W Cp/mv sel as\n"
|
||||
- "9v ^V Move here%15E Edit sel list\n"
|
||||
+ "9v ^V Move here%15l Edit sel list\n"
|
||||
"9x ^X Delete or trash%09S Listed sel size\n"
|
||||
"cX Delete (rm -rf)%07Esc Send to FIFO\n"
|
||||
"0\n"
|
||||
"1MISC\n"
|
||||
"8Alt ; Select plugin%11= Launch app\n"
|
||||
"9! ^] Shell%19] Cmd prompt\n"
|
||||
- "cc Connect remote%10u Unmount remote/archive\n"
|
||||
+ "cC Connect remote%10u Unmount remote/archive\n"
|
||||
"9t ^T Sort toggles%12s Manage session\n"
|
||||
"cT Set time type%110 Lock\n"
|
||||
"b^L Redraw%18? Help, conf\n"
|
||||
diff --git a/src/nnn.h b/src/nnn.h
|
||||
index bd500244..43b7fa22 100644
|
||||
--- a/src/nnn.h
|
||||
+++ b/src/nnn.h
|
||||
@@ -139,12 +139,12 @@ static struct key bindings[] = {
|
||||
{ '\r', SEL_OPEN },
|
||||
/* Pure navigate inside */
|
||||
{ KEY_RIGHT, SEL_NAV_IN },
|
||||
- { 'l', SEL_NAV_IN },
|
||||
+ { 'i', SEL_NAV_IN },
|
||||
/* Next */
|
||||
- { 'j', SEL_NEXT },
|
||||
+ { 'n', SEL_NEXT },
|
||||
{ KEY_DOWN, SEL_NEXT },
|
||||
/* Previous */
|
||||
- { 'k', SEL_PREV },
|
||||
+ { 'e', SEL_PREV },
|
||||
{ KEY_UP, SEL_PREV },
|
||||
/* Page down */
|
||||
{ KEY_NPAGE, SEL_PGDN },
|
||||
@@ -157,11 +157,11 @@ static struct key bindings[] = {
|
||||
/* First entry */
|
||||
{ KEY_HOME, SEL_HOME },
|
||||
{ 'g', SEL_HOME },
|
||||
- { CONTROL('A'), SEL_HOME },
|
||||
+ { CONTROL('E'), SEL_HOME },
|
||||
/* Last entry */
|
||||
{ KEY_END, SEL_END },
|
||||
{ 'G', SEL_END },
|
||||
- { CONTROL('E'), SEL_END },
|
||||
+ { CONTROL('N'), SEL_END },
|
||||
/* Go to first file */
|
||||
{ '\'', SEL_FIRST },
|
||||
/* Jump to an entry number/offset */
|
||||
@@ -179,7 +179,7 @@ static struct key bindings[] = {
|
||||
{ 'b', SEL_BMOPEN },
|
||||
{ CONTROL('_'), SEL_BMOPEN },
|
||||
/* Connect to server over SSHFS */
|
||||
- { 'c', SEL_REMOTE },
|
||||
+ { 'C', SEL_REMOTE },
|
||||
/* Cycle contexts in forward direction */
|
||||
{ '\t', SEL_CYCLE },
|
||||
/* Cycle contexts in reverse direction */
|
||||
@@ -202,7 +202,7 @@ static struct key bindings[] = {
|
||||
/* Filter */
|
||||
{ '/', SEL_FLTR },
|
||||
/* Toggle filter mode */
|
||||
- { CONTROL('N'), SEL_MFLTR },
|
||||
+ { CONTROL('K'), SEL_MFLTR },
|
||||
/* Toggle hide .dot files */
|
||||
{ '.', SEL_HIDDEN },
|
||||
/* Detailed listing */
|
||||
@@ -229,7 +229,7 @@ static struct key bindings[] = {
|
||||
/* Invert selection in current dir */
|
||||
{ 'A', SEL_SELINV },
|
||||
/* List, edit selection */
|
||||
- { 'E', SEL_SELEDIT },
|
||||
+ { 'l', SEL_SELEDIT },
|
||||
/* Copy from selection buffer */
|
||||
{ 'p', SEL_CP },
|
||||
{ CONTROL('P'), SEL_CP },
|
||||
@@ -247,7 +247,7 @@ static struct key bindings[] = {
|
||||
{ 'o', SEL_OPENWITH },
|
||||
{ CONTROL('O'), SEL_OPENWITH },
|
||||
/* Create a new file */
|
||||
- { 'n', SEL_NEW },
|
||||
+ { 'c', SEL_NEW },
|
||||
/* Show rename prompt */
|
||||
{ CONTROL('R'), SEL_RENAME },
|
||||
/* Rename contents of current dir */
|
||||
@@ -259,7 +259,7 @@ static struct key bindings[] = {
|
||||
/* Toggle auto-advance on file open */
|
||||
{ CONTROL('J'), SEL_AUTONEXT },
|
||||
/* Edit in EDITOR */
|
||||
- { 'e', SEL_EDIT },
|
||||
+ { 'y', SEL_EDIT },
|
||||
/* Run a plugin */
|
||||
{ ';', SEL_PLUGIN },
|
||||
/* Show total size of listed selection */
|
|
@ -6,22 +6,22 @@
|
|||
# Authors: Luuk van Baal
|
||||
|
||||
diff --git a/src/nnn.c b/src/nnn.c
|
||||
index 1028906a..c80314de 100644
|
||||
index 83ecdb90..4397944a 100644
|
||||
--- a/src/nnn.c
|
||||
+++ b/src/nnn.c
|
||||
@@ -262,6 +262,25 @@
|
||||
#define FREE 0
|
||||
#define CAPACITY 1
|
||||
@@ -270,6 +270,25 @@
|
||||
#define VFS_USED 1
|
||||
#define VFS_SIZE 2
|
||||
|
||||
+/* Git icons */
|
||||
+#ifdef NERD
|
||||
+#define GIT_ADD ""
|
||||
+#define GIT_DEL ""
|
||||
+#define GIT_IGN ""
|
||||
+#define GIT_MOD ""
|
||||
+#define GIT_MOD ""
|
||||
+#define GIT_NEW ""
|
||||
+#define GIT_NON "-"
|
||||
+#define GIT_UPD "ﮮ"
|
||||
+#define GIT_UPD ""
|
||||
+#else
|
||||
+#define GIT_ADD "A"
|
||||
+#define GIT_DEL "D"
|
||||
|
@ -35,7 +35,7 @@ index 1028906a..c80314de 100644
|
|||
/* TYPE DEFINITIONS */
|
||||
typedef unsigned int uint_t;
|
||||
typedef unsigned char uchar_t;
|
||||
@@ -286,6 +305,7 @@ typedef struct entry {
|
||||
@@ -294,6 +313,7 @@ typedef struct entry {
|
||||
uid_t uid; /* 4 bytes */
|
||||
gid_t gid; /* 4 bytes */
|
||||
#endif
|
||||
|
@ -43,7 +43,7 @@ index 1028906a..c80314de 100644
|
|||
} *pEntry;
|
||||
|
||||
/* Selection marker */
|
||||
@@ -342,6 +362,7 @@ typedef struct {
|
||||
@@ -349,6 +369,7 @@ typedef struct {
|
||||
uint_t cliopener : 1; /* All-CLI app opener */
|
||||
uint_t waitedit : 1; /* For ops that can't be detached, used EDITOR */
|
||||
uint_t rollover : 1; /* Roll over at edges */
|
||||
|
@ -51,7 +51,7 @@ index 1028906a..c80314de 100644
|
|||
} settings;
|
||||
|
||||
/* Non-persistent program-internal states (alphabeical order) */
|
||||
@@ -391,7 +412,17 @@ typedef struct {
|
||||
@@ -400,7 +421,17 @@ typedef struct {
|
||||
} session_header_t;
|
||||
#endif
|
||||
|
||||
|
@ -69,44 +69,27 @@ index 1028906a..c80314de 100644
|
|||
|
||||
/* Configuration, contexts */
|
||||
static settings cfg = {
|
||||
@@ -422,6 +453,7 @@ static settings cfg = {
|
||||
0, /* cliopener */
|
||||
0, /* waitedit */
|
||||
1, /* rollover */
|
||||
+ 0, /* normalgit */
|
||||
};
|
||||
|
||||
static context g_ctx[CTX_MAX] __attribute__ ((aligned));
|
||||
@@ -3839,6 +3871,56 @@ static int get_kv_key(kv *kvarr, char *val, uchar_t max, uchar_t id)
|
||||
@@ -3796,6 +3827,47 @@ static int get_kv_key(kv *kvarr, char *val, uchar_t max, uchar_t id)
|
||||
return -1;
|
||||
}
|
||||
|
||||
+static size_t get_git_statuses(const char *path)
|
||||
+{
|
||||
+ static char gitrev[] = "git rev-parse --show-toplevel 2>/dev/null";
|
||||
+ char workdir[PATH_MAX], *ret;
|
||||
+ FILE *fp = popen(gitrev, "r");
|
||||
+
|
||||
+ static char gst[] = "git -c core.quotePath= status -s --no-renames --ignored=matching -unormal . 2>/dev/null";
|
||||
+ FILE *fp = popen(gst, "r");
|
||||
+ char status[PATH_MAX];
|
||||
+ size_t pathindex, i = -1;
|
||||
+ git_statuses.show = FALSE;
|
||||
+ ret = fgets(workdir, PATH_MAX, fp);
|
||||
+ pclose(fp);
|
||||
+ if (!ret)
|
||||
+ return 0;
|
||||
+
|
||||
+ static char gitstat[] = "git -c core.quotePath= status --porcelain --no-renames --ignored=matching -u ";
|
||||
+ char pathspec[PATH_MAX], status[PATH_MAX];
|
||||
+ size_t i = -1;
|
||||
+ workdir[xstrlen(workdir) - 1] = '\0';
|
||||
+ snprintf(pathspec, PATH_MAX, "%s\"%s\"%s 2>/dev/null", gitstat, path, cfg.showhidden ? "" : "/*");
|
||||
+ fp = popen(pathspec, "r");
|
||||
+
|
||||
+ while (fgets(status, PATH_MAX, fp)) {
|
||||
+ size_t pathindex = (status[3] == '"') ? 4 : 3;
|
||||
+ pathindex = (status[3] == '"') ? 4 : 3;
|
||||
+ if (!cfg.showhidden && status[pathindex] == '.')
|
||||
+ continue;
|
||||
+ status[xstrlen(status) - pathindex + 2] = '\0';
|
||||
+ git_statuses.statuses = xrealloc(git_statuses.statuses, sizeof(git_status_t) * (++i + 1));
|
||||
+ git_statuses.statuses[i].status[0] = status[0];
|
||||
+ git_statuses.statuses[i].status[1] = status[1];
|
||||
+ mkpath(workdir, status + pathindex, git_statuses.statuses[i].path);
|
||||
+ mkpath(path, status + pathindex, git_statuses.statuses[i].path);
|
||||
+ }
|
||||
+
|
||||
+ pclose(fp);
|
||||
|
@ -134,7 +117,7 @@ index 1028906a..c80314de 100644
|
|||
static void resetdircolor(int flags)
|
||||
{
|
||||
/* Directories are always shown on top, clear the color when moving to first file */
|
||||
@@ -4176,6 +4258,10 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
|
||||
@@ -4123,6 +4195,10 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
|
||||
|
||||
uchar_t color_pair = get_color_pair_name_ind(ent, &ind, &attrs);
|
||||
|
||||
|
@ -145,7 +128,7 @@ index 1028906a..c80314de 100644
|
|||
addch((ent->flags & FILE_SELECTED) ? '+' | A_REVERSE | A_BOLD : ' ');
|
||||
|
||||
if (g_state.oldcolor)
|
||||
@@ -5617,6 +5703,11 @@ static int dentfill(char *path, struct entry **ppdents)
|
||||
@@ -5592,6 +5668,11 @@ static int dentfill(char *path, struct entry **ppdents)
|
||||
attron(COLOR_PAIR(cfg.curctx + 1));
|
||||
}
|
||||
|
||||
|
@ -157,7 +140,7 @@ index 1028906a..c80314de 100644
|
|||
#if _POSIX_C_SOURCE >= 200112L
|
||||
posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||
#endif
|
||||
@@ -5815,6 +5906,29 @@ static int dentfill(char *path, struct entry **ppdents)
|
||||
@@ -5792,6 +5873,29 @@ static int dentfill(char *path, struct entry **ppdents)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -187,7 +170,7 @@ index 1028906a..c80314de 100644
|
|||
++ndents;
|
||||
} while ((dp = readdir(dirp)));
|
||||
|
||||
@@ -6360,11 +6474,12 @@ static int adjust_cols(int n)
|
||||
@@ -6361,11 +6465,12 @@ static int adjust_cols(int n)
|
||||
#endif
|
||||
if (cfg.showdetail) {
|
||||
/* Fallback to light mode if less than 35 columns */
|
||||
|
@ -203,32 +186,32 @@ index 1028906a..c80314de 100644
|
|||
|
||||
/* 2 columns for preceding space and indicator */
|
||||
return (n - 2);
|
||||
@@ -8126,6 +8241,7 @@ static void usage(void)
|
||||
@@ -8143,6 +8248,7 @@ static void usage(void)
|
||||
" -F val fifo mode [0:preview 1:explore]\n"
|
||||
#endif
|
||||
" -g regex filters\n"
|
||||
+ " -G always show git status\n"
|
||||
" -H show hidden files\n"
|
||||
" -i show current file info\n"
|
||||
" -J no auto-proceed on select\n"
|
||||
@@ -8266,6 +8382,7 @@ static void cleanup(void)
|
||||
free(hostname);
|
||||
" -J no auto-advance on selection\n"
|
||||
@@ -8282,6 +8388,7 @@ static void cleanup(void)
|
||||
fflush(stdout);
|
||||
}
|
||||
#endif
|
||||
+ free(git_statuses.statuses);
|
||||
free(selpath);
|
||||
free(plgpath);
|
||||
free(cfgpath);
|
||||
@@ -8310,7 +8427,7 @@ int main(int argc, char *argv[])
|
||||
@@ -8326,7 +8433,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
while ((opt = (env_opts_id > 0
|
||||
? env_opts[--env_opts_id]
|
||||
- : getopt(argc, argv, "aAb:cCdDeEfF:gHiJKl:nop:P:QrRs:St:T:uUVxh"))) != -1) {
|
||||
+ : getopt(argc, argv, "aAb:cCdDeEfF:gGHiJKl:nop:P:QrRs:St:T:uUVxh"))) != -1) {
|
||||
- : getopt(argc, argv, "aAb:BcCdDeEfF:gHiJKl:nNop:P:QrRs:St:T:uUVxh"))) != -1) {
|
||||
+ : getopt(argc, argv, "aAb:BcCdDeEfF:gGHiJKl:nNop:P:QrRs:St:T:uUVxh"))) != -1) {
|
||||
switch (opt) {
|
||||
#ifndef NOFIFO
|
||||
case 'a':
|
||||
@@ -8361,6 +8478,9 @@ int main(int argc, char *argv[])
|
||||
@@ -8380,6 +8487,9 @@ int main(int argc, char *argv[])
|
||||
cfg.regex = 1;
|
||||
filterfn = &visible_re;
|
||||
break;
|
||||
|
|
|
@ -7,22 +7,22 @@
|
|||
# Authors: Luuk van Baal
|
||||
|
||||
diff --git a/src/nnn.c b/src/nnn.c
|
||||
index af586056..9ebfb203 100644
|
||||
index 88538787..d4af7c43 100644
|
||||
--- a/src/nnn.c
|
||||
+++ b/src/nnn.c
|
||||
@@ -262,6 +262,25 @@
|
||||
#define FREE 0
|
||||
#define CAPACITY 1
|
||||
@@ -270,6 +270,25 @@
|
||||
#define VFS_USED 1
|
||||
#define VFS_SIZE 2
|
||||
|
||||
+/* Git icons */
|
||||
+#ifdef NERD
|
||||
+#define GIT_ADD ""
|
||||
+#define GIT_DEL ""
|
||||
+#define GIT_IGN ""
|
||||
+#define GIT_MOD ""
|
||||
+#define GIT_MOD ""
|
||||
+#define GIT_NEW ""
|
||||
+#define GIT_NON "-"
|
||||
+#define GIT_UPD "ﮮ"
|
||||
+#define GIT_UPD ""
|
||||
+#else
|
||||
+#define GIT_ADD "A"
|
||||
+#define GIT_DEL "D"
|
||||
|
@ -36,7 +36,7 @@ index af586056..9ebfb203 100644
|
|||
/* TYPE DEFINITIONS */
|
||||
typedef unsigned int uint_t;
|
||||
typedef unsigned char uchar_t;
|
||||
@@ -286,6 +305,7 @@ typedef struct entry {
|
||||
@@ -294,6 +313,7 @@ typedef struct entry {
|
||||
uid_t uid; /* 4 bytes */
|
||||
gid_t gid; /* 4 bytes */
|
||||
#endif
|
||||
|
@ -44,7 +44,7 @@ index af586056..9ebfb203 100644
|
|||
} *pEntry;
|
||||
|
||||
/* Selection marker */
|
||||
@@ -342,6 +362,7 @@ typedef struct {
|
||||
@@ -349,6 +369,7 @@ typedef struct {
|
||||
uint_t cliopener : 1; /* All-CLI app opener */
|
||||
uint_t waitedit : 1; /* For ops that can't be detached, used EDITOR */
|
||||
uint_t rollover : 1; /* Roll over at edges */
|
||||
|
@ -52,7 +52,7 @@ index af586056..9ebfb203 100644
|
|||
} settings;
|
||||
|
||||
/* Non-persistent program-internal states (alphabeical order) */
|
||||
@@ -395,7 +416,17 @@ static struct {
|
||||
@@ -404,7 +425,17 @@ static struct {
|
||||
ushort_t maxnameln, maxsizeln, maxuidln, maxgidln, maxentln, uidln, gidln, printguid;
|
||||
} dtls;
|
||||
|
||||
|
@ -70,44 +70,27 @@ index af586056..9ebfb203 100644
|
|||
|
||||
/* Configuration, contexts */
|
||||
static settings cfg = {
|
||||
@@ -426,6 +457,7 @@ static settings cfg = {
|
||||
0, /* cliopener */
|
||||
0, /* waitedit */
|
||||
1, /* rollover */
|
||||
+ 0, /* normalgit */
|
||||
};
|
||||
|
||||
static context g_ctx[CTX_MAX] __attribute__ ((aligned));
|
||||
@@ -3847,6 +3879,56 @@ static int get_kv_key(kv *kvarr, char *val, uchar_t max, uchar_t id)
|
||||
@@ -3804,6 +3835,47 @@ static int get_kv_key(kv *kvarr, char *val, uchar_t max, uchar_t id)
|
||||
return -1;
|
||||
}
|
||||
|
||||
+static size_t get_git_statuses(const char *path)
|
||||
+{
|
||||
+ static char gitrev[] = "git rev-parse --show-toplevel 2>/dev/null";
|
||||
+ char workdir[PATH_MAX], *ret;
|
||||
+ FILE *fp = popen(gitrev, "r");
|
||||
+
|
||||
+ static char gst[] = "git -c core.quotePath= status -s --no-renames --ignored=matching -unormal . 2>/dev/null";
|
||||
+ FILE *fp = popen(gst, "r");
|
||||
+ char status[PATH_MAX];
|
||||
+ size_t pathindex, i = -1;
|
||||
+ git_statuses.show = FALSE;
|
||||
+ ret = fgets(workdir, PATH_MAX, fp);
|
||||
+ pclose(fp);
|
||||
+ if (!ret)
|
||||
+ return 0;
|
||||
+
|
||||
+ static char gitstat[] = "git -c core.quotePath= status --porcelain --no-renames --ignored=matching -u ";
|
||||
+ char pathspec[PATH_MAX], status[PATH_MAX];
|
||||
+ size_t i = -1;
|
||||
+ workdir[xstrlen(workdir) - 1] = '\0';
|
||||
+ snprintf(pathspec, PATH_MAX, "%s\"%s\"%s 2>/dev/null", gitstat, path, cfg.showhidden ? "" : "/*");
|
||||
+ fp = popen(pathspec, "r");
|
||||
+
|
||||
+ while (fgets(status, PATH_MAX, fp)) {
|
||||
+ size_t pathindex = (status[3] == '"') ? 4 : 3;
|
||||
+ pathindex = (status[3] == '"') ? 4 : 3;
|
||||
+ if (!cfg.showhidden && status[pathindex] == '.')
|
||||
+ continue;
|
||||
+ status[xstrlen(status) - pathindex + 2] = '\0';
|
||||
+ git_statuses.statuses = xrealloc(git_statuses.statuses, sizeof(git_status_t) * (++i + 1));
|
||||
+ git_statuses.statuses[i].status[0] = status[0];
|
||||
+ git_statuses.statuses[i].status[1] = status[1];
|
||||
+ mkpath(workdir, status + pathindex, git_statuses.statuses[i].path);
|
||||
+ mkpath(path, status + pathindex, git_statuses.statuses[i].path);
|
||||
+ }
|
||||
+
|
||||
+ pclose(fp);
|
||||
|
@ -135,7 +118,7 @@ index af586056..9ebfb203 100644
|
|||
static void resetdircolor(int flags)
|
||||
{
|
||||
/* Directories are always shown on top, clear the color when moving to first file */
|
||||
@@ -4157,6 +4239,9 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
|
||||
@@ -4104,6 +4176,9 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
|
||||
int attrs = 0, namelen;
|
||||
uchar_t color_pair = get_color_pair_name_ind(ent, &ind, &attrs);
|
||||
|
||||
|
@ -145,7 +128,7 @@ index af586056..9ebfb203 100644
|
|||
addch((ent->flags & FILE_SELECTED) ? '+' | A_REVERSE | A_BOLD : ' ');
|
||||
|
||||
if (g_state.oldcolor)
|
||||
@@ -5623,6 +5708,11 @@ static int dentfill(char *path, struct entry **ppdents)
|
||||
@@ -5598,6 +5673,11 @@ static int dentfill(char *path, struct entry **ppdents)
|
||||
attron(COLOR_PAIR(cfg.curctx + 1));
|
||||
}
|
||||
|
||||
|
@ -157,7 +140,7 @@ index af586056..9ebfb203 100644
|
|||
#if _POSIX_C_SOURCE >= 200112L
|
||||
posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||
#endif
|
||||
@@ -5821,6 +5911,29 @@ static int dentfill(char *path, struct entry **ppdents)
|
||||
@@ -5798,6 +5878,29 @@ static int dentfill(char *path, struct entry **ppdents)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -187,7 +170,7 @@ index af586056..9ebfb203 100644
|
|||
++ndents;
|
||||
} while ((dp = readdir(dirp)));
|
||||
|
||||
@@ -6357,7 +6470,8 @@ static int adjust_cols(int n)
|
||||
@@ -6362,7 +6465,8 @@ static int adjust_cols(int n)
|
||||
cfg.showdetail ^= 1;
|
||||
else /* 2 more accounted for below */
|
||||
n -= (dtls.maxentln - 2 - dtls.maxnameln);
|
||||
|
@ -197,7 +180,7 @@ index af586056..9ebfb203 100644
|
|||
|
||||
/* 2 columns for preceding space and indicator */
|
||||
return (n - 2);
|
||||
@@ -6512,7 +6626,7 @@ static void redraw(char *path)
|
||||
@@ -6517,7 +6621,7 @@ static void redraw(char *path)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -206,32 +189,32 @@ index af586056..9ebfb203 100644
|
|||
}
|
||||
|
||||
ncols = adjust_cols(ncols);
|
||||
@@ -8132,6 +8246,7 @@ static void usage(void)
|
||||
@@ -8153,6 +8257,7 @@ static void usage(void)
|
||||
" -F val fifo mode [0:preview 1:explore]\n"
|
||||
#endif
|
||||
" -g regex filters\n"
|
||||
+ " -G always show git status\n"
|
||||
" -H show hidden files\n"
|
||||
" -i show current file info\n"
|
||||
" -J no auto-proceed on select\n"
|
||||
@@ -8272,6 +8387,7 @@ static void cleanup(void)
|
||||
free(hostname);
|
||||
" -J no auto-advance on selection\n"
|
||||
@@ -8292,6 +8397,7 @@ static void cleanup(void)
|
||||
fflush(stdout);
|
||||
}
|
||||
#endif
|
||||
+ free(git_statuses.statuses);
|
||||
free(selpath);
|
||||
free(plgpath);
|
||||
free(cfgpath);
|
||||
@@ -8316,7 +8432,7 @@ int main(int argc, char *argv[])
|
||||
@@ -8336,7 +8442,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
while ((opt = (env_opts_id > 0
|
||||
? env_opts[--env_opts_id]
|
||||
- : getopt(argc, argv, "aAb:cCdDeEfF:gHiJKl:nop:P:QrRs:St:T:uUVxh"))) != -1) {
|
||||
+ : getopt(argc, argv, "aAb:cCdDeEfF:gGHiJKl:nop:P:QrRs:St:T:uUVxh"))) != -1) {
|
||||
- : getopt(argc, argv, "aAb:BcCdDeEfF:gHiJKl:nNop:P:QrRs:St:T:uUVxh"))) != -1) {
|
||||
+ : getopt(argc, argv, "aAb:BcCdDeEfF:gGHiJKl:nNop:P:QrRs:St:T:uUVxh"))) != -1) {
|
||||
switch (opt) {
|
||||
#ifndef NOFIFO
|
||||
case 'a':
|
||||
@@ -8367,6 +8483,9 @@ int main(int argc, char *argv[])
|
||||
@@ -8390,6 +8496,9 @@ int main(int argc, char *argv[])
|
||||
cfg.regex = 1;
|
||||
filterfn = &visible_re;
|
||||
break;
|
||||
|
|
|
@ -4,47 +4,47 @@
|
|||
# Author: Luuk van Baal
|
||||
|
||||
diff --git a/src/nnn.c b/src/nnn.c
|
||||
index 88263beb..55f32e73 100644
|
||||
index f8a2c58..9802a1f 100644
|
||||
--- a/src/nnn.c
|
||||
+++ b/src/nnn.c
|
||||
@@ -390,6 +390,10 @@ typedef struct {
|
||||
@@ -394,6 +394,10 @@ typedef struct {
|
||||
} session_header_t;
|
||||
#endif
|
||||
|
||||
|
||||
+static struct {
|
||||
+ ushort_t maxnameln, maxsizeln, maxuidln, maxgidln, maxentln, uidln, gidln, printguid;
|
||||
+} dtls;
|
||||
+
|
||||
/* GLOBALS */
|
||||
|
||||
|
||||
/* Configuration, contexts */
|
||||
@@ -1083,10 +1087,12 @@ static char *getpwname(uid_t uid)
|
||||
@@ -1070,10 +1074,12 @@ static char *getpwname(uid_t uid)
|
||||
static char *namecache;
|
||||
|
||||
|
||||
if (uidcache != uid) {
|
||||
+ if (dtls.maxuidln && !dtls.printguid) dtls.printguid = 1;
|
||||
struct passwd *pw = getpwuid(uid);
|
||||
|
||||
|
||||
uidcache = uid;
|
||||
namecache = pw ? pw->pw_name : NULL;
|
||||
+ dtls.uidln = xstrlen(namecache ? namecache : xitoa(uid));
|
||||
}
|
||||
|
||||
|
||||
return namecache ? namecache : xitoa(uid);
|
||||
@@ -1098,10 +1104,12 @@ static char *getgrname(gid_t gid)
|
||||
@@ -1085,10 +1091,12 @@ static char *getgrname(gid_t gid)
|
||||
static char *grpcache;
|
||||
|
||||
|
||||
if (gidcache != gid) {
|
||||
+ if (dtls.maxgidln && !dtls.printguid) dtls.printguid = 1;
|
||||
struct group *gr = getgrgid(gid);
|
||||
|
||||
|
||||
gidcache = gid;
|
||||
grpcache = gr ? gr->gr_name : NULL;
|
||||
+ dtls.gidln = xstrlen(grpcache ? grpcache : xitoa(gid));
|
||||
}
|
||||
|
||||
|
||||
return grpcache ? grpcache : xitoa(gid);
|
||||
@@ -3829,14 +3837,13 @@ static void resetdircolor(int flags)
|
||||
@@ -3834,14 +3842,13 @@ static void resetdircolor(int flags)
|
||||
* Max supported str length: NAME_MAX;
|
||||
*/
|
||||
#ifdef NOLC
|
||||
|
@ -62,18 +62,18 @@ index 88263beb..55f32e73 100644
|
|||
{
|
||||
wchar_t * const wbuf = (wchar_t *)g_buf;
|
||||
wchar_t *buf = wbuf;
|
||||
@@ -3861,7 +3868,7 @@ static wchar_t *unescape(const char *str, uint_t maxcols)
|
||||
@@ -3866,7 +3873,7 @@ static wchar_t *unescape(const char *str, uint_t maxcols)
|
||||
++buf;
|
||||
}
|
||||
|
||||
|
||||
- return wbuf;
|
||||
+ return len;
|
||||
}
|
||||
|
||||
|
||||
static off_t get_size(off_t size, off_t *pval, int comp)
|
||||
@@ -4122,33 +4129,7 @@ static uchar_t get_color_pair_name_ind(const struct entry *ent, char *pind, int
|
||||
static void printent(const struct entry *ent, uint_t namecols, bool sel)
|
||||
@@ -4228,38 +4235,13 @@ static void printent(int pdents_index, uint_t namecols, bool sel)
|
||||
{
|
||||
const struct entry *ent = &pdents[pdents_index];
|
||||
char ind = '\0';
|
||||
- int attrs;
|
||||
-
|
||||
|
@ -90,7 +90,7 @@ index 88263beb..55f32e73 100644
|
|||
- attron(attrs);
|
||||
-
|
||||
- /* Print details */
|
||||
- print_time(&ent->sec);
|
||||
- print_time(&ent->sec, ent->flags);
|
||||
-
|
||||
- printw("%s%9s ", perms, (type == S_IFREG || type == S_IFDIR)
|
||||
- ? coolsize(cfg.blkorder ? (blkcnt_t)ent->blocks << blk_shift : ent->size)
|
||||
|
@ -99,16 +99,21 @@ index 88263beb..55f32e73 100644
|
|||
- if (attrs)
|
||||
- attroff(attrs);
|
||||
- }
|
||||
-
|
||||
+ int attrs = 0, namelen;
|
||||
|
||||
if (g_state.showlines) {
|
||||
ptrdiff_t rel_num = pdents_index - cur;
|
||||
printw(rel_num == 0 ? "%4td" : "%+4td", rel_num);
|
||||
}
|
||||
|
||||
- attrs = 0;
|
||||
-
|
||||
+ int attrs = 0, namelen;
|
||||
uchar_t color_pair = get_color_pair_name_ind(ent, &ind, &attrs);
|
||||
|
||||
|
||||
addch((ent->flags & FILE_SELECTED) ? '+' | A_REVERSE | A_BOLD : ' ');
|
||||
@@ -4173,15 +4154,40 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
|
||||
@@ -4284,15 +4266,40 @@ static void printent(int pdents_index, uint_t namecols, bool sel)
|
||||
++namecols;
|
||||
|
||||
|
||||
#ifndef NOLC
|
||||
- addwstr(unescape(ent->name, namecols));
|
||||
+ addwstr((namelen = unescape(ent->name, namecols), (wchar_t *)g_buf));
|
||||
|
@ -116,7 +121,7 @@ index 88263beb..55f32e73 100644
|
|||
- addstr(unescape(ent->name, MIN(namecols, ent->nlen) + 1));
|
||||
+ addstr((namelen = unescape(ent->name, MIN(namecols, ent->nlen) + 1), (char *)g_buf));
|
||||
#endif
|
||||
|
||||
|
||||
- if (attrs)
|
||||
+ if (!sel && attrs)
|
||||
attroff(attrs);
|
||||
|
@ -132,8 +137,8 @@ index 88263beb..55f32e73 100644
|
|||
+ attron(attrs);
|
||||
+ if (!g_state.oldcolor && (type == S_IFDIR || (type == S_IFLNK && ent->flags & DIR_OR_DIRLNK)))
|
||||
+ attroff(A_BOLD);
|
||||
+ size_t sizelen = (type == S_IFREG || type == S_IFDIR) ? xstrlen(size = coolsize(cfg.blkorder ? ent->blocks << blk_shift : ent->size)) : 1;
|
||||
+ printw("%*c%*s%s%s", 1 + MIN(namecols, dtls.maxnameln + (size_t)(ind ? 0 : 1)) - namelen, ' ',
|
||||
+ int sizelen = (type == S_IFREG || type == S_IFDIR) ? xstrlen(size = coolsize(cfg.blkorder ? ent->blocks << blk_shift : ent->size)) : 1;
|
||||
+ printw("%*c%*s%s%s", 1 + MIN(namecols, dtls.maxnameln + (uint_t)(ind ? 0 : 1)) - namelen, ' ',
|
||||
+ dtls.maxsizeln - sizelen, "", size ? size : (type = (uchar_t)get_detail_ind(ent->mode), (char *)&type), " ");
|
||||
+#ifndef NOUG
|
||||
+ if (g_state.uidgid && dtls.printguid) {
|
||||
|
@ -143,37 +148,34 @@ index 88263beb..55f32e73 100644
|
|||
+ }
|
||||
+#endif
|
||||
+ addstr(perms);
|
||||
+ print_time(&ent->sec);
|
||||
+ print_time(&ent->sec, ent->flags);
|
||||
+ }
|
||||
+ if (attrs)
|
||||
+ attroff(attrs);
|
||||
}
|
||||
|
||||
static void savecurctx(char *path, char *curname, int nextctx)
|
||||
@@ -6250,18 +6256,6 @@ static void statusbar(char *path)
|
||||
tocursor();
|
||||
|
||||
/**
|
||||
@@ -6527,26 +6534,19 @@ static void statusbar(char *path)
|
||||
tocursor();
|
||||
}
|
||||
|
||||
|
||||
-static inline void markhovered(void)
|
||||
-{
|
||||
- if (cfg.showdetail && ndents) { /* Reversed block for hovered entry */
|
||||
- if (cfg.showdetail && ndents) { /* Bold forward arrowhead */
|
||||
- tocursor();
|
||||
-#ifdef ICONS_ENABLED
|
||||
- addstr(MD_ARROW_FORWARD);
|
||||
-#else
|
||||
- addch(' ' | A_REVERSE);
|
||||
-#endif
|
||||
- addch('>' | A_BOLD);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
static int adjust_cols(int n)
|
||||
{
|
||||
/* Calculate the number of cols available to print entry name */
|
||||
@@ -6269,11 +6263,10 @@ static int adjust_cols(int n)
|
||||
n -= (g_state.oldcolor ? 0 : 1 + xstrlen(ICON_PADDING_LEFT) + xstrlen(ICON_PADDING_RIGHT));
|
||||
#ifdef ICONS_ENABLED
|
||||
n -= (g_state.oldcolor ? 0 : ICON_SIZE + ICON_PADDING_LEFT_LEN + ICON_PADDING_RIGHT_LEN);
|
||||
#endif
|
||||
+
|
||||
if (cfg.showdetail) {
|
||||
- /* Fallback to light mode if less than 35 columns */
|
||||
/* Fallback to light mode if less than 35 columns */
|
||||
- if (n < 36)
|
||||
+ if (n < (dtls.maxentln + 1 - dtls.maxnameln))
|
||||
cfg.showdetail ^= 1;
|
||||
|
@ -181,21 +183,21 @@ index 88263beb..55f32e73 100644
|
|||
- n -= 32;
|
||||
+ n -= (dtls.maxentln - 2 - dtls.maxnameln);
|
||||
}
|
||||
|
||||
|
||||
/* 2 columns for preceding space and indicator */
|
||||
@@ -6310,8 +6303,6 @@ static void draw_line(int ncols)
|
||||
@@ -6412,8 +6411,6 @@ static void draw_line(int ncols)
|
||||
/* Must reset e.g. no files in dir */
|
||||
if (dir)
|
||||
attroff(COLOR_PAIR(cfg.curctx + 1) | A_BOLD);
|
||||
-
|
||||
- markhovered();
|
||||
}
|
||||
|
||||
|
||||
static void redraw(char *path)
|
||||
@@ -6419,6 +6410,21 @@ static void redraw(char *path)
|
||||
|
||||
@@ -6521,6 +6518,21 @@ static void redraw(char *path)
|
||||
|
||||
onscreen = MIN(onscreen + curscroll, ndents);
|
||||
|
||||
|
||||
+ if (cfg.showdetail) {
|
||||
+ ushort_t lenbuf = dtls.maxnameln = dtls.maxsizeln = dtls.maxuidln = dtls.maxgidln = dtls.printguid = 0;
|
||||
+ for (i = curscroll; i < onscreen; ++i) {
|
||||
|
@ -212,14 +214,14 @@ index 88263beb..55f32e73 100644
|
|||
+ }
|
||||
+
|
||||
ncols = adjust_cols(ncols);
|
||||
|
||||
|
||||
int len = scanselforpath(path, FALSE);
|
||||
@@ -6449,7 +6455,7 @@ static void redraw(char *path)
|
||||
@@ -6551,7 +6563,7 @@ static void redraw(char *path)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
- markhovered();
|
||||
+ statusbar(path);
|
||||
}
|
||||
|
||||
|
||||
static bool cdprep(char *lastdir, char *lastname, char *path, char *newpath)
|
||||
|
|
|
@ -1,33 +1,36 @@
|
|||
# Description: Adds preview pipe to enable closing and re-opening
|
||||
# the preview pane when running an undetached editor.
|
||||
# Description: Adds preview pipe to enable closing and re-opening the preview
|
||||
# pane when running an undetached editor. If you are using vim
|
||||
# you might experience incorrectly resized window. Consider adding
|
||||
# the following to your vimrc:
|
||||
# autocmd VimEnter * :silent exec "!kill -s WINCH $PPID"
|
||||
#
|
||||
# Authors: Luuk van Baal
|
||||
|
||||
diff --git a/src/nnn.c b/src/nnn.c
|
||||
index c7440149..8ae75614 100644
|
||||
index 0388b23c..66d3316a 100644
|
||||
--- a/src/nnn.c
|
||||
+++ b/src/nnn.c
|
||||
@@ -368,7 +368,8 @@ typedef struct {
|
||||
uint_t stayonsel : 1; /* Disable auto-proceed on select */
|
||||
uint_t trash : 2; /* Trash method 0: rm -rf, 1: trash-cli, 2: gio trash */
|
||||
uint_t uidgid : 1; /* Show owner and group info */
|
||||
- uint_t reserved : 7; /* Adjust when adding/removing a field */
|
||||
@@ -391,7 +391,8 @@ typedef struct {
|
||||
uint_t usebsdtar : 1; /* Use bsdtar as default archive utility */
|
||||
uint_t xprompt : 1; /* Use native prompt instead of readline prompt */
|
||||
uint_t showlines : 1; /* Show line numbers */
|
||||
- uint_t reserved : 3; /* Adjust when adding/removing a field */
|
||||
+ uint_t previewer : 1; /* Run state of previewer */
|
||||
+ uint_t reserved : 6; /* Adjust when adding/removing a field */
|
||||
+ uint_t reserved : 2; /* Adjust when adding/removing a field */
|
||||
} runstate;
|
||||
|
||||
|
||||
/* Contexts or workspaces */
|
||||
@@ -516,6 +517,9 @@ static char g_tmpfpath[TMP_LEN_MAX] __attribute__ ((aligned));
|
||||
@@ -516,6 +517,9 @@ alignas(max_align_t) static char g_tmpfpath[TMP_LEN_MAX];
|
||||
/* Buffer to store plugins control pipe location */
|
||||
static char g_pipepath[TMP_LEN_MAX] __attribute__ ((aligned));
|
||||
|
||||
alignas(max_align_t) static char g_pipepath[TMP_LEN_MAX];
|
||||
|
||||
+/* Buffer to store preview plugins control pipe location */
|
||||
+static char g_ppipepath[TMP_LEN_MAX] __attribute__ ((aligned));
|
||||
+
|
||||
/* Non-persistent runtime states */
|
||||
static runstate g_state;
|
||||
|
||||
@@ -690,12 +694,13 @@ static const char * const messages[] = {
|
||||
|
||||
@@ -696,12 +700,13 @@ static const char * const messages[] = {
|
||||
#define NNN_FCOLORS 5
|
||||
#define NNNLVL 6
|
||||
#define NNN_PIPE 7
|
||||
|
@ -44,10 +47,10 @@ index c7440149..8ae75614 100644
|
|||
+#define NNN_ORDER 12
|
||||
+#define NNN_HELP 13 /* strings end here */
|
||||
+#define NNN_TRASH 14 /* flags begin here */
|
||||
|
||||
|
||||
static const char * const env_cfg[] = {
|
||||
"NNN_OPTS",
|
||||
@@ -706,6 +711,7 @@ static const char * const env_cfg[] = {
|
||||
@@ -712,6 +717,7 @@ static const char * const env_cfg[] = {
|
||||
"NNN_FCOLORS",
|
||||
"NNNLVL",
|
||||
"NNN_PIPE",
|
||||
|
@ -57,14 +60,14 @@ index c7440149..8ae75614 100644
|
|||
"NNN_ARCHIVE",
|
||||
@@ -850,7 +856,7 @@ static int set_sort_flags(int r);
|
||||
static void statusbar(char *path);
|
||||
static bool get_output(char *file, char *arg1, char *arg2, int fdout, bool multi, bool page);
|
||||
static bool get_output(char *file, char *arg1, char *arg2, int fdout, bool page);
|
||||
#ifndef NOFIFO
|
||||
-static void notify_fifo(bool force);
|
||||
+static void notify_fifo(bool force, bool closepreview);
|
||||
#endif
|
||||
|
||||
|
||||
/* Functions */
|
||||
@@ -3065,7 +3071,7 @@ try_quit:
|
||||
@@ -3140,7 +3146,7 @@ try_quit:
|
||||
} else {
|
||||
#ifndef NOFIFO
|
||||
if (!g_state.fifomode)
|
||||
|
@ -73,14 +76,14 @@ index c7440149..8ae75614 100644
|
|||
#endif
|
||||
escaped = TRUE;
|
||||
settimeout();
|
||||
@@ -5164,15 +5170,20 @@ static bool run_cmd_as_plugin(const char *file, char *runfile, uchar_t flags)
|
||||
|
||||
@@ -5258,15 +5264,20 @@ static void run_cmd_as_plugin(const char *file, uchar_t flags)
|
||||
|
||||
static bool plctrl_init(void)
|
||||
{
|
||||
- size_t len;
|
||||
+ size_t len, lenbuf;
|
||||
+ pid_t pid = getpid();
|
||||
|
||||
|
||||
/* g_tmpfpath is used to generate tmp file names */
|
||||
g_tmpfpath[tmpfplen - 1] = '\0';
|
||||
- len = xstrsncpy(g_pipepath, g_tmpfpath, TMP_LEN_MAX);
|
||||
|
@ -95,13 +98,13 @@ index c7440149..8ae75614 100644
|
|||
+ xstrsncpy(g_ppipepath + len - 1, xitoa(pid), TMP_LEN_MAX - len);
|
||||
setenv(env_cfg[NNN_PIPE], g_pipepath, TRUE);
|
||||
+ setenv(env_cfg[NNN_PPIPE], g_ppipepath, TRUE);
|
||||
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -5201,6 +5212,21 @@ static ssize_t read_nointr(int fd, void *buf, size_t count)
|
||||
@@ -5295,6 +5306,21 @@ static ssize_t read_nointr(int fd, void *buf, size_t count)
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
+void *previewpipe(void *arg __attribute__ ((unused)))
|
||||
+{
|
||||
+ int fd, buf;
|
||||
|
@ -120,19 +123,19 @@ index c7440149..8ae75614 100644
|
|||
static char *readpipe(int fd, char *ctxnum, char **path)
|
||||
{
|
||||
char ctx, *nextpath = NULL;
|
||||
@@ -5864,7 +5890,7 @@ static void populate(char *path, char *lastname)
|
||||
@@ -5979,7 +6005,7 @@ static void populate(char *path, char *lastname)
|
||||
}
|
||||
|
||||
|
||||
#ifndef NOFIFO
|
||||
-static void notify_fifo(bool force)
|
||||
+static void notify_fifo(bool force, bool closepreview)
|
||||
{
|
||||
if (!fifopath)
|
||||
return;
|
||||
@@ -5880,6 +5906,12 @@ static void notify_fifo(bool force)
|
||||
@@ -5995,6 +6021,12 @@ static void notify_fifo(bool force)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+ if (closepreview) {
|
||||
+ if (write(fifofd, "close\n", 6) != 6)
|
||||
+ xerror();
|
||||
|
@ -140,36 +143,36 @@ index c7440149..8ae75614 100644
|
|||
+ }
|
||||
+
|
||||
static struct entry lastentry;
|
||||
|
||||
if (!force && !memcmp(&lastentry, &pdents[cur], sizeof(struct entry)))
|
||||
@@ -5912,7 +5944,7 @@ static void send_to_explorer(int *presel)
|
||||
if (fd > 1)
|
||||
close(fd);
|
||||
} else
|
||||
|
||||
if (!force && !memcmp(&lastentry, &pdents[cur], sizeof(struct entry))) // NOLINT
|
||||
@@ -6027,7 +6059,7 @@ static void send_to_explorer(int *presel)
|
||||
if (fd > 1)
|
||||
close(fd);
|
||||
} else
|
||||
- notify_fifo(TRUE); /* Send opened path to NNN_FIFO */
|
||||
+ notify_fifo(TRUE, FALSE); /* Send opened path to NNN_FIFO */
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5945,7 +5977,7 @@ static void move_cursor(int target, int ignore_scrolloff)
|
||||
|
||||
|
||||
@@ -6060,7 +6092,7 @@ static void move_cursor(int target, int ignore_scrolloff)
|
||||
|
||||
#ifndef NOFIFO
|
||||
if (!g_state.fifomode)
|
||||
- notify_fifo(FALSE); /* Send hovered path to NNN_FIFO */
|
||||
+ notify_fifo(FALSE, FALSE); /* Send hovered path to NNN_FIFO */
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -6567,7 +6599,7 @@ static bool browse(char *ipath, const char *session, int pkey)
|
||||
|
||||
@@ -6733,7 +6765,7 @@ static bool browse(char *ipath, const char *session, int pkey)
|
||||
pEntry pent;
|
||||
enum action sel;
|
||||
struct stat sb;
|
||||
- int r = -1, presel, selstartid = 0, selendid = 0;
|
||||
+ int r = -1, presel, selstartid = 0, selendid = 0, previewkey = 0;
|
||||
const uchar_t opener_flags = (cfg.cliopener ? F_CLI : (F_NOTRACE | F_NOSTDIN | F_NOWAIT));
|
||||
bool watch = FALSE, cd = TRUE;
|
||||
bool watch = FALSE, cd = TRUE;
|
||||
ino_t inode = 0;
|
||||
@@ -6821,7 +6853,7 @@ nochange:
|
||||
@@ -6991,7 +7023,7 @@ nochange:
|
||||
move_cursor(r, 1);
|
||||
#ifndef NOFIFO
|
||||
else if ((event.bstate == BUTTON1_PRESSED) && !g_state.fifomode)
|
||||
|
@ -178,7 +181,7 @@ index c7440149..8ae75614 100644
|
|||
#endif
|
||||
/* Handle right click selection */
|
||||
if (event.bstate == BUTTON3_PRESSED) {
|
||||
@@ -6981,7 +7013,14 @@ nochange:
|
||||
@@ -7153,7 +7185,14 @@ nochange:
|
||||
&& strstr(g_buf, "text")
|
||||
#endif
|
||||
) {
|
||||
|
@ -193,14 +196,14 @@ index c7440149..8ae75614 100644
|
|||
if (cfg.filtermode) {
|
||||
presel = FILTER;
|
||||
clearfilter();
|
||||
@@ -7293,8 +7332,14 @@ nochange:
|
||||
@@ -7471,8 +7510,14 @@ nochange:
|
||||
copycurname();
|
||||
goto nochange;
|
||||
case SEL_EDIT:
|
||||
+ if (g_state.previewer)
|
||||
+ notify_fifo(FALSE, TRUE);
|
||||
if (!g_state.picker)
|
||||
spawn(editor, newpath, NULL, NULL, F_CLI);
|
||||
if (!(g_state.picker || g_state.fifomode))
|
||||
spawn(editor, newpath, NULL, NULL, F_CLI);
|
||||
+ if (g_state.previewer) {
|
||||
+ pkey = previewkey;
|
||||
+ goto run_plugin;
|
||||
|
@ -208,18 +211,18 @@ index c7440149..8ae75614 100644
|
|||
continue;
|
||||
default: /* SEL_LOCK */
|
||||
lock_terminal();
|
||||
@@ -7660,6 +7705,7 @@ nochange:
|
||||
cd = FALSE;
|
||||
@@ -7860,6 +7905,7 @@ nochange:
|
||||
cd = FALSE;
|
||||
goto begin;
|
||||
}
|
||||
+run_plugin:
|
||||
case SEL_PLUGIN:
|
||||
/* Check if directory is accessible */
|
||||
if (!xdiraccess(plgpath)) {
|
||||
@@ -7685,6 +7731,12 @@ nochange:
|
||||
@@ -7885,6 +7931,12 @@ nochange:
|
||||
goto nochange;
|
||||
}
|
||||
|
||||
|
||||
+ if (xstrcmp(tmp, "preview-tui") == 0) {
|
||||
+ previewkey = r;
|
||||
+ pthread_t tid;
|
||||
|
@ -229,7 +232,21 @@ index c7440149..8ae75614 100644
|
|||
if (tmp[0] == '-' && tmp[1]) {
|
||||
++tmp;
|
||||
r = FALSE; /* Do not refresh dir after completion */
|
||||
@@ -8281,8 +8333,10 @@ static void cleanup(void)
|
||||
@@ -7943,7 +7995,13 @@ nochange:
|
||||
case SEL_SHELL: // fallthrough
|
||||
case SEL_LAUNCH: // fallthrough
|
||||
case SEL_PROMPT:
|
||||
+ if (g_state.previewer)
|
||||
+ notify_fifo(FALSE, TRUE);
|
||||
r = handle_cmd(sel, path, newpath);
|
||||
+ if (g_state.previewer) {
|
||||
+ pkey = previewkey;
|
||||
+ goto run_plugin;
|
||||
+ }
|
||||
|
||||
/* Continue in type-to-nav mode, if enabled */
|
||||
if (cfg.filtermode)
|
||||
@@ -8492,8 +8550,10 @@ static void cleanup(void)
|
||||
if (g_state.autofifo)
|
||||
unlink(fifopath);
|
||||
#endif
|
||||
|
@ -241,8 +258,8 @@ index c7440149..8ae75614 100644
|
|||
#ifdef DEBUG
|
||||
disabledbg();
|
||||
#endif
|
||||
@@ -8786,7 +8840,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
@@ -9020,7 +9080,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#ifndef NOFIFO
|
||||
if (!g_state.fifomode)
|
||||
- notify_fifo(FALSE);
|
||||
|
|
|
@ -22,8 +22,12 @@
|
|||
IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" # protect trailing \n
|
||||
|
||||
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
||||
[ -s "$selection" ] || { echo "plugin .cbcp error: empty selection" >&2 ; exit 1; }
|
||||
|
||||
if type xsel >/dev/null 2>&1; then
|
||||
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
|
||||
# Wayland
|
||||
tr '\0' '\n' < "$selection" | wl-copy
|
||||
elif type xsel >/dev/null 2>&1; then
|
||||
# Linux
|
||||
tr '\0' '\n' < "$selection" | xsel -bi
|
||||
elif type xclip >/dev/null 2>&1; then
|
||||
|
@ -41,9 +45,6 @@ elif type clip.exe >/dev/null 2>&1; then
|
|||
elif type clip >/dev/null 2>&1; then
|
||||
# Cygwin
|
||||
tr '\0' '\n' < "$selection" | clip
|
||||
elif type wl-copy >/dev/null 2>&1; then
|
||||
# Wayland
|
||||
tr '\0' '\n' < "$selection" | wl-copy
|
||||
elif type clipboard >/dev/null 2>&1; then
|
||||
# Haiku
|
||||
tr '\0' '\n' < "$selection" | clipboard --stdin
|
||||
|
|
|
@ -29,6 +29,7 @@ awk 'BEGIN {
|
|||
color_docs=202 #color_docs=173 #color_docs="208;135;112"
|
||||
color_archive=209 #color_archive=179 #color_archive="235;203;139"
|
||||
color_c=81 #color_c=150 #color_c="163;190;140"
|
||||
color_elixir=104 #color_elixir=109 #color_elixir="143;188;187"
|
||||
color_java=32 #color_java=139 #color_java="180;142;173"
|
||||
color_js=47 #color_js=109 #color_js="143;188;187"
|
||||
color_react=39 #color_react=111 #color_react="129;161;193"
|
||||
|
@ -44,49 +45,53 @@ awk 'BEGIN {
|
|||
|
||||
# icons[][1] contains icon and icons[][2] contains color
|
||||
icons["directory"][1] = ""; icons["directory"][2] = color_default
|
||||
icons["file"][1] = ""; icons["file"][2] = color_default
|
||||
icons["file"][1] = ""; icons["file"][2] = color_default
|
||||
icons["exec"][1] = ""; icons["exec"][2] = color_default
|
||||
icons["manual"][1] = ""; icons["manual"][2] = color_docs
|
||||
icons["pipe"][1] = "ﳣ"; icons["pipe"][2] = color_default
|
||||
icons["socket"][1] = "ﳧ"; icons["socket"][2] = color_default
|
||||
icons["manual"][1] = ""; icons["manual"][2] = color_docs
|
||||
icons["pipe"][1] = ""; icons["pipe"][2] = color_default
|
||||
icons["socket"][1] = ""; icons["socket"][2] = color_default
|
||||
icons["door"][1] = "➡"; icons["door"][2] = color_default
|
||||
|
||||
# top level and common icons
|
||||
icons[".git"][1] = ""; icons[".git"][2] = color_default
|
||||
icons["desktop"][1] = "ﲾ"; icons["desktop"][2] = color_default
|
||||
icons["briefcase"][1] = ""; icons["briefcase"][2] = color_default
|
||||
icons["document"][1] = ""; icons["document"][2] = color_default
|
||||
icons["downloads"][1] = ""; icons["downloads"][2] = color_default
|
||||
icons["music"][1] = ""; icons["music"][2] = color_default
|
||||
icons["musicfile"][1] = ""; icons["musicfile"][2] = color_audio
|
||||
icons["pictures"][1] = ""; icons["pictures"][2] = color_default
|
||||
icons["picturefile"][1] = ""; icons["picturefile"][2] = color_image
|
||||
icons["desktop"][1] = ""; icons["desktop"][2] = color_default
|
||||
icons["briefcase"][1] = ""; icons["briefcase"][2] = color_default
|
||||
icons["document"][1] = ""; icons["document"][2] = color_default
|
||||
icons["downloads"][1] = ""; icons["downloads"][2] = color_default
|
||||
icons["music"][1] = ""; icons["music"][2] = color_default
|
||||
icons["musicfile"][1] = ""; icons["musicfile"][2] = color_audio
|
||||
icons["pictures"][1] = ""; icons["pictures"][2] = color_default
|
||||
icons["picturefile"][1] = ""; icons["picturefile"][2] = color_image
|
||||
icons["public"][1] = ""; icons["public"][2] = color_default
|
||||
icons["templates"][1] = "陼"; icons["templates"][2] = color_default
|
||||
icons["videos"][1] = ""; icons["videos"][2] = color_default
|
||||
icons["videofile"][1] = "ﳜ"; icons["videofile"][2] = color_video
|
||||
icons["changelog"][1] = ""; icons["changelog"][2] = color_docs
|
||||
icons["templates"][1] = ""; icons["templates"][2] = color_default
|
||||
icons["videos"][1] = ""; icons["videos"][2] = color_default
|
||||
icons["videofile"][1] = ""; icons["videofile"][2] = color_video
|
||||
icons["changelog"][1] = ""; icons["changelog"][2] = color_docs
|
||||
icons["configure"][1] = ""; icons["configure"][2] = color_default
|
||||
icons["license"][1] = ""; icons["license"][2] = color_docs
|
||||
icons["makefile"][1] = ""; icons["makefile"][2] = color_default
|
||||
icons["archive"][1] = ""; icons["archive"][2] = color_archive
|
||||
icons["license"][1] = ""; icons["license"][2] = color_docs
|
||||
icons["makefile"][1] = ""; icons["makefile"][2] = color_default
|
||||
icons["archive"][1] = ""; icons["archive"][2] = color_archive
|
||||
icons["rust"][1] = ""; icons["rust"][2] = color_default
|
||||
icons["script"][1] = ""; icons["script"][2] = color_shell
|
||||
icons["subtitle"][1] = ""; icons["subtitle"][2] = color_default
|
||||
icons["cplusplus"][1] = ""; icons["cplusplus"][2] = color_c
|
||||
icons["java"][1] = ""; icons["java"][2] = color_java
|
||||
icons["clojure"][1] = ""; icons["clojure"][2] = color_default
|
||||
icons["js"][1] = ""; icons["js"][2] = color_js
|
||||
icons["linux"][1] = ""; icons["linux"][2] = color_default
|
||||
icons["js"][1] = ""; icons["js"][2] = color_js
|
||||
icons["linux"][1] = ""; icons["linux"][2] = color_default
|
||||
icons["elixir"][1] = ""; icons["elixir"][2] = color_fsharp
|
||||
icons["fsharp"][1] = ""; icons["fsharp"][2] = color_fsharp
|
||||
icons["ruby"][1] = ""; icons["ruby"][2] = color_ruby
|
||||
icons["c"][1] = ""; icons["c"][2] = color_c
|
||||
icons["chess"][1] = ""; icons["chess"][2] = color_default
|
||||
icons["chess"][1] = ""; icons["chess"][2] = color_default
|
||||
icons["haskell"][1] = ""; icons["haskell"][2] = color_vim
|
||||
icons["html"][1] = ""; icons["html"][2] = color_default
|
||||
icons["font"][1] = ""; icons["font"][2] = color_default
|
||||
icons["html"][1] = ""; icons["html"][2] = color_default
|
||||
icons["react"][1] = ""; icons["react"][2] = color_react
|
||||
icons["python"][1] = ""; icons["python"][2] = color_python
|
||||
icons["database"][1] = ""; icons["database"][2] = color_default
|
||||
icons["worddoc"][1] = ""; icons["worddoc"][2] = color_document
|
||||
icons["playlist"][1] = "蘿"; icons["playlist"][2] = color_audio
|
||||
icons["database"][1] = ""; icons["database"][2] = color_default
|
||||
icons["worddoc"][1] = ""; icons["worddoc"][2] = color_document
|
||||
icons["playlist"][1] = ""; icons["playlist"][2] = color_audio
|
||||
icons["opticaldisk"][1] = ""; icons["opticaldisk"][2] = color_archive
|
||||
|
||||
# numbers
|
||||
|
@ -140,6 +145,9 @@ awk 'BEGIN {
|
|||
icons["elf"][1] = icons["linux"][1]; icons["elf"][2] = icons["linux"][2]
|
||||
icons["epub"][1] = icons["manual"][1]; icons["epub"][2] = icons["manual"][2]
|
||||
icons["exe"][1] = icons["exec"][1]; icons["exe"][2] = icons["exec"][2]
|
||||
icons["ex"][1] = icons["elixir"][1]; icons["ex"][2] = icons["elixir"][2]
|
||||
icons["eex"][1] = icons["elixir"][1]; icons["eex"][2] = icons["elixir"][2]
|
||||
icons["exs"][1] = icons["elixir"][1]; icons["exs"][2] = icons["elixir"][2]
|
||||
|
||||
# f
|
||||
icons["fsharp"][1] = icons["fsharp"][1]; icons["fsharp"][2] = icons["fsharp"][2]
|
||||
|
@ -154,7 +162,7 @@ awk 'BEGIN {
|
|||
# g
|
||||
icons["gem"][1] = icons["ruby"][1]; icons["gem"][2] = icons["ruby"][2]
|
||||
icons["gif"][1] = icons["picturefile"][1]; icons["gif"][2] = icons["picturefile"][2]
|
||||
icons["go"][1] = "ﳑ"; icons["go"][2] = color_default
|
||||
icons["go"][1] = ""; icons["go"][2] = color_default
|
||||
icons["gz"][1] = icons["archive"][1]; icons["gz"][2] = icons["archive"][2]
|
||||
icons["gzip"][1] = icons["archive"][1]; icons["gzip"][2] = icons["archive"][2]
|
||||
|
||||
|
@ -167,12 +175,14 @@ awk 'BEGIN {
|
|||
icons["htpasswd"][1] = icons["configure"][1]; icons["htpasswd"][2] = icons["configure"][2]
|
||||
icons["htm"][1] = icons["html"][1]; icons["htm"][2] = icons["html"][2]
|
||||
icons["hxx"][1] = icons["cplusplus"][1]; icons["hxx"][2] = icons["cplusplus"][2]
|
||||
icons["heex"][1] = icons["elixir"][1]; icons["heex"][2] = icons["elixir"][2]
|
||||
|
||||
# i
|
||||
icons["ico"][1] = icons["picturefile"][1]; icons["ico"][2] = icons["picturefile"][2]
|
||||
icons["img"][1] = icons["opticaldisk"][1]; icons["img"][2] = icons["opticaldisk"][2]
|
||||
icons["ini"][1] = icons["configure"][1]; icons["ini"][2] = icons["configure"][2]
|
||||
icons["iso"][1] = icons["opticaldisk"][1]; icons["iso"][2] = icons["opticaldisk"][2]
|
||||
icons["isub"][1] = icons["subtitle"][1]; icons["isub"][2] = icons["subtitle"][2]
|
||||
|
||||
# j
|
||||
icons["jar"][1] = icons["java"][1]; icons["jar"][2] = icons["java"][2]
|
||||
|
@ -180,10 +190,12 @@ awk 'BEGIN {
|
|||
icons["jl"][1] = icons["configure"][1]; icons["jl"][2] = icons["configure"][2]
|
||||
icons["jpeg"][1] = icons["picturefile"][1]; icons["jpeg"][2] = icons["picturefile"][2]
|
||||
icons["jpg"][1] = icons["picturefile"][1]; icons["jpg"][2] = icons["picturefile"][2]
|
||||
icons["json"][1] = "ﬥ"; icons["json"][2] = color_js
|
||||
icons["json"][1] = ""; icons["json"][2] = color_js
|
||||
icons["jsx"][1] = icons["react"][1]; icons["jsx"][2] = icons["react"][2]
|
||||
icons["jxl"][1] = icons["picturefile"][1]; icons["jxl"][2] = icons["picturefile"][2]
|
||||
|
||||
# k
|
||||
icons["ksh"][1] = icons["font"][1]; icons["ksf"][2] = icons["font"][2]
|
||||
|
||||
# l
|
||||
icons["lha"][1] = icons["archive"][1]; icons["lha"][2] = icons["archive"][2]
|
||||
|
@ -194,7 +206,7 @@ awk 'BEGIN {
|
|||
icons["lzma"][1] = icons["archive"][1]; icons["lzma"][2] = icons["archive"][2]
|
||||
|
||||
# m
|
||||
icons["m"][1] = "ﴜ"; icons["mat"][2] = color_c
|
||||
icons["m"][1] = ""; icons["mat"][2] = color_c
|
||||
icons["m4a"][1] = icons["musicfile"][1]; icons["m4a"][2] = icons["musicfile"][2]
|
||||
icons["m4v"][1] = icons["videofile"][1]; icons["m4v"][2] = icons["videofile"][2]
|
||||
icons["mat"][1] = ""; icons["mat"][2] = color_c
|
||||
|
@ -207,7 +219,7 @@ awk 'BEGIN {
|
|||
icons["mp4"][1] = icons["videofile"][1]; icons["mp4"][2] = icons["videofile"][2]
|
||||
icons["mpeg"][1] = icons["videofile"][1]; icons["mpeg"][2] = icons["videofile"][2]
|
||||
icons["mpg"][1] = icons["videofile"][1]; icons["mpg"][2] = icons["videofile"][2]
|
||||
icons["msi"][1] = ""; icons["msi"][2] = color_default
|
||||
icons["msi"][1] = ""; icons["msi"][2] = color_default
|
||||
|
||||
# n
|
||||
icons["nix"][1] = ""; icons["nix"][2] = color_fsharp
|
||||
|
@ -216,17 +228,18 @@ awk 'BEGIN {
|
|||
icons["o"][1] = icons["manual"][1]; icons["o"][2] = icons["manual"][2]
|
||||
icons["ogg"][1] = icons["musicfile"][1]; icons["ogg"][2] = icons["musicfile"][2]
|
||||
icons["odownload"][1] = icons["download"][1]; icons["odownload"][2] = icons["download"][2]
|
||||
icons["otf"][1] = icons["font"][1]; icons["otf"][2] = icons["font"][2]
|
||||
icons["out"][1] = icons["linux"][1]; icons["out"][2] = icons["linux"][2]
|
||||
|
||||
# p
|
||||
icons["part"][1] = icons["download"][1]; icons["part"][2] = icons["download"][2]
|
||||
icons["patch"][1] = icons["diff"][1]; icons["patch"][2] = icons["diff"][2]
|
||||
icons["pdf"][1] = ""; icons["pdf"][2] = color_docs
|
||||
icons["pdf"][1] = ""; icons["pdf"][2] = color_docs
|
||||
icons["pgn"][1] = icons["chess"][1]; icons["pgn"][2] = icons["chess"][2]
|
||||
icons["php"][1] = ""; icons["php"][2] = color_default
|
||||
icons["png"][1] = icons["picturefile"][1]; icons["png"][2] = icons["picturefile"][2]
|
||||
icons["ppt"][1] = ""; icons["ppt"][2] = color_default
|
||||
icons["pptx"][1] = ""; icons["pptx"][2] = color_default
|
||||
icons["ppt"][1] = ""; icons["ppt"][2] = color_default
|
||||
icons["pptx"][1] = ""; icons["pptx"][2] = color_default
|
||||
icons["psb"][1] = ""; icons["psb"][2] = color_default
|
||||
icons["psd"][1] = ""; icons["psd"][2] = color_default
|
||||
icons["py"][1] = icons["python"][1]; icons["py"][2] = icons["python"][2]
|
||||
|
@ -239,10 +252,10 @@ awk 'BEGIN {
|
|||
# r
|
||||
icons["rar"][1] = icons["archive"][1]; icons["rar"][2] = icons["archive"][2]
|
||||
icons["rc"][1] = icons["configure"][1]; icons["rc"][2] = icons["configure"][2]
|
||||
icons["rom"][1] = ""; icons["rom"][2] = color_default
|
||||
icons["rom"][1] = ""; icons["rom"][2] = color_default
|
||||
icons["rpm"][1] = icons["archive"][1]; icons["rpm"][2] = icons["archive"][2]
|
||||
icons["rss"][1] = "參"; icons["rss"][2] = color_default
|
||||
icons["rtf"][1] = ""; icons["rtf"][2] = color_default
|
||||
icons["rss"][1] = ""; icons["rss"][2] = color_default
|
||||
icons["rtf"][1] = ""; icons["rtf"][2] = color_default
|
||||
|
||||
# s
|
||||
icons["sass"][1] = ""; icons["sass"][2] = color_css
|
||||
|
@ -253,18 +266,18 @@ awk 'BEGIN {
|
|||
icons["slim"][1] = icons["script"][1]; icons["slim"][2] = icons["script"][2]
|
||||
icons["sln"][1] = ""; icons["sln"][2] = color_default
|
||||
icons["sql"][1] = icons["database"][1]; icons["sql"][2] = icons["database"][2]
|
||||
icons["srt"][1] = ""; icons["srt"][2] = color_default
|
||||
icons["isub"][1] = ""; icons["isub"][2] = color_default
|
||||
icons["srt"][1] = icons["subtitle"][1]; icons["srt"][2] = icons["subtitle"][2]
|
||||
icons["svg"][1] = icons["picturefile"][1]; icons["svg"][2] = icons["picturefile"][2]
|
||||
|
||||
# t
|
||||
icons["tar"][1] = icons["archive"][1]; icons["tar"][2] = icons["archive"][2]
|
||||
icons["tex"][1] = ""; icons["tex"][2] = color_default
|
||||
icons["tex"][1] = ""; icons["tex"][2] = color_default
|
||||
icons["tgz"][1] = icons["archive"][1]; icons["tgz"][2] = icons["archive"][2]
|
||||
icons["ts"][1] = ""; icons["ts"][2] = color_js
|
||||
icons["tsx"][1] = icons["react"][1]; icons["tsx"][2] = icons["react"][2]
|
||||
icons["txt"][1] = icons["document"][1]; icons["txt"][2] = icons["document"][2]
|
||||
icons["txz"][1] = icons["archive"][1]; icons["txz"][2] = icons["archive"][2]
|
||||
icons["ttf"][1] = icons["font"][1]; icons["ttf"][2] = icons["font"][2]
|
||||
|
||||
# u
|
||||
|
||||
|
@ -272,7 +285,7 @@ awk 'BEGIN {
|
|||
icons["vid"][1] = icons["videofile"][1]; icons["vid"][2] = icons["videofile"][2]
|
||||
icons["vim"][1] = ""; icons["vim"][2] = color_vim
|
||||
icons["vimrc"][1] = ""; icons["vimrc"][2] = color_vim
|
||||
icons["vtt"][1] = ""; icons["vtt"][2] = color_default
|
||||
icons["vtt"][1] = icons["subtitle"][1]; icons["vtt"][2] = icons["subtitle"][2]
|
||||
# w
|
||||
icons["wav"][1] = icons["musicfile"][1]; icons["wav"][2] = icons["musicfile"][2]
|
||||
icons["webm"][1] = icons["videofile"][1]; icons["webm"][2] = icons["videofile"][2]
|
||||
|
@ -283,8 +296,8 @@ awk 'BEGIN {
|
|||
icons["xbps"][1] = icons["archive"][1]; icons["xbps"][2] = color_archive
|
||||
icons["xcf"][1] = icons["picturefile"][1]; icons["xcf"][2] = color_image
|
||||
icons["xhtml"][1] = icons["html"][1]; icons["xhtml"][2] = icons["html"][2]
|
||||
icons["xls"][1] = ""; icons["xls"][2] = color_default
|
||||
icons["xlsx"][1] = ""; icons["xlsx"][2] = color_default
|
||||
icons["xls"][1] = ""; icons["xls"][2] = color_default
|
||||
icons["xlsx"][1] = ""; icons["xlsx"][2] = color_default
|
||||
icons["xml"][1] = icons["html"][1]; icons["xml"][2] = icons["html"][2]
|
||||
icons["xz"][1] = icons["archive"][1]; icons["xz"][2] = icons["archive"][2]
|
||||
|
||||
|
|
41
plugins/.nmv
41
plugins/.nmv
|
@ -17,27 +17,28 @@
|
|||
# Shell: bash
|
||||
# Author: KlzXS
|
||||
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
. "$(dirname "$0")"/.nnn-plugin-helper
|
||||
|
||||
EDITOR="${EDITOR:-vi}"
|
||||
TMPDIR="${TMPDIR:-/tmp}"
|
||||
INCLUDE_HIDDEN="${INCLUDE_HIDDEN:-0}"
|
||||
NNN_INCLUDE_HIDDEN="${NNN_INCLUDE_HIDDEN:-0}"
|
||||
VERBOSE="${VERBOSE:-0}"
|
||||
RECURSIVE="${RECURSIVE:-0}"
|
||||
|
||||
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
||||
case "$NNN_TRASH" in
|
||||
1)
|
||||
RM_UTIL="trash-put" ;;
|
||||
2)
|
||||
RM_UTIL="gio trash" ;;
|
||||
*)
|
||||
RM_UTIL="rm -ri --" ;;
|
||||
esac
|
||||
|
||||
exit_status=0
|
||||
|
||||
dst_file=$(mktemp "$TMPDIR/.nnnXXXXXX")
|
||||
|
||||
if [ -s "$selection" ]; then
|
||||
printf "Rename 'c'urrent / 's'election? "
|
||||
read -r resp
|
||||
|
||||
if ! [ "$resp" = "c" ] && ! [ "$resp" = "s" ]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$resp" = "s" ]; then
|
||||
if nnn_use_selection "Rename"; then
|
||||
# shellcheck disable=SC2154
|
||||
arr=$(tr '\0' '\n' < "$selection")
|
||||
else
|
||||
findcmd="find . ! -name ."
|
||||
|
@ -46,7 +47,7 @@ else
|
|||
findcmd="$findcmd -prune"
|
||||
fi
|
||||
|
||||
if [ "$INCLUDE_HIDDEN" -eq 0 ]; then
|
||||
if [ "$NNN_INCLUDE_HIDDEN" -eq 0 ]; then
|
||||
findcmd="$findcmd ! -name \".*\""
|
||||
fi
|
||||
|
||||
|
@ -62,6 +63,9 @@ fi
|
|||
lines=$(printf "%s\n" "$arr" | wc -l)
|
||||
width=${#lines}
|
||||
|
||||
dst_file=$(mktemp "$TMPDIR/.nnnXXXXXX")
|
||||
trap 'rm -f -- "$dst_file"' EXIT
|
||||
|
||||
printf "%s" "$arr" | awk '{printf("%'"${width}"'d %s\n", NR, $0)}' > "$dst_file"
|
||||
|
||||
items=("~")
|
||||
|
@ -118,7 +122,7 @@ while read -r num name; do
|
|||
tmp="$tmp~$c"
|
||||
done
|
||||
|
||||
if mv "$name" "$tmp"; then
|
||||
if mv -- "$name" "$tmp"; then
|
||||
if [ "$VERBOSE" -ne 0 ]; then
|
||||
printf "'%s' -> '%s'\n" "$name" "$tmp"
|
||||
fi
|
||||
|
@ -138,7 +142,7 @@ while read -r num name; do
|
|||
if [ ! -d "$dir" ] && ! mkdir -p "$dir"; then
|
||||
printf "%s: failed to create directory tree %s\n" "$0" "$dir" > /dev/stderr
|
||||
exit_status=1
|
||||
elif ! mv -i "$src" "$name"; then
|
||||
elif ! mv -i -- "$src" "$name"; then
|
||||
printf "%s: failed to rename %s to %s: %s\n" "$0" "$name" "$tmp" "$!" > /dev/stderr
|
||||
exit_status=1
|
||||
else
|
||||
|
@ -164,8 +168,7 @@ done <"$dst_file"
|
|||
|
||||
unset "items[0]"
|
||||
for item in "${items[@]}"; do
|
||||
rm -ri "$item"
|
||||
$RM_UTIL "$item"
|
||||
done
|
||||
|
||||
rm "$dst_file"
|
||||
exit $exit_status
|
||||
|
|
|
@ -12,6 +12,9 @@ export selection
|
|||
CUR_CTX=0
|
||||
export CUR_CTX
|
||||
|
||||
NNN_PREFER_SELECTION="${NNN_PREFER_SELECTION:-0}"
|
||||
export NNN_PREFER_SELECTION
|
||||
|
||||
## Ask nnn to switch to directory $1 in context $2.
|
||||
## If $2 is not provided, the function asks explicitly.
|
||||
nnn_cd () {
|
||||
|
@ -36,3 +39,23 @@ cmd_exists () {
|
|||
type "$1" > /dev/null 2>&1
|
||||
echo $?
|
||||
}
|
||||
|
||||
nnn_use_selection() {
|
||||
if ! [ -s "$selection" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$NNN_PREFER_SELECTION" -eq 1 ]; then
|
||||
return 0
|
||||
else
|
||||
[ -n "$1" ] && printf "%s " "$1"
|
||||
printf "(s)election/(c)urrent? [default=c] "
|
||||
read -r resp__
|
||||
|
||||
if [ "$resp__" = "s" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -13,9 +13,11 @@ Plugins extend the capabilities of `nnn`. They are _executable_ scripts (or bina
|
|||
|
||||
| Plugin (a-z) | Description [Clears selection<sup>1</sup>] | Lang | Dependencies |
|
||||
| --- | --- | --- | --- |
|
||||
| [autojump](autojump) | Navigate to dir/path | sh | [jump](https://github.com/gsamokovarov/jump)/autojump/<br>zoxide/z (needs fzf) |
|
||||
| [autojump](autojump) | Navigate to dir/path | sh | [jump](https://github.com/gsamokovarov/jump)/autojump/<br>zoxide/z/[z.lua](https://github.com/skywind3000/z.lua) |
|
||||
| [boom](boom) | Play random music from dir | sh | [moc](http://moc.daper.net/) |
|
||||
| [bulknew](bulknew) | Create multiple files/dirs at once | bash | sed, xargs, mktemp |
|
||||
| [cbcopy-mac](cbcopy-mac) | Copy the hovered file to MacOS clipboard | applescript | macos |
|
||||
| [cbpaste-mac](cbpaste-mac) | Pastes files from MacOS clipboard into currect directory | macos |
|
||||
| [cdpath](cdpath) | `cd` to the directory from `CDPATH` | sh | fzf |
|
||||
| [chksum](chksum) | Create and verify checksums [✓] | sh | md5sum,<br>sha256sum |
|
||||
| [cmusq](cmusq) | Queue/play files/dirs in cmus player [✓] | sh | cmus, pgrep |
|
||||
|
@ -29,23 +31,26 @@ Plugins extend the capabilities of `nnn`. They are _executable_ scripts (or bina
|
|||
| [fzopen](fzopen) | Fuzzy find file(s) in subtree to edit/open/pick | sh | fzf, xdg-open/open |
|
||||
| [fzplug](fzplug) | Fuzzy find, preview and run other plugins | sh | fzf |
|
||||
| [getplugs](getplugs) | Update plugins to installed `nnn` version | sh | curl |
|
||||
| [gpg\*](gpg\*) | Encrypt/decrypt files using GPG [✓] | sh | gpg |
|
||||
| [gitroot](gitroot) | Cd to the root of current git repo | sh | git |
|
||||
| [gpge](gpge) | Encrypt/decrypt files using GPG [✓] | sh | gpg |
|
||||
| [gutenread](gutenread) | Browse, download, read from Project Gutenberg | sh | curl, unzip, w3m<br>[epr](https://github.com/wustho/epr) (optional) |
|
||||
| [gsconnect](gsconnect) | GNOME's implementation of kdeconnect [✓] | sh | gsconnect |
|
||||
| [imgresize](imgresize) | Batch resize images in dir to screen resolution | sh | [imgp](https://github.com/jarun/imgp) |
|
||||
| [imgur](imgur) | Upload an image to imgur (from [imgur-screenshot](https://github.com/jomo/imgur-screenshot)) | bash | - |
|
||||
| [imgview](imgview) | View (thumbnail)images, set wallpaper, [rename](https://github.com/jarun/nnn/wiki/Basic-use-cases#browse-rename-images) and [more](https://wiki.archlinux.org/index.php/Sxiv#Assigning_keyboard_shortcuts)| sh | _see in-file docs_ |
|
||||
| [ipinfo](ipinfo) | Fetch external IP address and whois information | sh | curl, whois |
|
||||
| [kdeconnect](kdeconnect) | Send selected files to an Android device [✓] | sh | kdeconnect-cli |
|
||||
| [launch](launch) | GUI application launcher | sh | fzf |
|
||||
| [mimelist](mimelist) | List files by mime in subtree | sh | - |
|
||||
| [mimelist](mimelist) | List files by mime in subtree | sh | file/mimetype |
|
||||
| [moclyrics](moclyrics) | Show lyrics of the track playing in moc | sh | [ddgr](https://github.com/jarun/ddgr), [moc](http://moc.daper.net/) |
|
||||
| [mocq](mocq) | Queue/play selection/dir/file in moc [✓] | sh | [moc](http://moc.daper.net/) |
|
||||
| [mp3conv](mp3conv) | Extract audio from multimedia as mp3 | sh | ffmpeg |
|
||||
| [mtpmount](mtpmount) | Toggle mount of MTP device (eg. Android) | sh | gvfs-mtp |
|
||||
| [nbak](nbak) | Backs up `nnn` config | sh | tar, awk, mktemp |
|
||||
| [nmount](nmount) | Toggle mount status of a device as normal user | sh | pmount, udisks2 |
|
||||
| [nmount](nmount) | Toggle mount status of a device as normal user | sh | pmount (optional), udisks2 |
|
||||
| [nuke](nuke) | Sample file opener (CLI-only by default) | sh | _see in-file docs_ |
|
||||
| [oldbigfile](oldbigfile) | List large files by access time | sh | find, sort |
|
||||
| [openall](openall) | Open selected files together or one by one [✓] | bash | - |
|
||||
| [organize](organize) | Auto-organize files in directories by file type [✓] | sh | file |
|
||||
| [pdfread](pdfread) | Read a PDF or text file aloud | sh | pdftotext, mpv,<br>pico2wave |
|
||||
| [preview-tabbed](preview-tabbed) | Preview files with Tabbed/xembed | bash | _see in-file docs_ |
|
||||
|
@ -59,23 +64,24 @@ Plugins extend the capabilities of `nnn`. They are _executable_ scripts (or bina
|
|||
| [togglex](togglex) | Toggle executable mode for selection [✓] | sh | chmod |
|
||||
| [umounttree](umounttree) | Unmount a remote mountpoint from within | sh | fusermount |
|
||||
| [upload](upload) | Upload to Firefox Send or ix.io (text) or file.io (bin) | sh | [ffsend](https://github.com/timvisee/ffsend), curl, jq, tr |
|
||||
| [wallpaper](wall) | Set wallpaper or change colorscheme | sh | nitrogen/pywal |
|
||||
| [wallpaper](wallpaper) | Set wallpaper or change colorscheme | sh | nitrogen/pywal |
|
||||
| [x2sel](x2sel) | Copy file list from system clipboard to selection | sh | _see in-file docs_ |
|
||||
| [xdgdefault](xdgdefault) | Set the default app for the hovered file type | sh | xdg-utils, fzf/dmenu |
|
||||
|
||||
Note:
|
||||
Notes:
|
||||
|
||||
1. A plugin has to explicitly request `nnn` to clear the selection e.g. after operating on the selected files.
|
||||
2. Files starting with a dot in the `plugins` directory are internal files and should not be used as plugins.
|
||||
|
||||
### Table of contents
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Configuration](#configuration)
|
||||
- [Skip directory refresh after running a plugin](#skip-directory-refresh-after-running-a-plugin)
|
||||
- [Running commands as plugin](#running-commands-as-plugin)
|
||||
- [Skip user confirmation after command execution](#skip-user-confirmation-after-command-execution)
|
||||
- [Run a GUI app as plugin](#run-a-gui-app-as-plugin)
|
||||
- [Page non-interactive command output](#page-non-interactive-command-output)
|
||||
- [Skip directory refresh after running a plugin](#skip-directory-refresh-after-running-a-plugin--)
|
||||
- [Running commands as plugin](#running-commands-as-plugin-)
|
||||
- [Skip user confirmation after command execution](#skip-user-confirmation-after-command-execution-)
|
||||
- [Run a GUI app as plugin](#run-a-gui-app-as-plugin-)
|
||||
- [Page non-interactive command output](#page-non-interactive-command-output-)
|
||||
- [Some useful key-command examples](#some-useful-key-command-examples)
|
||||
- [Access level of plugins](#access-level-of-plugins)
|
||||
- [Create your own plugins](#create-your-own-plugins)
|
||||
|
@ -89,7 +95,7 @@ Note:
|
|||
The following command installs or updates (after backup) all plugins:
|
||||
|
||||
```sh
|
||||
curl -Ls https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs | sh
|
||||
sh -c "$(curl -Ls https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs)"
|
||||
```
|
||||
|
||||
Plugins are installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`.
|
||||
|
@ -99,7 +105,7 @@ Plugins are installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`.
|
|||
Set environment variable `NNN_PLUG` to assign keybinds and invoke plugins directly using the plugin shortcut (<kbd>;</kbd>) followed by the assigned key character. E.g., with the below config:
|
||||
|
||||
```sh
|
||||
export NNN_PLUG='f:finder;o:fzopen;p:mocplay;d:diffs;t:nmount;v:imgview'
|
||||
export NNN_PLUG='f:finder;o:fzopen;p:mocq;d:diffs;t:nmount;v:imgview'
|
||||
```
|
||||
|
||||
plugin `finder` can be invoked with the keybind <kbd>;f</kbd>, `fzopen` can be run with <kbd>;o</kbd> and so on... The key vs. plugin pairs are shown in the help and config screen.
|
||||
|
@ -115,7 +121,7 @@ If the plugins list gets too long, try breaking them up into sections:
|
|||
```
|
||||
NNN_PLUG_PERSONAL='g:personal/convert2zoom;p:personal/echo'
|
||||
NNN_PLUG_WORK='j:work/prettyjson;d:work/foobar'
|
||||
NNN_PLUG_INLINE='e:!go run $nnn*'
|
||||
NNN_PLUG_INLINE='e:!go run "$nnn"*'
|
||||
NNN_PLUG_DEFAULT='1:ipinfo;p:preview-tui;o:fzz;b:nbak'
|
||||
NNN_PLUG="$NNN_PLUG_PERSONAL;$NNN_PLUG_WORK;$NNN_PLUG_DEFAULT;$NNN_PLUG_INLINE"
|
||||
export NNN_PLUG
|
||||
|
@ -127,7 +133,7 @@ Note:
|
|||
- A keybinding definition of more than 1 character will prevent nnn from starting.
|
||||
|
||||
|
||||
#### Skip directory refresh after running a plugin
|
||||
#### Skip directory refresh after running a plugin [`-`]
|
||||
|
||||
`nnn` refreshes the directory after running a plugin to reflect any changes by the plugin. To disable this add a `-` before the plugin name:
|
||||
|
||||
|
@ -135,68 +141,67 @@ Note:
|
|||
export NNN_PLUG='p:-plugin'
|
||||
```
|
||||
|
||||
## Running commands as plugin
|
||||
## Running commands as plugin [`!`]
|
||||
|
||||
To assign keys to arbitrary non-background cli commands and invoke like plugins, add `!` (underscore) before the command.
|
||||
To assign keys to arbitrary non-background cli commands and invoke like plugins, add `!` before the command.
|
||||
|
||||
```sh
|
||||
export NNN_PLUG='x:!chmod +x $nnn;g:!git log;s:!smplayer $nnn'
|
||||
export NNN_PLUG='x:!chmod +x "$nnn";g:!git log;s:!smplayer "$nnn"'
|
||||
```
|
||||
|
||||
Now <kbd>;x</kbd> can be used to make a file executable, <kbd>;g</kbd> can be used to the git log of a git project directory, <kbd>;s</kbd> can be used to preview a partially downloaded media file.
|
||||
|
||||
#### Skip user confirmation after command execution
|
||||
#### Skip user confirmation after command execution [`*`]
|
||||
|
||||
`nnn` waits for user confirmation (the prompt `Press Enter to continue`) after it executes a command as plugin (unlike plugins which can add a `read` to wait). To skip this, add a `*` after the command.
|
||||
|
||||
```sh
|
||||
export NNN_PLUG='s:!smplayer $nnn*;n:-!vim /home/vaio/Dropbox/Public/synced_note*'
|
||||
export NNN_PLUG='s:!smplayer "$nnn"*;n:-!vim /home/vaio/Dropbox/Public/synced_note*'
|
||||
```
|
||||
|
||||
Now there will be no prompt after <kbd>;s</kbd> and <kbd>;n</kbd>.
|
||||
|
||||
Note: Do not use `*` with programs those run and exit e.g. cat.
|
||||
Note: Do not use `*` with programs that run and exit e.g. cat.
|
||||
|
||||
#### Run a GUI app as plugin
|
||||
#### Run a GUI app as plugin [`&`]
|
||||
|
||||
To run a GUI app as plugin, add a `&` after `!`.
|
||||
|
||||
```sh
|
||||
export NNN_PLUG='m:-!&mousepad $nnn'
|
||||
export NNN_PLUG='m:-!&mousepad "$nnn"'
|
||||
```
|
||||
|
||||
Note: `$nnn` must be the last argument in this case.
|
||||
|
||||
#### Page non-interactive command output
|
||||
#### Page non-interactive command output [`|`]
|
||||
|
||||
To show the output of run-and-exit commands which do not need user input, add `|` (pipe) after `!`.
|
||||
|
||||
```sh
|
||||
export NNN_PLUG='m:-!|mediainfo $nnn;t:-!|tree -ps;l:-!|ls -lah --group-directories-first'
|
||||
export NNN_PLUG='m:-!|mediainfo "$nnn";t:-!|tree -ps;l:-!|ls -lah --group-directories-first'
|
||||
```
|
||||
|
||||
This option is incompatible with `&` (terminal output is masked for GUI programs) and ignores `*` (output is already paged for user).
|
||||
|
||||
Notes:
|
||||
|
||||
1. Use single quotes for `$NNN_PLUG` so `$nnn` is not interpreted
|
||||
2. (_Again_) add `!` before the command
|
||||
3. To disable directory refresh after running a _command as plugin_, prefix with `-!`
|
||||
1. Place `$nnn` (or exported variables) in double quotes (**`"$nnn"`**)
|
||||
2. Use single quotes for `$NNN_PLUG` so `"$nnn"` is not interpreted
|
||||
3. (_Again_) add `!` before the command
|
||||
4. To disable directory refresh after running a _command as plugin_, prefix with `-!`
|
||||
|
||||
#### Some useful key-command examples
|
||||
|
||||
| Key:Command | Description |
|
||||
|---|---|
|
||||
| `c:!convert $nnn png:- \| xclip -sel clipboard -t image/png*` | Copy image to clipboard |
|
||||
| `e:-!sudo -E vim $nnn*` | Edit file as root in vim |
|
||||
| `c:!convert "$nnn" png:- \| xclip -sel clipboard -t image/png*` | Copy image to clipboard |
|
||||
| `C:!cp -rv "$nnn" "$nnn".cp` | Create a copy of the hovered file |
|
||||
| `e:-!sudo -E vim "$nnn"*` | Edit file as root in vim |
|
||||
| `g:-!git diff` | Show git diff |
|
||||
| `h:-!hx $nnn*` | Open hovered file in [hx](https://github.com/krpors/hx) hex editor |
|
||||
| `k:-!fuser -kiv $nnn*` | Interactively kill process(es) using hovered file |
|
||||
| `h:-!hx "$nnn"*` | Open hovered file in [hx](https://github.com/krpors/hx) hex editor |
|
||||
| `k:-!fuser -kiv "$nnn"*` | Interactively kill process(es) using hovered file |
|
||||
| `l:-!git log` | Show git log |
|
||||
| `n:-!vi /home/user/Dropbox/dir/note*` | Take quick notes in a synced file/dir of notes |
|
||||
| `p:-!less -iR $nnn*` | Page through hovered file in less |
|
||||
| `s:-!&smplayer -minigui $nnn` | Play hovered media file, even unfinished download |
|
||||
| `x:!chmod +x $nnn` | Make the hovered file executable |
|
||||
| `p:-!less -iR "$nnn"*` | Page through hovered file in less |
|
||||
| `s:-!&smplayer -minigui "$nnn"` | Play hovered media file, even unfinished download |
|
||||
| `x:!chmod +x "$nnn"` | Make the hovered file executable |
|
||||
| `y:-!sync*` | Flush cached writes |
|
||||
|
||||
## Access level of plugins
|
||||
|
@ -208,6 +213,8 @@ When `nnn` executes a plugin, it does the following:
|
|||
2. `$2`: The working directory (might differ from `$PWD` in case of symlinked paths; non-canonical).
|
||||
3. `$3`: The picker mode output file (`-` for stdout) if `nnn` is executed as a file picker.
|
||||
- Sets the environment variable `NNN_PIPE` used to control `nnn` active directory.
|
||||
- Sets the environment variable `NNN_INCLUDE_HIDDEN` to `1` if hidden files are active, `0` otherwise.
|
||||
- Sets the environment variable `NNN_PREFER_SELECTION` to `1` if user prefers to use selection (see nnn's `-u` flag), `0` otherwise.
|
||||
- Exports the [special variables](https://github.com/jarun/nnn/wiki/Concepts#special-variables).
|
||||
|
||||
Plugins can also read the `.selection` file in the config directory.
|
||||
|
@ -226,6 +233,7 @@ The plugin should write a single string in the format `(<->)<ctxcode><opcode><da
|
|||
The optional `-` at the **beginning of the stream** instructs `nnn` to clear the selection.
|
||||
In cases where the data transfer to `nnn` has to happen while the selection file is being read (e.g. in a loop), the plugin should
|
||||
create a tmp copy of the selection file, inform `nnn` to clear the selection and then do the subsequent processing with the tmp file.
|
||||
A paged [`|`] or GUI [`&`] cmd run as plugin cannot clear selection.
|
||||
|
||||
The `ctxcode` indicates the context to change the active directory of.
|
||||
|
||||
|
@ -313,6 +321,23 @@ done < "$NNN_FIFO" &
|
|||
disown
|
||||
```
|
||||
|
||||
#### Quick `find` the first match in subtree and open in `nuke`
|
||||
|
||||
```sh
|
||||
#!/usr/bin/env sh
|
||||
|
||||
NUKE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/nuke"
|
||||
|
||||
printf "file name: "
|
||||
read -r pattern
|
||||
|
||||
entry=$(find . -type f -iname "$pattern" -print -quit 2>/dev/null)
|
||||
|
||||
if [ -n "$entry" ]; then
|
||||
"$NUKE" "$entry"
|
||||
fi
|
||||
```
|
||||
|
||||
#### Quick find (using `fd`)
|
||||
|
||||
```sh
|
||||
|
@ -345,10 +370,14 @@ if [ -n "$pattern" ]; then
|
|||
fi
|
||||
```
|
||||
|
||||
#### Change directory
|
||||
|
||||
NNN_PLUG='c:!read -r to && [ -n "$to" ] && printf "0c%s" "${to}" > "$NNN_PIPE"*'
|
||||
|
||||
## Contributing plugins
|
||||
|
||||
1. Add informative sections like _Description_, _Notes_, _Dependencies_, _Shell_, _Author_ etc. in the plugin.
|
||||
2. Add an entry in the table above.
|
||||
2. Add an entry in the table above. Note that the list is alphabetically ordered by plugin name.
|
||||
3. Keep non-portable commands (like `notify-send`) commented so users from any other OS/DE aren't surprised.
|
||||
4. The plugin file should be executable.
|
||||
5. If your plugin stores data, use `${XDG_CACHE_HOME:-$HOME/.cache}/nnn`. Document it _in-file_.
|
||||
|
|
|
@ -8,9 +8,12 @@
|
|||
# - OR zoxide - https://github.com/ajeetdsouza/zoxide
|
||||
# - OR z - https://github.com/rupa/z (z requires fzf)
|
||||
# - OR z (fish) - https://github.com/jethrokuan/z (z requires fzf)
|
||||
# - OR z.lua - https://github.com/skywind3000/z.lua (z.lua can enhanced with fzf)
|
||||
#
|
||||
# Note: The dependencies STORE NAVIGATION PATTERNS
|
||||
#
|
||||
# to make z.lua work, you need to set $NNN_ZLUA to the path of script z.lua
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Authors: Marty Buchaus, Dave Snider, Tim Adler, Nick Waywood
|
||||
|
||||
|
@ -41,6 +44,16 @@ elif type zoxide >/dev/null 2>&1; then
|
|||
odir="$(zoxide query -- "$dir")"
|
||||
printf "%s" "0c$odir" > "$NNN_PIPE"
|
||||
fi
|
||||
elif type lua >/dev/null 2>&1 && [ -n "$NNN_ZLUA" ]; then
|
||||
printf "jump to : "
|
||||
read -r line
|
||||
if type fzf >/dev/null 2>&1; then
|
||||
odir="$(lua "$NNN_ZLUA" -l "$line" | fzf --nth 2.. --reverse --inline-info --tac +s -e --height 35%)"
|
||||
printf "%s" "0c$(echo "$odir" | awk '{print $2}')" > "$NNN_PIPE"
|
||||
else
|
||||
odir="$(lua "$NNN_ZLUA" -e "$line")"
|
||||
printf "%s" "0c$odir" > "$NNN_PIPE"
|
||||
fi
|
||||
else
|
||||
# rupa/z uses $_Z_DATA, jethrokuan/z (=port of z for fish) uses $Z_DATA
|
||||
datafile="${_Z_DATA:-${Z_DATA:-$HOME/.z}}"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# Shell: POSIX compliant
|
||||
# Author: Arun Prakash Jana
|
||||
|
||||
GUIPLAYER="${GUIPLAYER}"
|
||||
GUIPLAYER="${GUIPLAYER:-""}"
|
||||
NUMTRACKS="${NUMTRACKS:-100}"
|
||||
|
||||
if [ -n "$GUIPLAYER" ]; then
|
||||
|
|
|
@ -29,4 +29,4 @@ $EDITOR "$tmpfile"
|
|||
|
||||
sed "/^\//d" "$tmpfile" | xargs -n1 -I{} sh -c "$cmd"
|
||||
|
||||
rm "$tmpfile"
|
||||
rm -- "$tmpfile"
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/osascript
|
||||
|
||||
# Description: Copy the hovered file to MacOS clipboard.
|
||||
#
|
||||
# Note: Supports only MacOS
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: Syed Umar Anis
|
||||
|
||||
|
||||
on run args
|
||||
set filePath to (second item of args & "/" & first item of args)
|
||||
tell application "Finder"
|
||||
set the clipboard to (filePath as POSIX file)
|
||||
end tell
|
||||
end
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env sh
|
||||
# shellcheck disable=all
|
||||
|
||||
# Description: Paste the clipboard files into the current directory.
|
||||
# Only works if clipboard contents are files.
|
||||
#
|
||||
# Note: Supports only MacOS
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: Syed Umar Anis
|
||||
|
||||
|
||||
fs=($( osascript -e "use framework \"Foundation\"
|
||||
property this : a reference to the current application
|
||||
property NSPasteboard : a reference to NSPasteboard of this
|
||||
property NSURL : a reference to NSURL of this
|
||||
property pb : a reference to NSPasteboard's generalPasteboard
|
||||
|
||||
property text item delimiters : linefeed
|
||||
|
||||
pb's readObjectsForClasses:[NSURL] options:[]
|
||||
(result's valueForKey:\"path\") as list as text" ))
|
||||
|
||||
cp -R -- "${fs[@]}" "$2/"
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Description: 'cd' to the directory from CDPATH
|
||||
#
|
||||
# Details: If the CDPATH environmet variable is not set, the default value of
|
||||
# Details: If the CDPATH environment variable is not set, the default value of
|
||||
# ${XDG_CONFIG_HOME:-$HOME/.config}/nnn/bookmarks will be used.
|
||||
# You can create this directory and fill it with symbolic links to your
|
||||
# favorite directories. It's a good idea to add it to CDPATH so that it
|
||||
|
@ -16,6 +16,7 @@
|
|||
# Shell: POSIX compliant
|
||||
# Author: Yuri Kloubakov
|
||||
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
. "$(dirname "$0")"/.nnn-plugin-helper
|
||||
|
||||
# Get a list of (symbolic links to) directories for every element of CDPATH
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
# Description: Create and verify checksums
|
||||
#
|
||||
# Note: On macOS, install the relevant checksum packages from Homebrew with:
|
||||
# brew install coreutils
|
||||
#
|
||||
# Details:
|
||||
# - selection: it will generate one file with the checksums and filenames
|
||||
# (and with paths if they are in another directory)
|
||||
|
@ -58,7 +61,7 @@ elif [ -n "$1" ]; then
|
|||
if echo "$1" | grep -q \.${chks}$; then
|
||||
${chks}sum -c < "$1"
|
||||
read -r _
|
||||
return
|
||||
exit
|
||||
fi
|
||||
done
|
||||
checksum_type
|
||||
|
|
|
@ -25,7 +25,7 @@ dirdiff() {
|
|||
ls -A1 "$1" > "$dir1"
|
||||
ls -A1 "$2" > "$dir2"
|
||||
$diffcmd "$dir1" "$dir2"
|
||||
rm "$dir1" "$dir2"
|
||||
rm -- "$dir1" "$dir2"
|
||||
}
|
||||
|
||||
if [ -s "$selection" ]; then
|
||||
|
|
|
@ -19,6 +19,8 @@ resp=f
|
|||
all=
|
||||
if type dragon-drag-and-drop >/dev/null 2>&1; then
|
||||
dnd="dragon-drag-and-drop"
|
||||
elif type dragon-drop >/dev/null 2>&1; then
|
||||
dnd="dragon-drop"
|
||||
else
|
||||
dnd="dragon"
|
||||
fi
|
||||
|
|
18
plugins/dups
18
plugins/dups
|
@ -28,17 +28,17 @@ printf "\
|
|||
" > "$tmpfile"
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
find . -size +0 -type f -printf "%${size_digits}s %p\n" | sort -rn | uniq -w"${size_digits}" -D | sed -E '
|
||||
s/^ {,12}([0-9]{,12}) (.*)$/printf "%s %s\\n" "$(md5sum "\2")" "d\1"/
|
||||
' | tr '\n' '\0' | xargs -0 -n1 sh -c | sort | { uniq -w32 --all-repeated=separate; echo; } | sed -nE '
|
||||
find . -size +0 -type f -printf "%${size_digits}s %p\n" | sort -rn | uniq -w"${size_digits}" -D | sed -e '
|
||||
s/^ \{0,12\}\([0-9]\{0,12\}\) \(.*\)$/printf "%s %s\\n" "$(md5sum "\2")" "d\1"/
|
||||
' | tr '\n' '\0' | xargs -0 -n1 sh -c | sort | { uniq -w32 --all-repeated=separate; echo; } | sed -ne '
|
||||
h
|
||||
s/^(.{32}).* d([0-9]*)$/## md5sum: \1 size: \2 bytes/p
|
||||
s/^\(.\{32\}\).* d\([0-9]*\)$/## md5sum: \1 size: \2 bytes/p
|
||||
g
|
||||
|
||||
:loop
|
||||
N
|
||||
/.*\n$/!b loop
|
||||
p' | sed -E 's/^.{32} (.*) d[0-9]*$/\1/' >> "$tmpfile"
|
||||
p' | sed -e 's/^.\{32\} \(.*\) d[0-9]*$/\1/' >> "$tmpfile"
|
||||
|
||||
"$EDITOR" "$tmpfile"
|
||||
|
||||
|
@ -46,7 +46,7 @@ printf "Remove commented files? (yes/no) [default=n]: "
|
|||
read -r commented
|
||||
|
||||
if [ "$commented" = "y" ]; then
|
||||
sedcmd="/^(##|[^#]).*/d; /^$/d; s/^# *(.*)$/\1/"
|
||||
sedcmd="/^##.*/d; /^[^#].*/d; /^$/d; s/^# *\(.*\)$/\1/"
|
||||
else
|
||||
printf "Press any key to exit"
|
||||
read -r _
|
||||
|
@ -58,13 +58,13 @@ read -r force
|
|||
|
||||
if [ "$force" = "f" ]; then
|
||||
#shellcheck disable=SC2016
|
||||
sed -E "$sedcmd" "$tmpfile" | tr '\n' '\0' | xargs -0 -r sh -c 'rm -f "$0" "$@" </dev/tty'
|
||||
sed -e "$sedcmd" "$tmpfile" | tr '\n' '\0' | xargs -0 -r sh -c 'rm -f -- "$0" "$@" </dev/tty'
|
||||
else
|
||||
#shellcheck disable=SC2016
|
||||
sed -E "$sedcmd" "$tmpfile" | tr '\n' '\0' | xargs -0 -r sh -c 'rm -i "$0" "$@" </dev/tty'
|
||||
sed -e "$sedcmd" "$tmpfile" | tr '\n' '\0' | xargs -0 -r sh -c 'rm -i -- "$0" "$@" </dev/tty'
|
||||
fi
|
||||
|
||||
rm "$tmpfile"
|
||||
rm -- "$tmpfile"
|
||||
|
||||
printf "Press any key to exit"
|
||||
read -r _
|
||||
|
|
|
@ -55,7 +55,7 @@ readexpr() {
|
|||
[ -n "$fexpr" ] && readexpr ;;
|
||||
\$*) cmd="${fexpr:1}" ;;
|
||||
*) mapexpr && readexpr
|
||||
cmd="find $fexpr -print0" ;;
|
||||
cmd="find . $fexpr -print0" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,6 @@ if [ -n "$fexpr" ]; then
|
|||
if [ -n "$fexpr" ]; then
|
||||
tail -n"$NNN_FINDHISTLEN" "$NNN_FINDHIST" > "$TMPDIR/finderbms"
|
||||
printf "%s\n" "$fexpr" >> "$TMPDIR/finderbms"
|
||||
mv "$TMPDIR/finderbms" "$NNN_FINDHIST"
|
||||
mv -- "$TMPDIR/finderbms" "$NNN_FINDHIST"
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -65,7 +65,7 @@ for i in "${targets[@]}"; do
|
|||
if [ -e "$(cleanup "$i")" ]; then
|
||||
tmp='_'
|
||||
fi
|
||||
mv "$i" "$tmp$(cleanup "$i")";
|
||||
mv -- "$i" "$tmp$(cleanup "$i")";
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
11
plugins/fzcd
11
plugins/fzcd
|
@ -22,10 +22,11 @@
|
|||
|
||||
IFS="$(printf '\n\r')"
|
||||
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
. "$(dirname "$0")"/.nnn-plugin-helper
|
||||
|
||||
CTX=+
|
||||
LIST="$LIST"
|
||||
LIST="${LIST:-""}"
|
||||
|
||||
if ! type fzf >/dev/null 2>&1; then
|
||||
printf "fzf missing"
|
||||
|
@ -55,15 +56,15 @@ if [ -n "$LIST" ]; then
|
|||
fi
|
||||
done < "$LIST"
|
||||
|
||||
sel=$(xargs -d '\n' -a "$tmpfile" -I{} find {} -type f -printf "%H//%P\n" | sed '/.*\/\/\(\..*\|.*\/\..*\)/d; s:/\+:/:g' | fzf --delimiter / --tiebreak=begin --info=hidden)
|
||||
sel=$(xargs -d '\n' < "$tmpfile" -I{} find {} -type f -printf "%H//%P\n" | sed '/.*\/\/\(\..*\|.*\/\..*\)/d; s:/\+:/:g' | fzf --delimiter / --tiebreak=begin --info=hidden)
|
||||
# Alternative for 'fd'
|
||||
# sel=$(xargs -d '\n' -a "$tmpfile" fd . | fzf --delimiter / --tiebreak=begin --info=hidden)
|
||||
# sel=$(xargs -d '\n' < "$tmpfile" fd . | fzf --delimiter / --tiebreak=begin --info=hidden)
|
||||
|
||||
rm "$tmpfile"
|
||||
rm -- "$tmpfile"
|
||||
else
|
||||
printf "find missing"
|
||||
read -r _
|
||||
exit 1
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
# Description: Fuzzy find a command from history,
|
||||
# edit in $EDITOR and run as a command
|
||||
#
|
||||
# Note: Supports only bash and fish history
|
||||
# Note: Supports only bash, zsh and fish history
|
||||
#
|
||||
# TODO: For zsh there's also $ZDOTDIR which might need to be checked as well for the -z $HISTFILE && -n $ZDOTDIR case.
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: Arun Prakash Jana
|
||||
|
@ -17,7 +19,18 @@ fi
|
|||
shellname="$(basename "$SHELL")"
|
||||
|
||||
if [ "$shellname" = "bash" ]; then
|
||||
hist_file="$HOME/.bash_history"
|
||||
if [ -f "$HISTFILE" ]; then
|
||||
hist_file="$HISTFILE"
|
||||
else
|
||||
hist_file="$HOME/.bash_history"
|
||||
fi
|
||||
entry="$("$fuzzy" < "$hist_file")"
|
||||
elif [ "$shellname" = "zsh" ]; then
|
||||
if [ -f "$HISTFILE" ]; then
|
||||
hist_file="$HISTFILE"
|
||||
else
|
||||
hist_file="$HOME/.zsh_history"
|
||||
fi
|
||||
entry="$("$fuzzy" < "$hist_file")"
|
||||
elif [ "$shellname" = "fish" ]; then
|
||||
hist_file="$HOME/.local/share/fish/fish_history"
|
||||
|
@ -33,7 +46,7 @@ if [ -n "$entry" ]; then
|
|||
$SHELL -c "$(cat "$tmpfile")"
|
||||
fi
|
||||
|
||||
rm "$tmpfile"
|
||||
rm -- "$tmpfile"
|
||||
|
||||
printf "Press any key to exit"
|
||||
read -r _
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
NUKE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/nuke"
|
||||
USE_NUKE=0
|
||||
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
. "$(dirname "$0")"/.nnn-plugin-helper
|
||||
|
||||
if type fzf >/dev/null 2>&1; then
|
||||
|
@ -58,25 +59,27 @@ if [ "$3" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$USE_NUKE" -ne 0 ]; then
|
||||
"$NUKE" "$entry"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$entry" ]; then
|
||||
if [ "$USE_NUKE" -ne 0 ]; then
|
||||
"$NUKE" "$entry"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Open the file (works for a single file only)
|
||||
cmd_file=""
|
||||
cmd_open=""
|
||||
if uname | grep -q "Darwin"; then
|
||||
cmd_file="file -bIL"
|
||||
cmd_open="open"
|
||||
else
|
||||
cmd_file="file -biL"
|
||||
cmd_open="xdg-open"
|
||||
fi
|
||||
# Open the file (works for a single file only)
|
||||
cmd_file=""
|
||||
cmd_open=""
|
||||
if uname | grep -q "Darwin"; then
|
||||
cmd_file="file -bIL"
|
||||
cmd_open="open"
|
||||
else
|
||||
cmd_file="file -biL"
|
||||
cmd_open="xdg-open"
|
||||
fi
|
||||
|
||||
case "$($cmd_file "$entry")" in
|
||||
*text*)
|
||||
"${VISUAL:-$EDITOR}" "$entry" ;;
|
||||
*)
|
||||
$cmd_open "$entry" >/dev/null 2>&1 ;;
|
||||
esac
|
||||
case "$($cmd_file "$entry")" in
|
||||
*text*)
|
||||
"${VISUAL:-$EDITOR}" "$entry" ;;
|
||||
*)
|
||||
$cmd_open "$entry" >/dev/null 2>&1 ;;
|
||||
esac
|
||||
fi
|
||||
|
|
|
@ -24,7 +24,7 @@ prompt () {
|
|||
if [ "$operation" = "m" ]; then
|
||||
op="merge"
|
||||
elif [ "$operation" = "o" ]; then
|
||||
op="cp -vRf"
|
||||
op="cp -vRf --"
|
||||
else
|
||||
op="true"
|
||||
fi
|
||||
|
@ -62,7 +62,7 @@ for f in $(find . -maxdepth 1 \( ! -iname "." ! -iname "*.md" \)); do
|
|||
$op "$f" ../../plugins/
|
||||
fi
|
||||
else
|
||||
cp -vRf "$f" ../../plugins/
|
||||
cp -vRf -- "$f" ../../plugins/
|
||||
fi
|
||||
done
|
||||
cd ../.. || exit 1
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# Description: cd to the top level of the current git repository in the current context
|
||||
# Dependencies: git
|
||||
# Shell: sh
|
||||
# Author: https://github.com/PatrickF1
|
||||
|
||||
root="$(git rev-parse --show-toplevel 2>/dev/null)"
|
||||
if [ -n "$root" ]; then
|
||||
printf "%s" "0c$root" > "$NNN_PIPE"
|
||||
else
|
||||
printf "Not in a git repository"
|
||||
read -r _
|
||||
exit 1
|
||||
fi
|
19
plugins/gpge
19
plugins/gpge
|
@ -10,7 +10,8 @@
|
|||
# Shell: POSIX compliant
|
||||
# Author: KlzXS
|
||||
|
||||
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
. "$(dirname "$0")"/.nnn-plugin-helper
|
||||
|
||||
printf "(s)ymmetric, (a)symmetric? [default=a] "
|
||||
read -r symmetry
|
||||
|
@ -18,12 +19,12 @@ read -r symmetry
|
|||
if [ "$symmetry" = "s" ]; then
|
||||
gpg --symmetric "$1"
|
||||
else
|
||||
printf "(s)election/(c)urrent? [default=c] "
|
||||
read -r resp
|
||||
|
||||
if [ "$resp" = "s" ]; then
|
||||
if nnn_use_selection; then
|
||||
clear_sel=1
|
||||
# shellcheck disable=SC2154
|
||||
files=$(tr '\0' '\n' < "$selection")
|
||||
else
|
||||
clear_sel=0
|
||||
files=$1
|
||||
fi
|
||||
|
||||
|
@ -37,8 +38,8 @@ else
|
|||
|
||||
printf "%s" "$files" | xargs -n1 gpg --encrypt --recipient "$recipient"
|
||||
|
||||
# Clear selection
|
||||
if [ "$resp" = "s" ] && [ -p "$NNN_PIPE" ]; then
|
||||
printf "-" > "$NNN_PIPE"
|
||||
fi
|
||||
# Clear selection
|
||||
if [ "$clear_sel" -eq 1 ] && [ -p "$NNN_PIPE" ]; then
|
||||
printf "-" > "$NNN_PIPE"
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#set -x
|
||||
# Description: Send the selected (or hovered) files to your Android device using gsconnect daemon.js.
|
||||
# GSConnect must be configured on the Android device and the PC.
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: Darukutsu
|
||||
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
||||
gsconnect=$HOME/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/daemon.js
|
||||
ids=$($gsconnect -l)
|
||||
|
||||
for id in $ids; do
|
||||
if [ -s "$selection" ]; then
|
||||
xargs -0 < "$selection" -I{} "$gsconnect" -d "$id" --share-file="{}"
|
||||
# Clear selection
|
||||
printf "-" > "$NNN_PIPE"
|
||||
else
|
||||
"$gsconnect" -d "$id" --share-file="$2/$1"
|
||||
fi
|
||||
done
|
|
@ -18,11 +18,11 @@
|
|||
# Shell: POSIX compliant
|
||||
# Author: Arun Prakash Jana
|
||||
|
||||
EBOOK_ID="${EBOOK_ID}"
|
||||
EBOOK_ID="${EBOOK_ID:-""}"
|
||||
DIR="${XDG_CACHE_HOME:-$HOME/.cache}/nnn/gutenbooks/$EBOOK_ID"
|
||||
BROWSE_LINK="https://www.gutenberg.org/ebooks/search/?sort_order=downloads"
|
||||
BROWSER="${BROWSER:-w3m}"
|
||||
READER="${READER}"
|
||||
READER="${READER:-""}"
|
||||
|
||||
if [ -n "$EBOOK_ID" ]; then
|
||||
if [ ! -e "$DIR" ]; then
|
||||
|
|
|
@ -112,6 +112,7 @@ check_update="true"
|
|||
|
||||
settings_path="${HOME}/.config/imgur-screenshot/settings.conf"
|
||||
if [ -f "${settings_path}" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
source "${settings_path}"
|
||||
fi
|
||||
|
||||
|
@ -204,6 +205,7 @@ function load_access_token() {
|
|||
token_expire_time=0
|
||||
# check for saved access_token and its expiration date
|
||||
if [ -f "${credentials_file}" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
source "${credentials_file}"
|
||||
fi
|
||||
current_time="$(date +%s)"
|
||||
|
@ -581,7 +583,7 @@ for upload_file in "${upload_files[@]}"; do
|
|||
# delete file if configured
|
||||
if [ "${keep_file}" = "false" ] && [ -z "${1}" ]; then
|
||||
echo "Deleting temp file ${file_dir}/${img_file}"
|
||||
rm -rf "${img_file}"
|
||||
rm -rf -- "${img_file}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# Dependencies:
|
||||
# - imv (https://github.com/eXeC64/imv) or,
|
||||
# - sxiv (https://github.com/muennich/sxiv) or,
|
||||
# - nsxiv (https://github.com/nsxiv/nsxiv) or,
|
||||
# - nsxiv (https://codeberg.org/nsxiv/nsxiv) or,
|
||||
# - ucollage (https://github.com/ckardaris/ucollage) or,
|
||||
# - lsix (https://github.com/hackerb9/lsix), or
|
||||
# - viu (https://github.com/atanunq/viu), or
|
||||
|
@ -31,8 +31,8 @@ exit_prompt() {
|
|||
|
||||
make_thumbs() {
|
||||
mkdir -p "$NNN_PREVIEWDIR$dir" || return
|
||||
if [ "$1" -eq 3 ]; then
|
||||
[ -d "$target" ] && exit_prompt "$2 can only display a single image"
|
||||
if [ "$1" = "viu" ] || [ "$1" = "catimg" ]; then
|
||||
[ -d "$target" ] && exit_prompt "$1 can only display a single image"
|
||||
mime="$(file -bL --mime-type -- "$target")"
|
||||
case "$mime" in
|
||||
audio/*) ffmpeg -i "$target" "$NNN_PREVIEWDIR$target.jpg" -y >/dev/null 2>&1
|
||||
|
@ -45,14 +45,16 @@ make_thumbs() {
|
|||
for file in "$dir"/*; do
|
||||
if [ ! -f "$NNN_PREVIEWDIR$file.jpg" ]; then
|
||||
case "$(file -bL --mime-type -- "$file")" in
|
||||
audio/*) [ "$1" -ne 0 ] && ffmpeg -i "$file" "$NNN_PREVIEWDIR$file.jpg" -y >/dev/null 2>&1 ;;
|
||||
video/*) [ "$1" -ne 1 ] && ffmpegthumbnailer -i "$file" -o "$NNN_PREVIEWDIR$file.jpg" 2> /dev/null ;;
|
||||
audio/*) [ "$1" != "sxiv" ] &&
|
||||
ffmpeg -i "$file" "$NNN_PREVIEWDIR$file.jpg" -y >/dev/null 2>&1 ;;
|
||||
video/*) [ "$1" != "ucollage" ] &&
|
||||
ffmpegthumbnailer -i "$file" -o "$NNN_PREVIEWDIR$file.jpg" 2> /dev/null ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
for file in "$NNN_PREVIEWDIR$dir"/*; do
|
||||
filename="$(basename "$file" .jpg)"
|
||||
[ ! -e "$dir/$filename" ] && rm "$file" 2>/dev/null
|
||||
[ ! -e "$dir/$filename" ] && rm -- "$file" 2>/dev/null
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -77,33 +79,33 @@ elif type lsix >/dev/null 2>&1; then
|
|||
if [ -d "$target" ]; then
|
||||
cd "$target" || exit_prompt
|
||||
fi
|
||||
make_thumbs ""
|
||||
make_thumbs lsix
|
||||
clear
|
||||
lsix
|
||||
cd "$NNN_PREVIEWDIR$dir" && lsix
|
||||
exit_prompt
|
||||
elif type ucollage >/dev/null 2>&1; then
|
||||
type ffmpeg >/dev/null 2>&1 && make_thumbs 1
|
||||
type ffmpeg >/dev/null 2>&1 && make_thumbs ucollage
|
||||
UCOLLAGE_EXPAND_DIRS=1 ucollage "$dir" "$NNN_PREVIEWDIR$dir" || exit_prompt
|
||||
elif type sxiv >/dev/null 2>&1; then
|
||||
type ffmpegthumbnailer >/dev/null 2>&1 && make_thumbs 0
|
||||
type ffmpegthumbnailer >/dev/null 2>&1 && make_thumbs sxiv
|
||||
view_files sxiv >/dev/null 2>&1 &
|
||||
elif type nsxiv >/dev/null 2>&1; then
|
||||
type ffmpegthumbnailer >/dev/null 2>&1 && make_thumbs 0
|
||||
type ffmpegthumbnailer >/dev/null 2>&1 && make_thumbs sxiv
|
||||
view_files nsxiv >/dev/null 2>&1 &
|
||||
elif type imv >/dev/null 2>&1; then
|
||||
make_thumbs ""
|
||||
make_thumbs imv
|
||||
view_files imv >/dev/null 2>&1 &
|
||||
elif type imvr >/dev/null 2>&1; then
|
||||
make_thumbs ""
|
||||
make_thumbs imv
|
||||
view_files imvr >/dev/null 2>&1 &
|
||||
elif type viu >/dev/null 2>&1; then
|
||||
clear
|
||||
make_thumbs 3 viu
|
||||
make_thumbs viu
|
||||
viu -n "$ret"
|
||||
exit_prompt
|
||||
elif type catimg >/dev/null 2>&1; then
|
||||
make_thumbs 3 catimg
|
||||
make_thumbs catimg
|
||||
catimg "$ret"
|
||||
exit_prompt
|
||||
else
|
||||
|
|
|
@ -1,24 +1,66 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# Description: Send the selected files to your Android device using kdeconnect-cli.
|
||||
# Description: Send files or folders to your Android device using kdeconnect-cli.
|
||||
# kdeconnect must be configured on the Android device and the PC.
|
||||
#
|
||||
# Usage:
|
||||
# - Hover over a file or a folder and call the plugin.
|
||||
# - Alternatively, select the files and folders you would like to send, and activate the plugin.
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: juacq97
|
||||
# Author: juacq97, raffaem, N-R-K
|
||||
|
||||
# If you want system notification, put this equal to 1
|
||||
notify=0
|
||||
|
||||
note() {
|
||||
if [ $notify = 1 ]; then
|
||||
notify-send -a "Kdeconnect" "$1"
|
||||
else
|
||||
echo "[Kdeconnect] $1"
|
||||
fi
|
||||
}
|
||||
|
||||
# kdeconnect doesn't cope with non-files
|
||||
filter_files() {
|
||||
xargs -0 -I{} sh -c '
|
||||
if [ -f "{}" ]; then
|
||||
printf "%s\0" "{}";
|
||||
else
|
||||
printf "Error: not a regular file: %s\n" "{}" >&2;
|
||||
fi;'
|
||||
}
|
||||
|
||||
send() {
|
||||
filter_files | xargs -0 -I{} kdeconnect-cli --name "$devname" --share {}
|
||||
note "Files sent"
|
||||
}
|
||||
|
||||
# Select paired device
|
||||
names=$(kdeconnect-cli --list-available --name-only 2>/dev/null)
|
||||
if [ -z "$names" ]; then
|
||||
note "No devices paired and available"
|
||||
exit
|
||||
fi
|
||||
|
||||
ndevs=$(printf "%s" "$names" | awk 'END{print NR}')
|
||||
if [ "$ndevs" -eq 1 ]; then
|
||||
devname="$names"
|
||||
else
|
||||
printf "%s" "$names" | awk '{ print NR ". " $0 }'
|
||||
printf "Pick a device: "
|
||||
read -r pick
|
||||
if [ -n "$pick" ] && [ "$pick" -eq "$pick" ]; then
|
||||
devname=$(printf '%s' "$names" | awk "NR==$pick")
|
||||
fi
|
||||
fi
|
||||
|
||||
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
||||
|
||||
id=$(kdeconnect-cli -a --id-only | awk '{print $1}')
|
||||
if [ -s "$selection" ]; then
|
||||
kdeconnect-cli -d "$id" --share "$(cat "$selection")"
|
||||
|
||||
# If you want a system notification, uncomment the next 3 lines.
|
||||
#notify-send -a "Kdeconnect" "Sending $(cat "$selection")"
|
||||
#else
|
||||
#notify-send -a "Kdeconnect" "No file selected"
|
||||
|
||||
# Clear selection
|
||||
if [ -p "$NNN_PIPE" ]; then
|
||||
printf "-" > "$NNN_PIPE"
|
||||
fi
|
||||
send < "$selection"
|
||||
[ -p "$NNN_PIPE" ] && printf "-" > "$NNN_PIPE" # clear selection
|
||||
elif [ -n "$1" ]; then
|
||||
printf "%s" "$1" | send
|
||||
else
|
||||
note "No selection and no hovered file"
|
||||
fi
|
||||
|
|
|
@ -2,13 +2,22 @@
|
|||
|
||||
# Description: Find and list files by mime type in smart context
|
||||
#
|
||||
# Dependencies:
|
||||
# - file
|
||||
# - mimetype (optional, PERL File MimeInfo)
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: Arun Prakash Jana
|
||||
# Author: Arun Prakash Jana, Michel DHOOGE
|
||||
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
. "$(dirname "$0")"/.nnn-plugin-helper
|
||||
|
||||
printf "mime (e.g., video/audio/image): "
|
||||
read -r mime
|
||||
|
||||
printf "%s" "+l" > "$NNN_PIPE"
|
||||
find . | file -if- | grep "$mime" | awk -F: '{printf "%s\0", $1}' > "$NNN_PIPE"
|
||||
if type mimetype >/dev/null 2>&1; then
|
||||
find . | mimetype -f - | grep "$mime" | awk -F: '{printf "%s%c", $1, 0}' > "$NNN_PIPE"
|
||||
else
|
||||
find . | file -if- | grep "$mime" | awk -F: '{printf "%s%c", $1, 0}' > "$NNN_PIPE"
|
||||
fi
|
||||
|
|
|
@ -34,7 +34,7 @@ fi
|
|||
cd "$tempdir/$outdir" || exit 1
|
||||
|
||||
# Backing up config dir content
|
||||
cp -r "$configdir" . || exit 1
|
||||
cp -r -- "$configdir" . || exit 1
|
||||
|
||||
# Environment config
|
||||
env | sed "s/'/'\\\\''/" |\
|
||||
|
@ -72,4 +72,4 @@ printf "Saving as '%s' ... " "$workdir/$outfile"
|
|||
|
||||
tar caf "$workdir/$outfile" "$outdir" && echo "Done" || echo "Failed"
|
||||
|
||||
cd "$workdir" && rm -rf "$tempdir"
|
||||
cd "$workdir" && rm -rf -- "$tempdir"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# If the device is not mounted, it will be mounted.
|
||||
# If the device is mounted, it will be unmounted and powered down.
|
||||
#
|
||||
# Dependencies: lsblk, pmount
|
||||
# Dependencies: lsblk, pmount (optional), udisks2
|
||||
#
|
||||
# Usage: Runs `lsblk` on 'l', exits on 'Return`.
|
||||
#
|
||||
|
@ -13,7 +13,7 @@
|
|||
# macOS: "diskutil list"
|
||||
# BSD: "geom disk list"
|
||||
# - The script uses udisksctl (from udisks2) to power down devices. This is also Linux-specific.
|
||||
# Users on non-Linux platforms can comment it and use an alterntive to power-down disks.
|
||||
# Users on non-Linux platforms can comment it and use an alternative to power-down disks.
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: Arun Prakash Jana
|
||||
|
@ -26,26 +26,59 @@ printf "\nEnsure you aren't still in the mounted device.\n"
|
|||
printf "%s" "$prompt"
|
||||
read -r dev
|
||||
|
||||
while [ -n "$dev" ]
|
||||
do
|
||||
while [ -n "$dev" ]; do
|
||||
if [ "$dev" = "l" ]; then
|
||||
lsblk
|
||||
elif [ "$dev" = "q" ]; then
|
||||
exit
|
||||
else
|
||||
if grep -qs "$dev " /proc/mounts; then
|
||||
sync
|
||||
if pumount "$dev"
|
||||
then
|
||||
echo "$dev" unmounted.
|
||||
if udisksctl power-off -b /dev/"$dev"
|
||||
then
|
||||
echo "$dev" ejected.
|
||||
# LUKS volumes mounted with udisksctl appear differently than with pmount
|
||||
if grep -qs "$dev " /proc/mounts || [ -n "$(lsblk -n "/dev/$dev" -o MOUNTPOINT)" ]; then
|
||||
sync "$(lsblk -n "/dev/$dev" -o MOUNTPOINT | sed "/^$/d")"
|
||||
if type pumount >/dev/null 2>&1; then
|
||||
pumount "/dev/$dev"
|
||||
exit_code="$?"
|
||||
else
|
||||
# Unlike pmount, udisksctl does not transparently handle LUKS volumes
|
||||
# We need to manually get the unlocked device, unmount it, and then lock the volume
|
||||
if lsblk -n "/dev/$dev" -o FSTYPE | grep "crypto_LUKS" >/dev/null; then
|
||||
dev_map="$(udisksctl info -b /dev/"$dev" | grep "CleartextDevice" | grep -o "dm_2d[[:digit:]]*" | sed "s/_2d/-/")"
|
||||
udisksctl unmount -b "/dev/$dev_map" --no-user-interaction >/dev/null
|
||||
exit_code="$?"
|
||||
udisksctl lock -b "/dev/$dev" --no-user-interaction >/dev/null
|
||||
else
|
||||
udisksctl unmount -b "/dev/$dev" --no-user-interaction >/dev/null
|
||||
exit_code="$?"
|
||||
fi
|
||||
fi
|
||||
if [ $exit_code -eq 0 ]; then
|
||||
echo "/dev/$dev unmounted."
|
||||
if udisksctl power-off -b "/dev/$dev" --no-user-interaction; then
|
||||
echo "/dev/$dev ejected."
|
||||
fi
|
||||
fi
|
||||
elif [ -b "/dev/$dev" ]; then
|
||||
if type pmount >/dev/null 2>&1; then
|
||||
pmount "/dev/$dev"
|
||||
exit_code="$?"
|
||||
else
|
||||
# Unlike pmount, udisksctl does not transparently handle LUKS volumes
|
||||
# We need to manually get the unlocked device and mount that instead of the volume itself
|
||||
if [ "$(lsblk "/dev/$dev" -n -o FSTYPE)" = "crypto_LUKS" ]; then
|
||||
dev_map=$(udisksctl unlock -b "/dev/$dev" --no-user-interaction | grep -o "dm-[[:digit:]]*")
|
||||
udisksctl mount -b "/dev/$dev_map" --no-user-interaction >/dev/null
|
||||
exit_code="$?"
|
||||
else
|
||||
udisksctl mount -b "/dev/$dev" --no-user-interaction >/dev/null
|
||||
exit_code="$?"
|
||||
fi
|
||||
fi
|
||||
if [ $exit_code -eq 0 ]; then
|
||||
sleep 1
|
||||
echo "/dev/$dev mounted to $(lsblk -n "/dev/$dev" -o MOUNTPOINT | sed "/^$/d")."
|
||||
fi
|
||||
else
|
||||
pmount "$dev"
|
||||
echo "$dev" mounted to "$(lsblk -n /dev/"$dev" | rev | cut -d' ' -f1 | rev)".
|
||||
echo "/dev/$dev does not exist or is not a block device."
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -271,13 +271,13 @@ abspath() {
|
|||
listimages() {
|
||||
find -L "///${1%/*}" -maxdepth 1 -type f -print0 |
|
||||
grep -izZE '\.(jpe?g|png|gif|webp|tiff|bmp|ico|svg)$' |
|
||||
sort -z | tee "$tmp"
|
||||
sort -zV | tee "$tmp"
|
||||
}
|
||||
|
||||
load_dir() {
|
||||
abspath "$2"
|
||||
tmp="${TMPDIR:-/tmp}/nuke_$$"
|
||||
trap 'rm -f $tmp' EXIT
|
||||
trap 'rm -f -- "$tmp"' EXIT
|
||||
count="$(listimages "$abs_target" | grep -a -m 1 -ZznF "$abs_target" | cut -d: -f1)"
|
||||
|
||||
if [ -n "$count" ]; then
|
||||
|
@ -318,6 +318,9 @@ handle_multimedia() {
|
|||
if is_mac; then
|
||||
nohup open "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
elif type imv >/dev/null 2>&1; then
|
||||
load_dir imv "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
elif type imvr >/dev/null 2>&1; then
|
||||
load_dir imvr "${FPATH}" >/dev/null 2>&1 &
|
||||
exit 0
|
||||
|
@ -399,7 +402,7 @@ handle_multimedia() {
|
|||
# "${FPATH}";
|
||||
# then
|
||||
# convert -- "${preview_png}" "${IMAGE_CACHE_PATH}" \
|
||||
# && rm "${preview_png}" \
|
||||
# && rm -- "${preview_png}" \
|
||||
# && exit 6
|
||||
# else
|
||||
# exit 1
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Description: Open selected files in nuke one by one or in oneshot
|
||||
#
|
||||
# Notes: 1. Opens the hovered file if the selection is empty
|
||||
# 2. nuke is the default, set OPENER below for custom
|
||||
# 3. Opener is invoked once for each file in a loop
|
||||
# 4. Keep pressing "Enter" to open files one by one
|
||||
#
|
||||
# Shell: bash
|
||||
# Author: Arun Prakash Jana
|
||||
|
||||
sel=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
||||
OPENER="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/nuke"
|
||||
|
||||
if [ -s "$sel" ]; then
|
||||
targets=()
|
||||
while IFS= read -r -d '' entry || [ -n "$entry" ]; do
|
||||
targets+=( "$entry" )
|
||||
done < "$sel"
|
||||
|
||||
elements=${#targets[@]}
|
||||
|
||||
if (( elements == 1 )); then
|
||||
# If there's only one file selected, open without prompts
|
||||
"$OPENER" "${targets[0]}"
|
||||
else
|
||||
printf "open [A]ll? "
|
||||
read -r all
|
||||
|
||||
for ((index=0; index <= ${#targets[@]}; index++)); do
|
||||
"$OPENER" "${targets[index]}"
|
||||
if [ "$all" != "A" ] && (( index+1 < elements )); then
|
||||
printf "press Enter to open '%s'\n" "${targets[index+1]}"
|
||||
read -r -s -n 1 key
|
||||
if [[ $key != "" ]]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Clear selection
|
||||
if [ -s "$sel" ] && [ -p "$NNN_PIPE" ]; then
|
||||
printf "-" > "$NNN_PIPE"
|
||||
fi
|
||||
elif [ -n "$1" ]; then
|
||||
"$OPENER" "$1"
|
||||
fi
|
|
@ -13,36 +13,36 @@ organize() {
|
|||
case "$(file -biL "$1")" in
|
||||
*video*)
|
||||
[ ! -d "Videos" ] && mkdir "Videos"
|
||||
mv "$1" "Videos/$1"
|
||||
mv -- "$1" "Videos/$1"
|
||||
printf "Moved %s to Videos\n" "$1" ;;
|
||||
|
||||
*audio*) [ ! -d "Audio" ] && mkdir "Audio"
|
||||
mv "$1" "Audio/$1"
|
||||
mv -- "$1" "Audio/$1"
|
||||
printf "Moved %s to Audio\n" "$1" ;;
|
||||
|
||||
*image*)
|
||||
[ ! -d "Images" ] && mkdir "Images"
|
||||
mv "$1" "Images/$1"
|
||||
mv -- "$1" "Images/$1"
|
||||
printf "Moved %s to Images\n" "$1" ;;
|
||||
|
||||
*pdf*|*document*|*epub*|*djvu*|*cb*)
|
||||
[ ! -d "Documents" ] && mkdir "Documents"
|
||||
mv "$1" "Documents/$1"
|
||||
mv -- "$1" "Documents/$1"
|
||||
printf "Moved %s to Documents\n" "$1" ;;
|
||||
|
||||
*text*)
|
||||
[ ! -d "Plaintext" ] && mkdir "Plaintext"
|
||||
mv "$1" "Plaintext/$1"
|
||||
mv -- "$1" "Plaintext/$1"
|
||||
printf "Moved %s to Plaintext\n" "$1" ;;
|
||||
|
||||
*tar*|*xz*|*compress*|*7z*|*rar*|*zip*)
|
||||
[ ! -d "Archives" ] && mkdir "Archives"
|
||||
mv "$1" "Archives/$1"
|
||||
mv -- "$1" "Archives/$1"
|
||||
printf "Moved %s to Archives\n" "$1" ;;
|
||||
|
||||
*binary*)
|
||||
[ ! -d "Binaries" ] && mkdir "Binaries"
|
||||
mv "$1" "Binaries/$1"
|
||||
mv -- "$1" "Binaries/$1"
|
||||
printf "Moved %s to Binaries\n" "$1" ;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ if [ -n "$1" ]; then
|
|||
|
||||
pico2wave -w "$tmpf".wav -l en-GB "$(tr '\n' ' ' < "$tmpf".txt)"
|
||||
|
||||
rm "$tmpf".txt
|
||||
rm -- "$tmpf".txt
|
||||
else
|
||||
pico2wave -w "$tmpf".wav -l en-GB "$(tr '\n' ' ' < "$1")"
|
||||
fi
|
||||
|
@ -26,5 +26,5 @@ if [ -n "$1" ]; then
|
|||
# flat read but better quality
|
||||
# play -qV0 "$tmpf".wav treble 2 gain -l 2
|
||||
|
||||
rm "$tmpf".wav
|
||||
rm -- "$tmpf".wav
|
||||
fi
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
#
|
||||
# Dependencies:
|
||||
# - tabbed (https://tools.suckless.org/tabbed): xembed host
|
||||
# - xterm (or urxvt or st) : xembed client for text-based preview
|
||||
# - xterm (or urxvt or st or alacritty) : xembed client for text-based preview
|
||||
# - mpv (https://mpv.io): xembed client for video/audio
|
||||
# - sxiv (https://github.com/muennich/sxiv) or,
|
||||
# - nsxiv (https://github.com/nsxiv/nsxiv) : xembed client for images
|
||||
# - nsxiv (https://codeberg.org/nsxiv/nsxiv) : xembed client for images
|
||||
# - zathura (https://pwmt.org/projects/zathura): xembed client for PDF
|
||||
# - nnn's nuke plugin for text preview and fallback
|
||||
# nuke is a fallback for 'mpv', 'sxiv'/'nsxiv', and 'zathura', but has its
|
||||
|
@ -27,6 +27,7 @@
|
|||
# 1. This plugin needs a "NNN_FIFO" to work. See man.
|
||||
# 2. If the same NNN_FIFO is used in multiple nnn instances, there will be one
|
||||
# common preview window. With different FIFO paths, they will be independent.
|
||||
# 3. This plugin only works on X, not on Wayland.
|
||||
#
|
||||
# How it works:
|
||||
# We use `tabbed` [1] as a xembed [2] host, to have a single window
|
||||
|
@ -51,6 +52,10 @@ XDOTOOL_TIMEOUT=2
|
|||
PAGER=${PAGER:-"vim -R"}
|
||||
NUKE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/nuke"
|
||||
|
||||
if [ -n "$WAYLAND_DISPLAY" ] ; then
|
||||
echo "Wayland is not supported in preview-tabbed, this plugin could freeze your session!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if type xterm >/dev/null 2>&1 ; then
|
||||
TERMINAL="xterm -into"
|
||||
|
@ -58,10 +63,15 @@ elif type urxvt >/dev/null 2>&1 ; then
|
|||
TERMINAL="urxvt -embed"
|
||||
elif type st >/dev/null 2>&1 ; then
|
||||
TERMINAL="st -w"
|
||||
elif type alacritty >/dev/null 2>&1 ; then
|
||||
TERMINAL="alacritty --embed"
|
||||
else
|
||||
echo "No xembed term found" >&2
|
||||
fi
|
||||
|
||||
if type xdg-user-dir >/dev/null 2>&1 ; then
|
||||
PICTURES_DIR=$(xdg-user-dir PICTURES)
|
||||
fi
|
||||
|
||||
term_nuke () {
|
||||
# $1 -> $XID, $2 -> $FILE
|
||||
|
@ -85,7 +95,7 @@ start_tabbed () {
|
|||
|
||||
read -r XID < "$FIFO"
|
||||
|
||||
rm "$FIFO"
|
||||
rm -- "$FIFO"
|
||||
}
|
||||
|
||||
get_viewer_pid () {
|
||||
|
@ -170,7 +180,17 @@ previewer_loop () {
|
|||
fi
|
||||
;;
|
||||
inode/directory)
|
||||
$TERMINAL "$XID" -e nnn "$FILE" &
|
||||
if [[ -n $PICTURES_DIR && "$FILE" == "$PICTURES_DIR"* ]] ; then
|
||||
if type sxiv >/dev/null 2>&1 ; then
|
||||
sxiv -te "$XID" "$FILE" &
|
||||
elif type nsxiv >/dev/null 2>&1 ; then
|
||||
nsxiv -te "$XID" "$FILE" &
|
||||
else
|
||||
$TERMINAL "$XID" -e nnn "$FILE" &
|
||||
fi
|
||||
else
|
||||
$TERMINAL "$XID" -e nnn "$FILE" &
|
||||
fi
|
||||
;;
|
||||
text/*)
|
||||
if [ -x "$NUKE" ] ; then
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
#!/usr/bin/env sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Description: Terminal based file previewer
|
||||
#
|
||||
# Note: This plugin needs a "NNN_FIFO" to work. See man.
|
||||
#
|
||||
# Dependencies:
|
||||
# - Supports 4 independent methods to preview with:
|
||||
# - Supports 6 independent methods to preview with:
|
||||
# - tmux (>=3.0), or
|
||||
# - kitty with allow_remote_control and listen_on set in kitty.conf, or
|
||||
# - QuickLook on WSL (https://github.com/QL-Win/QuickLook)
|
||||
# - $TERMINAL set to a terminal (it's xterm by default).
|
||||
# - less or $PAGER
|
||||
# - tree or exa or ls
|
||||
# - wezterm (https://wezfurlong.org/wezterm), or
|
||||
# - QuickLook on WSL (https://github.com/QL-Win/QuickLook), or
|
||||
# - Windows Terminal (https://github.com/Microsoft/Terminal | https://aka.ms/terminal) with WSL, or
|
||||
# - $NNN_TERMINAL set to a terminal (it's xterm by default).
|
||||
# - less or $NNN_PAGER
|
||||
# - tree or exa/eza or (GNU) ls
|
||||
# - mediainfo or file
|
||||
# - mktemp
|
||||
# - unzip
|
||||
|
@ -19,24 +21,30 @@
|
|||
# - man
|
||||
# - optional: bsdtar or atool for additional archive preview
|
||||
# - optional: bat for code syntax highlighting
|
||||
# - optional: ueberzug, kitty terminal, viu or catimg for images
|
||||
# - optional: convert(ImageMagick) for playing gif preview
|
||||
# - optional: ueberzug, kitty terminal, wezterm terminal, img2sixel, viu, catimg or chafa for images
|
||||
# - optional: convert(ImageMagick) for playing gif preview (mandatory for kitty image previews)
|
||||
# - optional: mpv for gif and video
|
||||
# Also requires a terminal supporting the sixel (https://www.arewesixelyet.com/)
|
||||
# or kitty (https://sw.kovidgoyal.net/kitty/graphics-protocol) video_output backends.
|
||||
# Requires tmux compiled with `./configure --enable-sixel` if used.
|
||||
# - optional: ffmpegthumbnailer for video thumbnails (https://github.com/dirkvdb/ffmpegthumbnailer)
|
||||
# - optional: ffmpeg for audio thumbnails
|
||||
# - optional: libreoffce for opendocument/officedocument preview
|
||||
# - optional: pdftoppm(poppler) for pdf thumbnails
|
||||
# - optional: gnome-epub-thumbnailer for epub thumbnails (https://gitlab.gnome.org/GNOME/gnome-epub-thumbnailer)
|
||||
# - optional: fontpreview for font preview (https://github.com/sdushantha/fontpreview)
|
||||
# - optional: djvulibre for djvu
|
||||
# - optional: glow or lowdown for markdown
|
||||
# - optional: w3m or lynx or elinks for html
|
||||
# - optional: set/export ICONLOOKUP as 1 to enable file icons in front of directory previews with .iconlookup
|
||||
# Icons and colors are configureable in .iconlookup
|
||||
# - optional: set/export NNN_ICONLOOKUP as 1 to enable file icons in front of directory previews with .iconlookup
|
||||
# Icons and colors are configurable in .iconlookup
|
||||
# - optional: scope.sh file viewer from ranger.
|
||||
# 1. drop scope.sh executable in $PATH
|
||||
# 2. set/export $USE_SCOPE as 1
|
||||
# 2. set/export $NNN_SCOPE as 1
|
||||
# - optional: pistol file viewer (https://github.com/doronbehar/pistol).
|
||||
# 1. install pistol
|
||||
# 2. set/export $USE_PISTOL as 1
|
||||
# 2. set/export $NNN_PISTOL as 1
|
||||
# - optional: librsvg for rsvg-convert
|
||||
#
|
||||
# Usage:
|
||||
# You need to set a NNN_FIFO path and a key for the plugin with NNN_PLUG,
|
||||
|
@ -56,95 +64,138 @@
|
|||
#
|
||||
# The previews will be shown in a tmux split. If that isn't possible, it
|
||||
# will try to use a kitty terminal split. And as a final fallback, a
|
||||
# different terminal window will be used ($TERMINAL).
|
||||
# different terminal window will be used ($NNN_TERMINAL).
|
||||
#
|
||||
# Tmux and kitty users can configure $SPLIT to either "h" or "v" to set a
|
||||
# 'h'orizontal split or a 'v'ertical split (as in, the line that splits the
|
||||
# windows will be horizontal or vertical).
|
||||
# Kitty users need something similar to the following in their kitty.conf:
|
||||
# - `allow_remote_control yes`
|
||||
# - `listen_on unix:$TMPDIR/kitty`
|
||||
# - `enabled_layouts splits` (optional)
|
||||
# With ImageMagick installed, this terminal can use the icat kitten to display images.
|
||||
# Refer to kitty documentation for further details.
|
||||
#
|
||||
# Kitty users need `allow_remote_control` set to `yes`, and `listen_on` set
|
||||
# to e.g. "unix:$TMPDIR/kitty". To customize the window split, `enabled_layouts`
|
||||
# has to be set to `all` or `splits` (the former is the default value).
|
||||
# This terminal is also able to show images without extra dependencies.
|
||||
# Users with both tmux and kitty can leverage image previews inside tmux with kitty's icat kitten
|
||||
# - setup kitty as stated above
|
||||
# - tmux >= v3.3a required
|
||||
# - add the following to your tmux.conf:
|
||||
# - `set -g allow-passthrough on`
|
||||
#
|
||||
# Iterm2 users are recommended to use viu to view images without getting pixelated.
|
||||
# Wezterm should work out of the box. If `NNN_PREVIEWIMGPROG` is not specified it will use
|
||||
# built in iTerm2 image protocol.
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Authors: Todd Yamakawa, Léo Villeveygoux, @Recidiviste, Mario Ortiz Manero, Luuk van Baal
|
||||
# Note that GNU ls is used for its `--group-directories-first` flag.
|
||||
# On MacOS this may be installed with `brew install coreutils`, or the flag can be removed.
|
||||
# iTerm2 users are recommended to use viu to view images without getting pixelated.
|
||||
#
|
||||
# Windows Terminal users can set "Profile termination behavior" under "Profile > Advanced" settings
|
||||
# to automatically close pane on quit when exit code is 0.
|
||||
#
|
||||
# When specifying a different terminal, additional arguments are supported. In particular, you can
|
||||
# append a specific title to the terminal and set it to "nofocus" in your WM config.
|
||||
# E.g for alacritty and i3, you can set $NNN_TERMINAL to 'alacritty --title preview-tui' and add
|
||||
# 'no_focus [title="preview-tui"]' to your i3 config file.
|
||||
#
|
||||
# Shell: Bash (for environment manipulation through arrays)
|
||||
# Authors: Todd Yamakawa, Léo Villeveygoux, @Recidiviste, Mario Ortiz Manero, Luuk van Baal, @WanderLanz, @flipflop133
|
||||
|
||||
#SPLIT="$SPLIT" # you can set a permanent split here
|
||||
#TERMINAL="$TERMINAL" # same goes for the terminal
|
||||
USE_SCOPE="${USE_SCOPE:-0}"
|
||||
USE_PISTOL="${USE_PISTOL:-0}"
|
||||
ICONLOOKUP="${ICONLOOKUP:-0}"
|
||||
PAGER="${PAGER:-less -P?n -R}"
|
||||
TMPDIR="${TMPDIR:-/tmp}"
|
||||
BAT_STYLE="${BAT_STYLE:-numbers}"
|
||||
BAT_THEME="${BAT_THEME:-ansi}"
|
||||
# Consider setting NNN_PREVIEWDIR to $XDG_CACHE_HOME/nnn/previews if you want to keep previews on disk between reboots
|
||||
NNN_PREVIEWDIR="${NNN_PREVIEWDIR:-$TMPDIR/nnn/previews}"
|
||||
NNN_PREVIEWWIDTH="${NNN_PREVIEWWIDTH:-1920}"
|
||||
NNN_PREVIEWHEIGHT="${NNN_PREVIEWHEIGHT:-1080}"
|
||||
NNN_PARENT="${NNN_FIFO#*.}"
|
||||
[ "$NNN_PARENT" -eq "$NNN_PARENT" ] 2>/dev/null || NNN_PARENT=""
|
||||
FIFOPID="$TMPDIR/nnn-preview-tui-fifopid.$NNN_PARENT"
|
||||
PREVIEWPID="$TMPDIR/nnn-preview-tui-pagerpid.$NNN_PARENT"
|
||||
CURSEL="$TMPDIR/nnn-preview-tui-selection.$NNN_PARENT"
|
||||
FIFO_UEBERZUG="$TMPDIR/nnn-preview-tui-ueberzug-fifo.$NNN_PARENT"
|
||||
# Configurable environment variables:
|
||||
NNN_SPLIT=${NNN_SPLIT:-} # permanent split direction
|
||||
NNN_TERMINAL=${NNN_TERMINAL:-} # external terminal to be used
|
||||
NNN_SPLITSIZE=${NNN_SPLITSIZE:-50} # previewer split size percentage
|
||||
TMPDIR=${TMPDIR:-/tmp} # location of temporary files
|
||||
ENVVARS=(
|
||||
"NNN_SCOPE=${NNN_SCOPE:-0}" # use scope
|
||||
"NNN_PISTOL=${NNN_PISTOL:-0}" # use pistol
|
||||
"NNN_ICONLOOKUP=${NNN_ICONLOOKUP:-0}" # use .iconlookup
|
||||
"NNN_PAGER=${NNN_PAGER:-less -P?n -R -C}" # pager options
|
||||
"NNN_BATTHEME=${NNN_BATTHEME:-ansi}" # bat theme
|
||||
"NNN_BATSTYLE=${NNN_BATSTYLE:-numbers}" # bat style
|
||||
"NNN_PREVIEWWIDTH=${NNN_PREVIEWWIDTH:-1920}" # width of generated preview images
|
||||
"NNN_PREVIEWHEIGHT=${NNN_PREVIEWHEIGHT:-1080}" # height of generated preview images
|
||||
"NNN_PREVIEWDIR=${NNN_PREVIEWDIR:-$TMPDIR/nnn/previews}" # location of generated preview images
|
||||
"NNN_PREVIEWIMGPROG=${NNN_PREVIEWIMGPROG:-}" # program used to preview images
|
||||
"NNN_PREVIEWVIDEO=${NNN_PREVIEWVIDEO:-}" # mpv backend used to preview video
|
||||
)
|
||||
# Non-configurable environment variables
|
||||
NNN_PARENT=${NNN_FIFO#*.}
|
||||
[ "$NNN_PARENT" -eq "$NNN_PARENT" ] 2>/dev/null || NNN_PARENT="" # Make empty if non-numeric
|
||||
ENVVARS+=(
|
||||
"PWD=$PWD"
|
||||
"PATH=$PATH"
|
||||
"NNN_FIFO=$NNN_FIFO"
|
||||
"FIFOPID=$TMPDIR/nnn-preview-tui-fifopid.$NNN_PARENT"
|
||||
"FIFOPATH=$TMPDIR/nnn-preview-tui-fifo.$NNN_PARENT"
|
||||
"PREVIEWPID=$TMPDIR/nnn-preview-tui-previewpid.$NNN_PARENT"
|
||||
"CURSEL=$TMPDIR/nnn-preview-tui-selection.$NNN_PARENT"
|
||||
"FIFO_UEBERZUG=$TMPDIR/nnn-preview-tui-ueberzug-fifo.$NNN_PARENT"
|
||||
"POSOFFSET=$TMPDIR/nnn-preview-tui-posoffset"
|
||||
)
|
||||
|
||||
trap '' PIPE
|
||||
exists() { type "$1" >/dev/null 2>&1 ;}
|
||||
pkill() { command pkill "$@" >/dev/null 2>&1 ;}
|
||||
prompt() { clear; printf "%b" "$@"; cfg=$(stty -g); stty raw -echo; head -c 1; stty "$cfg" ;}
|
||||
pidkill() {
|
||||
if [ -f "$1" ]; then
|
||||
PID="$(cat "$1" 2>/dev/null)" || return 1
|
||||
kill "$PID" >/dev/null 2>&1
|
||||
RET=$?
|
||||
wait "$PID" 2>/dev/null
|
||||
return $RET
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
start_preview() {
|
||||
[ "$PAGER" = "most" ] && PAGER="less -R"
|
||||
|
||||
if [ -e "${TMUX%%,*}" ] && tmux -V | grep -q '[ -][3456789]\.'; then
|
||||
TERMINAL=tmux
|
||||
NNN_TERMINAL=tmux
|
||||
exists mpv && tmux display -p '#{client_termfeatures}' | grep -q 'sixel' && ENVVARS+=("NNN_PREVIEWVIDEO=sixel")
|
||||
elif [ -n "$KITTY_LISTEN_ON" ]; then
|
||||
TERMINAL=kitty
|
||||
elif [ -z "$TERMINAL" ] && [ "$TERM_PROGRAM" = "iTerm.app" ]; then
|
||||
TERMINAL=iterm
|
||||
NNN_TERMINAL=kitty
|
||||
exists mpv && ENVVARS+=("NNN_PREVIEWVIDEO=kitty")
|
||||
elif [ -n "$WEZTERM_PANE" ]; then
|
||||
NNN_TERMINAL=wezterm
|
||||
exists mpv && ENVVARS+=("NNN_PREVIEWVIDEO=kitty")
|
||||
elif [ -z "$NNN_TERMINAL" ] && [ "$TERM_PROGRAM" = "iTerm.app" ]; then
|
||||
NNN_TERMINAL=iterm
|
||||
exists mpv && ENVVARS+=("NNN_PREVIEWVIDEO=sixel")
|
||||
elif [ -n "$WT_SESSION" ]; then
|
||||
NNN_TERMINAL=winterm
|
||||
else
|
||||
TERMINAL="${TERMINAL:-xterm}"
|
||||
NNN_TERMINAL="${NNN_TERMINAL:-xterm}"
|
||||
fi
|
||||
|
||||
if [ -z "$SPLIT" ] && [ $(($(tput lines <"$TTY") * 2)) -gt "$(tput cols <"$TTY")" ]; then
|
||||
SPLIT='h'
|
||||
elif [ "$SPLIT" != 'h' ]; then
|
||||
SPLIT='v'
|
||||
if [ -z "$NNN_SPLIT" ] && [ $(($(tput lines) * 2)) -gt "$(tput cols)" ]; then
|
||||
NNN_SPLIT='h'
|
||||
elif [ "$NNN_SPLIT" != 'h' ]; then
|
||||
NNN_SPLIT='v'
|
||||
fi
|
||||
|
||||
case "$TERMINAL" in
|
||||
ENVVARS+=("NNN_TERMINAL=$NNN_TERMINAL" "NNN_SPLIT=$NNN_SPLIT" "QLPATH=$2" "PREVIEW_MODE=1")
|
||||
case "$NNN_TERMINAL" in
|
||||
iterm|winterm) # has to run in separate shell command: escape
|
||||
ENVVARS=("${ENVVARS[@]/#/\\\"}")
|
||||
ENVVARS=("${ENVVARS[@]/%/\\\"}")
|
||||
command="$SHELL -c 'env ${ENVVARS[*]} \\\"$0\\\" \\\"$1\\\"'" ;;
|
||||
esac
|
||||
|
||||
case "$NNN_TERMINAL" in
|
||||
tmux) # tmux splits are inverted
|
||||
if [ "$SPLIT" = "v" ]; then DSPLIT="h"; else DSPLIT="v"; fi
|
||||
tmux split-window -e "NNN_FIFO=$NNN_FIFO" -e "PREVIEW_MODE=1" -e TTY="$TTY" \
|
||||
-e "CURSEL=$CURSEL" -e "TMPDIR=$TMPDIR" -e "FIFOPID=$FIFOPID" \
|
||||
-e "BAT_STYLE=$BAT_STYLE" -e "BAT_THEME=$BAT_THEME" -e "PREVIEWPID=$PREVIEWPID" \
|
||||
-e "PAGER=$PAGER" -e "ICONLOOKUP=$ICONLOOKUP" -e "NNN_PREVIEWWIDTH=$NNN_PREVIEWWIDTH" \
|
||||
-e "USE_SCOPE=$USE_SCOPE" -e "SPLIT=$SPLIT" -e "USE_PISTOL=$USE_PISTOL" \
|
||||
-e "NNN_PREVIEWDIR=$NNN_PREVIEWDIR" -e "NNN_PREVIEWHEIGHT=$NNN_PREVIEWHEIGHT" \
|
||||
-e "FIFO_UEBERZUG=$FIFO_UEBERZUG" -e "QLPATH=$2" -d"$DSPLIT" "$0" "$1" ;;
|
||||
ENVVARS=("${ENVVARS[@]/#/-e}")
|
||||
if [ "$NNN_SPLIT" = "v" ]; then split="h"; else split="v"; fi
|
||||
tmux split-window -l"$NNN_SPLITSIZE"% "${ENVVARS[@]}" -d"$split" -p"$NNN_SPLITSIZE" "$0" "$1" ;;
|
||||
kitty) # Setting the layout for the new window. It will be restored after the script ends.
|
||||
ENVVARS=("${ENVVARS[@]/#/--env=}")
|
||||
kitty @ goto-layout splits
|
||||
# Trying to use kitty's integrated window management as the split window. All
|
||||
# environmental variables that will be used in the new window must be explicitly passed.
|
||||
kitty @ launch --no-response --title "nnn preview" --keep-focus \
|
||||
--cwd "$PWD" --env "PATH=$PATH" --env "NNN_FIFO=$NNN_FIFO" \
|
||||
--env "PREVIEW_MODE=1" --env "PAGER=$PAGER" --env "TMPDIR=$TMPDIR" \
|
||||
--env "USE_SCOPE=$USE_SCOPE" --env "SPLIT=$SPLIT" --env "TERMINAL=$TERMINAL"\
|
||||
--env "PREVIEWPID=$PREVIEWPID" --env "FIFO_UEBERZUG=$FIFO_UEBERZUG" \
|
||||
--env "ICONLOOKUP=$ICONLOOKUP" --env "NNN_PREVIEWHEIGHT=$NNN_PREVIEWHEIGHT" \
|
||||
--env "NNN_PREVIEWWIDTH=$NNN_PREVIEWWIDTH" --env "NNN_PREVIEWDIR=$NNN_PREVIEWDIR" \
|
||||
--env "USE_PISTOL=$USE_PISTOL" --env "BAT_STYLE=$BAT_STYLE" \
|
||||
--env "BAT_THEME=$BAT_THEME" --env "FIFOPID=$FIFOPID" --env TTY="$TTY" \
|
||||
--env "CURSEL=$CURSEL" --location "${SPLIT}split" "$0" "$1" ;;
|
||||
# Trying to use kitty's integrated window management as the split window.
|
||||
kitty @ launch --no-response --title "preview-tui" --keep-focus \
|
||||
--cwd "$PWD" "${ENVVARS[@]}" --location "${NNN_SPLIT}split" "$0" "$1" ;;
|
||||
wezterm)
|
||||
export "${ENVVARS[@]}"
|
||||
if [ "$NNN_SPLIT" = "v" ]; then split="--horizontal"; else split="--bottom"; fi
|
||||
wezterm cli split-pane --cwd "$PWD" $split --percent "$NNN_SPLITSIZE" "$0" "$1" >/dev/null
|
||||
wezterm cli activate-pane-direction Prev ;;
|
||||
iterm)
|
||||
command="$SHELL -c 'cd $PWD; \
|
||||
PATH=\\\"$PATH\\\" NNN_FIFO=\\\"$NNN_FIFO\\\" PREVIEW_MODE=1 PAGER=\\\"$PAGER\\\" \
|
||||
USE_SCOPE=\\\"$USE_SCOPE\\\" SPLIT=\\\"$SPLIT\\\" TERMINAL=\\\"$TERMINAL\\\" \
|
||||
PREVIEWPID=\\\"$PREVIEWPID\\\" CURSEL=\\\"$CURSEL\\\" TMPDIR=\\\"$TMPDIR\\\" \
|
||||
ICONLOOKUP=\\\"$ICONLOOKUP\\\" NNN_PREVIEWHEIGHT=\\\"$NNN_PREVIEWHEIGHT\\\" \
|
||||
NNN_PREVIEWWIDTH=\\\"$NNN_PREVIEWWIDTH\\\" NNN_PREVIEWDIR=\\\"$NNN_PREVIEWDIR\\\" \
|
||||
USE_PISTOL=\\\"$USE_PISTOL\\\" BAT_STYLE=\\\"$BAT_STYLE\\\" TTY=\\\"$TTY\\\" \
|
||||
BAT_THEME=\\\"$BAT_THEME\\\" FIFOPID=\\\"$FIFOPID\\\" \\\"$0\\\" \\\"$1\\\"'"
|
||||
if [ "$SPLIT" = "h" ]; then split="horizontally"; else split="vertically"; fi
|
||||
if [ "$NNN_SPLIT" = "h" ]; then split="horizontally"; else split="vertically"; fi
|
||||
osascript <<-EOF
|
||||
tell application "iTerm"
|
||||
tell current session of current window
|
||||
|
@ -153,24 +204,28 @@ start_preview() {
|
|||
end tell
|
||||
EOF
|
||||
;;
|
||||
winterm)
|
||||
if [ "$NNN_SPLIT" = "h" ]; then split="H"; else split="V"; fi
|
||||
wt -w 0 sp -$split -s"0.$NNN_SPLITSIZE" "$command" \; -w 0 mf previous 2>/dev/null ;;
|
||||
*) if [ -n "$2" ]; then
|
||||
QUICKLOOK=1 QLPATH="$2" PREVIEW_MODE=1 "$0" "$1" &
|
||||
env "${ENVVARS[@]}" QUICKLOOK=1 "$0" "$1" &
|
||||
else
|
||||
PREVIEWPID="$PREVIEWPID" CURSEL="$CURSEL" PREVIEW_MODE=1 TTY="$TTY" \
|
||||
FIFOPID="$FIFOPID" FIFO_UEBERZUG="$FIFO_UEBERZUG" $TERMINAL -e "$0" "$1" &
|
||||
# shellcheck disable=SC2086 # (allow arguments)
|
||||
env "${ENVVARS[@]}" $NNN_TERMINAL -e "$0" "$1" &
|
||||
fi ;;
|
||||
esac
|
||||
} >/dev/null 2>&1
|
||||
}
|
||||
|
||||
toggle_preview() {
|
||||
export "${ENVVARS[@]}"
|
||||
if exists QuickLook.exe; then
|
||||
QLPATH="QuickLook.exe"
|
||||
elif exists Bridge.exe; then
|
||||
QLPATH="Bridge.exe"
|
||||
fi
|
||||
if kill "$(cat "$FIFOPID")"; then
|
||||
if pidkill "$FIFOPID"; then
|
||||
[ -p "$NNN_PPIPE" ] && printf "0" > "$NNN_PPIPE"
|
||||
kill "$(cat "$PREVIEWPID")"
|
||||
pidkill "$PREVIEWPID"
|
||||
pkill -f "tail --follow $FIFO_UEBERZUG"
|
||||
if [ -n "$QLPATH" ] && stat "$1"; then
|
||||
f="$(wslpath -w "$1")" && "$QLPATH" "$f" &
|
||||
|
@ -179,39 +234,34 @@ toggle_preview() {
|
|||
[ -p "$NNN_PPIPE" ] && printf "1" > "$NNN_PPIPE"
|
||||
start_preview "$1" "$QLPATH"
|
||||
fi
|
||||
} >/dev/null 2>&1
|
||||
|
||||
exists() {
|
||||
type "$1" >/dev/null
|
||||
}
|
||||
|
||||
fifo_pager() {
|
||||
cmd="$1"
|
||||
shift
|
||||
|
||||
# We use a FIFO to access $PAGER PID in jobs control
|
||||
tmpfifopath="$TMPDIR/nnn-preview-tui-fifo.$$"
|
||||
mkfifo "$tmpfifopath" || return
|
||||
# We use a FIFO to access $NNN_PAGER PID in jobs control
|
||||
mkfifo "$FIFOPATH" || return
|
||||
|
||||
$PAGER < "$tmpfifopath" &
|
||||
$NNN_PAGER < "$FIFOPATH" &
|
||||
printf "%s" "$!" > "$PREVIEWPID"
|
||||
|
||||
(
|
||||
exec > "$tmpfifopath"
|
||||
exec > "$FIFOPATH"
|
||||
if [ "$cmd" = "pager" ]; then
|
||||
if exists bat; then
|
||||
bat --terminal-width="$(tput cols <"$TTY")" --decorations=always --color=always \
|
||||
--paging=never --style="$BAT_STYLE" --theme="$BAT_THEME" "$@" &
|
||||
bat --terminal-width="$cols" --decorations=always --color=always \
|
||||
--paging=never --style="$NNN_BATSTYLE" --theme="$NNN_BATTHEME" "$@" &
|
||||
else
|
||||
$PAGER "$@" &
|
||||
$NNN_PAGER "$@" &
|
||||
fi
|
||||
else
|
||||
"$cmd" "$@" &
|
||||
fi
|
||||
)
|
||||
|
||||
rm "$tmpfifopath"
|
||||
} 2>/dev/null
|
||||
rm -- "$FIFOPATH"
|
||||
}
|
||||
|
||||
# Binary file: show file info inside the pager
|
||||
print_bin_info() {
|
||||
|
@ -221,17 +271,18 @@ print_bin_info() {
|
|||
else
|
||||
file -b "$1"
|
||||
fi
|
||||
} 2>/dev/null
|
||||
}
|
||||
|
||||
handle_mime() {
|
||||
case "$2" in
|
||||
image/jpeg) image_preview "$cols" "$lines" "$1" ;;
|
||||
image/gif) generate_preview "$cols" "$lines" "$1" "gif" ;;
|
||||
image/vnd.djvu) generate_preview "$cols" "$lines" "$1" "djvu" ;;
|
||||
image/*) generate_preview "$cols" "$lines" "$1" "image" ;;
|
||||
video/*) generate_preview "$cols" "$lines" "$1" "video" ;;
|
||||
audio/*) generate_preview "$cols" "$lines" "$1" "audio" ;;
|
||||
application/font*|application/*opentype|font/*) generate_preview "$cols" "$lines" "$1" "font" ;;
|
||||
*/*office*|*/*document*) generate_preview "$cols" "$lines" "$1" "office" ;;
|
||||
*/*office*|*/*document*|*/*msword|*/*ms-excel) generate_preview "$cols" "$lines" "$1" "office" ;;
|
||||
application/zip) fifo_pager unzip -l "$1" ;;
|
||||
text/troff)
|
||||
if exists man; then
|
||||
|
@ -283,13 +334,13 @@ handle_ext() {
|
|||
preview_file() {
|
||||
clear
|
||||
# Trying to use pistol if it's available.
|
||||
if [ "$USE_PISTOL" -ne 0 ] && exists pistol; then
|
||||
if [ "$NNN_PISTOL" -ne 0 ] && exists pistol; then
|
||||
fifo_pager pistol "$1"
|
||||
return
|
||||
fi
|
||||
|
||||
# Trying to use scope.sh if it's available.
|
||||
if [ "$USE_SCOPE" -ne 0 ] && exists scope.sh; then
|
||||
if [ "$NNN_SCOPE" -ne 0 ] && exists scope.sh; then
|
||||
fifo_pager scope.sh "$1" "$cols" "$lines" "$(mktemp -d)" "True"
|
||||
return
|
||||
fi
|
||||
|
@ -305,33 +356,39 @@ preview_file() {
|
|||
mimetype="$(file -bL --mime-type -- "$1")"
|
||||
ext="${1##*.}"
|
||||
[ -n "$ext" ] && ext="$(printf "%s" "${ext}" | tr '[:upper:]' '[:lower:]')"
|
||||
lines=$(tput lines <"$TTY")
|
||||
cols=$(tput cols <"$TTY")
|
||||
lines=$(tput lines)
|
||||
cols=$(tput cols)
|
||||
|
||||
# Otherwise, falling back to the defaults.
|
||||
if [ -d "$1" ]; then
|
||||
cd "$1" || return
|
||||
if [ "$ICONLOOKUP" -ne 0 ] && [ -f "$(dirname "$0")"/.iconlookup ]; then
|
||||
[ "$SPLIT" = v ] && BSTR="\n"
|
||||
if [ "$NNN_ICONLOOKUP" -ne 0 ] && [ -f "$(dirname "$0")"/.iconlookup ]; then
|
||||
[ "$NNN_SPLIT" = v ] && BSTR="\n"
|
||||
# shellcheck disable=SC2012
|
||||
ls -F --group-directories-first | head -n "$((lines - 3))" | "$(dirname "$0")"/.iconlookup -l "$cols" -B "$BSTR" -b " "
|
||||
elif exists tree; then
|
||||
fifo_pager tree --filelimit "$(find . -maxdepth 1 | wc -l)" -L 3 -C -F --dirsfirst --noreport
|
||||
elif exists exa; then
|
||||
exa -G --group-directories-first --colour=always
|
||||
fifo_pager exa -T --group-directories-first --colour=always -L 3
|
||||
elif exists eza; then # eza is a community fork of exa (exa is unmaintained)
|
||||
fifo_pager eza -T --group-directories-first --colour=always -L 3
|
||||
else
|
||||
fifo_pager ls -F --group-directories-first --color=always
|
||||
fi
|
||||
cd ..
|
||||
elif [ "${encoding#*)}" = "binary" ]; then
|
||||
handle_mime "$1" "$mimetype" "$ext" "bin"
|
||||
else
|
||||
handle_mime "$1" "$mimetype" "$ext"
|
||||
fi
|
||||
} 2>/dev/null
|
||||
}
|
||||
|
||||
generate_preview() {
|
||||
if [ -n "$QLPATH" ] && stat "$3"; then
|
||||
f="$(wslpath -w "$3")" && "$QLPATH" "$f" &
|
||||
elif [ -n "$NNN_PREVIEWVIDEO" ] && [[ "$4" == +(gif|video) ]]; then
|
||||
[ "$4" = "video" ] && args=(--start=10% --length=4) || args=()
|
||||
video_preview "$1" "$2" "$3" "${args[@]}" && return
|
||||
elif [ ! -f "$NNN_PREVIEWDIR/$3.jpg" ] || [ -n "$(find -L "$3" -newer "$NNN_PREVIEWDIR/$3.jpg")" ]; then
|
||||
mkdir -p "$NNN_PREVIEWDIR/${3%/*}"
|
||||
case $4 in
|
||||
|
@ -339,61 +396,91 @@ generate_preview() {
|
|||
epub) gnome-epub-thumbnailer "$3" "$NNN_PREVIEWDIR/$3.jpg" ;;
|
||||
font) fontpreview -i "$3" -o "$NNN_PREVIEWDIR/$3.jpg" ;;
|
||||
gif) if [ -p "$FIFO_UEBERZUG" ] && exists convert; then
|
||||
frameprefix="$NNN_PREVIEWDIR/$3/${3##*/}"
|
||||
if [ ! -d "$NNN_PREVIEWDIR/$3" ]; then
|
||||
mkdir -p "$NNN_PREVIEWDIR/$3"
|
||||
convert -coalesce -resize "$NNN_PREVIEWWIDTH"x"$NNN_PREVIEWHEIGHT"\> "$3" "$NNN_PREVIEWDIR/$3/${3##*/}.jpg"
|
||||
convert -coalesce -resize "$NNN_PREVIEWWIDTH"x"$NNN_PREVIEWHEIGHT"\> "$3" "$frameprefix.jpg" ||
|
||||
MAGICK_TMPDIR="/tmp" convert -coalesce -resize "$NNN_PREVIEWWIDTH"x"$NNN_PREVIEWHEIGHT"\> "$3" "$frameprefix.jpg"
|
||||
fi
|
||||
while true; do
|
||||
for frame in $(find "$NNN_PREVIEWDIR/$3"/*.jpg | sort -V); do
|
||||
image_preview "$1" "$2" "$frame"
|
||||
sleep 0.1
|
||||
done
|
||||
done &
|
||||
printf "%s" "$!" > "$PREVIEWPID"
|
||||
return
|
||||
else
|
||||
exec >/dev/tty
|
||||
image_preview "$1" "$2" "$3"
|
||||
frames=$(($(find "$NNN_PREVIEWDIR/$3" | wc -l) - 2))
|
||||
[ $frames -lt 0 ] && return
|
||||
while true; do
|
||||
for i in $(seq 0 $frames); do
|
||||
image_preview "$1" "$2" "$frameprefix-$i.jpg"
|
||||
sleep 0.1
|
||||
done
|
||||
done &
|
||||
printf "%s" "$!" > "$PREVIEWPID"
|
||||
return
|
||||
elif [ -n "$NNN_PREVIEWVIDEO" ]; then
|
||||
video_preview "$1" "$2" "$3" && return
|
||||
else
|
||||
image_preview "$1" "$2" "$3" && return
|
||||
fi ;;
|
||||
image) if exists convert; then
|
||||
image) if exists rsvg-convert && [[ "${3##*.}" == "svg" ]]; then
|
||||
rsvg-convert -a -w "$NNN_PREVIEWWIDTH" -h "$NNN_PREVIEWHEIGHT" -f png -o "$NNN_PREVIEWDIR/$3.png" "$3"
|
||||
elif exists convert; then
|
||||
convert "$3" -flatten -resize "$NNN_PREVIEWWIDTH"x"$NNN_PREVIEWHEIGHT"\> "$NNN_PREVIEWDIR/$3.jpg"
|
||||
else
|
||||
image_preview "$1" "$2" "$3" && return
|
||||
fi ;;
|
||||
office) libreoffice --convert-to jpg "$3" --outdir "$NNN_PREVIEWDIR/${3%/*}"
|
||||
filename="$(printf "%s" "${3##*/}" | cut -d. -f1)"
|
||||
mv "$NNN_PREVIEWDIR/${3%/*}/$filename.jpg" "$NNN_PREVIEWDIR/$3.jpg" ;;
|
||||
mv -- "$NNN_PREVIEWDIR/${3%/*}/$filename.jpg" "$NNN_PREVIEWDIR/$3.jpg" ;;
|
||||
pdf) pdftoppm -jpeg -f 1 -singlefile "$3" "$NNN_PREVIEWDIR/$3" ;;
|
||||
video) ffmpegthumbnailer -s0 -i "$3" -o "$NNN_PREVIEWDIR/$3.jpg" || rm "$NNN_PREVIEWDIR/$3.jpg" ;;
|
||||
djvu) ddjvu -format=ppm -page=1 "$3" "$NNN_PREVIEWDIR/$3.jpg" ;;
|
||||
video) video_preview "$1" "$2" "$3" && return ;;
|
||||
esac
|
||||
fi >/dev/null
|
||||
fi
|
||||
if [ -f "$NNN_PREVIEWDIR/$3.jpg" ]; then
|
||||
image_preview "$1" "$2" "$NNN_PREVIEWDIR/$3.jpg"
|
||||
elif [[ "${3##*.}" == "svg" ]] && [ -f "$NNN_PREVIEWDIR/$3.png" ]; then
|
||||
image_preview "$1" "$2" "$NNN_PREVIEWDIR/$3.png"
|
||||
else
|
||||
fifo_pager print_bin_info "$3"
|
||||
fi
|
||||
} 2>/dev/null
|
||||
} >/dev/null 2>&1
|
||||
|
||||
image_preview() {
|
||||
clear
|
||||
if [ "$TERMINAL" = "kitty" ]; then
|
||||
# Kitty terminal users can use the native image preview method
|
||||
kitty +kitten icat --silent --place "$1"x"$2"@0x0 --transfer-mode=stream --stdin=no "$3" &
|
||||
elif exists ueberzug; then
|
||||
exec >/dev/tty
|
||||
if [ "$NNN_TERMINAL" = "kitty" ] && [[ "$NNN_PREVIEWIMGPROG" == +(|icat) ]]; then
|
||||
kitty +kitten icat --silent --scale-up --place "$1"x"$2"@0x0 --transfer-mode=stream --stdin=no "$3" &
|
||||
elif [ "$NNN_TERMINAL" = "tmux" ] && [[ -n "$KITTY_LISTEN_ON" ]] && [[ "$NNN_PREVIEWIMGPROG" == +(|icat) ]]; then
|
||||
kitty +kitten icat --silent --scale-up --place "$(($1 - 1))x$(($2 - 1))"@0x0 --transfer-mode=memory --stdin=no "$3" &
|
||||
elif [ "$NNN_TERMINAL" = "wezterm" ] && [[ "$NNN_PREVIEWIMGPROG" == +(|imgcat) ]]; then
|
||||
wezterm imgcat "$3" &
|
||||
elif exists ueberzug && [[ "$NNN_PREVIEWIMGPROG" == +(|ueberzug) ]]; then
|
||||
ueberzug_layer "$1" "$2" "$3" && return
|
||||
elif exists catimg; then
|
||||
elif exists catimg && [[ "$NNN_PREVIEWIMGPROG" == +(|catimg) ]]; then
|
||||
catimg "$3" &
|
||||
elif exists viu; then
|
||||
elif exists viu && [[ "$NNN_PREVIEWIMGPROG" == +(|viu) ]]; then
|
||||
viu -t "$3" &
|
||||
elif exists chafa && [[ "$NNN_PREVIEWIMGPROG" == +(|chafa) ]]; then
|
||||
chafa "$3" &
|
||||
elif exists img2sixel && [[ "$NNN_PREVIEWIMGPROG" == +(|img2sixel) ]]; then
|
||||
img2sixel -g "$3" &
|
||||
else
|
||||
fifo_pager print_bin_info "$3" && return
|
||||
fi
|
||||
printf "%s" "$!" > "$PREVIEWPID"
|
||||
} 2>/dev/null
|
||||
}
|
||||
|
||||
video_preview() {
|
||||
clear
|
||||
exec >/dev/tty
|
||||
if [ -n "$NNN_PREVIEWVIDEO" ]; then
|
||||
mpv --no-config --really-quiet --vo="$NNN_PREVIEWVIDEO" --profile=sw-fast --loop-file --no-audio "$4" "$3" &
|
||||
else
|
||||
ffmpegthumbnailer -m -s0 -i "$3" -o "$NNN_PREVIEWDIR/$3.jpg" || rm -- "$NNN_PREVIEWDIR/$3.jpg" &
|
||||
fi
|
||||
printf "%s" "$!" > "$PREVIEWPID"
|
||||
}
|
||||
|
||||
ueberzug_layer() {
|
||||
printf '{"action": "add", "identifier": "nnn_ueberzug", "x": 0, "y": 0, "width": "%d", "height": "%d", "scaler": "fit_contain", "path": "%s"}\n' "$1" "$2" "$3" > "$FIFO_UEBERZUG"
|
||||
[ -f "$POSOFFSET" ] && read -r x y < "$POSOFFSET"
|
||||
printf '{"action": "add", "identifier": "nnn_ueberzug", "x": %d, "y": %d, "width": "%d", "height": "%d", "scaler": "fit_contain", "path": "%s"}\n'\
|
||||
"${x:-0}" "${y:-0}" "$1" "$2" "$3" > "$FIFO_UEBERZUG"
|
||||
}
|
||||
|
||||
ueberzug_remove() {
|
||||
|
@ -402,52 +489,50 @@ ueberzug_remove() {
|
|||
|
||||
winch_handler() {
|
||||
clear
|
||||
kill "$(cat "$PREVIEWPID")"
|
||||
pidkill "$PREVIEWPID"
|
||||
if [ -p "$FIFO_UEBERZUG" ]; then
|
||||
pkill -f "tail --follow $FIFO_UEBERZUG"
|
||||
tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser json &
|
||||
fi
|
||||
preview_file "$(cat "$CURSEL")"
|
||||
} 2>/dev/null
|
||||
}
|
||||
|
||||
preview_fifo() {
|
||||
while read -r selection; do
|
||||
if [ -n "$selection" ]; then
|
||||
kill "$(cat "$PREVIEWPID")"
|
||||
pidkill "$PREVIEWPID"
|
||||
[ -p "$FIFO_UEBERZUG" ] && ueberzug_remove
|
||||
[ "$selection" = "close" ] && sleep 0.15 && pkill -P "$$" && exit
|
||||
[ "$selection" = "close" ] && break
|
||||
preview_file "$selection"
|
||||
printf "%s" "$selection" > "$CURSEL"
|
||||
fi
|
||||
done < "$NNN_FIFO"
|
||||
sleep 0.1 # make sure potential preview by winch_handler is killed
|
||||
pkill -P "$$"
|
||||
} 2>/dev/null
|
||||
}
|
||||
|
||||
if [ "$PREVIEW_MODE" ]; then
|
||||
if [ "$TERMINAL" != "kitty" ] && exists ueberzug; then
|
||||
if [ "$PREVIEW_MODE" -eq 1 ] 2>/dev/null; then
|
||||
if exists ueberzug && [ "$NNN_TERMINAL" != "kitty" ] && [[ "$NNN_PREVIEWIMGPROG" == +(|ueberzug) ]]; then
|
||||
mkfifo "$FIFO_UEBERZUG"
|
||||
tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser json &
|
||||
fi
|
||||
|
||||
preview_file "$PWD/$1"
|
||||
preview_fifo &
|
||||
preview_fifo & WAITPID=$!
|
||||
printf "%s" "$!" > "$FIFOPID"
|
||||
printf "%s" "$PWD/$1" > "$CURSEL"
|
||||
trap 'winch_handler; wait' WINCH
|
||||
trap 'rm "$PREVIEWPID" "$CURSEL" "$FIFO_UEBERZUG" "$FIFOPID" 2>/dev/null' INT HUP EXIT
|
||||
wait "$!" 2>/dev/null
|
||||
trap 'winch_handler' WINCH
|
||||
trap 'rm -- "$PREVIEWPID" "$CURSEL" "$FIFO_UEBERZUG" "$FIFOPID" "$POSOFFSET" 2>/dev/null' INT HUP EXIT
|
||||
while kill -s 0 $WAITPID; do
|
||||
wait $WAITPID 2>/dev/null
|
||||
done
|
||||
exit 0
|
||||
else
|
||||
if [ ! -r "$NNN_FIFO" ]; then
|
||||
clear
|
||||
printf "No FIFO available! (\$NNN_FIFO='%s')\nPlease read Usage in preview-tui." "$NNN_FIFO"
|
||||
cfg=$(stty -g); stty raw -echo; head -c 1; stty "$cfg"
|
||||
prompt "No FIFO available! (\$NNN_FIFO='$NNN_FIFO')\nPlease read Usage in '$0'."
|
||||
elif [ "$KITTY_WINDOW_ID" ] && [ -z "$TMUX" ] && [ -z "$KITTY_LISTEN_ON" ]; then
|
||||
clear
|
||||
printf "\$KITTY_LISTEN_ON not set!\nPlease read Usage in preview-tui."
|
||||
cfg=$(stty -g); stty raw -echo; head -c 1; stty "$cfg"
|
||||
prompt "\$KITTY_LISTEN_ON not set!\nPlease read Usage in '$0'."
|
||||
else
|
||||
TTY="$(tty)"
|
||||
TTY="$TTY" toggle_preview "$1" &
|
||||
toggle_preview "$1" &
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -15,10 +15,10 @@ sel=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
|||
# Choose one of these two schemes by commenting
|
||||
|
||||
# more verbose
|
||||
xargs -0 -a "$sel" -I % rsync -ah --progress % "$PWD"
|
||||
xargs -0 -I % rsync -ah --progress % "$PWD" < "$sel"
|
||||
|
||||
# less verbose
|
||||
# xargs -0 -a "$sel" -I % rsync -ah --info=progress2 % "$PWD"
|
||||
# xargs -0 -I % rsync -ah --info=progress2 % "$PWD" < "$sel"
|
||||
|
||||
# Clear selection
|
||||
if [ -p "$NNN_PIPE" ]; then
|
||||
|
|
|
@ -26,7 +26,7 @@ if [ "$resp" = "j" ]; then
|
|||
for entry in $arr
|
||||
do
|
||||
if [ -d "$entry" ]; then
|
||||
echo "cant join directories"
|
||||
echo "can't join directories"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# Description: Upload to Firefox Send if ffsend is found, else
|
||||
# Description: Selections are uploaded using Firefox Send
|
||||
# For single files:
|
||||
# Upload to Firefox Send if ffsend is found, else
|
||||
# Paste contents of a text a file http://ix.io
|
||||
# Upload a binary file to file.io
|
||||
#
|
||||
|
@ -11,20 +13,33 @@
|
|||
# Shell: POSIX compliant
|
||||
# Author: Arun Prakash Jana
|
||||
|
||||
if [ -n "$1" ] && [ -s "$1" ]; then
|
||||
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
||||
if [ -s "$selection" ]; then
|
||||
if type ffsend >/dev/null 2>&1; then
|
||||
ffsend -fiq u "$1"
|
||||
elif [ "$(mimetype --output-format %m "$1" | awk -F '/' '{print $1}')" = "text" ]; then
|
||||
curl -F "f:1=@$1" ix.io
|
||||
# File name will be randomized foo.tar
|
||||
xargs -0 < "$selection" ffsend u
|
||||
else
|
||||
# Upload the file, show the download link and wait till user presses any key
|
||||
curl -s -F "file=@$1" https://file.io/?expires=1w | jq '.link' | tr -d '"'
|
||||
|
||||
# To write download link to "$1".loc and exit
|
||||
# curl -s -F "file=@$1" https://file.io/?expires=1w -o `basename "$1"`.loc
|
||||
printf "ffsend is required to upload selection."
|
||||
fi
|
||||
|
||||
# Clear selection
|
||||
printf "-" > "$NNN_PIPE"
|
||||
else
|
||||
printf "empty file!"
|
||||
if [ -n "$1" ] && [ -s "$1" ]; then
|
||||
if type ffsend >/dev/null 2>&1; then
|
||||
ffsend -fiq u "$1"
|
||||
elif [ "$(mimetype --output-format %m "$1" | awk -F '/' '{print $1}')" = "text" ]; then
|
||||
curl -F "f:1=@$1" ix.io
|
||||
else
|
||||
# Upload the file, show the download link and wait till user presses any key
|
||||
curl -s -F "file=@$1" https://file.io/?expires=1w | jq '.link' | tr -d '"'
|
||||
|
||||
# To write download link to "$1".loc and exit
|
||||
# curl -s -F "file=@$1" https://file.io/?expires=1w -o `basename "$1"`.loc
|
||||
fi
|
||||
else
|
||||
printf "empty file!"
|
||||
fi
|
||||
fi
|
||||
|
||||
read -r _
|
||||
|
|
|
@ -1,26 +1,45 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# Description: Set the selected image as wallpaper using nitrogen or pywal.
|
||||
# Description: Set the selected image as wallpaper.
|
||||
# Uses nitrogen or pywal on X11, swww on wayland.
|
||||
#
|
||||
# Usage: Hover on an image and run the script to set it as wallpaper.
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: juacq97
|
||||
|
||||
resp=
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
if [ "$(file --mime-type "$1" | awk '{print $NF}' | awk -F '/' '{print $1}')" = "image" ]; then
|
||||
if type nitrogen >/dev/null 2>&1; then
|
||||
nitrogen --set-zoom-fill --save "$1"
|
||||
elif type wal >/dev/null 2>&1; then
|
||||
wal -i "$1"
|
||||
if [ "$(file --mime-type "$1" | awk '{print $NF}' | awk -F '/' '{print $1}')" = "image" ]; then
|
||||
if [ "$XDG_SESSION_TYPE" = "x11" ]; then
|
||||
if type nitrogen >/dev/null 2>&1; then
|
||||
printf "Set to full desktop or a specific monitors? [0, 1, etc. Defaults to full.]"
|
||||
read -r resp
|
||||
if [ "$resp" != "" ]; then
|
||||
nitrogen --set-zoom-fill --save "$1" --head="$resp"
|
||||
else
|
||||
nitrogen --set-zoom-fill --save "$1"
|
||||
fi
|
||||
elif type wal >/dev/null 2>&1; then
|
||||
wal -i "$1"
|
||||
else
|
||||
printf "nitrogen or pywal missing"
|
||||
read -r _
|
||||
fi
|
||||
else
|
||||
printf "nitrogen or pywal missing"
|
||||
read -r _
|
||||
if type swww >/dev/null 2>&1; then
|
||||
swww img "$1"
|
||||
else
|
||||
printf "swww missing"
|
||||
read -r _
|
||||
fi
|
||||
fi
|
||||
|
||||
# If you want a system notification, uncomment the next 3 lines.
|
||||
# notify-send -a "nnn" "Wallpaper changed!"
|
||||
# else
|
||||
# notify-send -a "nnn" "No image selected"
|
||||
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -23,7 +23,10 @@ IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" # protect trailing \n
|
|||
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
||||
|
||||
getclip () {
|
||||
if type xsel >/dev/null 2>&1; then
|
||||
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
|
||||
# Wayland
|
||||
wl-paste
|
||||
elif type xsel >/dev/null 2>&1; then
|
||||
# Linux
|
||||
xsel -bo
|
||||
elif type xclip >/dev/null 2>&1; then
|
||||
|
@ -41,9 +44,6 @@ getclip () {
|
|||
elif [ -r /dev/clipboard ] ; then
|
||||
# Cygwin
|
||||
cat /dev/clipboard
|
||||
elif type wl-paste >/dev/null 2>&1; then
|
||||
# Wayland
|
||||
wl-paste
|
||||
elif type clipboard >/dev/null 2>&1; then
|
||||
# Haiku
|
||||
clipboard --print
|
||||
|
|
|
@ -42,12 +42,12 @@ done
|
|||
|
||||
app=$(find "$@" -iname '*.desktop' -exec grep '^Name=' {} + \
|
||||
| sort -u -t ':' -k 1,1 \
|
||||
| sed -E 's;.+/(.+desktop):Name=(.+);\2:\1;' \
|
||||
| sed -e 's;..*/\(..*desktop\):Name=\(..*\);\2:\1;' \
|
||||
| sort -t ':' -k 1,1 \
|
||||
| column -t -s ':' -o "$(printf '\t')" \
|
||||
| $menu \
|
||||
| cut -f 2)
|
||||
|
||||
if [ -n "$app" ]; then
|
||||
xdg-mime default "$app" "$ftype"
|
||||
xdg-mime default "${app%%[[:blank:]]*}" "$ftype"
|
||||
fi
|
||||
|
|
|
@ -1,5 +1,35 @@
|
|||
---
|
||||
Checks: 'clang-diagnostic-*,clang-analyzer-*,readability-*,modernize-*,bugprone-*,misc-*,-misc-unused-parameters,google-runtime-int,-llvm-header-guard,fuchsia-restrict-system-includes,-clang-analyzer-valist.Uninitialized,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-alpha.*,-readability-magic-numbers,-readability-braces-around-statements,-readability-function-cognitive-complexity,-readability-isolate-declaration,-readability-suspicious-call-argument,-bugprone-easily-swappable-parameters,-bugprone-narrowing-conversions,-bugprone-reserved-identifier'
|
||||
Checks: >
|
||||
clang-diagnostic-*,
|
||||
clang-analyzer-*,
|
||||
readability-*,
|
||||
modernize-*,
|
||||
bugprone-*,
|
||||
misc-*,
|
||||
google-runtime-int,
|
||||
fuchsia-restrict-system-includes,
|
||||
-misc-unused-parameters,
|
||||
-misc-include-cleaner,
|
||||
-llvm-header-guard,
|
||||
-clang-analyzer-valist.Uninitialized,
|
||||
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
|
||||
-clang-analyzer-security.insecureAPI.rand,
|
||||
-clang-analyzer-alpha.*,
|
||||
-modernize-macro-to-enum,
|
||||
-readability-magic-numbers,
|
||||
-readability-braces-around-statements,
|
||||
-readability-function-cognitive-complexity,
|
||||
-readability-identifier-length,
|
||||
-readability-isolate-declaration,
|
||||
-readability-suspicious-call-argument,
|
||||
-readability-avoid-nested-conditional-operator,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-bugprone-narrowing-conversions,
|
||||
-bugprone-reserved-identifier,
|
||||
-bugprone-switch-missing-default-case,
|
||||
-bugprone-inc-dec-in-conditions,
|
||||
-bugprone-multi-level-implicit-pointer-conversion,
|
||||
|
||||
WarningsAsErrors: '*'
|
||||
HeaderFilterRegex: '.*(?<!lookup3.c)$'
|
||||
FormatStyle: 'file'
|
||||
|
@ -11,5 +41,5 @@ CheckOptions:
|
|||
- key: fuchsia-restrict-system-includes.Includes
|
||||
value: '*,-stdint.h,-stdbool.h'
|
||||
- key: readability-function-size.StatementThreshold
|
||||
value: '905'
|
||||
value: '950'
|
||||
...
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2014-2016, Lazaros Koromilas <lostd@2f30.org>
|
||||
* Copyright (C) 2014-2016, Dimitris Papastamos <sin@2f30.org>
|
||||
* Copyright (C) 2016-2021, Arun Prakash Jana <engineerarun@gmail.com>
|
||||
* Copyright (C) 2016-2023, Arun Prakash Jana <engineerarun@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -0,0 +1,291 @@
|
|||
/*
|
||||
* simple program which outputs a hash-table of `icons_ext` with low collusion.
|
||||
* the hash function is case-insensitive, it also doesn't hash beyond the
|
||||
* length of the longest extension.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#define GOLDEN_RATIO_32 UINT32_C(2654442313) /* golden ratio for 32bits: (2^32) / 1.61803 */
|
||||
#define GOLDEN_RATIO_64 UINT64_C(0x9E3793492EEDC3F7)
|
||||
#define ICONS_TABLE_SIZE 8 /* size in bits. 8 = 256 */
|
||||
|
||||
#ifndef TOUPPER
|
||||
#define TOUPPER(ch) (((ch) >= 'a' && (ch) <= 'z') ? ((ch) - 'a' + 'A') : (ch))
|
||||
#endif
|
||||
|
||||
/* all of this is just for the static hash-table generation. only the hash
|
||||
* function gets included in `nnn` binary.
|
||||
*/
|
||||
#ifdef ICONS_GENERATE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include "icons.h"
|
||||
|
||||
/* like assert, but always sticks around during generation. */
|
||||
#define ENSURE(X) do { \
|
||||
if (!(X)) { \
|
||||
fprintf(stderr, "%s:%d: `%s`\n", __FILE__, __LINE__, #X); \
|
||||
abort(); \
|
||||
} \
|
||||
} while (0)
|
||||
#define ARRLEN(X) (sizeof(X) / sizeof((X)[0]))
|
||||
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
||||
#define HGEN_ITERARATION (1ul << 13)
|
||||
#define ICONS_PROBE_MAX_ALLOWED 6
|
||||
#define ICONS_MATCH_MAX (512)
|
||||
|
||||
#if 0 /* for logging some interesting info to stderr */
|
||||
#define log(...) fprintf(stderr, "[INFO]: " __VA_ARGS__)
|
||||
#else
|
||||
#define log(...) ((void)0)
|
||||
#endif
|
||||
|
||||
static uint32_t icon_ext_hash(const char *s);
|
||||
|
||||
/* change ICONS_TABLE_SIZE to increase the size of the table */
|
||||
static struct icon_pair table[1u << ICONS_TABLE_SIZE];
|
||||
static uint8_t seen[ARRLEN(table)];
|
||||
/* arbitrarily picked starting position. change if needed.
|
||||
* but ensure they're above 1 and prefer prime numbers.
|
||||
*/
|
||||
static uint32_t hash_start = 7;
|
||||
static uint32_t hash_mul = 251; /* unused as of now */
|
||||
|
||||
/*
|
||||
* use robin-hood insertion to reduce the max probe length
|
||||
*/
|
||||
static void
|
||||
rh_insert(const struct icon_pair item, uint32_t idx, uint32_t n)
|
||||
{
|
||||
ENSURE(n != 0);
|
||||
for (uint32_t tries = 0; tries < ARRLEN(table); ++tries, ++n) {
|
||||
if (seen[idx] < n) {
|
||||
struct icon_pair tmp_item = table[idx];
|
||||
uint32_t tmp_n = seen[idx];
|
||||
|
||||
ENSURE(n < (uint8_t)-1);
|
||||
table[idx] = item;
|
||||
seen[idx] = n;
|
||||
|
||||
if (tmp_n != 0) /* the slot we inserted to wasn't empty */
|
||||
rh_insert(tmp_item, idx, tmp_n);
|
||||
return;
|
||||
}
|
||||
idx = (idx + 1) % ARRLEN(table);
|
||||
}
|
||||
ENSURE(0 && "unreachable");
|
||||
}
|
||||
|
||||
enum { PROBE_MAX, PROBE_TOTAL, PROBE_CNT };
|
||||
static unsigned int *
|
||||
table_populate(unsigned int p[static PROBE_CNT])
|
||||
{
|
||||
memset(seen, 0x0, sizeof seen);
|
||||
memset(table, 0x0, sizeof table);
|
||||
for (size_t i = 0; i < ARRLEN(icons_ext); ++i) {
|
||||
if (icons_ext[i].icon[0] == '\0') /* skip empty entries */
|
||||
continue;
|
||||
uint32_t h = icon_ext_hash(icons_ext[i].match);
|
||||
rh_insert(icons_ext[i], h, 1);
|
||||
}
|
||||
|
||||
p[PROBE_MAX] = p[PROBE_TOTAL] = 0;
|
||||
for (size_t i = 0; i < ARRLEN(seen); ++i) {
|
||||
p[PROBE_MAX] = MAX(p[PROBE_MAX], seen[i]);
|
||||
p[PROBE_TOTAL] += seen[i];
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/* permuted congruential generator */
|
||||
static uint32_t
|
||||
pcg(uint64_t *state)
|
||||
{
|
||||
uint64_t oldstate = *state;
|
||||
*state *= GOLDEN_RATIO_64;
|
||||
uint32_t r = (oldstate >> 59);
|
||||
uint32_t v = (oldstate ^ (oldstate >> 18)) >> 27;
|
||||
return (v >> (-r & 31)) | (v << r);
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
ENSURE(ARRLEN(icons_ext) <= ARRLEN(table));
|
||||
ENSURE(ICONS_TABLE_SIZE < 16);
|
||||
ENSURE(1u << ICONS_TABLE_SIZE == ARRLEN(table));
|
||||
ENSURE((GOLDEN_RATIO_32 & 1) == 1); /* must be odd */
|
||||
ENSURE((GOLDEN_RATIO_64 & 1) == 1); /* must be odd */
|
||||
ENSURE(hash_start > 1);
|
||||
ENSURE(hash_mul > 1);
|
||||
/* ensure power of 2 hashtable size which allows compiler to optimize
|
||||
* away mod (`%`) operations
|
||||
*/
|
||||
ENSURE((ARRLEN(table) & (ARRLEN(table) - 1)) == 0);
|
||||
|
||||
unsigned int max_probe = (unsigned)-1;
|
||||
uint32_t best_hash_start = 0, best_hash_mul = 0, best_total_probe = 9999;
|
||||
uint64_t hash_start_rng = hash_start, hash_mul_rng = hash_mul;
|
||||
|
||||
for (size_t i = 0; i < HGEN_ITERARATION; ++i) {
|
||||
unsigned *p = table_populate((unsigned [PROBE_CNT]){0});
|
||||
if (p[PROBE_MAX] < max_probe ||
|
||||
(p[PROBE_MAX] == max_probe && p[PROBE_TOTAL] < best_total_probe))
|
||||
{
|
||||
max_probe = p[PROBE_MAX];
|
||||
best_total_probe = p[PROBE_TOTAL];
|
||||
best_hash_start = hash_start;
|
||||
best_hash_mul = hash_mul;
|
||||
}
|
||||
hash_start = pcg(&hash_start_rng);
|
||||
hash_mul = pcg(&hash_mul_rng);
|
||||
}
|
||||
ENSURE(max_probe < ICONS_PROBE_MAX_ALLOWED);
|
||||
hash_start = best_hash_start;
|
||||
hash_mul = best_hash_mul;
|
||||
{
|
||||
unsigned *p = table_populate((unsigned [PROBE_CNT]){0});
|
||||
ENSURE(p[PROBE_MAX] == max_probe);
|
||||
ENSURE(p[PROBE_TOTAL] == best_total_probe);
|
||||
}
|
||||
|
||||
/* sanity check */
|
||||
double nitems = 0;
|
||||
unsigned int total_probe = 0;
|
||||
for (size_t i = 0; i < ARRLEN(icons_ext); ++i) {
|
||||
if (icons_ext[i].icon[0] == 0)
|
||||
continue;
|
||||
uint32_t found = 0, h = icon_ext_hash(icons_ext[i].match);
|
||||
for (uint32_t k = 0; k < max_probe; ++k) {
|
||||
uint32_t z = (h + k) % ARRLEN(table);
|
||||
++total_probe;
|
||||
if (table[z].match && strcasecmp(icons_ext[i].match, table[z].match) == 0) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ENSURE(found);
|
||||
++nitems;
|
||||
}
|
||||
ENSURE(total_probe == best_total_probe);
|
||||
|
||||
size_t match_max = 0, icon_max = 0;
|
||||
for (size_t i = 0; i < ARRLEN(icons_name); ++i) {
|
||||
match_max = MAX(match_max, strlen(icons_name[i].match) + 1);
|
||||
icon_max = MAX(icon_max, strlen(icons_name[i].icon) + 1);
|
||||
}
|
||||
for (size_t i = 0; i < ARRLEN(icons_ext); ++i) {
|
||||
match_max = MAX(match_max, strlen(icons_ext[i].match) + 1);
|
||||
icon_max = MAX(icon_max, strlen(icons_ext[i].icon) + 1);
|
||||
}
|
||||
icon_max = MAX(icon_max, strlen(dir_icon.icon) + 1);
|
||||
icon_max = MAX(icon_max, strlen(exec_icon.icon) + 1);
|
||||
icon_max = MAX(icon_max, strlen(file_icon.icon) + 1);
|
||||
ENSURE(icon_max < ICONS_MATCH_MAX);
|
||||
|
||||
const char *uniq[ARRLEN(icons_ext)] = {0};
|
||||
size_t uniq_head = 0;
|
||||
for (size_t i = 0; i < ARRLEN(icons_ext); ++i) {
|
||||
if (icons_ext[i].icon[0] == 0)
|
||||
continue;
|
||||
int isuniq = 1;
|
||||
for (size_t k = 0; k < uniq_head; ++k) {
|
||||
if (strcasecmp(uniq[k], icons_ext[i].icon) == 0) {
|
||||
isuniq = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isuniq) {
|
||||
ENSURE(uniq_head < ARRLEN(uniq));
|
||||
uniq[uniq_head++] = icons_ext[i].icon;
|
||||
}
|
||||
}
|
||||
ENSURE(uniq_head < (unsigned char)-1);
|
||||
|
||||
log("load-factor: %.2f (%u/%zu)\n", (nitems * 100.0) / (double)ARRLEN(table),
|
||||
(unsigned int)nitems, ARRLEN(table));
|
||||
log("max_probe : %6u\n", max_probe);
|
||||
log("total_probe: %6u\n", total_probe);
|
||||
log("uniq icons : %6zu\n", uniq_head);
|
||||
log("no-compact : %6zu bytes\n", ARRLEN(table) * icon_max);
|
||||
log("compaction : %6zu bytes\n", uniq_head * icon_max + ARRLEN(table));
|
||||
log("hash_start : %6" PRIu32 "\n", hash_start);
|
||||
log("hash_mul : %6" PRIu32 "\n", hash_mul);
|
||||
|
||||
printf("#ifndef INCLUDE_ICONS_GENERATED\n");
|
||||
printf("#define INCLUDE_ICONS_GENERATED\n\n");
|
||||
|
||||
printf("/*\n * NOTE: This file is automatically generated.\n");
|
||||
printf(" * DO NOT EDIT THIS FILE DIRECTLY.\n");
|
||||
printf(" * Use `icons.h` to customize icons\n */\n\n");
|
||||
|
||||
printf("#define hash_start UINT32_C(%" PRIu32 ")\n", hash_start);
|
||||
printf("#define hash_mul UINT32_C(%" PRIu32 ")\n\n", hash_mul);
|
||||
printf("#define ICONS_PROBE_MAX %uu\n", max_probe);
|
||||
printf("#define ICONS_MATCH_MAX %zuu\n\n", match_max);
|
||||
printf("#define ICONS_STR_MAX %zuu\n\n", icon_max);
|
||||
|
||||
printf("struct icon_pair { const char match[ICONS_MATCH_MAX]; "
|
||||
"const char icon[ICONS_STR_MAX]; unsigned char color; };\n\n");
|
||||
|
||||
printf("static const char icons_ext_uniq[%zu][ICONS_STR_MAX] = {\n", uniq_head);
|
||||
for (size_t i = 0; i < uniq_head; ++i)
|
||||
printf("\t\"%s\",\n", uniq[i]);
|
||||
printf("};\n\n");
|
||||
|
||||
printf("static const struct {\n\tconst char match[ICONS_MATCH_MAX];\n"
|
||||
"\tunsigned char idx;\n\tunsigned char color;\n} icons_ext[%zu] = {\n",
|
||||
ARRLEN(table));
|
||||
for (size_t i = 0; i < ARRLEN(table); ++i) {
|
||||
if (table[i].icon == NULL || table[i].icon[0] == '\0') /* skip empty entries */
|
||||
continue;
|
||||
size_t k;
|
||||
for (k = 0; k < uniq_head; ++k) {
|
||||
if (strcasecmp(table[i].icon, uniq[k]) == 0)
|
||||
break;
|
||||
}
|
||||
ENSURE(k < uniq_head);
|
||||
printf("\t[%3zu] = {\"%s\", %zu, %hhu },\n",
|
||||
i, table[i].match, k, table[i].color);
|
||||
}
|
||||
printf("};\n\n");
|
||||
|
||||
printf("#endif /* INCLUDE_ICONS_GENERATED */\n");
|
||||
}
|
||||
|
||||
#else
|
||||
#define ENSURE(X) ((void)0)
|
||||
#endif /* ICONS_GENERATE */
|
||||
|
||||
#if defined(ICONS_GENERATE) || defined(ICONS_ENABLED)
|
||||
static uint32_t
|
||||
icon_ext_hash(const char *str)
|
||||
{
|
||||
uint32_t i, hash = hash_start;
|
||||
enum { wsz = sizeof hash * CHAR_BIT, z = wsz - ICONS_TABLE_SIZE, r = 5 };
|
||||
|
||||
/* just an xor-rotate hash. in general, this is a horrible hash
|
||||
* function but for our specific input it works fine while being
|
||||
* computationally cheap.
|
||||
*/
|
||||
for (i = 0; i < ICONS_MATCH_MAX && str[i] != '\0'; ++i) {
|
||||
hash ^= TOUPPER((unsigned char)str[i]);
|
||||
hash = (hash >> (wsz - r)) | (hash << r);
|
||||
}
|
||||
|
||||
/* finalizer: https://probablydance.com/2018/06/16 */
|
||||
hash ^= (hash >> z);
|
||||
hash *= GOLDEN_RATIO_32;
|
||||
|
||||
hash >>= z;
|
||||
ENSURE(hash < ARRLEN(table));
|
||||
|
||||
return hash;
|
||||
}
|
||||
#endif
|
|
@ -1,274 +0,0 @@
|
|||
#ifndef ICONS_NERDFONT
|
||||
#define ICONS_NERDFONT
|
||||
|
||||
// You can find hex codes for nerd fonts here
|
||||
// https://www.nerdfonts.com/cheat-sheet
|
||||
|
||||
// Arrows
|
||||
#define MD_ARROW_UPWARD "\uf55c"
|
||||
#define MD_ARROW_FORWARD "\uf553"
|
||||
#define MD_ARROW_DOWNWARD "\uf544"
|
||||
|
||||
// Generics
|
||||
#define ICON_DIRECTORY "\ue5ff"
|
||||
#define ICON_FILE "\uf713"
|
||||
#define ICON_EXEC "\uf144"
|
||||
#define ICON_MANUAL "\uf5bd"
|
||||
|
||||
// Top level and common icons
|
||||
#define ICON_ARCHIVE "\uf53b"
|
||||
#define ICON_BRIEFCASE "\uf5d5"
|
||||
#define ICON_C "\ue61e"
|
||||
#define ICON_CHANGELOG "\uf7d9"
|
||||
#define ICON_CHESS "\uf639"
|
||||
#define ICON_CLOJURE "\ue76a"
|
||||
#define ICON_CONFIGURE "\uf423"
|
||||
#define ICON_CPLUSPLUS "\ue61d"
|
||||
#define ICON_DATABASE "\uf6b7"
|
||||
#define ICON_DESKTOP "\ufcbe"
|
||||
#define ICON_DOCUMENT "\uf718"
|
||||
#define ICON_DOWNLOADS "\uf5d7"
|
||||
#define ICON_ENCRYPT "\uf805"
|
||||
#define ICON_FSHARP "\ue7a7"
|
||||
#define ICON_GIT "\ue5fb"
|
||||
#define ICON_HASKELL "\ue777"
|
||||
#define ICON_HTML "\uf72d"
|
||||
#define ICON_JAVA "\ue738"
|
||||
#define ICON_JAVASCRIPT "\uf81d"
|
||||
#define ICON_LICENSE "\uf718"
|
||||
#define ICON_LINUX "\uf83c"
|
||||
#define ICON_MAKEFILE "\uf68c"
|
||||
#define ICON_MUSIC "\uf832"
|
||||
#define ICON_MUSICFILE "\uf886"
|
||||
#define ICON_OPTICALDISK "\ue271"
|
||||
#define ICON_PICTUREFILE "\uf71e"
|
||||
#define ICON_PICTURES "\uf753"
|
||||
#define ICON_PLAYLIST "\uf910"
|
||||
#define ICON_PUBLIC "\ue5ff"
|
||||
#define ICON_PYTHON "\ue235"
|
||||
#define ICON_REACT "\ue625"
|
||||
#define ICON_RUBY "\ue23e"
|
||||
#define ICON_SCRIPT "\ue795"
|
||||
#define ICON_TEMPLATES "\ufac6"
|
||||
#define ICON_TEX "\ufb68"
|
||||
#define ICON_VIDEOFILE "\uf72a"
|
||||
#define ICON_VIDEOS "\uf72f"
|
||||
#define ICON_WORDDOC "\uf72b"
|
||||
|
||||
|
||||
/* Numbers */
|
||||
#define ICON_EXT_1 ICON_MANUAL
|
||||
#define ICON_EXT_7Z ICON_ARCHIVE
|
||||
|
||||
/* A */
|
||||
#define ICON_EXT_A ICON_MANUAL
|
||||
#define ICON_EXT_APK ICON_ARCHIVE
|
||||
#define ICON_EXT_ASM ICON_FILE
|
||||
#define ICON_EXT_AUP ICON_MUSICFILE
|
||||
#define ICON_EXT_AVI ICON_VIDEOFILE
|
||||
|
||||
/* B */
|
||||
#define ICON_EXT_BAT ICON_SCRIPT
|
||||
#define ICON_EXT_BIB ICON_TEX
|
||||
#define ICON_EXT_BIN "\uf471"
|
||||
#define ICON_EXT_BMP ICON_PICTUREFILE
|
||||
#define ICON_EXT_BZ2 ICON_ARCHIVE
|
||||
|
||||
/* C */
|
||||
#define ICON_EXT_C ICON_C
|
||||
#define ICON_EXT_CPLUSPLUS ICON_CPLUSPLUS
|
||||
#define ICON_EXT_CAB ICON_ARCHIVE
|
||||
#define ICON_EXT_CABAL ICON_HASKELL
|
||||
#define ICON_EXT_CBR ICON_ARCHIVE
|
||||
#define ICON_EXT_CBZ ICON_ARCHIVE
|
||||
#define ICON_EXT_CC ICON_CPLUSPLUS
|
||||
#define ICON_EXT_CLASS ICON_JAVA
|
||||
#define ICON_EXT_CLJ ICON_CLOJURE
|
||||
#define ICON_EXT_CLJC ICON_CLOJURE
|
||||
#define ICON_EXT_CLJS ICON_CLOJURE
|
||||
#define ICON_EXT_CLS ICON_TEX
|
||||
#define ICON_EXT_CMAKE ICON_MAKEFILE
|
||||
#define ICON_EXT_COFFEE "\ue751"
|
||||
#define ICON_EXT_CONF ICON_CONFIGURE
|
||||
#define ICON_EXT_CPIO ICON_ARCHIVE
|
||||
#define ICON_EXT_CPP ICON_CPLUSPLUS
|
||||
#define ICON_EXT_CSS "\ue749"
|
||||
#define ICON_EXT_CUE ICON_PLAYLIST
|
||||
#define ICON_EXT_CVS ICON_CONFIGURE
|
||||
#define ICON_EXT_CXX ICON_CPLUSPLUS
|
||||
|
||||
/* D */
|
||||
#define ICON_EXT_DB ICON_DATABASE
|
||||
#define ICON_EXT_DEB "\ue77d"
|
||||
#define ICON_EXT_DIFF "\uf440"
|
||||
#define ICON_EXT_DLL ICON_SCRIPT
|
||||
#define ICON_EXT_DOC ICON_WORDDOC
|
||||
#define ICON_EXT_DOCX ICON_WORDDOC
|
||||
|
||||
/* E */
|
||||
#define ICON_EXT_EJS ICON_JAVASCRIPT
|
||||
#define ICON_EXT_ELF ICON_LINUX
|
||||
#define ICON_EXT_EPUB ICON_MANUAL
|
||||
#define ICON_EXT_EXE ICON_EXEC
|
||||
|
||||
/* F */
|
||||
#define ICON_EXT_FEN ICON_CHESS
|
||||
#define ICON_EXT_FSHARP ICON_FSHARP
|
||||
#define ICON_EXT_FLAC ICON_MUSICFILE
|
||||
#define ICON_EXT_FLV ICON_VIDEOFILE
|
||||
#define ICON_EXT_FS ICON_FSHARP
|
||||
#define ICON_EXT_FSI ICON_FSHARP
|
||||
#define ICON_EXT_FSSCRIPT ICON_FSHARP
|
||||
#define ICON_EXT_FSX ICON_FSHARP
|
||||
|
||||
/* G */
|
||||
#define ICON_EXT_GEM ICON_RUBY
|
||||
#define ICON_EXT_GIF ICON_PICTUREFILE
|
||||
#define ICON_EXT_GO "\ufcd1"
|
||||
#define ICON_EXT_GPG ICON_ENCRYPT
|
||||
#define ICON_EXT_GZ ICON_ARCHIVE
|
||||
#define ICON_EXT_GZIP ICON_ARCHIVE
|
||||
|
||||
/* H */
|
||||
#define ICON_EXT_H ICON_C
|
||||
#define ICON_EXT_HH ICON_CPLUSPLUS
|
||||
#define ICON_EXT_HPP ICON_CPLUSPLUS
|
||||
#define ICON_EXT_HS ICON_HASKELL
|
||||
#define ICON_EXT_HTACCESS ICON_CONFIGURE
|
||||
#define ICON_EXT_HTPASSWD ICON_CONFIGURE
|
||||
#define ICON_EXT_HTM ICON_HTML
|
||||
#define ICON_EXT_HTML ICON_HTML
|
||||
#define ICON_EXT_HXX ICON_CPLUSPLUS
|
||||
|
||||
/* I */
|
||||
#define ICON_EXT_ICO ICON_PICTUREFILE
|
||||
#define ICON_EXT_IMG ICON_OPTICALDISK
|
||||
#define ICON_EXT_INI ICON_CONFIGURE
|
||||
#define ICON_EXT_ISO ICON_OPTICALDISK
|
||||
|
||||
/* J */
|
||||
#define ICON_EXT_JAR ICON_JAVA
|
||||
#define ICON_EXT_JAVA ICON_JAVA
|
||||
#define ICON_EXT_JL ICON_CONFIGURE
|
||||
#define ICON_EXT_JPEG ICON_PICTUREFILE
|
||||
#define ICON_EXT_JPG ICON_PICTUREFILE
|
||||
#define ICON_EXT_JS ICON_JAVASCRIPT
|
||||
#define ICON_EXT_JSON "\ufb25"
|
||||
#define ICON_EXT_JSX ICON_REACT
|
||||
|
||||
/* K */
|
||||
|
||||
/* L */
|
||||
#define ICON_EXT_LHA ICON_ARCHIVE
|
||||
#define ICON_EXT_LHS ICON_HASKELL
|
||||
#define ICON_EXT_LOG ICON_DOCUMENT
|
||||
#define ICON_EXT_LUA "\ue620"
|
||||
#define ICON_EXT_LZH ICON_ARCHIVE
|
||||
#define ICON_EXT_LZMA ICON_ARCHIVE
|
||||
|
||||
/* M */
|
||||
#define ICON_EXT_M4A ICON_MUSICFILE
|
||||
#define ICON_EXT_M4V ICON_VIDEOFILE
|
||||
#define ICON_EXT_M "\ufd1c"
|
||||
#define ICON_EXT_MAT "\uf0ce"
|
||||
#define ICON_EXT_MD "\ue609"
|
||||
#define ICON_EXT_MK ICON_MAKEFILE
|
||||
#define ICON_EXT_MKV ICON_VIDEOFILE
|
||||
#define ICON_EXT_MOV ICON_VIDEOFILE
|
||||
#define ICON_EXT_MP3 ICON_MUSICFILE
|
||||
#define ICON_EXT_MP4 ICON_VIDEOFILE
|
||||
#define ICON_EXT_MPEG ICON_VIDEOFILE
|
||||
#define ICON_EXT_MPG ICON_VIDEOFILE
|
||||
#define ICON_EXT_MSI "\uf871"
|
||||
|
||||
/* N */
|
||||
#define ICON_EXT_NIX "\uf313"
|
||||
|
||||
/* O */
|
||||
#define ICON_EXT_O ICON_MANUAL
|
||||
#define ICON_EXT_OGG ICON_MUSICFILE
|
||||
#define ICON_EXT_ODOWNLOAD ICON_DOWNLOADS
|
||||
#define ICON_EXT_OUT ICON_LINUX
|
||||
|
||||
/* P */
|
||||
#define ICON_EXT_PART ICON_DOWNLOADS
|
||||
#define ICON_EXT_PATCH "\uf440"
|
||||
#define ICON_EXT_PDF "\uf724"
|
||||
#define ICON_EXT_PGN ICON_CHESS
|
||||
#define ICON_EXT_PHP "\ue73d"
|
||||
#define ICON_EXT_PNG ICON_PICTUREFILE
|
||||
#define ICON_EXT_PPT "\uf726"
|
||||
#define ICON_EXT_PPTX "\uf726"
|
||||
#define ICON_EXT_PSB "\ue7b8"
|
||||
#define ICON_EXT_PSD "\ue7b8"
|
||||
#define ICON_EXT_PY ICON_PYTHON
|
||||
#define ICON_EXT_PYC ICON_PYTHON
|
||||
#define ICON_EXT_PYD ICON_PYTHON
|
||||
#define ICON_EXT_PYO ICON_PYTHON
|
||||
|
||||
/* Q */
|
||||
|
||||
/* R */
|
||||
#define ICON_EXT_RAR ICON_ARCHIVE
|
||||
#define ICON_EXT_RC ICON_CONFIGURE
|
||||
#define ICON_EXT_ROM "\uf795"
|
||||
#define ICON_EXT_RPM ICON_ARCHIVE
|
||||
#define ICON_EXT_RSS "\uf96b"
|
||||
#define ICON_EXT_RTF "\uf724"
|
||||
#define ICON_EXT_RB ICON_RUBY
|
||||
|
||||
/* S */
|
||||
#define ICON_EXT_SASS "\ue603"
|
||||
#define ICON_EXT_SCSS "\ue603"
|
||||
#define ICON_EXT_SO ICON_MANUAL
|
||||
#define ICON_EXT_SCALA "\ue737"
|
||||
#define ICON_EXT_SH ICON_SCRIPT
|
||||
#define ICON_EXT_SLIM ICON_SCRIPT
|
||||
#define ICON_EXT_SLN "\ue70c"
|
||||
#define ICON_EXT_SQL ICON_DATABASE
|
||||
#define ICON_EXT_SRT "\uf679"
|
||||
#define ICON_EXT_STY ICON_TEX
|
||||
#define ICON_EXT_SUB "\uf679"
|
||||
#define ICON_EXT_SVG ICON_PICTUREFILE
|
||||
|
||||
/* T */
|
||||
#define ICON_EXT_TAR ICON_ARCHIVE
|
||||
#define ICON_EXT_TEX ICON_TEX
|
||||
#define ICON_EXT_TGZ ICON_ARCHIVE
|
||||
#define ICON_EXT_TS "\ue628"
|
||||
#define ICON_EXT_TSX ICON_REACT
|
||||
#define ICON_EXT_TXT ICON_DOCUMENT
|
||||
#define ICON_EXT_TXZ ICON_ARCHIVE
|
||||
|
||||
/* U */
|
||||
|
||||
/* V */
|
||||
#define ICON_EXT_VID ICON_VIDEOFILE
|
||||
#define ICON_EXT_VIM "\ue62b"
|
||||
#define ICON_EXT_VIMRC "\ue62b"
|
||||
|
||||
/* W */
|
||||
#define ICON_EXT_WAV ICON_MUSICFILE
|
||||
#define ICON_EXT_WEBM ICON_VIDEOFILE
|
||||
#define ICON_EXT_WMA ICON_VIDEOFILE
|
||||
#define ICON_EXT_WMV ICON_VIDEOFILE
|
||||
|
||||
/* X */
|
||||
#define ICON_EXT_XBPS ICON_ARCHIVE
|
||||
#define ICON_EXT_XCF ICON_PICTUREFILE
|
||||
#define ICON_EXT_XHTML ICON_HTML
|
||||
#define ICON_EXT_XLS "\uf71a"
|
||||
#define ICON_EXT_XLSX "\uf71a"
|
||||
#define ICON_EXT_XML ICON_HTML
|
||||
#define ICON_EXT_XZ ICON_ARCHIVE
|
||||
|
||||
/* Y */
|
||||
#define ICON_EXT_YAML ICON_CONFIGURE
|
||||
#define ICON_EXT_YML ICON_CONFIGURE
|
||||
|
||||
/* Z */
|
||||
#define ICON_EXT_ZIP ICON_ARCHIVE
|
||||
#define ICON_EXT_ZSH ICON_SCRIPT
|
||||
#define ICON_EXT_ZST ICON_ARCHIVE
|
||||
|
||||
#endif // ICONS_NERDFONT
|
817
src/icons.h
817
src/icons.h
|
@ -1,526 +1,445 @@
|
|||
#pragma once
|
||||
#ifndef INCLUDE_ICONS_H
|
||||
#define INCLUDE_ICONS_H
|
||||
|
||||
#if defined(ICONS)
|
||||
#include "icons-in-terminal.h"
|
||||
#if defined(ICONS_GENERATE) || defined(ICONS_ENABLED)
|
||||
|
||||
/*
|
||||
* 1st arg = ICONS_IN_TERM
|
||||
*
|
||||
* 2nd arg = NERD ICONS
|
||||
* You can find hex codes for nerd fonts here: https://www.nerdfonts.com/cheat-sheet
|
||||
*
|
||||
* 3rd arg = EMOJIS
|
||||
* You can find a list of emoji here: https://unicode.org/Public/emoji/5.0/emoji-test.txt
|
||||
*
|
||||
* Any entry with empty icon gets removed by the hash-table generator
|
||||
*/
|
||||
#if defined(ICONS_IN_TERM)
|
||||
#define ICON_STR(I, N, E) I
|
||||
#include "icons-in-terminal.h"
|
||||
#elif defined(NERD)
|
||||
#include "icons-nerdfont.h"
|
||||
#define ICON_STR(I, N, E) N
|
||||
#elif defined(EMOJI)
|
||||
#define ICON_STR(I, N, E) E
|
||||
#endif
|
||||
|
||||
struct icon_pair {
|
||||
const char *match;
|
||||
const char *icon;
|
||||
/*
|
||||
* Hex xterm 256 color code, 0 to follow file specific (if any)
|
||||
* Codes: https://jonasjacek.github.io/colors/
|
||||
* Spectrum sorted: https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg
|
||||
*/
|
||||
const unsigned char color;
|
||||
};
|
||||
|
||||
/*
|
||||
* Define a string to be printed before and after the icon
|
||||
* Adjust if the icons are not printed properly
|
||||
*/
|
||||
|
||||
#if defined(EMOJI)
|
||||
/*
|
||||
* NOTE: As some emojis take up two cells, all of the emoji icons must
|
||||
* be of width 2. Therefore, right pad single-width emoji with a space.
|
||||
*/
|
||||
#define ICON_SIZE 2
|
||||
#define ICON_PADDING_RIGHT " "
|
||||
#else
|
||||
#define ICON_SIZE 1
|
||||
#define ICON_PADDING_RIGHT " "
|
||||
#endif
|
||||
#define ICON_PADDING_LEFT ""
|
||||
#define ICON_PADDING_RIGHT " "
|
||||
#define ICON_PADDING_LEFT_LEN (sizeof ICON_PADDING_LEFT - 1)
|
||||
#define ICON_PADDING_RIGHT_LEN (sizeof ICON_PADDING_RIGHT - 1)
|
||||
|
||||
/* ARROWS */
|
||||
#define ICON_ARROW_UP ICON_STR(MD_ARROW_UPWARD, "", "⬆")
|
||||
#define ICON_ARROW_FORWARD ICON_STR(MD_ARROW_FORWARD, "", "➡")
|
||||
#define ICON_ARROW_DOWN ICON_STR(MD_ARROW_DOWNWARD, "", "⬇")
|
||||
|
||||
/* GENERIC */
|
||||
#define ICON_DIRECTORY ICON_STR(FA_FOLDER, "", "📂")
|
||||
#define ICON_FILE ICON_STR(FA_FILE, "", "📃")
|
||||
#define ICON_EXEC ICON_STR(FA_COG, "", "⚙️ ")
|
||||
|
||||
/* Top level and common icons */
|
||||
#define ICON_ARCHIVE ICON_STR(FA_FILE_ARCHIVE_O, "", "📦")
|
||||
#define ICON_BRIEFCASE ICON_STR(FA_BRIEFCASE, "", "💼")
|
||||
#define ICON_C ICON_STR(MFIZZ_C, "", "🇨 ")
|
||||
#define ICON_CHANGELOG ICON_STR(FA_HISTORY, "", "🔺")
|
||||
#define ICON_CHESS ICON_STR("", "", "")
|
||||
#define ICON_CLOJURE ICON_STR(MFIZZ_CLOJURE, "", "")
|
||||
#define ICON_CONFIGURE ICON_STR(FILE_CONFIG, "", "🔧")
|
||||
#define ICON_CPLUSPLUS ICON_STR(MFIZZ_CPLUSPLUS, "", ICON_C)
|
||||
#define ICON_DATABASE ICON_STR(MFIZZ_DATABASE_ALT2, "", "🗃️ ")
|
||||
#define ICON_DESKTOP ICON_STR(FA_DESKTOP, "", "🖥️ ")
|
||||
#define ICON_DJVU ICON_STR(FA_PAPERCLIP, "", "📎")
|
||||
#define ICON_DOCUMENT ICON_STR(FA_FILE_TEXT_O, "", "🗒 ")
|
||||
#define ICON_DOWNLOADS ICON_STR(FA_DOWNLOAD, "", "📥")
|
||||
#define ICON_ELIXIR ICON_STR(MFIZZ_ELIXIR, "", "💧")
|
||||
#define ICON_ENCRYPT ICON_STR("", "", "🔒")
|
||||
#define ICON_FSHARP ICON_STR(DEV_FSHARP, "", "")
|
||||
#define ICON_FONT ICON_STR(FILE_FONT, "", "")
|
||||
#define ICON_GIT ICON_STR(FA_GIT, "", "🌱")
|
||||
#define ICON_HASKELL ICON_STR("", "", "")
|
||||
#define ICON_HTML ICON_STR(FA_FILE_CODE_O, "", "")
|
||||
#define ICON_JAVA ICON_STR(MFIZZ_JAVA, "", "☕")
|
||||
#define ICON_JAVASCRIPT ICON_STR(FA_FILE_CODE_O, "", "")
|
||||
#define ICON_LICENSE ICON_STR(FA_COPYRIGHT, "", "⚖️ ")
|
||||
#define ICON_LINUX ICON_STR(FA_LINUX, "", "🐧")
|
||||
#define ICON_MAKEFILE ICON_STR(FILE_CMAKE, "", "🛠 ")
|
||||
#define ICON_MANUAL ICON_STR(FILE_MANPAGE, "", "❓")
|
||||
#define ICON_MS_EXCEL ICON_STR(FILE_EXCEL, "", ICON_WORDDOC)
|
||||
#define ICON_MUSIC ICON_STR(FA_MUSIC, "", "🎧")
|
||||
#define ICON_MUSICFILE ICON_STR(FA_FILE_AUDIO_O, "", ICON_MUSIC)
|
||||
#define ICON_OPTICALDISK ICON_STR(LINEA_MUSIC_CD, "", "💿")
|
||||
#define ICON_PDF ICON_STR(FA_FILE_PDF_O, "", "📕")
|
||||
#define ICON_PHOTOSHOP ICON_STR(DEV_PHOTOSHOP, "", ICON_PICTUREFILE)
|
||||
#define ICON_PICTUREFILE ICON_STR(FA_FILE_IMAGE_O, "", ICON_PICTURES)
|
||||
#define ICON_PICTURES ICON_STR(MD_CAMERA_ALT, "", "🎨")
|
||||
#define ICON_PLAYLIST ICON_STR(ICON_MUSICFILE, "", "")
|
||||
#define ICON_POWERPOINT ICON_STR(FILE_POWERPOINT, "", "📊")
|
||||
#define ICON_PUBLIC ICON_STR(FA_INBOX, "", "👀")
|
||||
#define ICON_PYTHON ICON_STR(MFIZZ_PYTHON, "", "🐍")
|
||||
#define ICON_REACT ICON_STR(FILE_JSX, "", ICON_JAVASCRIPT)
|
||||
#define ICON_RUBY ICON_STR(MFIZZ_RUBY, "", "💎")
|
||||
#define ICON_RUST ICON_STR(DEV_RUST, "", "")
|
||||
#define ICON_SASS ICON_STR("", "", "")
|
||||
#define ICON_SCRIPT ICON_STR(MFIZZ_SCRIPT, "", "📜")
|
||||
#define ICON_SUBTITLE ICON_STR(FA_COMMENTS_O, "", "💬")
|
||||
#define ICON_TEMPLATES ICON_STR(FA_PAPERCLIP, "", "📎")
|
||||
#define ICON_TEX ICON_STR(FILE_TEX, "", ICON_DOCUMENT)
|
||||
#define ICON_VIDEOFILE ICON_STR(FA_FILE_MOVIE_O, "", ICON_VIDEOS)
|
||||
#define ICON_VIDEOS ICON_STR(FA_FILM, "", "🎞 ")
|
||||
#define ICON_VIM ICON_STR(DEV_VIM, "", "")
|
||||
#define ICON_WORDDOC ICON_STR(FILE_WORD, "", "📘")
|
||||
|
||||
#define ICON_EXT_ASM ICON_STR(FILE_NASM, "", "")
|
||||
#define ICON_EXT_BIN ICON_STR(OCT_FILE_BINARY, "", "📓")
|
||||
#define ICON_EXT_COFFEE ICON_STR(MFIZZ_COFFEE_BEAN, "", "")
|
||||
#define ICON_EXT_CSS ICON_STR(MFIZZ_CSS3, "", "🦋")
|
||||
#define ICON_EXT_DEB ICON_STR(MFIZZ_DEBIAN, "", ICON_LINUX)
|
||||
#define ICON_EXT_DIFF ICON_STR(FILE_DIFF, "", "📋")
|
||||
#define ICON_EXT_GO ICON_STR(MFIZZ_GO, "", "")
|
||||
#define ICON_EXT_JSON ICON_STR(ICON_JAVASCRIPT, "", ICON_JAVASCRIPT)
|
||||
#define ICON_EXT_LUA ICON_STR(FILE_LUA, "", "🌘")
|
||||
#define ICON_EXT_M ICON_STR("", "", "📊")
|
||||
#define ICON_EXT_MAT ICON_STR("", "", "")
|
||||
#define ICON_EXT_MD ICON_STR(DEV_MARKDOWN, "", "📝")
|
||||
#define ICON_EXT_MSI ICON_STR(FA_WINDOWS, "", "🪟")
|
||||
#define ICON_EXT_NIX ICON_STR("", "", "")
|
||||
#define ICON_EXT_PATCH ICON_STR(FILE_PATCH, "", "🩹")
|
||||
#define ICON_EXT_PHP ICON_STR(MFIZZ_PHP, "", "🌐")
|
||||
#define ICON_EXT_ROM ICON_STR(FA_LOCK, "", "")
|
||||
#define ICON_EXT_RSS ICON_STR(FA_RSS_SQUARE, "", "📡")
|
||||
#define ICON_EXT_RTF ICON_STR(ICON_PDF, "", ICON_PDF)
|
||||
#define ICON_EXT_SCALA ICON_STR(MFIZZ_SCALA, "", "")
|
||||
#define ICON_EXT_SLN ICON_STR(DEV_VISUALSTUDIO, "", "")
|
||||
#define ICON_EXT_TS ICON_STR(FILE_TS, "", "")
|
||||
|
||||
#define COLOR_VIDEO 93 /* Purple */
|
||||
#define COLOR_AUDIO 220 /* Gold1 */
|
||||
#define COLOR_IMAGE 82 /* Chartreuse2 */
|
||||
#define COLOR_DOCS 202 /* OrangeRed1 */
|
||||
#define COLOR_ARCHIVE 209 /* Salmon1 */
|
||||
#define COLOR_C 81 /* SteelBlue1 */
|
||||
#define COLOR_JAVA 32 /* DeepSkyBlue3 */
|
||||
#define COLOR_JAVASCRIPT 47 /* SpringGreen2 */
|
||||
#define COLOR_REACT 39 /* DeepSkyBlue1 */
|
||||
#define COLOR_CSS 199 /* DeepPink1 */
|
||||
#define COLOR_PYTHON 227 /* LightGoldenrod1 */
|
||||
#define COLOR_LUA 19 /* Blue3 */
|
||||
#define COLOR_DOCUMENT 15 /* White */
|
||||
#define COLOR_FSHARP 31 /* DeepSkyBlue3 */
|
||||
#define COLOR_RUBY 160 /* Red3 */
|
||||
#define COLOR_SCALA 196 /* Red1 */
|
||||
#define COLOR_SHELL 47 /* SpringGreen2 */
|
||||
#define COLOR_VIM 28 /* Green4 */
|
||||
|
||||
/*
|
||||
* Using symbols defined in icons-in-terminal.h, or even using icons-in-terminal is not necessary.
|
||||
* You can use whatever pathched font you like. You just have to put the desired icon as a string.
|
||||
* If you are using icons-in-terminal the creator recommends that you do use the symbols in the generated header.
|
||||
* Hex xterm 256 color code, 0 to follow file specific (if any)
|
||||
* Codes: https://jonasjacek.github.io/colors/
|
||||
* Spectrum sorted: https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg
|
||||
* Color names: https://www.ditig.com/256-colors-cheat-sheet
|
||||
*/
|
||||
#define COLOR_LIST \
|
||||
COLOR_X(COLOR_VIDEO, 45) /* Turquoise2 */ \
|
||||
COLOR_X(COLOR_VIDEO1, 226) /* Yellow1 */ \
|
||||
COLOR_X(COLOR_AUDIO, 220) /* Gold1 */ \
|
||||
COLOR_X(COLOR_AUDIO1, 205) /* HotPink */ \
|
||||
COLOR_X(COLOR_IMAGE, 82) /* Chartreuse2 */ \
|
||||
COLOR_X(COLOR_DOCS, 202) /* OrangeRed1 */ \
|
||||
COLOR_X(COLOR_ARCHIVE, 209) /* Salmon1 */ \
|
||||
COLOR_X(COLOR_C, 81) /* SteelBlue1 */ \
|
||||
COLOR_X(COLOR_JAVA, 32) /* DeepSkyBlue3 */ \
|
||||
COLOR_X(COLOR_JAVASCRIPT, 47) /* SpringGreen2 */ \
|
||||
COLOR_X(COLOR_REACT, 39) /* DeepSkyBlue1 */ \
|
||||
COLOR_X(COLOR_CSS, 199) /* DeepPink1 */ \
|
||||
COLOR_X(COLOR_PYTHON, 227) /* LightGoldenrod1 */ \
|
||||
COLOR_X(COLOR_LUA, 19) /* Blue3 */ \
|
||||
COLOR_X(COLOR_DOCUMENT, 15) /* White */ \
|
||||
COLOR_X(COLOR_FSHARP, 31) /* DeepSkyBlue3 */ \
|
||||
COLOR_X(COLOR_RUBY, 160) /* Red3 */ \
|
||||
COLOR_X(COLOR_SCALA, 196) /* Red1 */ \
|
||||
COLOR_X(COLOR_SHELL, 47) /* SpringGreen2 */ \
|
||||
COLOR_X(COLOR_VIM, 28) /* Green4 */ \
|
||||
COLOR_X(COLOR_ELIXIR, 104) /* MediumPurple */ \
|
||||
|
||||
#if defined(ICONS)
|
||||
static const struct icon_pair dir_icon = {"", FA_FOLDER, 0};
|
||||
static const struct icon_pair file_icon = {"", FA_FILE_O, 0};
|
||||
static const struct icon_pair exec_icon = {"", FA_COG, 0};
|
||||
#elif defined(NERD)
|
||||
static const struct icon_pair dir_icon = {"", ICON_DIRECTORY, 0};
|
||||
static const struct icon_pair file_icon = {"", ICON_FILE, 0};
|
||||
static const struct icon_pair exec_icon = {"", ICON_EXEC, 0};
|
||||
/* X-Macro: https://en.wikipedia.org/wiki/X_Macro */
|
||||
#define COLOR_X(N, V) N = (V),
|
||||
enum { COLOR_LIST };
|
||||
#undef COLOR_X
|
||||
#define COLOR_X(N, V) N,
|
||||
static const unsigned char init_colors[] = { COLOR_LIST };
|
||||
#undef COLOR_X
|
||||
|
||||
#ifdef ICONS_GENERATE
|
||||
/* temporary struct using `char *`. the hash-table generator will
|
||||
* output a more optimized version which uses `char[]` instead reducing
|
||||
* indirection and the total binary size.
|
||||
*/
|
||||
struct icon_pair { const char *match; const char *icon; unsigned char color; };
|
||||
#endif
|
||||
|
||||
/* All entries are case-insensitive */
|
||||
struct icon { const char *icon; unsigned char color; };
|
||||
|
||||
static const struct icon dir_icon = {ICON_DIRECTORY, 0};
|
||||
static const struct icon file_icon = {ICON_FILE, 0};
|
||||
static const struct icon exec_icon = {ICON_EXEC, 0};
|
||||
|
||||
static const struct icon_pair icons_name[] = {
|
||||
#if defined(ICONS)
|
||||
{".git", FA_GIT, 0},
|
||||
{"Desktop", FA_DESKTOP, 0},
|
||||
{"Documents", FA_BRIEFCASE, 0},
|
||||
{"Downloads", FA_DOWNLOAD, 0},
|
||||
{"Music", FA_MUSIC, 0},
|
||||
{"Pictures", MD_CAMERA_ALT, 0},
|
||||
{"Public", FA_INBOX, 0},
|
||||
{"Templates", FA_PAPERCLIP, 0},
|
||||
{"Videos", FA_FILM, 0},
|
||||
{"CHANGELOG", FA_HISTORY, COLOR_DOCS},
|
||||
{"configure", FILE_CONFIG, 0},
|
||||
{"License", FA_COPYRIGHT, COLOR_DOCS},
|
||||
{"Makefile", FILE_CMAKE, 0},
|
||||
#elif defined(NERD)
|
||||
{".git", ICON_GIT, 0},
|
||||
{"Desktop", ICON_DESKTOP, 0},
|
||||
{"Documents", ICON_BRIEFCASE, 0},
|
||||
{"Downloads", ICON_DOWNLOADS, 0},
|
||||
{"Music", ICON_MUSIC, 0},
|
||||
{"Pictures", ICON_PICTURES, 0},
|
||||
{"Public", ICON_PUBLIC, 0},
|
||||
{"Templates", ICON_TEMPLATES, 0},
|
||||
{"Videos", ICON_VIDEOS, 0},
|
||||
{"CHANGELOG", ICON_CHANGELOG, COLOR_DOCS},
|
||||
{"configure", ICON_CONFIGURE, 0},
|
||||
{"License", ICON_LICENSE, COLOR_DOCS},
|
||||
{"Makefile", ICON_MAKEFILE, 0},
|
||||
#endif
|
||||
{".git", ICON_GIT, 0},
|
||||
{"Desktop", ICON_DESKTOP, 0},
|
||||
{"Documents", ICON_BRIEFCASE, 0},
|
||||
{"Downloads", ICON_DOWNLOADS, 0},
|
||||
{"Music", ICON_MUSIC, 0},
|
||||
{"Pictures", ICON_PICTURES, 0},
|
||||
{"Public", ICON_PUBLIC, 0},
|
||||
{"Templates", ICON_TEMPLATES, 0},
|
||||
{"Videos", ICON_VIDEOS, 0},
|
||||
{"CHANGELOG", ICON_CHANGELOG, COLOR_DOCS},
|
||||
{"configure", ICON_CONFIGURE, 0},
|
||||
{"License", ICON_LICENSE, COLOR_DOCS},
|
||||
{"Makefile", ICON_MAKEFILE, 0},
|
||||
};
|
||||
|
||||
#ifdef ICONS_GENERATE
|
||||
/*
|
||||
* New entries should bu added such that the first character of the extension is in the correct group .
|
||||
* This is done for performance reason so that the correct icon can be found faster.
|
||||
* All entries are case-insensitive
|
||||
* The goal here is to provide a small set of default values. We don't try to
|
||||
* provide icons for everything under the sun because keeping a _huge_ table of
|
||||
* icons would: increase binary size, increase memory usage, decrease performance.
|
||||
*
|
||||
* Users are free to customize this *locally* as they see fit. Only open a
|
||||
* pull-request if you think your changes are aligned with the goal described
|
||||
* above.
|
||||
*/
|
||||
|
||||
static const struct icon_pair icons_ext[] = {
|
||||
#if defined(ICONS)
|
||||
static const struct icon_pair icons_ext[] = { /* All entries are case-insensitive */
|
||||
/* Numbers */
|
||||
{"1", FILE_MANPAGE, COLOR_DOCS},
|
||||
{"7z", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"1", ICON_MANUAL, COLOR_DOCS},
|
||||
{"7z", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
|
||||
/* A */
|
||||
{"a", FILE_MANPAGE, 0},
|
||||
{"apk", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"asm", FILE_NASM, 0},
|
||||
{"aup", FA_FILE_AUDIO_O, COLOR_AUDIO},
|
||||
{"avi", FA_FILE_MOVIE_O, COLOR_VIDEO},
|
||||
{"a", ICON_MANUAL, 0},
|
||||
{"apk", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"asm", ICON_EXT_ASM, 0},
|
||||
{"aup", ICON_MUSICFILE, COLOR_AUDIO},
|
||||
{"avi", ICON_VIDEOFILE, COLOR_VIDEO},
|
||||
|
||||
/* B */
|
||||
{"bat", MFIZZ_SCRIPT, 0},
|
||||
{"bin", OCT_FILE_BINARY, 0},
|
||||
{"bmp", FA_FILE_IMAGE_O, COLOR_IMAGE},
|
||||
{"bz2", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"bat", ICON_SCRIPT, 0},
|
||||
{"bib", ICON_TEX, 0},
|
||||
{"bin", ICON_EXT_BIN, 0},
|
||||
{"bmp", ICON_PICTUREFILE, COLOR_IMAGE},
|
||||
{"bz2", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
|
||||
/* C */
|
||||
{"c", MFIZZ_C, 0},
|
||||
{"c++", MFIZZ_CPLUSPLUS, 0},
|
||||
{"cab", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"cbr", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"cbz", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"cc", MFIZZ_CPLUSPLUS, 0},
|
||||
{"class", MFIZZ_JAVA, 0},
|
||||
{"clj", MFIZZ_CLOJURE, 0},
|
||||
{"cljc", MFIZZ_CLOJURE, 0},
|
||||
{"cljs", MFIZZ_CLOJURE, 0},
|
||||
{"cmake", FILE_CMAKE, 0},
|
||||
{"coffee", MFIZZ_COFFEE_BEAN, 0},
|
||||
{"conf", FA_COGS, 0},
|
||||
{"cpio", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"cpp", MFIZZ_CPLUSPLUS, 0},
|
||||
{"css", MFIZZ_CSS3, 0},
|
||||
{"cue", FA_FILE_AUDIO_O, COLOR_AUDIO},
|
||||
{"cvs", FA_COGS, 0},
|
||||
{"cxx", MFIZZ_CPLUSPLUS, 0},
|
||||
/* C */
|
||||
{"c", ICON_C, COLOR_C},
|
||||
{"c++", ICON_CPLUSPLUS, COLOR_C},
|
||||
{"cabal", ICON_HASKELL, COLOR_VIDEO},
|
||||
{"cab", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"cbr", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"cbz", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"cc", ICON_CPLUSPLUS, COLOR_C},
|
||||
{"class", ICON_JAVA, COLOR_JAVA},
|
||||
{"clj", ICON_CLOJURE, 0},
|
||||
{"cljc", ICON_CLOJURE, 0},
|
||||
{"cljs", ICON_CLOJURE, 0},
|
||||
{"cls", ICON_TEX, 0},
|
||||
{"cmake", ICON_MAKEFILE, 0},
|
||||
{"coffee", ICON_EXT_COFFEE, 0},
|
||||
{"conf", ICON_CONFIGURE, 0},
|
||||
{"cpio", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"cpp", ICON_CPLUSPLUS, COLOR_C},
|
||||
{"css", ICON_EXT_CSS, COLOR_CSS},
|
||||
{"cue", ICON_PLAYLIST, COLOR_AUDIO},
|
||||
{"cvs", ICON_CONFIGURE, 0},
|
||||
{"cxx", ICON_CPLUSPLUS, COLOR_C},
|
||||
|
||||
/* D */
|
||||
{"db", MFIZZ_DATABASE_ALT2, 0},
|
||||
{"deb", MFIZZ_DEBIAN, COLOR_ARCHIVE},
|
||||
{"diff", FILE_DIFF, 0},
|
||||
{"dll", FILE_MANPAGE, 0},
|
||||
{"doc", FILE_WORD, 0},
|
||||
{"docx", FILE_WORD, 0},
|
||||
{"db", ICON_DATABASE, 0},
|
||||
{"deb", ICON_EXT_DEB, COLOR_ARCHIVE},
|
||||
{"diff", ICON_EXT_DIFF, 0},
|
||||
{"dll", ICON_SCRIPT, 0},
|
||||
{"djvu", ICON_DJVU, COLOR_DOCS},
|
||||
{"doc", ICON_WORDDOC, COLOR_DOCUMENT},
|
||||
{"docx", ICON_WORDDOC, COLOR_DOCUMENT},
|
||||
|
||||
/* E */
|
||||
{"ejs", FA_FILE_CODE_O, 0},
|
||||
{"elf", FA_LINUX, 0},
|
||||
{"epub", FA_FILE_PDF_O, COLOR_DOCS},
|
||||
{"exe", FA_WINDOWS, 0},
|
||||
/* E */
|
||||
{"ejs", ICON_JAVASCRIPT, COLOR_JAVASCRIPT},
|
||||
{"elf", ICON_LINUX, 0},
|
||||
{"epub", ICON_PDF, COLOR_DOCS},
|
||||
{"exe", ICON_EXEC, 0},
|
||||
{"ex", ICON_ELIXIR, COLOR_ELIXIR},
|
||||
{"eex", ICON_ELIXIR, COLOR_ELIXIR},
|
||||
{"exs", ICON_ELIXIR, COLOR_ELIXIR},
|
||||
|
||||
/* F */
|
||||
{"f#", DEV_FSHARP, 0},
|
||||
{"flac", FA_FILE_AUDIO_O, COLOR_AUDIO},
|
||||
{"flv", FA_FILE_MOVIE_O, COLOR_VIDEO},
|
||||
{"fs", DEV_FSHARP, 0},
|
||||
{"fsi", DEV_FSHARP, 0},
|
||||
{"fsscript", DEV_FSHARP, 0},
|
||||
{"fsx", DEV_FSHARP, 0},
|
||||
{"f#", ICON_FSHARP, COLOR_FSHARP},
|
||||
{"fen", ICON_CHESS, 0},
|
||||
{"flac", ICON_MUSICFILE, COLOR_AUDIO1},
|
||||
{"flv", ICON_VIDEOFILE, COLOR_VIDEO},
|
||||
{"fs", ICON_FSHARP, COLOR_FSHARP},
|
||||
{"fsi", ICON_FSHARP, COLOR_FSHARP},
|
||||
{"fsscript", ICON_FSHARP, COLOR_FSHARP},
|
||||
{"fsx", ICON_FSHARP, COLOR_FSHARP},
|
||||
|
||||
/* G */
|
||||
{"gem", FA_FILE_ARCHIVE_O, 0},
|
||||
{"gif", FA_FILE_IMAGE_O, COLOR_IMAGE},
|
||||
{"go", MFIZZ_GO, 0},
|
||||
{"gz", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"gzip", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"gem", ICON_RUBY, COLOR_RUBY},
|
||||
{"gif", ICON_PICTUREFILE, COLOR_IMAGE},
|
||||
{"go", ICON_EXT_GO, COLOR_C},
|
||||
{"gpg", ICON_ENCRYPT, COLOR_ARCHIVE},
|
||||
{"gz", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"gzip", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
|
||||
/* H */
|
||||
{"h", MFIZZ_C, 0},
|
||||
{"hh", MFIZZ_CPLUSPLUS, 0},
|
||||
{"htaccess", FA_COGS, 0},
|
||||
{"htpasswd", FA_COGS, 0},
|
||||
{"htm", FA_FILE_CODE_O, 0},
|
||||
{"html", FA_FILE_CODE_O, 0},
|
||||
{"hxx", MFIZZ_CPLUSPLUS, 0},
|
||||
{"h", ICON_C, COLOR_C},
|
||||
{"hh", ICON_CPLUSPLUS, COLOR_C},
|
||||
{"hpp", ICON_CPLUSPLUS, COLOR_C},
|
||||
{"hs", ICON_HASKELL, COLOR_ELIXIR},
|
||||
{"htaccess", ICON_CONFIGURE, 0},
|
||||
{"htpasswd", ICON_CONFIGURE, 0},
|
||||
{"htm", ICON_HTML, 0},
|
||||
{"html", ICON_HTML, 0},
|
||||
{"hxx", ICON_CPLUSPLUS, COLOR_C},
|
||||
{"heex", ICON_ELIXIR, COLOR_ELIXIR},
|
||||
|
||||
/* I */
|
||||
{"ico", FA_FILE_IMAGE_O, COLOR_IMAGE},
|
||||
{"img", LINEA_MUSIC_CD, COLOR_ARCHIVE},
|
||||
{"ini", FA_COGS, 0},
|
||||
{"iso", LINEA_MUSIC_CD, COLOR_ARCHIVE},
|
||||
{"ico", ICON_PICTUREFILE, COLOR_IMAGE},
|
||||
{"ini", ICON_CONFIGURE, 0},
|
||||
{"img", ICON_OPTICALDISK, COLOR_ARCHIVE},
|
||||
{"iso", ICON_OPTICALDISK, COLOR_ARCHIVE},
|
||||
|
||||
/* J */
|
||||
{"jar", MFIZZ_JAVA, 0},
|
||||
{"java", MFIZZ_JAVA, 0},
|
||||
{"jl", FA_COGS, 0},
|
||||
{"jpeg", FA_FILE_IMAGE_O, COLOR_IMAGE},
|
||||
{"jpg", FA_FILE_IMAGE_O, COLOR_IMAGE},
|
||||
{"js", DEV_JAVASCRIPT_BADGE, 0},
|
||||
{"json", MFIZZ_JAVASCRIPT, 0},
|
||||
{"jsx", FILE_JSX, 0},
|
||||
{"jar", ICON_JAVA, COLOR_JAVA},
|
||||
{"java", ICON_JAVA, COLOR_JAVA},
|
||||
{"jl", ICON_CONFIGURE, 0},
|
||||
{"jpeg", ICON_PICTUREFILE, COLOR_IMAGE},
|
||||
{"jpg", ICON_PICTUREFILE, COLOR_IMAGE},
|
||||
{"js", ICON_JAVASCRIPT, COLOR_JAVASCRIPT},
|
||||
{"json", ICON_EXT_JSON, COLOR_JAVASCRIPT},
|
||||
{"jsx", ICON_REACT, COLOR_REACT},
|
||||
{"jxl", ICON_PICTUREFILE, COLOR_IMAGE},
|
||||
|
||||
/* K */
|
||||
{"ksh", ICON_SCRIPT, COLOR_SHELL},
|
||||
|
||||
/* L */
|
||||
{"lha", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"log", FA_FILE_TEXT_O, 0},
|
||||
{"lua", FILE_LUA, COLOR_LUA},
|
||||
{"lzh", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"lzma", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"lha", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"lhs", ICON_HASKELL, COLOR_VIM},
|
||||
{"log", ICON_DOCUMENT, 0},
|
||||
{"lua", ICON_EXT_LUA, COLOR_LUA},
|
||||
{"lzh", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"lzma", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
|
||||
/* M */
|
||||
{"m4a", FA_FILE_AUDIO_O, COLOR_AUDIO},
|
||||
{"m4v", FA_FILE_MOVIE_O, COLOR_VIDEO},
|
||||
{"markdown", DEV_MARKDOWN, COLOR_DOCS},
|
||||
{"md", DEV_MARKDOWN, COLOR_DOCS},
|
||||
{"mk", FILE_CMAKE, 0},
|
||||
{"mkv", FA_FILE_MOVIE_O, COLOR_VIDEO},
|
||||
{"mov", FA_FILE_MOVIE_O, COLOR_VIDEO},
|
||||
{"mp3", FA_FILE_AUDIO_O, COLOR_AUDIO},
|
||||
{"mp4", FA_FILE_MOVIE_O, COLOR_VIDEO},
|
||||
{"mpeg", FA_FILE_MOVIE_O, COLOR_VIDEO},
|
||||
{"mpg", FA_FILE_MOVIE_O, COLOR_VIDEO},
|
||||
{"msi", FA_WINDOWS, 0},
|
||||
{"m", ICON_EXT_M, COLOR_C},
|
||||
{"m4a", ICON_MUSICFILE, COLOR_AUDIO},
|
||||
{"m4v", ICON_VIDEOFILE, COLOR_VIDEO},
|
||||
{"markdown", ICON_EXT_MD, COLOR_DOCS},
|
||||
{"mat", ICON_EXT_MAT, COLOR_C},
|
||||
{"md", ICON_EXT_MD, COLOR_DOCS},
|
||||
{"mk", ICON_MAKEFILE, 0},
|
||||
{"mkv", ICON_VIDEOFILE, COLOR_VIDEO},
|
||||
{"mov", ICON_VIDEOFILE, COLOR_VIDEO},
|
||||
{"mp3", ICON_MUSICFILE, COLOR_AUDIO},
|
||||
{"mp4", ICON_VIDEOFILE, COLOR_VIDEO1},
|
||||
{"mpeg", ICON_VIDEOFILE, COLOR_VIDEO},
|
||||
{"mpg", ICON_VIDEOFILE, COLOR_VIDEO},
|
||||
{"msi", ICON_EXT_MSI, 0},
|
||||
|
||||
/* N */
|
||||
{"nix", ICON_EXT_NIX, COLOR_FSHARP},
|
||||
|
||||
/* O */
|
||||
{"o", FILE_MANPAGE, 0},
|
||||
{"ogg", FA_FILE_AUDIO_O, COLOR_AUDIO},
|
||||
{"opdownload", FA_DOWNLOAD, 0},
|
||||
{"out", FA_LINUX, 0},
|
||||
{"o", ICON_MANUAL, 0},
|
||||
{"ogg", ICON_MUSICFILE, COLOR_AUDIO},
|
||||
{"opus", ICON_MUSICFILE, COLOR_AUDIO},
|
||||
{"opdownload", ICON_DOWNLOADS, 0},
|
||||
{"otf", ICON_FONT, 0},
|
||||
{"out", ICON_LINUX, 0},
|
||||
|
||||
/* P */
|
||||
{"part", FA_DOWNLOAD, 0},
|
||||
{"patch", FILE_PATCH, 0},
|
||||
{"pdf", FA_FILE_PDF_O, COLOR_DOCS},
|
||||
{"php", MFIZZ_PHP, 0},
|
||||
{"png", FA_FILE_IMAGE_O, COLOR_IMAGE},
|
||||
{"ppt", FILE_POWERPOINT, 0},
|
||||
{"pptx", FILE_POWERPOINT, 0},
|
||||
{"psb", DEV_PHOTOSHOP, 0},
|
||||
{"psd", DEV_PHOTOSHOP, 0},
|
||||
{"py", MFIZZ_PYTHON, 0},
|
||||
{"pyc", MFIZZ_PYTHON, 0},
|
||||
{"pyd", MFIZZ_PYTHON, 0},
|
||||
{"pyo", MFIZZ_PYTHON, 0},
|
||||
{"part", ICON_DOWNLOADS, 0},
|
||||
{"patch", ICON_EXT_PATCH, 0},
|
||||
{"pdf", ICON_PDF, COLOR_DOCS},
|
||||
{"pgn", ICON_CHESS, 0},
|
||||
{"php", ICON_EXT_PHP, 0},
|
||||
{"png", ICON_PICTUREFILE, COLOR_IMAGE},
|
||||
{"ppt", ICON_POWERPOINT, 0},
|
||||
{"pptx", ICON_POWERPOINT, 0},
|
||||
{"psb", ICON_PHOTOSHOP, 0},
|
||||
{"psd", ICON_PHOTOSHOP, 0},
|
||||
{"py", ICON_PYTHON, COLOR_PYTHON},
|
||||
{"pyc", ICON_PYTHON, COLOR_PYTHON},
|
||||
{"pyd", ICON_PYTHON, COLOR_PYTHON},
|
||||
{"pyo", ICON_PYTHON, COLOR_PYTHON},
|
||||
|
||||
/* Q */
|
||||
|
||||
/* R */
|
||||
{"rar", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"rb", MFIZZ_RUBY, COLOR_RUBY},
|
||||
{"rc", FA_COGS, 0},
|
||||
{"rom", FA_LOCK, 0},
|
||||
{"rpm", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"rss", FA_RSS_SQUARE, 0},
|
||||
{"rtf", FA_FILE_PDF_O, 0},
|
||||
{"rar", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"rb", ICON_RUBY, COLOR_RUBY},
|
||||
{"rc", ICON_CONFIGURE, 0},
|
||||
{"rom", ICON_EXT_ROM, 0},
|
||||
{"rpm", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"rs", ICON_RUST, COLOR_DOCS},
|
||||
{"rss", ICON_EXT_RSS, 0},
|
||||
{"rtf", ICON_EXT_RTF, 0},
|
||||
|
||||
/* S */
|
||||
{"so", FILE_MANPAGE, 0},
|
||||
{"scala", MFIZZ_SCALA, 0},
|
||||
{"sh", MFIZZ_SCRIPT, COLOR_SHELL},
|
||||
{"slim", FA_FILE_CODE_O, 0},
|
||||
{"sln", DEV_VISUALSTUDIO, 0},
|
||||
{"sql", MFIZZ_MYSQL, 0},
|
||||
{"srt", FA_COMMENTS_O, 0},
|
||||
{"sub", FA_COMMENTS_O, 0},
|
||||
{"svg", FA_FILE_IMAGE_O, COLOR_IMAGE},
|
||||
{"sass", ICON_SASS, COLOR_CSS},
|
||||
{"scss", ICON_SASS, COLOR_CSS},
|
||||
{"so", ICON_MANUAL, 0},
|
||||
{"scala", ICON_EXT_SCALA, COLOR_SCALA},
|
||||
{"sh", ICON_SCRIPT, COLOR_SHELL},
|
||||
{"slim", ICON_SCRIPT, COLOR_DOCUMENT},
|
||||
{"sln", ICON_EXT_SLN, 0},
|
||||
{"sql", ICON_DATABASE, 0},
|
||||
{"srt", ICON_SUBTITLE, 0},
|
||||
{"sty", ICON_TEX, 0},
|
||||
{"sub", ICON_SUBTITLE, 0},
|
||||
{"svg", ICON_PICTUREFILE, COLOR_IMAGE},
|
||||
|
||||
/* T */
|
||||
{"tar", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"tex", FILE_TEX, 0},
|
||||
{"tgz", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"ts", FILE_TS, 0},
|
||||
{"tsx", FILE_TSX, 0},
|
||||
{"txt", FA_FILE_TEXT_O, 0},
|
||||
{"txz", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"tar", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"tex", ICON_TEX, 0},
|
||||
{"tgz", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"ts", ICON_EXT_TS, COLOR_JAVASCRIPT},
|
||||
{"tsx", ICON_REACT, COLOR_REACT},
|
||||
{"txt", ICON_DOCUMENT, COLOR_DOCUMENT},
|
||||
{"txz", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"ttf", ICON_FONT, 0},
|
||||
|
||||
/* U */
|
||||
|
||||
/* V */
|
||||
{"vid", FA_FILE_MOVIE_O, COLOR_VIDEO},
|
||||
{"vim", DEV_VIM, 0},
|
||||
{"vimrc", DEV_VIM, 0},
|
||||
{"vtt", FA_COMMENTS_O, 0},
|
||||
{"vid", ICON_VIDEOFILE, COLOR_VIDEO},
|
||||
{"vim", ICON_VIM, COLOR_VIM},
|
||||
{"vimrc", ICON_VIM, COLOR_VIM},
|
||||
{"vtt", ICON_SUBTITLE, 0},
|
||||
|
||||
/* W */
|
||||
{"wav", FA_FILE_AUDIO_O, COLOR_AUDIO},
|
||||
{"webm", FA_FILE_MOVIE_O, COLOR_VIDEO},
|
||||
{"wma", FA_FILE_AUDIO_O, COLOR_AUDIO},
|
||||
{"wmv", FA_FILE_MOVIE_O, COLOR_VIDEO},
|
||||
{"wav", ICON_MUSICFILE, COLOR_AUDIO},
|
||||
{"webm", ICON_VIDEOFILE, COLOR_VIDEO},
|
||||
{"webp", ICON_PICTUREFILE, COLOR_IMAGE},
|
||||
{"wma", ICON_VIDEOFILE, COLOR_AUDIO},
|
||||
{"wmv", ICON_VIDEOFILE, COLOR_VIDEO},
|
||||
|
||||
/* X */
|
||||
{"xbps", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"xcf", FA_FILE_IMAGE_O, COLOR_IMAGE},
|
||||
{"xhtml", FA_FILE_CODE_O, 0},
|
||||
{"xls", FILE_EXCEL, 0},
|
||||
{"xlsx", FILE_EXCEL, 0},
|
||||
{"xml", FA_FILE_CODE_O, 0},
|
||||
{"xz", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"xbps", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"xcf", ICON_PICTUREFILE, COLOR_IMAGE},
|
||||
{"xhtml", ICON_HTML, 0},
|
||||
{"xls", ICON_MS_EXCEL, 0},
|
||||
{"xlsx", ICON_MS_EXCEL, 0},
|
||||
{"xml", ICON_HTML, 0},
|
||||
{"xz", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
|
||||
/* Y */
|
||||
{"yaml", FA_COGS, 0},
|
||||
{"yml", FA_COGS, 0},
|
||||
{"yaml", ICON_CONFIGURE, COLOR_DOCUMENT},
|
||||
{"yml", ICON_CONFIGURE, COLOR_DOCUMENT},
|
||||
|
||||
/* Z */
|
||||
{"zip", FA_FILE_ARCHIVE_O, COLOR_ARCHIVE},
|
||||
{"zip", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
{"zsh", ICON_SCRIPT, COLOR_SHELL},
|
||||
{"zst", ICON_ARCHIVE, COLOR_ARCHIVE},
|
||||
|
||||
/* Other */
|
||||
#elif defined(NERD)
|
||||
/* Numbers */
|
||||
{"1", ICON_EXT_1, COLOR_DOCS},
|
||||
{"7z", ICON_EXT_7Z, COLOR_ARCHIVE},
|
||||
|
||||
/* A */
|
||||
{"a", ICON_EXT_A, 0},
|
||||
{"apk", ICON_EXT_APK, COLOR_ARCHIVE},
|
||||
{"asm", ICON_EXT_ASM, 0},
|
||||
{"aup", ICON_EXT_AUP, COLOR_AUDIO},
|
||||
{"avi", ICON_EXT_AVI, COLOR_VIDEO},
|
||||
|
||||
/* B */
|
||||
{"bat", ICON_EXT_BAT, 0},
|
||||
{"bib", ICON_EXT_BIB, 0},
|
||||
{"bin", ICON_EXT_BIN, 0},
|
||||
{"bmp", ICON_EXT_BMP, COLOR_IMAGE},
|
||||
{"bz2", ICON_EXT_BZ2, COLOR_ARCHIVE},
|
||||
|
||||
/* C */
|
||||
{"c", ICON_EXT_C, COLOR_C},
|
||||
{"c++", ICON_EXT_CPLUSPLUS, COLOR_C},
|
||||
{"cabal", ICON_EXT_CABAL, COLOR_VIDEO},
|
||||
{"cab", ICON_EXT_CAB, COLOR_ARCHIVE},
|
||||
{"cbr", ICON_EXT_CBR, COLOR_ARCHIVE},
|
||||
{"cbz", ICON_EXT_CBZ, COLOR_ARCHIVE},
|
||||
{"cc", ICON_EXT_CC, COLOR_C},
|
||||
{"class", ICON_EXT_CLASS, COLOR_JAVA},
|
||||
{"clj", ICON_EXT_CLJ, 0},
|
||||
{"cljc", ICON_EXT_CLJC, 0},
|
||||
{"cljs", ICON_EXT_CLJS, 0},
|
||||
{"cls", ICON_EXT_CLS, 0},
|
||||
{"cmake", ICON_EXT_CMAKE, 0},
|
||||
{"coffee", ICON_EXT_COFFEE, 0},
|
||||
{"conf", ICON_EXT_CONF, 0},
|
||||
{"cpio", ICON_EXT_CPIO, COLOR_ARCHIVE},
|
||||
{"cpp", ICON_EXT_CPP, COLOR_C},
|
||||
{"css", ICON_EXT_CSS, COLOR_CSS},
|
||||
{"cue", ICON_EXT_CUE, COLOR_AUDIO},
|
||||
{"cvs", ICON_EXT_CVS, 0},
|
||||
{"cxx", ICON_EXT_CXX, COLOR_C},
|
||||
|
||||
/* D */
|
||||
{"db", ICON_EXT_DB, 0},
|
||||
{"deb", ICON_EXT_DEB, COLOR_ARCHIVE},
|
||||
{"diff", ICON_EXT_DIFF, 0},
|
||||
{"dll", ICON_EXT_DLL, 0},
|
||||
{"doc", ICON_EXT_DOC, COLOR_DOCUMENT},
|
||||
{"docx", ICON_EXT_DOCX, COLOR_DOCUMENT},
|
||||
|
||||
/* E */
|
||||
{"ejs", ICON_EXT_EJS, COLOR_JAVASCRIPT},
|
||||
{"elf", ICON_EXT_ELF, 0},
|
||||
{"epub", ICON_EXT_EPUB, COLOR_DOCS},
|
||||
{"exe", ICON_EXT_EXE, 0},
|
||||
|
||||
/* F */
|
||||
{"f#", ICON_EXT_FSHARP, COLOR_FSHARP},
|
||||
{"fen", ICON_EXT_FEN, 0},
|
||||
{"flac", ICON_EXT_FLAC, COLOR_AUDIO},
|
||||
{"flv", ICON_EXT_FLV, COLOR_VIDEO},
|
||||
{"fs", ICON_EXT_FS, COLOR_FSHARP},
|
||||
{"fsi", ICON_EXT_FSI, COLOR_FSHARP},
|
||||
{"fsscript", ICON_EXT_FSSCRIPT, COLOR_FSHARP},
|
||||
{"fsx", ICON_EXT_FSX, COLOR_FSHARP},
|
||||
|
||||
/* G */
|
||||
{"gem", ICON_EXT_GEM, COLOR_RUBY},
|
||||
{"gif", ICON_EXT_GIF, COLOR_IMAGE},
|
||||
{"go", ICON_EXT_GO, 0},
|
||||
{"gpg", ICON_EXT_GPG, COLOR_ARCHIVE},
|
||||
{"gz", ICON_EXT_GZ, COLOR_ARCHIVE},
|
||||
{"gzip", ICON_EXT_GZIP, COLOR_ARCHIVE},
|
||||
|
||||
/* H */
|
||||
{"h", ICON_EXT_H, COLOR_C},
|
||||
{"hh", ICON_EXT_HH, COLOR_C},
|
||||
{"hpp", ICON_EXT_HPP, COLOR_C},
|
||||
{"hs", ICON_EXT_HS, COLOR_VIM},
|
||||
{"htaccess", ICON_EXT_HTACCESS, 0},
|
||||
{"htpasswd", ICON_EXT_HTPASSWD, 0},
|
||||
{"htm", ICON_EXT_HTM, 0},
|
||||
{"html", ICON_EXT_HTML, 0},
|
||||
{"hxx", ICON_EXT_HXX, COLOR_C},
|
||||
|
||||
/* I */
|
||||
{"ico", ICON_EXT_ICO, COLOR_IMAGE},
|
||||
{"img", ICON_EXT_IMG, COLOR_ARCHIVE},
|
||||
{"ini", ICON_EXT_INI, 0},
|
||||
{"iso", ICON_EXT_ISO, COLOR_ARCHIVE},
|
||||
|
||||
/* J */
|
||||
{"jar", ICON_EXT_JAR, COLOR_JAVA},
|
||||
{"java", ICON_EXT_JAVA, COLOR_JAVA},
|
||||
{"jl", ICON_EXT_JL, 0},
|
||||
{"jpeg", ICON_EXT_JPEG, COLOR_IMAGE},
|
||||
{"jpg", ICON_EXT_JPG, COLOR_IMAGE},
|
||||
{"js", ICON_EXT_JS, COLOR_JAVASCRIPT},
|
||||
{"json", ICON_EXT_JSON, COLOR_JAVASCRIPT},
|
||||
{"jsx", ICON_EXT_JSX, COLOR_REACT},
|
||||
|
||||
/* K */
|
||||
|
||||
/* L */
|
||||
{"lha", ICON_EXT_LHA, COLOR_ARCHIVE},
|
||||
{"lhs", ICON_EXT_LHS, COLOR_VIM},
|
||||
{"log", ICON_EXT_LOG, 0},
|
||||
{"lua", ICON_EXT_LUA, COLOR_LUA},
|
||||
{"lzh", ICON_EXT_LZH, COLOR_ARCHIVE},
|
||||
{"lzma", ICON_EXT_LZMA, COLOR_ARCHIVE},
|
||||
|
||||
/* M */
|
||||
{"m", ICON_EXT_M, COLOR_C},
|
||||
{"m4a", ICON_EXT_M4A, COLOR_AUDIO},
|
||||
{"m4v", ICON_EXT_M4V, COLOR_VIDEO},
|
||||
{"markdown", ICON_EXT_MD, COLOR_DOCS},
|
||||
{"mat", ICON_EXT_MAT, COLOR_C},
|
||||
{"md", ICON_EXT_MD, COLOR_DOCS},
|
||||
{"mk", ICON_EXT_MK, 0},
|
||||
{"mkv", ICON_EXT_MKV, COLOR_VIDEO},
|
||||
{"mov", ICON_EXT_MOV, COLOR_VIDEO},
|
||||
{"mp3", ICON_EXT_MP3, COLOR_AUDIO},
|
||||
{"mp4", ICON_EXT_MP4, COLOR_VIDEO},
|
||||
{"mpeg", ICON_EXT_MPEG, COLOR_VIDEO},
|
||||
{"mpg", ICON_EXT_MPG, COLOR_VIDEO},
|
||||
{"msi", ICON_EXT_MSI, 0},
|
||||
|
||||
/* N */
|
||||
{"nix", ICON_EXT_NIX, COLOR_FSHARP},
|
||||
|
||||
/* O */
|
||||
{"o", ICON_EXT_O, 0},
|
||||
{"ogg", ICON_EXT_OGG, COLOR_AUDIO},
|
||||
{"opdownload", ICON_EXT_ODOWNLOAD, 0},
|
||||
{"out", ICON_EXT_OUT, 0},
|
||||
|
||||
/* P */
|
||||
{"part", ICON_EXT_PART, 0},
|
||||
{"patch", ICON_EXT_PATCH, 0},
|
||||
{"pdf", ICON_EXT_PDF, COLOR_DOCS},
|
||||
{"pgn", ICON_EXT_PGN, 0},
|
||||
{"php", ICON_EXT_PHP, 0},
|
||||
{"png", ICON_EXT_PNG, COLOR_IMAGE},
|
||||
{"ppt", ICON_EXT_PPT, 0},
|
||||
{"pptx", ICON_EXT_PPTX, 0},
|
||||
{"psb", ICON_EXT_PSB, 0},
|
||||
{"psd", ICON_EXT_PSD, 0},
|
||||
{"py", ICON_EXT_PY, COLOR_PYTHON},
|
||||
{"pyc", ICON_EXT_PYC, COLOR_PYTHON},
|
||||
{"pyd", ICON_EXT_PYD, COLOR_PYTHON},
|
||||
{"pyo", ICON_EXT_PYO, COLOR_PYTHON},
|
||||
|
||||
/* Q */
|
||||
|
||||
/* R */
|
||||
{"rar", ICON_EXT_RAR, COLOR_ARCHIVE},
|
||||
{"rb", ICON_EXT_RB, COLOR_RUBY},
|
||||
{"rc", ICON_EXT_RC, 0},
|
||||
{"rom", ICON_EXT_ROM, 0},
|
||||
{"rpm", ICON_EXT_RPM, COLOR_ARCHIVE},
|
||||
{"rss", ICON_EXT_RSS, 0},
|
||||
{"rtf", ICON_EXT_RTF, 0},
|
||||
|
||||
/* S */
|
||||
{"sass", ICON_EXT_SASS, COLOR_CSS},
|
||||
{"scss", ICON_EXT_SCSS, COLOR_CSS},
|
||||
{"so", ICON_EXT_SO, 0},
|
||||
{"scala", ICON_EXT_SCALA, COLOR_SCALA},
|
||||
{"sh", ICON_EXT_SH, COLOR_SHELL},
|
||||
{"slim", ICON_EXT_SLIM, COLOR_DOCUMENT},
|
||||
{"sln", ICON_EXT_SLN, 0},
|
||||
{"sql", ICON_EXT_SQL, 0},
|
||||
{"srt", ICON_EXT_SRT, 0},
|
||||
{"sty", ICON_EXT_STY, 0},
|
||||
{"sub", ICON_EXT_SUB, 0},
|
||||
{"svg", ICON_EXT_SVG, COLOR_IMAGE},
|
||||
|
||||
/* T */
|
||||
{"tar", ICON_EXT_TAR, COLOR_ARCHIVE},
|
||||
{"tex", ICON_EXT_TEX, 0},
|
||||
{"tgz", ICON_EXT_TGZ, COLOR_ARCHIVE},
|
||||
{"ts", ICON_EXT_TS, COLOR_JAVASCRIPT},
|
||||
{"tsx", ICON_EXT_TSX, COLOR_REACT},
|
||||
{"txt", ICON_EXT_TXT, COLOR_DOCUMENT},
|
||||
{"txz", ICON_EXT_TXZ, COLOR_ARCHIVE},
|
||||
|
||||
/* U */
|
||||
|
||||
/* V */
|
||||
{"vid", ICON_EXT_VID, COLOR_VIDEO},
|
||||
{"vim", ICON_EXT_VIM, COLOR_VIM},
|
||||
{"vimrc", ICON_EXT_VIMRC, COLOR_VIM},
|
||||
{"vtt", ICON_EXT_SRT, 0},
|
||||
|
||||
/* W */
|
||||
{"wav", ICON_EXT_WAV, COLOR_AUDIO},
|
||||
{"webm", ICON_EXT_WEBM, COLOR_VIDEO},
|
||||
{"wma", ICON_EXT_WMA, COLOR_AUDIO},
|
||||
{"wmv", ICON_EXT_WMV, COLOR_VIDEO},
|
||||
|
||||
/* X */
|
||||
{"xbps", ICON_EXT_XBPS, COLOR_ARCHIVE},
|
||||
{"xcf", ICON_EXT_XCF, COLOR_IMAGE},
|
||||
{"xhtml", ICON_EXT_XHTML, 0},
|
||||
{"xls", ICON_EXT_XLS, 0},
|
||||
{"xlsx", ICON_EXT_XLSX, 0},
|
||||
{"xml", ICON_EXT_XML, 0},
|
||||
{"xz", ICON_EXT_XZ, COLOR_ARCHIVE},
|
||||
|
||||
/* Y */
|
||||
{"yaml", ICON_EXT_YAML, COLOR_DOCUMENT},
|
||||
{"yml", ICON_EXT_YML, COLOR_DOCUMENT},
|
||||
|
||||
/* Z */
|
||||
{"zip", ICON_EXT_ZIP, COLOR_ARCHIVE},
|
||||
{"zsh", ICON_EXT_ZSH, COLOR_SHELL},
|
||||
{"zst", ICON_EXT_ZST, COLOR_ARCHIVE},
|
||||
|
||||
/* Other */
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* defined(ICONS_GENERATE) || defined(ICONS_ENABLED) */
|
||||
|
||||
#endif /* INCLUDE_ICONS_H */
|
||||
|
|
27
src/nnn.h
27
src/nnn.h
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2014-2016, Lazaros Koromilas <lostd@2f30.org>
|
||||
* Copyright (C) 2014-2016, Dimitris Papastamos <sin@2f30.org>
|
||||
* Copyright (C) 2016-2021, Arun Prakash Jana <engineerarun@gmail.com>
|
||||
* Copyright (C) 2016-2023, Arun Prakash Jana <engineerarun@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -31,6 +31,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <curses.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#define CONTROL(c) ((c) & 0x1f)
|
||||
|
||||
|
@ -56,6 +57,8 @@ enum action {
|
|||
SEL_HOME,
|
||||
SEL_END,
|
||||
SEL_FIRST,
|
||||
SEL_JUMP,
|
||||
SEL_YOUNG,
|
||||
SEL_CDHOME,
|
||||
SEL_CDBEGIN,
|
||||
SEL_CDLAST,
|
||||
|
@ -93,7 +96,8 @@ enum action {
|
|||
SEL_CP,
|
||||
SEL_MV,
|
||||
SEL_CPMVAS,
|
||||
SEL_RM,
|
||||
SEL_TRASH,
|
||||
SEL_RM_ONLY,
|
||||
SEL_OPENWITH,
|
||||
SEL_NEW,
|
||||
SEL_RENAME,
|
||||
|
@ -103,6 +107,7 @@ enum action {
|
|||
SEL_AUTONEXT,
|
||||
SEL_EDIT,
|
||||
SEL_PLUGIN,
|
||||
SEL_SELSIZE,
|
||||
SEL_SHELL,
|
||||
SEL_LAUNCH,
|
||||
SEL_PROMPT,
|
||||
|
@ -121,7 +126,7 @@ enum action {
|
|||
|
||||
/* Associate a pressed key to an action */
|
||||
struct key {
|
||||
int sym; /* Key pressed */
|
||||
wint_t sym; /* Key pressed */
|
||||
enum action act; /* Action */
|
||||
};
|
||||
|
||||
|
@ -159,6 +164,9 @@ static struct key bindings[] = {
|
|||
{ CONTROL('E'), SEL_END },
|
||||
/* Go to first file */
|
||||
{ '\'', SEL_FIRST },
|
||||
/* Jump to an entry number/offset */
|
||||
{ 'J', SEL_JUMP },
|
||||
{ CONTROL('Y'), SEL_YOUNG },
|
||||
/* HOME */
|
||||
{ '~', SEL_CDHOME },
|
||||
/* Initial directory */
|
||||
|
@ -212,8 +220,8 @@ static struct key bindings[] = {
|
|||
/* Redraw window */
|
||||
{ CONTROL('L'), SEL_REDRAW },
|
||||
/* Select current file path */
|
||||
{ CONTROL('J'), SEL_SEL },
|
||||
{ ' ', SEL_SEL },
|
||||
{ '+', SEL_SEL },
|
||||
/* Toggle select multiple files */
|
||||
{ 'm', SEL_SELMUL },
|
||||
/* Select all files in current dir */
|
||||
|
@ -232,8 +240,9 @@ static struct key bindings[] = {
|
|||
{ 'w', SEL_CPMVAS },
|
||||
{ CONTROL('W'), SEL_CPMVAS },
|
||||
/* Delete from selection buffer */
|
||||
{ 'x', SEL_RM },
|
||||
{ CONTROL('X'), SEL_RM },
|
||||
{ 'x', SEL_TRASH },
|
||||
{ CONTROL('X'), SEL_TRASH },
|
||||
{ 'X', SEL_RM_ONLY },
|
||||
/* Open in a custom application */
|
||||
{ 'o', SEL_OPENWITH },
|
||||
{ CONTROL('O'), SEL_OPENWITH },
|
||||
|
@ -247,12 +256,14 @@ static struct key bindings[] = {
|
|||
{ 'u', SEL_UMOUNT },
|
||||
/* Show help */
|
||||
{ '?', SEL_HELP },
|
||||
/* Quit a context */
|
||||
{ '+', SEL_AUTONEXT },
|
||||
/* Toggle auto-advance on file open */
|
||||
{ CONTROL('J'), SEL_AUTONEXT },
|
||||
/* Edit in EDITOR */
|
||||
{ 'e', SEL_EDIT },
|
||||
/* Run a plugin */
|
||||
{ ';', SEL_PLUGIN },
|
||||
/* Show total size of listed selection */
|
||||
{ 'S', SEL_SELSIZE },
|
||||
/* Run command */
|
||||
{ '!', SEL_SHELL },
|
||||
{ CONTROL(']'), SEL_SHELL },
|
||||
|
|
Loading…
Reference in New Issue