Squashed commit of the following:
commit f031b8d76d9bec6ea99ecbb298bc14ef6fa288e0 Author: Donald T <tang.1208@osu.edu> Date: Mon May 29 14:55:14 2023 -0400 . commit 94f905b7ced8522e63d39f288bcb1f7a4e15cc18 Author: Donald T <tang.1208@osu.edu> Date: Sat May 20 00:20:51 2023 -0400 . commit f41a8c8c1ac190de2f654b25e73d3ec2a0a2d09d Author: Donald T <tang.1208@osu.edu> Date: Fri May 5 23:24:25 2023 -0700 . commit 48b861af7a8a7b32eef2bd41ccce5cd9381c21ed Author: Donald T <tang.1208@osu.edu> Date: Wed May 3 03:32:30 2023 -0400 . commit 6be7fb3fd0a8e72f04cd1dc9044b9b072292eaaf Author: Donald T <tang.1208@osu.edu> Date: Wed May 3 03:32:23 2023 -0400 . commit bc541b919d7e3173ff33d60fcf4ac235c66d6e63 Author: Donald T <tang.1208@osu.edu> Date: Tue May 2 17:01:32 2023 -0400 . commit 3e5edf081c9ba0369edc34769f8d9ff411e50ab9 Author: Donald T <tang.1208@osu.edu> Date: Tue May 2 03:37:37 2023 -0400 . commit 2e18d3ed4740f92931e8b41e1af72fa7bc651345 Author: Donald T <tang.1208@osu.edu> Date: Tue May 2 03:06:28 2023 -0400 . commit 01027999ef4ea2c556759c113fb02870d76fcfa6 Merge: 29a6e45 46b9814 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon May 1 19:10:05 2023 -0400 Merge branch 'gitlab' of gitlab.com:tangnachuan1208/dotfiles into gitlab commit 29a6e452c79bad6ed88f4a43b56f0d1a9b6c8dbc Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon May 1 19:09:43 2023 -0400 . commit 46b9814e7f311517cdca863f834fc4422d856479 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon May 1 17:56:39 2023 -0400 . commit 80125dd6783241c703403e06b831999779acac55 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon May 1 13:25:02 2023 -0400 . commit 0aa1d47e46af507fa2262aae149ec83047a1b359 Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 30 00:51:16 2023 -0400 . commit 753ea9333c3cf25d910c6c81c34dfc7c9cdeac4b Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 29 20:04:20 2023 -0400 . commit 186dbc0731f5d2e918930eb42f554161d002e96d Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 29 19:46:41 2023 -0400 format commit a6ecdd9c44f3c113b86b1a244b2ec34cb6c16c31 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 29 19:44:44 2023 -0400 . commit 05c8b25e3e629f86a247066169f3215d0f720558 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 29 19:29:32 2023 -0400 . commit e82940eca591e182fcbf8ec212baa14d243810e2 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 29 19:07:57 2023 -0400 . commit 5d0bf02856ec9ebed7b8a393f723bb473c95576f Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 29 14:59:54 2023 -0400 . commit 968f7bdca5affca622f53528178811d39a46ef68 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 29 06:07:02 2023 -0400 . commit 19feb7fcaa76edf56e5829db594d3f113cd3f602 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 29 05:55:37 2023 -0400 . commit 710ec3d53b02672896690cb9b0544976df575c19 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 29 05:03:38 2023 -0400 . commit 05e21d7712705671be001b3376b440ea271d7415 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 29 04:57:08 2023 -0400 . commit 13d938b5ce19271a7bbc1428c4e637df40745889 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 29 03:28:14 2023 -0400 . commit 739c24b5846feaf18954db45435f3993e6d661b1 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 29 03:21:12 2023 -0400 . commit 2cdc9cf1f25788c6e8f9efaf2a368210937d6116 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 29 03:05:17 2023 -0400 . commit a25a424efd5d79ba3b2d70efca9c5b75685f852a Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 29 02:54:21 2023 -0400 . commit c7794f48a76cac0f98749c3f0d8711100f0e18dc Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 29 02:48:57 2023 -0400 . commit eedf1c88d64ec13356a10ab6ca86b8f5dddfe68e Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 29 02:30:52 2023 -0400 . commit adbe5512cc7511691540ce47bb381969e39148a4 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 29 02:03:11 2023 -0400 . commit e6c9b57a498978509cb94f34fef5e9414f3f349c Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 29 01:51:39 2023 -0400 . commit d88450c7a69c544896ed399138a5e80e9ef3a1f6 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 29 00:53:56 2023 -0400 . commit 2c1019cae42e9205e10e582b96737671889cd307 Author: Donald T <tang.1208@osu.edu> Date: Fri Apr 28 04:17:23 2023 -0400 . commit 03eec51af196432ae9590e3b1f9f3a93348b8fe6 Author: Donald T <tang.1208@osu.edu> Date: Fri Apr 28 04:03:40 2023 -0400 yes commit 4b62a9ab80475a6b1a1722abf53876c1ff326700 Author: Donald T <tang.1208@osu.edu> Date: Fri Apr 28 03:41:36 2023 -0400 . commit 59214cd6541637b071c9064060fe16bf5bb27725 Author: Donald T <tang.1208@osu.edu> Date: Fri Apr 28 03:22:09 2023 -0400 . commit f30a7552d3181d781c3d0d1488844987822b6522 Author: Donald T <tang.1208@osu.edu> Date: Fri Apr 28 01:35:18 2023 -0400 . commit 3a2d1082e84c37f0c2fee8217796fa4d4499294f Author: Donald T <tang.1208@osu.edu> Date: Fri Apr 28 00:48:17 2023 -0400 . commit 520fd153e401ab822f1042ff8376b1e8d8b2ac92 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 23:50:09 2023 -0400 . commit 7437561bc3ffc3641f45bd76d9ab70aeb469c2f2 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 19:28:16 2023 -0400 . commit 32a8001f2e39102ed73ee68570d451603ed154b3 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 19:20:08 2023 -0400 . commit 9652a519b4024d36d87037d6549d3f852a17a1e6 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 16:56:54 2023 -0400 . commit b12009000ecf4d1db967708aed5947dd9553fb1e Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 16:51:59 2023 -0400 . commit cf194922c2b24267c5d7397d07dc89b90286acf3 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 16:51:00 2023 -0400 . commit f4d9203afdb998f0c842118bc88dbf9e8ffe71e0 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 14:53:57 2023 -0400 fast grep done!! commit 2a176f1b5ec1b3e32af1c12b18ad5ef41f3e60f6 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 14:50:43 2023 -0400 . commit baeeba23deff9dd80d2a8865e91c1f630e7e7e23 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 06:07:00 2023 -0400 . commit 586bbf01cf29cb42c8be794b73b73a274d7e4ed3 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 05:51:28 2023 -0400 ag allow partial fuzzy search now commit 139fdbc6285e68e5a13277877344097480ba5387 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 03:41:43 2023 -0400 add info win commit a08839510d7329ac28c18f18d598e9f261100880 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 02:38:24 2023 -0400 . commit 7663230223592f9ad0509b80973542c2928d7771 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 02:35:42 2023 -0400 Revert "." This reverts commit 254db14a3118a0f898283f62942f10762405ffc9. commit 796758bf647d83652b6fffa54fc6e54548488bff Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 02:35:21 2023 -0400 Revert "Revert "."" This reverts commit f1bb558ce24d92064219d9282bcc9ba1359aa6ac. commit f1bb558ce24d92064219d9282bcc9ba1359aa6ac Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 02:31:13 2023 -0400 Revert "." This reverts commit 1fc9da602ff45ab72a3b37fb6fd8b2d2b3d88fe5. commit 254db14a3118a0f898283f62942f10762405ffc9 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Thu Apr 27 02:28:07 2023 -0400 . commit 1fc9da602ff45ab72a3b37fb6fd8b2d2b3d88fe5 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 01:50:16 2023 -0400 . commit b18489c135043b6a4f0b6c0e8eb5b0ddfad10160 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 01:46:15 2023 -0400 hide cursor when having popup commit 052ee3417392b42c081d1c2be6e249b8db8592ff Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 27 01:10:41 2023 -0400 add prompt cursor support commit 38ffb515e51913804c31e8fb872381fbef965e44 Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 26 15:14:46 2023 -0400 . commit 5cbc177ba5409cb3b0532149df535c8265c370d1 Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 26 15:04:49 2023 -0400 . commit 25edf4d4cda19d9b628afb4eb3e1dfd828ead7e6 Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 26 15:04:00 2023 -0400 . commit e57064e2102af2489f4884e48dcc9431723e04fb Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 26 15:02:56 2023 -0400 . commit 1571c42fdeba67a27b7f890d462144059c22320a Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 26 14:59:25 2023 -0400 . commit 65c7982637b428829724dea1afd217a5ff71e093 Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 26 14:56:15 2023 -0400 . commit 348d2198a64d3af90b80452fd29ac8fcf89ce4f6 Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 26 14:52:28 2023 -0400 . commit f3eacf8a9a03dfa1fa2b9c489504aaaeb517bf8b Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Wed Apr 26 14:40:55 2023 -0400 . commit 34f7af3e179dadb6be0d4f97ef0a2eb31d02d761 Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 26 13:40:17 2023 -0400 . commit 8fdcb5692177d7a5742e4974b2859b1c09762dcd Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 26 05:11:10 2023 -0400 . commit 3340905398916d441c42454d49e32b766b8d78c3 Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 26 04:35:24 2023 -0400 . commit 8c9953a1ddf1641b3559672ea847de156da7e395 Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 26 04:13:42 2023 -0400 . commit 98851e14c76f300ba6045951e1c9b9093af56d72 Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 26 03:23:07 2023 -0400 . commit d189f8860f11bded35871796165a1af18ccc9c89 Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 26 01:39:26 2023 -0400 . commit 793a4d13f2503b83dd671ee08aab208151369e63 Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 26 01:07:45 2023 -0400 add reverse menu function commit 32aacd806a614deca71a43848cda954976db7fcc Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 25 22:55:25 2023 -0400 . commit ca0253d34e61746bca92c05a66042d35424ddb52 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 25 18:06:13 2023 -0400 . commit 13411243f756f46c6c3171531904edbaf19b0b07 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Tue Apr 25 06:38:25 2023 -0400 . commit 62e418f26f80d0e75f30ce9cf7428c418ea6bce9 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 25 14:19:55 2023 -0400 . commit a52a2ff769f03e1efff89cbca4d5b929de4e30d4 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 25 04:49:48 2023 -0400 . commit b89d69e632c61a2907f978e2f8b32f4ae83347f8 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 25 04:42:17 2023 -0400 add popup support commit 4abb92b4a18c9f79c4a529e0309da09631318644 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 25 00:06:33 2023 -0400 . commit 0c0aab52ee5e81aa6b7ee9a6a1a8b0379a2b3427 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 25 00:06:07 2023 -0400 . commit a6265472178a300bbb80505e59dfebf5ee978dc1 Merge: 78e3485 35aaca1 Author: Donald T <tang.1208@osu.edu> Date: Mon Apr 24 04:57:54 2023 -0400 Merge branch 'gitlab' of gitlab.com:tangnachuan1208/dotfiles into gitlab commit 78e3485b80adcf20553741c5f48320365f2734b2 Author: Donald T <tang.1208@osu.edu> Date: Mon Apr 24 04:57:51 2023 -0400 . commit 35aaca10cabc5a8de2482f5654a862c254f69af2 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 24 04:05:02 2023 -0400 . commit 4ff85f84e0fb5c70e275715f684c560e99bc6d25 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 24 03:15:05 2023 -0400 . commit 626e840630457c978dc7cfc67c12412ce19ec7b2 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 24 02:08:38 2023 -0400 . commit 94fe349621b79c60de4bc8aaf51412ed5b6ea60d Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 24 01:54:18 2023 -0400 . commit cafa07ebe88983c16bc9c71052f7406202403b60 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 24 01:11:27 2023 -0400 . commit 860e5524d7b05d7eed4223e71fdc877d833e4906 Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 23 15:16:23 2023 -0400 . commit 50f23de9e70138aa9aca4fef9bd25fe55762d031 Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 23 14:56:29 2023 -0400 . commit f2a72b117d0d55c2052dda3b565879b0f1838131 Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 23 05:16:23 2023 -0400 . commit 97c6a07d009698c16862bf58bb87bd5577abf7e6 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sun Apr 23 03:17:43 2023 -0400 . commit ea6c04a1f953779ca78dce9abed7752b1aa78799 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sun Apr 23 02:55:17 2023 -0400 . commit cb00739211a8f6475195d69b04af74052faa02a2 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sun Apr 23 02:33:05 2023 -0400 . commit a6e0962b0c8015fad840d742e9fd7bfdd713566c Merge: 6c9f799 615dce2 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 22 09:52:03 2023 -0400 Merge branch 'gitlab' of gitlab.com:tangnachuan1208/dotfiles into gitlab commit 615dce2e6b85376ab25a75c9c2fa752c6decb43a Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 22 13:59:56 2023 -0400 . commit 35c2916a58117bee6c72368142322ff90697948f Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 22 13:42:14 2023 -0400 . commit 6c9f7990c943a17536df37e06ac6dfe49a543b36 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 22 09:51:55 2023 -0400 . commit 474592185b1d15c5e75f80c20bc0bf991e0917e7 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 22 06:07:11 2023 -0400 . commit 328baea58d4208b36d2956eb536f1bb1a137fc16 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 22 06:01:41 2023 -0400 . commit 441e377dee9694a3c6154a1ff175bacd2ecfcd47 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 22 05:24:22 2023 -0400 . commit 226bb43ad152f2a7396132294deb8fde0c08bb97 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 22 03:13:27 2023 -0400 . commit 327fe11db15371c59d0eb885edf93d5d1047c54e Merge: bd494eb b14a5b8 Author: Donald T <tang.1208@osu.edu> Date: Fri Apr 21 13:01:04 2023 -0400 Merge branch 'gitlab' of gitlab.com:tangnachuan1208/dotfiles into gitlab commit bd494eb6d2e074aa76f67b553f550ad9e11f9a86 Author: Donald T <tang.1208@osu.edu> Date: Fri Apr 21 13:00:57 2023 -0400 . commit b14a5b8fc1a0549ce3d6508c73e582043fc7577c Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Fri Apr 21 01:41:18 2023 -0400 . commit 74a6c19ba61d4e5674842aded812381cd2526b49 Merge: 8d55b09 bedee86 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 20 11:59:16 2023 -0400 Merge branch 'gitlab' of gitlab.com:tangnachuan1208/dotfiles into gitlab commit 8d55b09cf7ca7665f6f8bfccd9cf668e011f5072 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 20 11:59:04 2023 -0400 . commit bedee86bd7c32b74ecc685aeddd6280670f6e5a7 Merge: 5c10b61 1369540 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Wed Apr 19 19:51:59 2023 -0400 Merge branch 'gitlab' of gitlab.com:tangnachuan1208/dotfiles into gitlab commit 5c10b61a20e45bfeb18b4ae2251c9eb09e0889be Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Wed Apr 19 19:51:54 2023 -0400 . commit 13695401c7474ffe9782ea756c0d179cb114da6c Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 19 03:22:05 2023 -0400 . commit 2948e2aa670fe89598220f59df6912fa105470b0 Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 19 03:05:37 2023 -0400 . commit 9da84d3cdfd7ebbc6fc25015b5a51ba340ab1a2c Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 19 03:05:23 2023 -0400 . commit 53e69aabc39336a457f629daa96d707b23244c40 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Wed Apr 19 00:55:06 2023 -0400 . commit 7b9d98f104ab838103d21aea94a3da5ce2f996ea Merge: 3511f2d 691adc5 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Tue Apr 18 21:46:11 2023 -0400 Merge branch 'gitlab' of gitlab.com:tangnachuan1208/dotfiles into gitlab commit 691adc506755d1607495cc9e65d373ddd86247fc Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 18 21:45:54 2023 -0400 . commit 3511f2d70238bc0ff669591417dbf4bf552fc333 Merge: fe17ea1 2a5e926 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Tue Apr 18 21:45:00 2023 -0400 Merge branch 'gitlab' of gitlab.com:tangnachuan1208/dotfiles into gitlab commit fe17ea164a6872dc9ac9a1a1360be8a8a3eeab37 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Tue Apr 18 21:44:55 2023 -0400 . commit 2a5e926e33e04b95b3af4c7c72d2df4f430e5869 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 18 18:35:18 2023 -0400 . commit bb01b10935e24518746d0cc1974cbf40d3bab28e Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Tue Apr 18 12:57:19 2023 -0400 . commit b94e1c2a14d771c94567bdc9a2503f57a6c649b3 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Tue Apr 18 12:44:53 2023 -0400 . commit a0fabd29b6c31ff70ad2396ac7b1ca52c693f2d2 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 18 03:53:30 2023 -0400 . commit 383cc61310d9f07787865294e9fbd8b6007c3c0a Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 18 03:46:23 2023 -0400 . commit 2a2bb928e22962ac97959c90a844b0f3fe9786d7 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 18 03:30:50 2023 -0400 . commit 5edd588447bdcc8c50f40f9698e7179753c51417 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 18 03:25:46 2023 -0400 . commit f01329b49bd05fccabfabf4c3a95e68dab8973ba Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Tue Apr 18 01:25:09 2023 -0400 . commit c808517c93a71668b1e9395c8a041c2e208df4e2 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 17 23:45:11 2023 -0400 . commit 4a0390f6b4eff0cacfe8855553ba0d7c9a6d6b39 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 17 23:43:08 2023 -0400 . commit c31b86ed2082cfb315883885164afa89e06ca2f6 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 17 22:08:14 2023 -0400 . commit d9b226e63648612529a7f679024ec323717bb96c Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 17 21:08:31 2023 -0400 . commit b6a00e990e7b9377621838e051822600e7b7026a Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 17 19:01:11 2023 -0400 . commit e2978d17a1160ede53c58090bbb8e5d707d303cf Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 17 16:51:41 2023 -0400 . commit f063a88f479a1e95a2c6bdc6479c0e51169aef85 Merge: d18fddb a432c4d Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 17 04:10:24 2023 -0400 Merge branch 'gitlab' of gitlab.com:tangnachuan1208/dotfiles into gitlab commit a432c4d0f5427cfe91439c73b7dfbdf0afb9abfd Author: Donald T <tang.1208@osu.edu> Date: Mon Apr 17 12:59:29 2023 -0400 . commit 0f1f0bd02db0b1ae8c4491594c7d1cfaa5a0a90c Author: Donald T <tang.1208@osu.edu> Date: Mon Apr 17 04:10:50 2023 -0400 . commit d18fddb5d103a9e32219a250db5a12040c2e2e94 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 17 04:10:17 2023 -0400 . commit 025d686fa07cc2484842878bfb61086a25232e20 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 17 03:33:53 2023 -0400 . commit 40e6d011a9373ad1c9519271e8b3ef1f039a42ab Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sun Apr 16 16:47:28 2023 -0400 . commit b0bfe0db5af9bd5d1dee2cece2354785475bbde5 Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 16 14:27:11 2023 -0400 . commit 45875076c01911b086cdad37f097ff1bce90c97a Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 16 13:55:01 2023 -0400 . commit df0f8ac3d45a4e24ef1d6e9b19be32598fe77430 Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 16 13:25:56 2023 -0400 . commit 49c8f8193f3d847bd3a4780624a4bdc1ad9fe636 Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 16 13:00:45 2023 -0400 . commit dc1591c3b82fd921a366d5df3b6023acd435e210 Merge: 1ab8301 ea8066d Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 16 04:16:08 2023 -0400 Merge branch 'gitlab' of gitlab.com:tangnachuan1208/dotfiles into gitlab commit 1ab83017bec3c84cd61a2d1932f70367337199e0 Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 16 04:16:02 2023 -0400 . commit ba9c3f96e41cb1271341c407b771ea3da01ea46e Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 16 04:15:46 2023 -0400 . commit ea8066d90f1641b516fb60224763ada2af2a428e Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 15 18:06:44 2023 -0400 . commit 5cc85602ce355ac341ee69ac6931744a4d252163 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 15 03:03:48 2023 -0400 . commit fa6493a393c4f61532b91408e6546fd17f587486 Author: Donald T <tang.1208@osu.edu> Date: Fri Apr 14 17:17:50 2023 -0400 . commit b7937e39049ac61507a95c8e8345a9622c7ace56 Author: Donald T <tang.1208@osu.edu> Date: Fri Apr 14 16:22:38 2023 -0400 . commit 1fc71a9a93708b2509e47f88ae0e48350a8cb7e2 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Thu Apr 13 22:25:39 2023 -0400 . commit 9e6679cbe0fd54db2e5ac2427f2e2ef1193c8578 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Thu Apr 13 01:56:05 2023 -0400 . commit 8f0382f9a5e632f55cbafaa4dfe778cfd48e799b Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 12 13:49:20 2023 -0400 . commit 020ad452eb38f39bacc9becd519c4deb7bf75200 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Wed Apr 12 01:18:37 2023 -0400 . commit a779a3622bfc7cf44ea16aca494c0169508a02de Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Wed Apr 12 00:27:01 2023 -0400 . commit 6b2762ec49d24304a70552c76cae6457204c1bd9 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Wed Apr 12 00:06:10 2023 -0400 . commit 50228c85aa6d6ccd03a8b10abcc9be259689e22f Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Tue Apr 11 23:04:03 2023 -0400 . commit 4f40c2604ddbfa527c7cc414903e65a2e650c8e6 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Tue Apr 11 21:42:30 2023 -0400 . commit b59ab4008e4d385853923e6ef8686aeb06016657 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 11 21:18:29 2023 -0400 . commit 71e866eae4b1f5277a58574a22112cbbc5ee8217 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 11 21:10:32 2023 -0400 . commit c960b981ead6f7a54deda6f5598ba75f11eb2b60 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 11 20:35:47 2023 -0400 . commit 7245012bb8a81a2bc81b45576b53c8a40b95b075 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 11 20:35:37 2023 -0400 . commit 5414f79cf47236bf052975d58f6f3cfd6f974dae Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 11 19:56:24 2023 -0400 neovim theme handle linked hi commit b646b3379ab80aff56174643aa3cf4c2877115c4 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 11 04:42:33 2023 -0400 . commit 7c40fed18ee3e867883c097c9654c9953d15f874 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 11 04:33:39 2023 -0400 . commit 470e697fc356e173a5ea014539ef8595582a5178 Merge: 1a033ed 540e599 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 11 04:07:13 2023 -0400 Merge branch 'gitlab' of gitlab.com:tangnachuan1208/dotfiles into gitlab commit 1a033ed725625e45a9d6d6e7f725e769c05313f2 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 11 04:07:09 2023 -0400 . commit 540e599ba85869fe236c8c1a9ef2729ace1a9a60 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Tue Apr 11 03:28:57 2023 -0400 . commit 353baed95808a186b1c88bb19a253dddd58636ff Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 10 16:09:51 2023 -0400 . commit 2646334fca2f50321c1e722d9f4902b23d68e03d Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 10 14:05:13 2023 -0400 . commit f03e8c05e2df0012e5b818847bd5055f226a16fd Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 10 05:58:25 2023 -0400 . commit 425c4726611b41bcc06310228d53b32f4b2c4ff3 Author: Donald T <tang.1208@osu.edu> Date: Mon Apr 10 13:04:29 2023 -0400 . commit 58987e779b5b262e508bdb0fcfe64d9ac8260a34 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 10 05:05:02 2023 -0400 . commit acea1d24abd1c8944c57a7b8cf42d83c268ad8a6 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Apr 10 04:24:11 2023 -0400 . commit aae699d87bb779c08ca0ee9d753591950e2e1ded Author: Donald T <tang.1208@osu.edu> Date: Mon Apr 10 01:16:38 2023 -0400 . commit 6c9a99677b547a51058b20935aaa000eaa0b8bfe Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sun Apr 9 20:51:34 2023 -0400 . commit d3be402926167053f93ee6e73157286c34c9b96e Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sun Apr 9 17:13:17 2023 -0400 . commit 3467157ffc607f2f25eca1937979fd9e3f844991 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sun Apr 9 17:02:07 2023 -0400 . commit a7f0bf2cf8c23e993c520556ab9d56992620a7ef Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 9 14:15:45 2023 -0400 . commit 011f56acb8d952df923ed268099c59dec4550b05 Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 9 12:40:49 2023 -0400 . commit a8100759f84aff64d137b0347f3ee1a13735563c Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sun Apr 9 01:58:34 2023 -0400 . commit 937655d11ff4dfb5f53f000726d90ad23c18001f Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 8 21:15:53 2023 -0400 . commit 5f028a3fdac8bf999b323eae1687d5e9cd90c582 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 8 18:59:57 2023 -0400 . commit 0a8c4d2c36bb32244ae8c73770be97cf9544d6ce Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 8 15:34:24 2023 -0400 . commit 6dc51cd6ec29277a2a310a12c8a5e531b2fc1cbf Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 8 12:55:56 2023 -0400 . commit cdb43ca867fdbaf9590a61d7e964135bf1fbb446 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 8 02:54:41 2023 -0400 . commit 4950f3f01ed0fcfb0ec65040c5c933e176837812 Author: Donald T <tang.1208@osu.edu> Date: Fri Apr 7 02:27:05 2023 -0400 . commit 42a046c3bd3eb49360814c589da0699e5b55abd2 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 6 22:20:06 2023 -0400 . commit 659febb83e50b8248d6d11d81ca93e8602cc8bc8 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 6 18:49:28 2023 -0400 . commit 6d9503b24c23fa2d471b6c6411c61fc39f227147 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 6 01:59:15 2023 -0400 . commit add1eb8588f0d713bf606d8630f13e136aa2b629 Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 6 01:59:07 2023 -0400 . commit 5e742f86d4b66950aabe4db5de3170d155e2651f Author: Donald T <tang.1208@osu.edu> Date: Thu Apr 6 01:31:03 2023 -0400 fix: non bottom windowns' fillchars commit a5106e1f03272f1a57b53f00700e49eee95e16fa Author: Donald T <tang.1208@osu.edu> Date: Wed Apr 5 13:03:17 2023 -0400 . commit 015d0777ded7d5dcbb2621a58ce00eca0f76a35c Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 4 13:48:13 2023 -0400 . commit ae4c58b44149e8abe20c930b312c95385181ff8c Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 4 13:21:51 2023 -0400 . commit 88e20f1483f263a08a9031a6f65caa25bc73a564 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 4 13:21:41 2023 -0400 . commit ac32272023fd5e0fe236f7c1ea5fde1442e15ee3 Author: Donald T <tang.1208@osu.edu> Date: Tue Apr 4 05:41:40 2023 -0400 . commit 30da5d0a4b4bfd180f40d3d27e2f68553fcd6f0a Author: Donald T <tang.1208@osu.edu> Date: Mon Apr 3 18:20:15 2023 -0400 add global statusline commit 1cb22a5a558b94506e024b396ef96c39f25b54d1 Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 2 05:14:01 2023 -0400 . commit a266737bc28d108efa6b6d9377bebafbb44a4cc6 Author: Donald T <tang.1208@osu.edu> Date: Sun Apr 2 02:18:17 2023 -0400 add demo commit 33c6f5dc475f2a0b02a72f64c954204c4abeb0bd Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 1 20:45:23 2023 -0400 . commit 888f8aab0a34ca47d2129b6d1843e44ad8fe419d Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 1 18:47:35 2023 -0400 . commit ea82974dc10729396e0a80a52f413140f39d7d9b Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 1 18:29:14 2023 -0400 . commit 894f37a2073fa6314e6fc32d07ff1337376d8c40 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 1 16:28:55 2023 -0400 add trace.vim commit e280e7a1d60cae9fd6ec173f6c77ffacb47a5328 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Sat Apr 1 16:17:02 2023 -0400 . commit ef3e51bbe50211b4f3db4f42bfde4fac1547b277 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 1 15:19:20 2023 -0400 . commit 6e7f86b535bf0eced8f13d0f88efd5178604ddd5 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 1 15:15:35 2023 -0400 . commit 9e942741c54ed648f3b15bf587b62118be9b5373 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 1 14:40:32 2023 -0400 . commit a1a4be8f93fa32f2691087796c4d1c545761258b Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 1 14:38:37 2023 -0400 . commit 90a8f6add2e8bd8c973992145c831c2e2688ccb9 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 1 14:35:24 2023 -0400 . commit 4100fb3b815dce519c7b305e6b63897082bacdd8 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 1 05:40:59 2023 -0400 . commit d581fb1c276c355bf85f73689b33d97ef0c5ce20 Author: Donald T <tang.1208@osu.edu> Date: Sat Apr 1 05:11:14 2023 -0400 . commit 30a5a319d690665e106fb074750da87da0fc17d9 Author: Donald T <tang.1208@osu.edu> Date: Fri Mar 31 13:09:15 2023 -0400 . commit 0f61b98009dd804f9e00c92909d5f52143f66143 Author: Donald T <tang.1208@osu.edu> Date: Fri Mar 31 03:47:44 2023 -0400 . commit e7cd4991139f3a27f5db40cc9034bf44672a9517 Author: Donald T <tang.1208@osu.edu> Date: Fri Mar 31 02:56:40 2023 -0400 win compatibility commit 179ac4f4057c0a6b88e5abde14414d0a4c785006 Author: Donald T <tang.1208@osu.edu> Date: Fri Mar 31 02:09:51 2023 -0400 win compatibility commit 212e64eaebc7ce59866f537b41b42a22cc2212c1 Author: Donald T <tang.1208@osu.edu> Date: Fri Mar 31 01:01:33 2023 -0400 win compatibility commit 21e06398719f2b363e8f48ae72a7017ffe5912a7 Author: Donald T <tang.1208@osu.edu> Date: Thu Mar 30 19:37:04 2023 -0400 . commit 79660071b4d68f9e07a71179e77b2e994e5ca7df Author: Donald T <tang.1208@osu.edu> Date: Thu Mar 30 16:11:00 2023 -0400 fix airline coc extension not updated properly commit bd24de81a9bb8d2fb29ef48908b3c26c5f246550 Author: Donald T <tang.1208@osu.edu> Date: Thu Mar 30 14:22:47 2023 -0400 add my own transparent method commit 15c3fc74c329ba256d36b0056756132c5ce296b8 Author: Donald T <tang.1208@osu.edu> Date: Thu Mar 30 04:58:41 2023 -0400 . commit 2405ae16e8cc26f51a641d7a71a7ab5d7972b1e6 Author: Donald T <tang.1208@osu.edu> Date: Thu Mar 30 02:50:17 2023 -0400 . commit f6d251b4ced41b855737fe713f2e18d98af988d5 Author: Donald T <tang.1208@osu.edu> Date: Thu Mar 30 00:00:48 2023 -0400 . commit 67c25293ddb51686e34a76c7437752de244c8e12 Author: Donald T <tang.1208@osu.edu> Date: Wed Mar 29 23:48:17 2023 -0400 . commit 3bba91fdb46d23b50e9ef9805274ab9583f53572 Author: Donald T <tang.1208@osu.edu> Date: Wed Mar 29 13:15:00 2023 -0400 . commit 22300562576222261d3b75f03fbd9ca6b17c5d7a Author: Donald T <tang.1208@osu.edu> Date: Wed Mar 29 12:35:50 2023 -0400 . commit a42a2ccfa022070524a8b4aa5c3eaed884c2826f Author: Donald T <tang.1208@osu.edu> Date: Wed Mar 29 03:51:15 2023 -0400 imporve preview script to support cat commit d69f83aaa0af5310e639af72c0d5d9831a3559fe Author: Donald T <tang.1208@osu.edu> Date: Wed Mar 29 01:24:50 2023 -0400 . commit 29fbf97bbbd636f569b6ca366ce5c8d24bfb537e Author: Donald T <tang.1208@osu.edu> Date: Wed Mar 29 01:19:37 2023 -0400 move theme related function commit be7844c3078596bbd29548e7adad8fa4eee707e1 Author: Donald T <tang.1208@osu.edu> Date: Wed Mar 29 00:40:10 2023 -0400 move more functions to utils commit 4f54fd428a8fbbf507324feb5390f84d86adf0a1 Author: Donald T <tang.1208@osu.edu> Date: Wed Mar 29 00:01:29 2023 -0400 add config for coc-fzf commit b8f095f7c7cfa55f0963a3c0f580896c7a3f50bc Author: Donald T <tang.1208@osu.edu> Date: Tue Mar 28 22:44:53 2023 -0400 move functions commit 8e8610f5214defae8fd7b7cd7e329278a23a7469 Author: Donald T <tang.1208@osu.edu> Date: Tue Mar 28 01:48:36 2023 -0400 . commit 2797153564ac377c5c39e3f34a5736cda5530b51 Author: Donald T <tang.1208@osu.edu> Date: Tue Mar 28 00:54:26 2023 -0400 . commit 90e1382038b88a7807ec09fc23dbc38fb5707d39 Author: Donald T <tang.1208@osu.edu> Date: Mon Mar 27 22:50:23 2023 -0400 . commit 37681413115c5e746c25e252ee2ef98addfe5b9d Author: Donald T <tang.1208@osu.edu> Date: Mon Mar 27 22:36:21 2023 -0400 . commit 839816c3eb10093ed3a1200f43470b4841273a3b Author: Donald T <tang.1208@osu.edu> Date: Mon Mar 27 20:19:20 2023 -0400 fix path issue commit 5581395825ca4876e67abf8cdc2567d431a3c1cb Author: Donald T <tang.1208@osu.edu> Date: Mon Mar 27 19:52:13 2023 -0400 . commit 141b58a12b8f1bcd43db6902752c402e02dbd371 Author: Donald T <tang.1208@osu.edu> Date: Mon Mar 27 19:52:01 2023 -0400 . commit c0de4df26f83cebd99d6a65a9ad42e4de086c08a Author: Donald T <tang.1208@osu.edu> Date: Mon Mar 27 19:16:21 2023 -0400 add fish config and imporve install script commit c7313fd820c0cd0ad7727fda98c417f62c6c23de Author: Donald T <tang.1208@osu.edu> Date: Mon Mar 27 18:08:49 2023 -0400 fix bugs commit 5de8083028596f91da45e6d2d7abcc40f7bdb6ad Author: Donald T <tang.1208@osu.edu> Date: Mon Mar 27 18:00:02 2023 -0400 fix ariline bug commit 057a255478d3ee08095f092cf671cd1fbdfc916d Author: Donald T <tang.1208@osu.edu> Date: Mon Mar 27 16:07:07 2023 -0400 . commit 13af63e75a4cd1dce1407db8c09ca6b7b74dcd7f Author: Donald T <tang.1208@osu.edu> Date: Mon Mar 27 15:36:15 2023 -0400 . commit 1969e30302e1fc2a84293bd9d3e29d98c0a2abec Author: Donald T <tang.1208@osu.edu> Date: Mon Mar 27 15:24:47 2023 -0400 . commit fd7a79c760ef9942d033eb206c17148aa11ddc9b Author: Donald T <tang.1208@osu.edu> Date: Mon Mar 27 14:06:49 2023 -0400 . commit 7f39e43e8e58139c1a55e889b8c525f767239b79 Author: Nachuan Tang <tangnachuan1208@gmail.com> Date: Mon Mar 27 04:07:45 2023 -0400 fix fzf preview not working in windows commit 2b3784d04bbb1c1412c5e46c35d4825ef492196a Author: Nachuan Tang <tang.1208@osu.edu> Date: Mon Mar 27 03:02:05 2023 -0400 . commit 9c5ee3626d7f9416ec243c3fcb2d5b41102a1792 Author: Nachuan Tang <tang.1208@osu.edu> Date: Sun Mar 26 20:14:31 2023 -0400 . commit d19b6b79d898a40385553d02f64aa3690e5aeb62 Author: Nachuan Tang <tang.1208@osu.edu> Date: Sun Mar 26 06:11:39 2023 -0400 . commit 49c77cc5135f5578b2268b4819311c45f6a00702 Author: Nachuan Tang <tang.1208@osu.edu> Date: Sun Mar 26 04:52:33 2023 -0400 . commit 870f45a06cb849e0d91b6dac9ce1da8d3f2f1f7e Author: Nachuan Tang <tang.1208@osu.edu> Date: Sun Mar 26 04:50:01 2023 -0400 structure change commit 251a36fbd66b861dc2a96a403a73dcdc20f0289c Author: Nachuan Tang <tang.1208@osu.edu> Date: Sun Mar 26 02:38:05 2023 -0400 .
This commit is contained in:
@@ -4,3 +4,6 @@
|
||||
.vim/
|
||||
node_modules/
|
||||
tags
|
||||
.netrwhist
|
||||
.vimspector.json
|
||||
*.log
|
||||
|
||||
+25
-15
@@ -1,7 +1,7 @@
|
||||
set-option -sg escape-time 10
|
||||
# set-option -g default-terminal "screen-256color"
|
||||
set -g default-terminal "xterm-256color"
|
||||
set-option -g history-limit 6000
|
||||
set -g default-terminal "screen-256color"
|
||||
# set -g default-terminal "xterm-256color"
|
||||
set-option -g history-limit 1000000
|
||||
|
||||
set -g focus-events on # requirement for vim's vim-tmux-clipboard plugin
|
||||
|
||||
@@ -13,27 +13,27 @@ setw -g mode-keys vi
|
||||
bind-key -T copy-mode-vi 'v' send -X begin-selection
|
||||
bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
|
||||
|
||||
# vim-like pane resizing
|
||||
# vim-like pane resizing
|
||||
bind-key -r C-k resize-pane -U
|
||||
bind-key -r C-j resize-pane -D
|
||||
bind-key -r C-h resize-pane -L
|
||||
bind-key -r C-l resize-pane -R
|
||||
|
||||
# vim-like pane switching
|
||||
# bind-key -n C-k select-pane -U
|
||||
# bind-key -n C-j select-pane -D
|
||||
# bind-key -n C-h select-pane -L
|
||||
# bind-key -n C-l select-pane -R
|
||||
# bind-key -n C-k select-pane -U
|
||||
# bind-key -n C-j select-pane -D
|
||||
# bind-key -n C-h select-pane -L
|
||||
# bind-key -n C-l select-pane -R
|
||||
|
||||
# and now unbind keys
|
||||
unbind Up
|
||||
unbind Down
|
||||
unbind Left
|
||||
unbind Right
|
||||
unbind Up
|
||||
unbind Down
|
||||
unbind Left
|
||||
unbind Right
|
||||
|
||||
unbind C-Up
|
||||
unbind C-Down
|
||||
unbind C-Left
|
||||
unbind C-Up
|
||||
unbind C-Down
|
||||
unbind C-Left
|
||||
unbind C-Right
|
||||
|
||||
# Smart pane switching with awareness of Vim splits.
|
||||
@@ -55,3 +55,13 @@ bind-key -T copy-mode-vi 'C-j' select-pane -D
|
||||
bind-key -T copy-mode-vi 'C-k' select-pane -U
|
||||
bind-key -T copy-mode-vi 'C-l' select-pane -R
|
||||
bind-key -T copy-mode-vi 'C-\' select-pane -l
|
||||
|
||||
set -g @plugin 'tmux-plugins/tpm'
|
||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||
|
||||
set -g @plugin 'roosta/tmux-fuzzback'
|
||||
set -g @fuzzback-popup-size '90%'
|
||||
set -g @fuzzback-popup 1
|
||||
set -g @fuzzback-fzf-colors 'gutter:-1,bg+:-1'
|
||||
|
||||
run '~/.tmux/plugins/tpm/tpm'
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
" get current neovim version
|
||||
let g:vim_version = -1
|
||||
|
||||
" set nocompatible
|
||||
" dotfile location
|
||||
let g:dotfiledir = expand(fnamemodify(resolve(expand('<sfile>:p')), ':h').'/')
|
||||
" vim runtime folder
|
||||
let g:vim_dir = expand('~/.vim/')
|
||||
|
||||
" dotfile location
|
||||
let g:mydotfiles_directory = expand('~/.dotfiles/')
|
||||
let after_directory = g:mydotfiles_directory . 'config/vi-plugs/coc-theme/after/'
|
||||
|
||||
" detect vim type(vim or nvim)
|
||||
let g:vim_v = 0
|
||||
if has('nvim')
|
||||
let g:vim_type = 'nvim'
|
||||
let g:vim_version = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
|
||||
else
|
||||
let g:vim_type = 'vim'
|
||||
let g:vim_version = matchstr(execute('version'), 'Vi IMproved \zs[^\n]*')
|
||||
let g:vim_v = v:version
|
||||
endif
|
||||
|
||||
@@ -31,11 +23,8 @@
|
||||
endif
|
||||
endif
|
||||
|
||||
let g:vim_version = str2float(g:vim_version)
|
||||
let g:dotfile_path = '~/.dotfiles/'
|
||||
|
||||
set runtimepath^=~/.vim runtimepath+=~/.vim/after
|
||||
execute('set runtimepath^=' . after_directory)
|
||||
let &packpath=&runtimepath
|
||||
|
||||
" The default leader is '\', but many people prefer ',' as it's in a standard
|
||||
@@ -44,19 +33,14 @@
|
||||
|
||||
" General {
|
||||
|
||||
noremap <leader>h :noh<CR> " turn off highlight
|
||||
|
||||
filetype plugin indent on " Automatically detect file types.
|
||||
syntax on " Syntax highlighting
|
||||
set belloff=all " Turn off the annoying bell
|
||||
set mouse=a " Automatically enable mouse usage
|
||||
set mousehide " Hide the mouse cursor while typing
|
||||
set shortmess+=F " Don't show the file name when open new file
|
||||
" scriptencoding utf-8
|
||||
|
||||
" Most prefer to automatically switch to the current file directory when
|
||||
" a new buffer is opened;
|
||||
" autocmd BufEnter * if bufname("") !~ "^\[A-Za-z0-9\]*://" | lcd %:p:h | endif
|
||||
" Always switch to the current file directory
|
||||
|
||||
set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter')
|
||||
" set viewoptions=folds,options,cursor,unix,slash " Better Unix / Windows compatibility
|
||||
" set virtualedit=onemore " Allow for cursor beyond last character
|
||||
@@ -72,26 +56,11 @@
|
||||
" autocmd FileType c,cpp,python,java setlocal tabstop=4 shiftwidth=4 softtabstop=4
|
||||
autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig
|
||||
autocmd FileType haskell,puppet,ruby,yml setlocal expandtab shiftwidth=2 softtabstop=2
|
||||
autocmd FileType vim execute('setlocal iskeyword='.&iskeyword.',:')
|
||||
" Instead of reverting the cursor to the last position in the buffer, we
|
||||
" set it to the first line when editing a git commit message
|
||||
autocmd FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
|
||||
augroup END
|
||||
|
||||
" " http://vim.wikia.com/wiki/Restore_cursor_to_file_position_in_previous_editing_session
|
||||
" " Restore cursor to file position in previous editing session
|
||||
" function! ResCur()
|
||||
" if line("'\"") <= line("$")
|
||||
" silent! normal! g`"
|
||||
" return 1
|
||||
" endif
|
||||
" endfunction
|
||||
|
||||
" augroup resCur
|
||||
" autocmd!
|
||||
" autocmd BufWinEnter * call ResCur()
|
||||
" augroup END
|
||||
|
||||
" Setting up the directories {
|
||||
" set backup " Backups are nice ...
|
||||
if has('persistent_undo')
|
||||
@@ -105,17 +74,13 @@
|
||||
|
||||
" Vim UI {
|
||||
"
|
||||
set nocursorline " Highlight current line
|
||||
set noshowmode
|
||||
set cursorline " Highlight current line
|
||||
set cursorlineopt=number " only highlight line number
|
||||
set cmdheight=1 " get rid of the extra useless line at the bottom(if not working, probably a plugin is changing the value)
|
||||
|
||||
" if has('cmdline_info')
|
||||
" set ruler " Show the ruler
|
||||
" set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " A ruler on steroids
|
||||
" set showcmd " Show partial commands in status line and
|
||||
" endif
|
||||
|
||||
set backspace=indent,eol,start " Backspace for dummies
|
||||
set fillchars=eob:\ " it can remove '~' at the end of buffer
|
||||
set fillchars=eob:\ ,vert:│,stl:\ ,stlnc:\ , " it can remove '~' at the end of buffer, and window split line
|
||||
set number " Line numbers on
|
||||
set showmatch " Show matching brackets/parenthesis
|
||||
set incsearch " Find as you type search
|
||||
@@ -128,19 +93,24 @@
|
||||
set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap too
|
||||
set scrolljump=1 " Lines to scroll when cursor leaves screen
|
||||
set scrolloff=5 " Minimum lines to keep above and below cursor
|
||||
set sidescrolloff=5 " Minimum lines to keep at the left or right of the cursor
|
||||
|
||||
set sidescrolloff=5 " Minimum lines to keep at the left or right of the cursor
|
||||
set display=lastline " don't replace whole long line with @@@
|
||||
augroup cc
|
||||
au!
|
||||
autocmd FileType c,cpp,vim,java,python,lua set colorcolumn=80
|
||||
autocmd FileType help set colorcolumn=
|
||||
augroup END
|
||||
|
||||
" }
|
||||
|
||||
" Formatting {
|
||||
|
||||
set autoindent " Indent at the same level of the previous line
|
||||
set expandtab " Tabs are spaces, not tabs
|
||||
set shiftwidth=4 " Use indents of 4 spaces
|
||||
set tabstop=4 " An indentation every four columns
|
||||
set softtabstop=4 " Let backspace delete indent
|
||||
|
||||
set conceallevel=0
|
||||
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
|
||||
set splitright " Puts new vsplit windows to the right of the current
|
||||
set splitbelow " Puts new split windows to the bottom of the current
|
||||
@@ -166,13 +136,16 @@
|
||||
" Yank from the cursor to the end of the line, to be consistent with C and D.
|
||||
nnoremap Y y$
|
||||
|
||||
if has('nvim')
|
||||
set foldmethod=expr
|
||||
set foldexpr=nvim_treesitter#foldexpr()
|
||||
else
|
||||
set foldmethod=syntax
|
||||
autocmd FileType python,vim set foldmethod=indent
|
||||
endif
|
||||
set foldmethod=syntax
|
||||
augroup vimfold
|
||||
autocmd!
|
||||
if has('nvim')
|
||||
" check tree-sitter config
|
||||
else
|
||||
autocmd FileType python set foldmethod=indent
|
||||
autocmd FileType vim set foldmethod=syntax
|
||||
endif
|
||||
augroup END
|
||||
|
||||
" so when a buffer open it wouldn't be fold by default
|
||||
" set nofoldenable
|
||||
@@ -233,27 +206,6 @@
|
||||
endfunction
|
||||
call InitializeDirectories()
|
||||
|
||||
" Shell command
|
||||
" function! s:RunShellCommand(cmdline)
|
||||
" botright new
|
||||
|
||||
" setlocal buftype=nofile
|
||||
" setlocal bufhidden=delete
|
||||
" setlocal nobuflisted
|
||||
" setlocal noswapfile
|
||||
" setlocal nowrap
|
||||
" setlocal filetype=shell
|
||||
" setlocal syntax=shell
|
||||
|
||||
" call setline(1, a:cmdline)
|
||||
" call setline(2, substitute(a:cmdline, '.', '=', 'g'))
|
||||
" execute 'silent $read !' . escape(a:cmdline, '%#')
|
||||
" setlocal nomodifiable
|
||||
" endfunction
|
||||
|
||||
" command! -complete=file -nargs=+ Shell call s:RunShellCommand(<q-args>)
|
||||
" e.g. Grep current file for <search_term>: Shell grep -Hn <search_term> %
|
||||
|
||||
" Visual mode pressing * or # searches for the current selection
|
||||
" Super useful! From an idea by Michael Naumann
|
||||
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
|
||||
@@ -262,32 +214,32 @@
|
||||
" Fix file type error for typescript
|
||||
autocmd BufNewFile,BufRead *.ts set filetype=typescript
|
||||
|
||||
" These are to cancel the default behavior of d, D, c, C
|
||||
" to put the text they delete in the default register.
|
||||
" Note that this means e.g. "ad won't copy the text into
|
||||
" register a anymore. You have to explicitly yank it.
|
||||
" TIPS: you can type :registers to view value in each registers
|
||||
" vnoremap y "+y
|
||||
" nnoremap y "+y
|
||||
|
||||
" copy to system
|
||||
if g:os == 'Darwin' || g:os == 'Windows'
|
||||
set clipboard=unnamed
|
||||
else
|
||||
set clipboard=unnamedplus
|
||||
if g:isWSL
|
||||
" will cause freezing of vim, not sure why
|
||||
" function CopyToWin(timer)
|
||||
" try
|
||||
" call system('/mnt/c/windows/system32/clip.exe ',@")
|
||||
" catch
|
||||
" endtry
|
||||
" endfunction
|
||||
" augroup Yank
|
||||
" autocmd!
|
||||
" " autocmd TextYankPost * :call system('/mnt/c/windows/system32/clip.exe ',@")
|
||||
" autocmd TextYankPost * let _ = timer_start(0, 'CopyToWin', { 'repeat': 1 })
|
||||
" augroup END
|
||||
if g:isWSL && has('nvim')
|
||||
" :h clipboard-wsl
|
||||
set clipboard=unnamedplus
|
||||
|
||||
" cache has to be enabled otherwise cause freeze
|
||||
" obviously wsl without xclip won't work
|
||||
let g:clipboard = {
|
||||
\ 'name': 'WSLxclip',
|
||||
\ 'copy': {
|
||||
\ '+': 'xclip -quiet -i -selection clipboard',
|
||||
\ '*': 'xclip -quiet -i -selection primary',
|
||||
\ },
|
||||
\ 'paste': {
|
||||
\ '+': 'xclip -o -selection clipboard',
|
||||
\ '*': 'xclip -o -selection primary',
|
||||
\ },
|
||||
\ 'cache_enabled': 1,
|
||||
\ }
|
||||
elseif g:isWSL
|
||||
set clipboard=unnamedplus
|
||||
else
|
||||
set clipboard=unnamedplus
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -299,8 +251,12 @@
|
||||
exec "set t_PE=\e[201~"
|
||||
endif
|
||||
|
||||
" disable netrw as i am using nerdtree and nvim-tree
|
||||
let g:loaded_netrw = 1
|
||||
let g:loaded_netrwPlugin = 1
|
||||
|
||||
" Use bundles config {
|
||||
if filereadable(expand("~/.vimrc.bundles"))
|
||||
source ~/.vimrc.bundles
|
||||
if filereadable(g:dotfiledir."/main.vim")
|
||||
execute('source '.g:dotfiledir.'/main.vim')
|
||||
endif
|
||||
" }
|
||||
|
||||
-963
@@ -1,963 +0,0 @@
|
||||
" (jump to the topic)
|
||||
"
|
||||
" OPTIONS
|
||||
" PLUGIN_INSTALL
|
||||
" UTILITIES
|
||||
" PLUGIN_CONFIGURATION " THEME_CONFIGURATION
|
||||
" KEY_MAPS
|
||||
" OTHER_CONFIGS
|
||||
|
||||
let g:debug_mode = v:false
|
||||
let g:high_performence = v:false " set true will also disable animation
|
||||
let g:autocomplte_enable = v:true
|
||||
let g:copilot_enable = v:false
|
||||
|
||||
" only in nvim (using which-key)
|
||||
let g:key_prompt = v:false
|
||||
|
||||
" only used by neovim
|
||||
let g:classic_vim_ui = v:true
|
||||
let g:animation_enable = v:true
|
||||
|
||||
let g:swap_dict = [
|
||||
\ ['v:false', '0', 'dark', 'false' ],
|
||||
\ ['v:true' , '1', 'light', 'true']]
|
||||
" convinient function to swap between two options
|
||||
nmap <leader><leader>t :call SwapWord()<CR>
|
||||
|
||||
"""""" PLUGIN_INSTALL """"""
|
||||
|
||||
let g:dotfiledir = expand('~/.dotfiles/')
|
||||
let g:plugin_dir = expand('~/.vim/plugged/')
|
||||
let g:config_file_path = g:vim_dir . ".config.vim"
|
||||
call plug#begin(g:plugin_dir)
|
||||
" https://github.com/junegunn/vim-plug/wiki/tips
|
||||
function! Cond(cond, ...)
|
||||
let opts = get(a:000, 0, {})
|
||||
return a:cond ? opts : extend(opts, { 'on': [], 'for': [] })
|
||||
endfunction
|
||||
let g:animation_enable = g:high_performence ? v:false : g:animation_enable
|
||||
|
||||
" custom plugin
|
||||
Plug 'Donaldttt/fzf-color-preview', Cond(g:vim_v >= 800)
|
||||
|
||||
"""" THEME_PLUGINS """"
|
||||
|
||||
Plug 'sainnhe/everforest'
|
||||
if !g:high_performence
|
||||
Plug 'bluz71/vim-moonfly-colors', { 'as': 'moonfly' }
|
||||
Plug 'jacoborus/tender.vim'
|
||||
Plug 'cocopon/iceberg.vim'
|
||||
Plug 'catppuccin/nvim', Cond( has('nvim-0.8.2') \|\| g:vim_v >= 900 , { 'as': 'catppuccin' })
|
||||
Plug 'NLKNguyen/papercolor-theme'
|
||||
Plug 'EdenEast/nightfox.nvim', Cond(has('nvim-0.5'))
|
||||
Plug 'projekt0n/github-nvim-theme', Cond(has('nvim-0.5'), { 'tag': 'v0.0.7' })
|
||||
Plug 'folke/tokyonight.nvim', Cond(g:vim_type == 'nvim', { 'branch': 'main' })
|
||||
endif
|
||||
|
||||
"""""""" END """"""""""
|
||||
Plug 'lervag/vimtex'
|
||||
Plug 'github/copilot.vim', Cond(( g:vim_type == 'nvim' \|\| g:vim_v >= 900 )
|
||||
\ && g:copilot_enable && executable('node'))
|
||||
|
||||
Plug 'gelguy/wilder.nvim', Cond((g:vim_type == 'vim' \|\| g:classic_vim_ui) && !g:high_performence)
|
||||
" " To use Python remote plugin features in Vim for wilder, can be skipped
|
||||
" " Plug 'roxma/nvim-yarp', Cond(g:vim_type == 'vim')
|
||||
Plug 'roxma/vim-hug-neovim-rpc', Cond(g:vim_v >= 800 && has('python3'))
|
||||
|
||||
Plug 'dstein64/vim-startuptime', Cond(!g:high_performence)
|
||||
Plug 'simeji/winresizer', Cond(!g:high_performence)
|
||||
Plug 'rust-lang/rust.vim', { 'for': ['rust'] }
|
||||
|
||||
Plug 'machakann/vim-sandwich'
|
||||
Plug 'rhysd/conflict-marker.vim'
|
||||
|
||||
Plug 'jiangmiao/auto-pairs'
|
||||
" Plug 'mg979/vim-visual-multi'
|
||||
Plug 'RRethy/vim-illuminate', Cond(!g:high_performence)
|
||||
"Plug 'easymotion/vim-easymotion'
|
||||
Plug 'mhinz/vim-startify'
|
||||
" Plug 'ludovicchabant/vim-gutentags'
|
||||
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
Plug 'airblade/vim-rooter'
|
||||
Plug 'roxma/vim-tmux-clipboard', Cond(executable('tmux'))
|
||||
Plug 'liuchengxu/vista.vim', Cond(!g:high_performence)
|
||||
|
||||
"" ESSENTIAL_PLUGINS ""
|
||||
|
||||
" Comment stuff out
|
||||
Plug 'tpope/vim-commentary'
|
||||
Plug 'vim-scripts/restore_view.vim'
|
||||
|
||||
" vim only plugins
|
||||
Plug 'scrooloose/nerdtree', Cond(g:vim_type == 'vim' \|\| !has('nvim-0.8'), { 'on' : ['NERDTreeToggle', 'NERDTreeFind'] })
|
||||
Plug 'tiagofumo/vim-nerdtree-syntax-highlight', Cond(g:vim_type == 'vim' && !g:high_performence)
|
||||
|
||||
Plug 'neoclide/coc.nvim', Cond(g:autocomplte_enable && executable('node'), {'branch': 'release'})
|
||||
|
||||
" only work with vim
|
||||
if g:vim_type == 'vim'
|
||||
Plug 'voldikss/vim-floaterm', Cond(has('terminal'))
|
||||
set encoding=UTF-8
|
||||
if executable('fzf')
|
||||
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'antoinemadec/coc-fzf'
|
||||
endif
|
||||
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'Donaldttt/vim-bufferline'
|
||||
Plug 'ryanoasis/vim-devicons'
|
||||
Plug 'wfxr/minimap.vim', Cond(executable('code-minimap'), {'on' : ['MinimapToggle']})
|
||||
endif
|
||||
|
||||
if g:vim_type == 'nvim'
|
||||
if g:vim_version >= 0.5
|
||||
Plug 'xiyaowong/nvim-transparent'
|
||||
Plug 'lukas-reineke/indent-blankline.nvim', Cond(!g:animation_enable)
|
||||
Plug 'echasnovski/mini.indentscope', Cond(g:animation_enable)
|
||||
Plug 'echasnovski/mini.animate', Cond(g:animation_enable)
|
||||
|
||||
Plug 'nvim-lualine/lualine.nvim'
|
||||
Plug 'karb94/neoscroll.nvim', Cond(g:animation_enable)
|
||||
Plug 'petertriho/nvim-scrollbar', Cond(g:animation_enable)
|
||||
Plug 'folke/which-key.nvim', Cond(!g:high_performence && g:key_prompt)
|
||||
endif
|
||||
if g:vim_version >= 0.7
|
||||
Plug 'nvim-treesitter/nvim-treesitter', Cond(executable('make'), {'do': ':TSUpdate'})
|
||||
|
||||
" for telescope
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
Plug 'nvim-telescope/telescope.nvim', Cond(g:vim_type == 'nvim', { 'branch': '0.1.x' })
|
||||
" c plugin for telescope to make it faster
|
||||
Plug 'nvim-telescope/telescope-fzf-native.nvim', Cond(executable('make'), { 'do': 'make' })
|
||||
|
||||
" comment out this plugin if the machine doesn't have required
|
||||
" font install
|
||||
Plug 'nvim-tree/nvim-web-devicons'
|
||||
Plug 'akinsho/toggleterm.nvim', Cond(g:vim_type == 'nvim', {'tag' : '*'})
|
||||
endif
|
||||
if g:vim_version >= 0.8
|
||||
Plug 'nvim-tree/nvim-tree.lua'
|
||||
|
||||
Plug 'rcarriga/nvim-notify', Cond(!g:high_performence && !g:classic_vim_ui)
|
||||
Plug 'folke/noice.nvim', Cond(!g:high_performence && !g:classic_vim_ui)
|
||||
Plug 'MunifTanjim/nui.nvim', Cond(!g:high_performence && !g:classic_vim_ui)
|
||||
endif
|
||||
endif
|
||||
|
||||
call plug#end()
|
||||
|
||||
augroup InitConfig
|
||||
autocmd VimLeave * call SaveConfig()
|
||||
|
||||
" Automatically install missing plugins at startup
|
||||
autocmd VimEnter *
|
||||
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||
\| PlugInstall --sync | q
|
||||
\| endif
|
||||
augroup end
|
||||
|
||||
"""""" UTILITIES """"""
|
||||
|
||||
" import ultilities functions
|
||||
execute('source ' . g:dotfiledir . '/utils.vim')
|
||||
|
||||
function! SaveConfig()
|
||||
let p = ReadVariable(g:config_file_path)
|
||||
if type(p) != type({})
|
||||
let p = {}
|
||||
endif
|
||||
|
||||
let config = has_key(p, g:vim_type) && type(p[g:vim_type]) == 4
|
||||
\ ? p[g:vim_type] : {}
|
||||
let config = Merge(config, g:my_config)
|
||||
|
||||
" vim and nvim may have diferenrt available plugins
|
||||
let p[g:vim_type] = config
|
||||
call SaveVariable(p, g:config_file_path)
|
||||
endfunction
|
||||
|
||||
function! LoadConfig()
|
||||
let result = ReadVariable(g:config_file_path)
|
||||
" if it is dictionary
|
||||
if type(result) == 4
|
||||
if has_key(result, g:vim_type)
|
||||
let config = result[g:vim_type]
|
||||
if type(config) == 4 | return config | endif
|
||||
endif
|
||||
endif
|
||||
return {}
|
||||
endfunction
|
||||
|
||||
""""""" PLUGIN_CONFIGURATION """"""
|
||||
|
||||
" a list of funcref that will be initilized late
|
||||
let s:post_init_func = []
|
||||
function s:registerLateInit(func)
|
||||
let Funcref = type(a:func) == 10 ? func : function(a:func)
|
||||
call add(s:post_init_func, Funcref)
|
||||
endfunction
|
||||
|
||||
function s:executeLateInit()
|
||||
function s:lateInitHelper(...)
|
||||
for Funcref in s:post_init_func
|
||||
call Funcref()
|
||||
endfor
|
||||
endfunction
|
||||
autocmd VimEnter * call timer_start(1, function('s:lateInitHelper'))
|
||||
endfunction
|
||||
|
||||
if HasPlug('vim-floaterm')
|
||||
let g:floaterm_wintype = 'float'
|
||||
let g:floaterm_keymap_toggle = '<C-\>'
|
||||
let g:floaterm_position = 'bottomright'
|
||||
let g:floaterm_width = 0.5
|
||||
let g:floaterm_height = 0.5
|
||||
autocmd QuitPre * :FloatermKill!<CR>
|
||||
autocmd FileType floaterm tmap <buffer> <C-[> <C-\><C-n>
|
||||
endif
|
||||
if HasPlug('Copilot.vim')
|
||||
" imap <expr> <C-n> <Plug>(copilot-next)
|
||||
" imap <expr> <C-p> <Plug>(copilot-prev)
|
||||
endif
|
||||
|
||||
if HasPlug('vimtex')
|
||||
if g:os == 'Darwin'
|
||||
let g:vimtex_view_method = 'skim'
|
||||
endif
|
||||
nmap <leader>lv <plug>(vimtex-view)
|
||||
nmap <leader>lc :VimtexCompile<CR>
|
||||
let g:vimtex_quickfix_open_on_warning = 0
|
||||
endif
|
||||
if HasPlug('minimap.vim')
|
||||
nnoremap <silent> <leader>mm :MinimapToggle<CR>
|
||||
let g:minimap_highlight_search = 1
|
||||
let g:minimap_git_colors = 1
|
||||
let g:minimap_enable_highlight_colorgroup = 1
|
||||
let g:minimap_block_filetypes = ['help', 'nerdtree']
|
||||
endif
|
||||
|
||||
if HasPlug('vista.vim')
|
||||
let g:vista_default_executive = 'vim_lsp'
|
||||
if HasPlug('coc.nvim')
|
||||
let g:vista_default_executive = 'coc'
|
||||
elseif HasPlug('coc.nvim')
|
||||
let g:vista_default_executive = 'ctags'
|
||||
endif
|
||||
nnoremap <silent> <leader>v :Vista!!<CR>
|
||||
let g:vista_cursor_delay = 0
|
||||
let g:vista_echo_cursor = 0
|
||||
let g:vista_echo_cursor_strategy = 'floating_win'
|
||||
let g:vista_close_on_jump = 0
|
||||
let g:vista_floating_delay = 0
|
||||
let g:vista_ignore_kinds = ['Variable', 'Field', 'EnumMember',
|
||||
\ 'String', 'Object', 'Array', 'Constant', 'Package', 'Boolean', 'Number'
|
||||
\ ]
|
||||
let g:vista_floating_border = 'rounded'
|
||||
let g:vista_disable_statusline = 1
|
||||
" let g:vista_keep_fzf_colors = 1
|
||||
let g:vista_update_on_text_changed_delay = 0
|
||||
let g:vista_update_on_text_changed = 1
|
||||
let g:vista#renderer#enable_kind = 1
|
||||
let g:vista#renderer#enable_icon = 1
|
||||
|
||||
" return to last position of vista
|
||||
let g:vista_last_row = v:null
|
||||
function VistaCursorJump()
|
||||
" let found = vista#util#BinarySearch(g:vista.raw, line('.'), 'line', '')
|
||||
let found = g:vista_last_row
|
||||
if empty(found)
|
||||
return
|
||||
endif
|
||||
let vlnum = get(found, 'vlnum', v:null)
|
||||
call cursor(vlnum, 3)
|
||||
endfunction
|
||||
|
||||
" save tag for VistaCursorJump use
|
||||
function VistaH2()
|
||||
if exists('*vista#util#BinarySearch')
|
||||
let bufs = map(filter(copy(getbufinfo()), 'v:val.listed'), 'v:val.bufnr')
|
||||
if index(bufs, bufnr('%')) < 0
|
||||
return
|
||||
endif
|
||||
let found = vista#util#BinarySearch(g:vista.raw, line('.'), 'line', '')
|
||||
if empty(found)
|
||||
return
|
||||
endif
|
||||
let g:vista_last_row = found
|
||||
endif
|
||||
endfunction
|
||||
autocmd BufLeave * call VistaH2()
|
||||
autocmd FileType vista call VistaCursorJump()
|
||||
|
||||
endif
|
||||
|
||||
if HasPlug('indentLine')
|
||||
let g:indentLine_fileTypeExclude = ['startify']
|
||||
endif
|
||||
|
||||
if HasPlug('vim-illuminate') && g:vim_type == 'vim' " nvim doesn't need this config
|
||||
let g:Illuminate_ftHighlightGroups = {
|
||||
\ 'vim:blacklist': ['vimLet', 'vimFuncKey', 'vimNotFunc', 'vimOperParen', 'vimLineComment'],
|
||||
\ 'java:blacklist' : [ 'javaType', 'javaScopeDecl', 'javaMethodDecl',
|
||||
\ 'javaComment', 'javaStorageClass', 'javaClassDecl', 'javaExternal',
|
||||
\ 'javaTypedef', 'javaLineComment', 'javaStatement', 'javaCommentTitle', 'javaDocComment' ],
|
||||
\ 'lua:blacklist' : [ 'luaComment', 'luaCond', 'luaStatement', 'luaFunction' ]
|
||||
\ }
|
||||
let g:Illuminate_ftwhitelist = ['vim', 'sh', 'python', 'rust', 'java',
|
||||
\ 'c', 'cpp', 'javascript', 'typescript', 'lua']
|
||||
|
||||
" ugly workaround for the bug that illuminate not working after first
|
||||
" enter vim
|
||||
function s:init_illuminate(...)
|
||||
hi illuminatedWord cterm=underline gui=underline
|
||||
endfunction
|
||||
|
||||
call s:registerLateInit('s:init_illuminate')
|
||||
augroup illuminate_augroup
|
||||
autocmd!
|
||||
autocmd ColorScheme * hi illuminatedWord cterm=underline gui=underline
|
||||
augroup END
|
||||
|
||||
endif
|
||||
|
||||
if HasPlug('wilder.nvim')
|
||||
|
||||
call wilder#setup({
|
||||
\ 'modes': [':'],
|
||||
\ 'next_key': '<tab>',
|
||||
\ 'previous_key': '<S-Tab>',
|
||||
\ 'enable_cmdline_enter': 0,
|
||||
\ })
|
||||
|
||||
call wilder#set_option('pipeline', [
|
||||
\ wilder#debounce(10),
|
||||
\ wilder#branch(
|
||||
\ wilder#cmdline_pipeline({'language': g:vim_type == 'nvim' ? 'python' : 'vim'}),
|
||||
\ ),
|
||||
\ ])
|
||||
|
||||
if g:vim_type == 'vim'
|
||||
call wilder#set_option('renderer', wilder#popupmenu_renderer())
|
||||
else
|
||||
call wilder#set_option('renderer', wilder#popupmenu_renderer(
|
||||
\ wilder#popupmenu_border_theme({
|
||||
\ 'highlights': {
|
||||
\ 'default': 'Normal',
|
||||
\ },
|
||||
\ 'pumblend': 20,
|
||||
\ 'border': 'rounded',
|
||||
\ })))
|
||||
endif
|
||||
endif
|
||||
|
||||
if HasPlug('vim-tmux-navigator')
|
||||
let g:tmux_navigator_no_mappings = 1
|
||||
|
||||
noremap <silent> <c-h> :<C-U>TmuxNavigateLeft<cr>
|
||||
noremap <silent> <c-j> :<C-U>TmuxNavigateDown<cr>
|
||||
noremap <silent> <c-k> :<C-U>TmuxNavigateUp<cr>
|
||||
noremap <silent> <c-l> :<C-U>TmuxNavigateRight<cr>
|
||||
" noremap <silent> {Previous-Mapping} :<C-U>TmuxNavigatePrevious<cr>
|
||||
endif
|
||||
|
||||
if HasPlug("vim-startify")
|
||||
if g:vim_type == 'nvim'
|
||||
let buffer_str_len = (&columns - 60) / 2
|
||||
let g:startify_custom_header = GenVimAsciiArt(buffer_str_len)
|
||||
else
|
||||
let buffer_str_len = (&columns - 30) / 2
|
||||
let g:startify_custom_header = GenVimAsciiArt(buffer_str_len)
|
||||
endif
|
||||
|
||||
let g:startify_lists = [
|
||||
\ { 'header': [' RECENT'], 'type': 'files' },
|
||||
\ { 'header': [' SESSIONS'], 'type': 'sessions' },
|
||||
\ ]
|
||||
|
||||
" session related KeyBinding. These KeyBinding uses function from startify
|
||||
nnoremap <silent> <leader><leader>s :SSave!<CR>
|
||||
nnoremap <silent> <leader><leader>l :SLoad<CR>
|
||||
nnoremap <silent> <leader><leader>d :SDelete!<CR>
|
||||
nnoremap <silent> <leader><leader>c :SClose<CR>
|
||||
|
||||
endif
|
||||
|
||||
if HasPlug("vim-devicons")
|
||||
let g:webdevicons_enable_airline_statusline = 0
|
||||
endif
|
||||
|
||||
if HasPlug("winresizer")
|
||||
let g:winresizer_vert_resize = 2
|
||||
let g:winresizer_horiz_resize = 2
|
||||
" nnoremap <C-w>r :WinResizerStartResize<CR>
|
||||
let g:winresizer_start_key = '<C-w>r'
|
||||
endif
|
||||
|
||||
if HasPlug("vim-gutentags")
|
||||
if exists("*gutentags#statusline()")
|
||||
set statusline+=%{gutentags#statusline()}
|
||||
endif
|
||||
let g:gutentags_trace = 1
|
||||
let g:gutentags_cache_dir=g:vim_dir . '/.vimtags/'
|
||||
let g:gutentags_project_root=['.git', '.hg', '.svn', '.bzr', '_darcs', '_FOSSIL_', '.fslckout', 'src']
|
||||
endif
|
||||
|
||||
if HasPlug("vim-easymotion")
|
||||
" <Leader>f{char} to move to {char}
|
||||
map <Leader>f <Plug>(easymotion-bd-f)
|
||||
nmap <Leader>f <Plug>(easymotion-overwin-f)
|
||||
|
||||
" s{char}{char} to move to {char}{char}
|
||||
nmap s <Plug>(easymotion-overwin-f2)
|
||||
|
||||
" Move to line
|
||||
map <Leader>L <Plug>(easymotion-bd-jk)
|
||||
nmap <Leader>L <Plug>(easymotion-overwin-line)
|
||||
|
||||
" Move to word
|
||||
map <Leader>w <Plug>(easymotion-bd-w)
|
||||
nmap <Leader>w <Plug>(easymotion-overwin-w)
|
||||
endif
|
||||
|
||||
if HasPlug("coc-fzf")
|
||||
" nnoremap <silent> <space><space> :<C-u>CocFzfList<CR>
|
||||
" nnoremap <leader>o :<C-u>CocFzfList outline<CR>
|
||||
endif
|
||||
|
||||
if HasPlug("vim-bufferline") && HasPlug("vim-airline")
|
||||
let g:bufferline_echo = 0
|
||||
let g:bufferline_modified = '+'
|
||||
|
||||
" scrolling with fixed current buffer position
|
||||
|
||||
let g:bufferline_active_buffer_left = '['
|
||||
let g:bufferline_active_buffer_right = ']'
|
||||
let g:bufferline_inactive_highlight = 'airline_c'
|
||||
let g:bufferline_active_highlight = 'airline_c_bold'
|
||||
endif
|
||||
|
||||
if HasPlug("undotree")
|
||||
nnoremap <leader>ut :UndotreeToggle<CR>
|
||||
endif
|
||||
|
||||
if HasPlug("vim-rooter")
|
||||
let g:rooter_patterns = ['.vscode', '.git', '*.sln', 'src']
|
||||
let g:rooter_change_directory_for_non_project_files = 'current'
|
||||
let g:rooter_silent_chdir = 1
|
||||
endif
|
||||
|
||||
if (g:vim_type == 'vim' || g:vim_version < 0.8) && HasPlug('nerdtree')
|
||||
if HasPlug('vim-nerdtree-syntax-highlight')
|
||||
let g:NERDTreeLimitedSyntax = 1
|
||||
endif
|
||||
let g:NERDShutUp=1
|
||||
|
||||
" work around for nerdtree bug: https://github.com/preservim/nerdtree/issues/1321
|
||||
let g:NERDTreeMinimalMenu = v:true
|
||||
let g:NERDTreeMinimalUI = v:true
|
||||
|
||||
function! NERDTreeEchoPathHandler(node)
|
||||
echo a:node.path.str()
|
||||
endfunction
|
||||
|
||||
autocmd! User nerdtree call NERDTreeAddKeyMap({
|
||||
\ 'key': 'p',
|
||||
\ 'callback': 'NERDTreeEchoPathHandler',
|
||||
\ 'quickhelpText': 'echo full path of current node',
|
||||
\ 'scope': 'Node' })
|
||||
|
||||
function! NERDTreeFindToggle()
|
||||
let my_filetype = &filetype
|
||||
let specical_fts = ['nerdtree', 'startify']
|
||||
if my_filetype == '' || index(specical_fts, my_filetype) >= 0
|
||||
:NERDTreeToggle
|
||||
else
|
||||
:NERDTreeFind
|
||||
endif
|
||||
endfunction
|
||||
nnoremap <silent> <leader>e :call NERDTreeFindToggle()<CR>
|
||||
|
||||
"let NERDTreeShowBookmarks=1
|
||||
"let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$']
|
||||
let NERDTreeChDirMode = 0
|
||||
let NERDTreeQuitOnOpen = 1
|
||||
let NERDTreeMouseMode = 2
|
||||
let NERDTreeShowHidden = 1
|
||||
|
||||
if HasPlug('vim-devicons') || HasPlug('nerdfont.vim')
|
||||
let NERDTreeDirArrowCollapsible = ''
|
||||
let NERDTreeDirArrowExpandable = ''
|
||||
else
|
||||
" let NERDTreeDirArrowCollapsible = ''
|
||||
" let NERDTreeDirArrowExpandable = ''
|
||||
endif
|
||||
" Exit Vim if NERDTree is the only window remaining in the only tab.
|
||||
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
|
||||
endif
|
||||
|
||||
if HasPlug("vim-airline")
|
||||
|
||||
" Set configuration options for the statusline plugin vim-airline.
|
||||
" Use the powerline theme and optionally enable powerline symbols.
|
||||
|
||||
" TODO
|
||||
" 22 is a magic number, it is best it can change as buffer width
|
||||
" changing
|
||||
|
||||
" This must use my fork version of bufferline
|
||||
" the number of cols bufferline cannot use out of max of screen cols
|
||||
let g:bufferline_forbided_col = 32
|
||||
call airline#parts#define_function('bufnum', 'AirlineBufferNumber')
|
||||
call airline#parts#define_function('cocstatus', 'AirlineCocStatus')
|
||||
call airline#parts#define_accent('cocstatus', 'italic')
|
||||
call airline#parts#define_accent('bufnum', 'bold')
|
||||
call airline#parts#define_accent('bufnum', 'italic')
|
||||
call airline#parts#define_accent('filetype', 'italic')
|
||||
|
||||
let g:airline_experimental = g:vim_v >= 900 ? 1 : 0
|
||||
|
||||
function! AirlineInit()
|
||||
let _airline_section_y = ''
|
||||
if HasPlug('coc.nvim')
|
||||
let _airline_section_y = airline#section#create(['cocstatus'])
|
||||
endif
|
||||
" this create function returns a format string for status line (:h
|
||||
" stl). the string we append is what will happend if we pass
|
||||
" cocstatus into the create function. By appending them we have
|
||||
" more freedom format the highlight
|
||||
" let g:airline_section_y = '%{%airline#util#wrap(AirlineCocStatus(), 0)%}'
|
||||
let g:airline_section_a = airline#section#create(['mode'])
|
||||
let g:airline_section_b = ''
|
||||
let g:airline_section_error = ''
|
||||
let g:airline_section_warning = ''
|
||||
" let g:airline_section_x = airline#section#create(['bufnum'])
|
||||
let g:airline_section_x = ''
|
||||
let g:airline_section_y = _airline_section_y
|
||||
let g:airline_section_z = airline#section#create(['filetype'])
|
||||
" see source for current list
|
||||
function s:airline_refresh(timer)
|
||||
:AirlineRefresh!
|
||||
endfunction
|
||||
|
||||
" autocmd! CursorMoved * call s:airline_refresh(0)
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:airlineconfig()
|
||||
" TODO
|
||||
" the problem is that colorscheme command will trigger this function
|
||||
" and at that time background=new but airline_theme=old
|
||||
" Right now I decide to modify airline them first and if the
|
||||
" colorscheme has it's own ariline theme it will override user
|
||||
" choice.
|
||||
" call add(g:msgs, g:ccc)
|
||||
" call add(g:msgs, g:airline_theme)
|
||||
" call add(g:msgs, &background)
|
||||
" let g:my_config[&background].airline_theme = g:airline_theme
|
||||
endfunction
|
||||
|
||||
augroup AirlineAu
|
||||
autocmd!
|
||||
autocmd User AirlineAfterTheme call s:airlineconfig()
|
||||
autocmd User AirlineAfterInit call AirlineInit()
|
||||
augroup end
|
||||
|
||||
let g:airline#extensions#localsearch#enabled = 0
|
||||
let g:airline_extensions = ['bufferline']
|
||||
let g:airline_exclude_filetypes = ['vista', 'minimap']
|
||||
let g:airline_skip_empty_sections = 1
|
||||
" without this airline will overwrite some setting like bufferline_active_buffer_left, etc.
|
||||
let g:airline#extensions#bufferline#overwrite_variables = 0
|
||||
let g:airline_mode_map = {
|
||||
\ '__' : '-',
|
||||
\ 'c' : 'C',
|
||||
\ 'i' : 'I',
|
||||
\ 'ic' : 'I',
|
||||
\ 'ix' : 'I',
|
||||
\ 'n' : 'N',
|
||||
\ 'multi' : 'M',
|
||||
\ 'ni' : 'N',
|
||||
\ 'no' : 'N',
|
||||
\ 'R' : 'R',
|
||||
\ 'Rv' : 'R',
|
||||
\ 's' : 'S',
|
||||
\ 'S' : 'S',
|
||||
\ '' : 'S',
|
||||
\ 't' : 'T',
|
||||
\ 'v' : 'V',
|
||||
\ 'V' : 'V',
|
||||
\ '' : 'V',
|
||||
\ }
|
||||
|
||||
endif
|
||||
|
||||
if HasPlug("fzf") && HasPlug("fzf.vim")
|
||||
" [Buffers] Jump to the existing window if possible
|
||||
let g:fzf_buffers_jump = 1
|
||||
"let $FZF_DEFAULT_COMMAND='find . \( -name node_modules -o -name .git \) -prune -o -print'
|
||||
|
||||
" - CTRL-/ will toggle preview window.
|
||||
if g:os == 'Windows'
|
||||
let g:fzf_preview_window = []
|
||||
else
|
||||
let g:fzf_preview_window = ['right:50%']
|
||||
end
|
||||
|
||||
hi! fzfborderhi term=bold cterm=bold ctermbg=236 gui=bold guibg=#272c42
|
||||
hi! fzfqueryhi term=underline cterm=underline gui=underline
|
||||
|
||||
let g:fzf_force_termguicolors = 1
|
||||
|
||||
let g:fzf_colors = { 'gutter': ['bg', 'Normal'], 'bg+': ['bg', 'Normal'], 'bg': ['bg', 'Normal'], 'fg+': ['fg', 'WarningMsg'] }
|
||||
|
||||
let g:fzf_files_options = ['--border-label', 'Files', '--border-label-pos', '9', '--no-scrollbar', '--no-hscroll', '--no-separator']
|
||||
" check if ripgrep is installed
|
||||
function! FzfRg()
|
||||
if ! executable('rg')
|
||||
let cmd = 'grep -R --line-number --exclude-dir=".git;.svn" --color=always -- '.shellescape('')
|
||||
else
|
||||
let cmd = "rg --column --line-number --no-heading --color=always --smart-case -- ".shellescape('')
|
||||
endif
|
||||
|
||||
let RgOptions = ['--border-label', 'Grep', '--border-label-pos', '9', '--no-scrollbar',
|
||||
\ '--no-hscroll', '--no-separator']
|
||||
let with_preview = fzf#vim#with_preview()
|
||||
let with_preview.options = RgOptions + with_preview.options
|
||||
call fzf#vim#grep(cmd, 1, with_preview, 0)
|
||||
endfunction
|
||||
|
||||
function! FzfColorSelect(color_name)
|
||||
execute("colorscheme " . a:color_name)
|
||||
let g:my_config.background = &background
|
||||
let g:my_config[&background].theme = a:color_name
|
||||
if has_key(g:colo2airline, a:color_name )
|
||||
call SetStatusLineTheme(&background, g:colo2airline[a:color_name])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! FzfAirlineColorSelect(color_name)
|
||||
call SetStatusLineTheme(&background, a:color_name)
|
||||
endfunction
|
||||
|
||||
noremap <leader>fr :call FzfRg()<CR>
|
||||
noremap <leader>ff :Files<CR>
|
||||
|
||||
if HasPlug('fzf-color-preview')
|
||||
let g:FzfColorComfirmCb = function('FzfColorSelect')
|
||||
let g:FzfAirlineComfirmCb = function('FzfAirlineColorSelect')
|
||||
noremap <leader>fa :AirlinePreview<CR>
|
||||
noremap <leader>fc :ColorsPreview<CR>
|
||||
else
|
||||
noremap <leader>fc :Colors<CR>
|
||||
endif
|
||||
endif
|
||||
|
||||
if HasPlug("coc.nvim") && executable('node')
|
||||
" coc-clangd: c/c++, may need to install clangd seperatly
|
||||
|
||||
if filereadable(g:dotfiledir . "/coc-nvim-config.vim")
|
||||
exec "source " . g:dotfiledir . "/coc-nvim-config.vim"
|
||||
endif
|
||||
" warning that coc work best for vim >= 8.3
|
||||
let g:coc_disable_startup_warning = 1
|
||||
endif
|
||||
|
||||
"""""" THEME_CONFIGURATION """"""
|
||||
" GOTO menu
|
||||
" THEME_README
|
||||
" THEME_PLUGINS_CONFIG
|
||||
" THEME_ULTILITIES
|
||||
" THEME_INIT " Setup theme when vim first start
|
||||
" THEME_OPTIONS
|
||||
|
||||
""" THEME_README """
|
||||
|
||||
" set custom callback functions to use when when enabling/diabling transparent
|
||||
" for certain colorscheme
|
||||
" let g:light_transparent_enable_cb = ''
|
||||
" let g:light_transparent_disable_cb = ''
|
||||
" let g:dark_transparent_enable_cb = ''
|
||||
" let g:dark_transparent_disable_cb = ''
|
||||
|
||||
""" THEME_PLUGINS_CONFIG """
|
||||
|
||||
if HasPlug('nvim-transparent')
|
||||
|
||||
" generic nvim transparent enable and disable function
|
||||
function Nvim_TB_enable()
|
||||
:TransparentEnable
|
||||
endfunction
|
||||
function Nvim_TB_disable()
|
||||
:TransparentDisable
|
||||
endfunction
|
||||
|
||||
let g:light_transparent_enable_cb = 'Nvim_TB_enable'
|
||||
let g:light_transparent_disable_cb = 'Nvim_TB_disable'
|
||||
let g:dark_transparent_enable_cb = 'Nvim_TB_enable'
|
||||
let g:dark_transparent_disable_cb = 'Nvim_TB_disable'
|
||||
endif
|
||||
|
||||
if HasPlug('everforest')
|
||||
let g:everforest_better_performance = 1
|
||||
let g:everforest_background = 'hard'
|
||||
" let g:everforest_enable_italic = 1
|
||||
function! Everforest_trans_enable()
|
||||
let g:everforest_transparent_background = 2
|
||||
colorscheme everforest
|
||||
call SetStatusLineTheme(&background, 'everforest')
|
||||
" hack to fix caret characters appearing in the statusline when StatusLine
|
||||
" and StatusLineNC has same highlight(https://vi.stackexchange.com/questions/15873/carets-in-status-line)
|
||||
hi StatusLine guifg=#d3c6aa ctermfg=223
|
||||
endfunction
|
||||
function! Everforest_trans_disable()
|
||||
let g:everforest_transparent_background = 0
|
||||
colorscheme everforest
|
||||
call SetStatusLineTheme(&background, 'everforest')
|
||||
endfunction
|
||||
function! CB_dark_tb_enable_everforest()
|
||||
call Everforest_trans_enable()
|
||||
endfunction
|
||||
function! CB_light_tb_enable_everforest()
|
||||
call Everforest_trans_enable()
|
||||
endfunction
|
||||
function! CB_dark_tb_disable_everforest()
|
||||
call Everforest_trans_disable()
|
||||
endfunction
|
||||
function! CB_light_tb_disable_everforest()
|
||||
call Everforest_trans_disable()
|
||||
endfunction
|
||||
|
||||
endif
|
||||
if HasPlug('papercolor-theme')
|
||||
function! CB_dark_tb_enable_PaperColor()
|
||||
let g:PaperColor_Theme_Options = {
|
||||
\ 'theme': {'default.dark': { 'transparent_background': 1 }}}
|
||||
colorscheme PaperColor
|
||||
endfunction
|
||||
function! CB_light_tb_enable_PaperColor()
|
||||
let g:PaperColor_Theme_Options = {
|
||||
\ 'theme': {'default.light': { 'transparent_background': 1 }}}
|
||||
colorscheme PaperColor
|
||||
endfunction
|
||||
function! CB_dark_tb_disable_PaperColor()
|
||||
let g:PaperColor_Theme_Options = {
|
||||
\ 'theme': {'default.dark': { 'transparent_background': 0 }}}
|
||||
colorscheme PaperColor
|
||||
endfunction
|
||||
function! CB_light_tb_disable_PaperColor()
|
||||
let g:PaperColor_Theme_Options = {
|
||||
\ 'theme': {'default.light': { 'transparent_background': 0 }}}
|
||||
colorscheme PaperColor
|
||||
endfunction
|
||||
endif
|
||||
|
||||
""" THEME_ULTILITIES """
|
||||
nmap <Leader>db :call ShowHighLightGroup()<CR>
|
||||
|
||||
function! SetTheme(bg, ...)
|
||||
let colors_name = a:0 > 0 ? a:1 : g:my_config[a:bg].theme
|
||||
if HasColorscheme(colors_name)
|
||||
let g:my_config.background = a:bg
|
||||
let g:my_config[a:bg].theme = colors_name
|
||||
call SetStatusLineTheme(a:bg)
|
||||
execute("colorscheme " . colors_name)
|
||||
if &background != a:bg
|
||||
execute('set background='.a:bg)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Change bottom airline/lualine theme
|
||||
function! SetStatusLineTheme(bg, ...)
|
||||
if has('nvim-0.5')
|
||||
" lualine will change theme automatically
|
||||
else
|
||||
if HasPlug('vim-airline') && exists(':AirlineTheme')
|
||||
let theme = a:0 > 0 ? a:1 : g:my_config[a:bg].airline_theme
|
||||
try
|
||||
execute('AirlineTheme ' . theme)
|
||||
catch
|
||||
let theme = g:default_config[a:bg].airline_theme
|
||||
execute('AirlineTheme ' . theme)
|
||||
endtry
|
||||
let g:my_config[a:bg].airline_theme = theme
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! EnableTransparent()
|
||||
let colorscheme_name = ColourSchemeName()
|
||||
let bg = &background
|
||||
let cb_name = 'CB_' .bg. '_tb_enable_'.colorscheme_name
|
||||
if exists('*' . cb_name)
|
||||
execute('call ' . cb_name . '()')
|
||||
elseif exists('g:'.bg.'_transparent_enable_cb') && g:dark_transparent_enable_cb != ''
|
||||
let cb_name = get(g:, bg.'_transparent_enable_cb', '')
|
||||
if cb_name != ''
|
||||
execute('call '.cb_name.'()')
|
||||
endif
|
||||
else
|
||||
return
|
||||
endif
|
||||
let g:my_config[&background].transparent = v:true
|
||||
endfunction
|
||||
|
||||
function! DisableTransparent()
|
||||
let colorscheme_name = ColourSchemeName()
|
||||
let bg = &background
|
||||
let cb_name = 'CB_' . bg . '_tb_disable_'.colorscheme_name
|
||||
if exists('*' . cb_name)
|
||||
execute('call ' . cb_name . '()')
|
||||
elseif exists('g:'.bg.'_transparent_disable_cb')
|
||||
let cb_name = get(g:, bg.'_transparent_disable_cb', '')
|
||||
if cb_name != ''
|
||||
execute('call '.cb_name.'()')
|
||||
endif
|
||||
else
|
||||
return
|
||||
endif
|
||||
let g:my_config[&background].transparent = v:false
|
||||
endfunction
|
||||
|
||||
" ToggleTransparent background
|
||||
function! ToggleTransparent()
|
||||
if g:my_config[&background].transparent
|
||||
call DisableTransparent()
|
||||
else
|
||||
call EnableTransparent()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Allow to trigger background
|
||||
function! ToggleBG()
|
||||
" Inversion
|
||||
let newbg = &background == "dark" ? 'light' : 'dark'
|
||||
call SetTheme(newbg)
|
||||
if g:my_config[&background].transparent
|
||||
call EnableTransparent()
|
||||
else
|
||||
call DisableTransparent()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
""" THEME_INIT """
|
||||
function! s:theme_initilize()
|
||||
let bg = g:my_config.background
|
||||
call SetStatusLineTheme(bg)
|
||||
if HasColorscheme(g:my_config[bg].theme)
|
||||
call SetTheme(bg)
|
||||
else
|
||||
call SetTheme(bg, g:my_config[bg].default)
|
||||
endif
|
||||
|
||||
if g:my_config[bg].transparent
|
||||
call EnableTransparent()
|
||||
else
|
||||
call DisableTransparent()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
if g:vim_type == 'vim'
|
||||
" workaround that statusline theme doesn't work right
|
||||
call s:registerLateInit('s:theme_initilize')
|
||||
endif
|
||||
autocmd VimEnter * call s:theme_initilize()
|
||||
|
||||
|
||||
""" THEME_OPTIONS """
|
||||
|
||||
if has('termguicolors')
|
||||
set termguicolors
|
||||
endif
|
||||
|
||||
let g:default_config = {
|
||||
\ 'background': 'dark',
|
||||
\ 'dark': {
|
||||
\ 'theme': 'default',
|
||||
\ 'default': 'default',
|
||||
\ 'transparent': v:false,
|
||||
\ 'airline_theme': 'angr',
|
||||
\ },
|
||||
\ 'light': {
|
||||
\ 'theme': 'default',
|
||||
\ 'default': 'default',
|
||||
\ 'transparent': v:false,
|
||||
\ 'airline_theme': 'silver',
|
||||
\ },
|
||||
\ }
|
||||
|
||||
let g:my_config = {}
|
||||
|
||||
let g:colo2airline = {
|
||||
\ }
|
||||
|
||||
" permenent default
|
||||
if HasPlug("everforest")
|
||||
let g:default_config = Merge(g:default_config, {
|
||||
\ 'dark': {
|
||||
\ 'airline_theme': 'everforest',
|
||||
\ 'default': 'everforest',
|
||||
\ },
|
||||
\ 'light': {
|
||||
\ 'airline_theme': 'everforest',
|
||||
\ 'default': 'everforest',
|
||||
\ },
|
||||
\ })
|
||||
endif
|
||||
|
||||
let g:my_config = Merge(g:default_config, LoadConfig())
|
||||
" }
|
||||
|
||||
"""""" KEY_MAPS """"""
|
||||
" (This doesn't include plugin specific mapping.
|
||||
" For them check plugin Preferences)
|
||||
|
||||
nnoremap <leader>ws :call TrimWhitespace()<CR>
|
||||
|
||||
" Toggle dark/light theme
|
||||
noremap <silent> <leader>bg :call ToggleBG()<CR>
|
||||
|
||||
" Toggle transparent background
|
||||
noremap <silent> <leader>tb :call ToggleTransparent()<CR>
|
||||
|
||||
" Buffer navigation
|
||||
nnoremap <silent> <space>q :bprevious<CR>
|
||||
nnoremap <silent> <space>e :bnext<CR>
|
||||
|
||||
" leader s change all occurence
|
||||
nnoremap <Leader>s :%s/\<<C-r><C-w>\>/<C-r><C-w>
|
||||
|
||||
" disable two easily mispressed yet useless key
|
||||
nnoremap q: <nop>
|
||||
nnoremap Q <nop>
|
||||
|
||||
" leader num change tab
|
||||
" only for vim or nvim without lualine
|
||||
|
||||
if (g:vim_type == 'vim' || !has('nvim-0.5')) && HasPlug('vim-bufferline')
|
||||
for i in range(1, 9)
|
||||
execute "nnoremap <silent> <nowait> <leader>" . i .
|
||||
\ " :call bufferline#jump(" . i . ")<CR>"
|
||||
endfor
|
||||
for i in range(10, 20)
|
||||
execute "nnoremap <silent> <nowait> <space>" . i .
|
||||
\ " :call bufferline#jump(" . i . ")<CR>"
|
||||
endfor
|
||||
end
|
||||
|
||||
" split window comform with other window management shortcuts
|
||||
nnoremap <silent> <C-w>% :vsplit<CR>
|
||||
nnoremap <silent> <C-w>" :split<CR>
|
||||
|
||||
"""""" OTHERS """"""
|
||||
|
||||
" Lua configuration
|
||||
if has('nvim') && filereadable(g:dotfiledir . '.vimrc.lua')
|
||||
execute('source ' . g:dotfiledir . '/.vimrc.lua')
|
||||
endif
|
||||
|
||||
call s:executeLateInit()
|
||||
-590
@@ -1,590 +0,0 @@
|
||||
-------------------------------------------------
|
||||
-------------------OPTIONS-----------------------
|
||||
-------------------------------------------------
|
||||
|
||||
-- enable animation of command like "<C-u>" and "<C-d>", or cursor
|
||||
-- jump animation. (Performence will be effected)
|
||||
local animation_enable = vim.g.animation_enable
|
||||
local high_performence = vim.g.high_performence
|
||||
local debug_mode = vim.g.debug_mode
|
||||
|
||||
-- false basicly enable plugins like noice, nvim-notify etc.
|
||||
local classic_vim_ui = vim.g.classic_vim_ui
|
||||
|
||||
-------------------------------------------------
|
||||
------------------UTILITIES----------------------
|
||||
-------------------------------------------------
|
||||
|
||||
local vim = vim
|
||||
function HasPlug(name)
|
||||
return vim.fn.HasPlug(name)
|
||||
end
|
||||
|
||||
-- use as a wrapper function to set keymap that call a function with
|
||||
-- parameters
|
||||
local _wrap = function(func, ...)
|
||||
local args = { ... }
|
||||
return function()
|
||||
func(unpack(args))
|
||||
end
|
||||
end
|
||||
-- use to print object
|
||||
function _G.put(...)
|
||||
local objects = {}
|
||||
for i = 1, select('#', ...) do
|
||||
local v = select(i, ...)
|
||||
table.insert(objects, vim.inspect(v))
|
||||
end
|
||||
|
||||
print(table.concat(objects, '\n'))
|
||||
return ...
|
||||
end
|
||||
|
||||
local wk = nil
|
||||
local function wk_register(opt)
|
||||
if wk == nil then
|
||||
return
|
||||
end
|
||||
wk.register(opt)
|
||||
end
|
||||
|
||||
-------------------------------------------------
|
||||
----------------CONFIGURATION--------------------
|
||||
-------------------------------------------------
|
||||
|
||||
local vim_version = vim.version()
|
||||
|
||||
local vim_version_minor = vim_version['minor']
|
||||
|
||||
local show_icon = false
|
||||
if HasPlug('nvim-web-devicons') then
|
||||
show_icon = true
|
||||
end
|
||||
|
||||
local function nvim_noice_config()
|
||||
if classic_vim_ui
|
||||
or not HasPlug('noice.nvim')
|
||||
or not HasPlug('nvim-notify')
|
||||
or not HasPlug('nui.nvim') then
|
||||
return
|
||||
end
|
||||
|
||||
require("noice").setup({
|
||||
lsp = {
|
||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
},
|
||||
-- you can enable a preset for easier configuration
|
||||
presets = {
|
||||
bottom_search = true, -- use a classic bottom cmdline for search
|
||||
-- command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
cmdline = {
|
||||
enabled = true, -- enables the Noice cmdline UI
|
||||
-- view = "cmdline", -- view for rendering the cmdline. Change to `cmdline` to get a classic cmdline at the bottom
|
||||
opts = {}, -- global options for the cmdline. See section on views
|
||||
format = {
|
||||
-- cmdline = false,
|
||||
search_down = false,
|
||||
search_up = false,
|
||||
-- filter = false,
|
||||
-- help = false,
|
||||
-- input = {}, -- Used by input()
|
||||
-- lua = false, -- to disable a format, set to `false`
|
||||
},
|
||||
},
|
||||
messages = {
|
||||
-- NOTE: If you enable messages, then the cmdline is enabled automatically.
|
||||
-- This is a current Neovim limitation.
|
||||
enabled = true, -- enables the Noice messages UI
|
||||
view = "notify", -- default view for messages
|
||||
view_error = "notify", -- view for errors
|
||||
view_warn = "notify", -- view for warnings
|
||||
view_history = "messages", -- view for :messages
|
||||
view_search = false, -- view for search count messages. Set to `false` to disable
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
local function nvim_scrollbar_config()
|
||||
if classic_vim_ui or
|
||||
not HasPlug('nvim-scrollbar') then
|
||||
return
|
||||
end
|
||||
require("scrollbar").setup({
|
||||
excluded_filetypes = {
|
||||
"prompt",
|
||||
"TelescopePrompt",
|
||||
"noice",
|
||||
"startify",
|
||||
"vista",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
local function toggleterm_config()
|
||||
if not HasPlug('toggleterm.nvim') then
|
||||
return
|
||||
end
|
||||
require("toggleterm").setup({
|
||||
open_mapping = [[<c-\>]],
|
||||
direction = 'float',
|
||||
float_opts = {
|
||||
border = 'rounded',
|
||||
width = function(term) return math.floor(vim.o.columns * 0.5) end,
|
||||
height = function(term) return math.floor(vim.o.lines * 0.5) end,
|
||||
winblend = 20,
|
||||
row = vim.o.lines * 0.5 - 3,
|
||||
col = vim.o.columns * 0.5,
|
||||
},
|
||||
})
|
||||
function _G.set_terminal_keymaps()
|
||||
local opts = { buffer = 0 }
|
||||
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
|
||||
vim.keymap.set('t', 'jk', [[<C-\><C-n>]], opts)
|
||||
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts)
|
||||
end
|
||||
|
||||
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
||||
end
|
||||
|
||||
local function vim_illuminate_config()
|
||||
if not HasPlug('vim-illuminate') then
|
||||
return
|
||||
end
|
||||
local illuminate = require('illuminate')
|
||||
illuminate.configure({
|
||||
providers = {
|
||||
'lsp',
|
||||
'treesitter',
|
||||
'regex',
|
||||
},
|
||||
delay = 0,
|
||||
filetype_overrides = {},
|
||||
filetypes_denylist = {
|
||||
'dirvish',
|
||||
'fugitive',
|
||||
'NvimTree',
|
||||
'help',
|
||||
'vista',
|
||||
},
|
||||
filetypes_allowlist = {},
|
||||
modes_denylist = {},
|
||||
modes_allowlist = {},
|
||||
providers_regex_syntax_denylist = {},
|
||||
providers_regex_syntax_allowlist = {},
|
||||
under_cursor = true,
|
||||
large_file_cutoff = nil,
|
||||
large_file_overrides = nil,
|
||||
min_count_to_highlight = 1,
|
||||
})
|
||||
end
|
||||
|
||||
local function which_key_config()
|
||||
if not HasPlug('which-key.nvim') then
|
||||
return
|
||||
end
|
||||
wk = require("which-key")
|
||||
wk.setup({
|
||||
triggers_blacklist = {
|
||||
i = { "j", "k" },
|
||||
v = { "j", "k" },
|
||||
c = { "w" },
|
||||
},
|
||||
})
|
||||
end
|
||||
vim.g.hhx = ''
|
||||
local function telescope_config()
|
||||
if not HasPlug('telescope.nvim') then
|
||||
return
|
||||
end
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require "telescope.actions.state"
|
||||
if HasPlug('telescope-fzf-native.nvim') then
|
||||
require('telescope').setup {
|
||||
pickers = {
|
||||
colorscheme = {
|
||||
enable_preview = true,
|
||||
mappings = {
|
||||
i = {
|
||||
["<CR>"] = function(bufnr)
|
||||
local selection = action_state.get_selected_entry()
|
||||
actions.select_default()
|
||||
local bg = vim.o.background
|
||||
local config = vim.g.my_config
|
||||
vim.fn.SetTheme(bg, selection.value)
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
}
|
||||
}
|
||||
}
|
||||
require('telescope').load_extension('fzf')
|
||||
end
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = "Search files inside cwd" })
|
||||
-- need to install ripgrep
|
||||
vim.keymap.set('n', '<leader>fr', builtin.live_grep, { desc = "Regex search inside files" })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = "Search buffers" })
|
||||
vim.keymap.set('n', '<leader>fc', builtin.colorscheme, { desc = "Search colorscheme" })
|
||||
wk_register({ ["<leader>f"] = { name = "+Telescope" } })
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "TelescopePreviewerLoaded",
|
||||
command = "setlocal wrap number"
|
||||
})
|
||||
end
|
||||
|
||||
local function github_theme_config()
|
||||
if not HasPlug('github-nvim-theme') then
|
||||
return
|
||||
end
|
||||
-- Example config in Lua
|
||||
require("github-theme").setup({
|
||||
-- Overwrite the highlight groups
|
||||
overrides = function(c)
|
||||
return {
|
||||
NormalFloat = { link = 'Pmenu' },
|
||||
}
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
local function animate_config()
|
||||
if not animation_enable then
|
||||
return
|
||||
end
|
||||
|
||||
if HasPlug('mini.animate') then
|
||||
local animate = require('mini.animate')
|
||||
animate.setup({
|
||||
cursor = {
|
||||
-- Whether to enable this animation
|
||||
enable = true,
|
||||
-- Timing of animation (how steps will progress in time)
|
||||
-- timing = --<function: implements linear total 250ms animation duration>,
|
||||
},
|
||||
scroll = {
|
||||
-- Whether to enable this animation
|
||||
enable = true,
|
||||
-- Timing of animation (how steps will progress in time)
|
||||
timing = animate.gen_timing.linear({ duration = 150, unit = 'total' }),
|
||||
},
|
||||
open = {
|
||||
-- Whether to enable this animation
|
||||
enable = false,
|
||||
},
|
||||
})
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy", "mason",
|
||||
"NvimTree", "vista", "toggleterm", "noice" },
|
||||
callback = function()
|
||||
vim.b.minianimate_disable = true
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- if HasPlug('neoscroll.nvim') then
|
||||
-- require('neoscroll').setup({
|
||||
-- -- Set any options as needed
|
||||
-- mappings = {'<C-u>', '<C-d>', '<C-b>', '<C-f>',
|
||||
-- },
|
||||
-- })
|
||||
|
||||
-- local t = {}
|
||||
-- -- Syntax: t[keys] = {function, {function arguments}}
|
||||
-- t['<C-u>'] = {'scroll', {'-vim.wo.scroll', 'true', '150'}}
|
||||
-- t['<C-d>'] = {'scroll', { 'vim.wo.scroll', 'true', '150'}}
|
||||
-- t['<C-b>'] = {'scroll', {'-vim.api.nvim_win_get_height(0)', 'true', '200'}}
|
||||
-- t['<C-f>'] = {'scroll', { 'vim.api.nvim_win_get_height(0)', 'true', '200'}}
|
||||
-- -- t['zb'] = {'zb', {'250'}}
|
||||
|
||||
-- require('neoscroll.config').set_mappings(t)
|
||||
-- end
|
||||
end
|
||||
|
||||
local function indentline_config()
|
||||
if not animation_enable then
|
||||
if HasPlug('indent-blankline.nvim') then
|
||||
-- Example config in Lua
|
||||
require("indent_blankline").setup {
|
||||
show_current_context = true,
|
||||
filetype_exclude = { "lspinfo", "packer", "checkhealth",
|
||||
"help", "man", "", "startify", }
|
||||
-- use_treesitter = true,
|
||||
}
|
||||
end
|
||||
else
|
||||
if HasPlug('mini.indentscope') then
|
||||
MiniIndentscope = require('mini.indentscope')
|
||||
MiniIndentscope.setup({
|
||||
symbol = '│',
|
||||
-- draw = {
|
||||
-- animation = MiniIndentscope.gen_animation.linear({
|
||||
-- easing = 'out',
|
||||
-- duration = 150,
|
||||
-- unit = 'total'
|
||||
-- })
|
||||
-- },
|
||||
})
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy", "mason",
|
||||
"NvimTree", "vista", "startify", "toggleterm" },
|
||||
callback = function()
|
||||
vim.b.miniindentscope_disable = true
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function transparent_config()
|
||||
if not HasPlug('nvim-transparent') then
|
||||
return
|
||||
end
|
||||
require("transparent").setup({
|
||||
extra_groups = { -- table/string: additional groups that should be cleared
|
||||
-- In particular, when you set it to 'all', that means all available groups
|
||||
"NvimTreeNormal",
|
||||
"VertSplit",
|
||||
},
|
||||
exclude_groups = {}, -- table: groups you don't want to clear
|
||||
})
|
||||
end
|
||||
|
||||
local function lualine_config()
|
||||
if not HasPlug('lualine.nvim') then
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_set_hl(0, 'CocstatusSucceed', { fg = "#e32be0" })
|
||||
vim.api.nvim_set_hl(0, 'CocstatusLoading', { fg = "#35f0e9" })
|
||||
-- custom lualine plugin show coc lsp status
|
||||
local function cocstatus()
|
||||
local loading = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" }
|
||||
local step = #loading
|
||||
local ok, result = pcall(vim.fn.CocAction, 'services')
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
local ft = vim.bo.filetype
|
||||
local state, id
|
||||
for _, entry in ipairs(result) do
|
||||
if entry['languageIds'][1] == ft then
|
||||
state = entry['state']
|
||||
id = entry['id']
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local speed = 1600
|
||||
local loadidx = (vim.loop.now() % speed)
|
||||
local msg = "lsp:" .. id
|
||||
if state == "starting" then
|
||||
return msg .. " %#CocstatusLoading#" .. loading[math.floor(loadidx / (step * (speed / 100))) + 1]
|
||||
elseif state == "running" then
|
||||
return msg .. " %#CocstatusSucceed#✔"
|
||||
end
|
||||
return ''
|
||||
end
|
||||
|
||||
local function debugstats()
|
||||
local t = vim.fn.Debugstats()
|
||||
return "ft:" .. t['filetype'] .. " bt:" .. t['buftype'] .. " wid:" .. t['winid']
|
||||
end
|
||||
|
||||
local _section_x = {}
|
||||
local _section_y = { 'encoding' }
|
||||
if HasPlug('coc.nvim') then table.insert(_section_x, cocstatus) end
|
||||
if debug_mode then _section_y = { debugstats } end
|
||||
|
||||
local disabled_filetypes_data = {}
|
||||
if vim_version_minor < 7 then
|
||||
-- globalstatus only work for nvim >= 0.7
|
||||
disabled_filetypes_data = {
|
||||
-- Filetypes to disable lualine for.
|
||||
statusline = {}, -- only ignores the ft for statusline.
|
||||
winbar = {}, -- only ignores the ft for winbar.
|
||||
'NvimTree',
|
||||
'vista',
|
||||
}
|
||||
end
|
||||
|
||||
local opt = {
|
||||
options = {
|
||||
icons_enabled = show_icon,
|
||||
theme = 'auto', -- lualine theme
|
||||
-- component_separators = { left = '', right = ''},
|
||||
-- section_separators = { left = '', right = ''},
|
||||
component_separators = { left = '', right = '' },
|
||||
section_separators = { left = '', right = '' },
|
||||
always_divide_middle = false,
|
||||
globalstatus = true,
|
||||
disabled_filetypes = disabled_filetypes_data,
|
||||
refresh = { statusline = 200 }
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = {},
|
||||
lualine_c = {
|
||||
{
|
||||
'buffers',
|
||||
mode = 2,
|
||||
filetype_names = {
|
||||
TelescopePrompt = 'Telescope',
|
||||
dashboard = 'Dashboard',
|
||||
packer = 'Packer',
|
||||
fzf = 'FZF',
|
||||
alpha = 'Alpha',
|
||||
NvimTree = '',
|
||||
vista = '',
|
||||
},
|
||||
}
|
||||
},
|
||||
-- lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_x = _section_x,
|
||||
lualine_y = _section_y,
|
||||
lualine_z = { 'location' }
|
||||
},
|
||||
}
|
||||
|
||||
require('lualine').setup(opt)
|
||||
|
||||
for i = 1, 9 do
|
||||
-- :nnoremap <silent> <Leader>1 :LualineBuffersJump 1<CR>
|
||||
vim.api.nvim_set_keymap('n', '<Leader>' .. i, ':LualineBuffersJump ' .. i .. '<CR>',
|
||||
{ noremap = true, silent = true, nowait = true })
|
||||
end
|
||||
for i = 10, 20 do
|
||||
-- :nnoremap <silent> <Leader>1 :LualineBuffersJump 1<CR>
|
||||
vim.api.nvim_set_keymap('n', '<Space>' .. i, ':LualineBuffersJump ' .. i .. '<CR>',
|
||||
{ noremap = true, silent = true, nowait = true })
|
||||
end
|
||||
end
|
||||
|
||||
local function nvim_treesitter_config()
|
||||
if not HasPlug('nvim-treesitter') then
|
||||
return
|
||||
end
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = { "c", "bash", "lua", "python", "vim" },
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
local function nvim_tree_config()
|
||||
if not HasPlug('nvim-tree.lua') then
|
||||
return
|
||||
end
|
||||
-- disable netrw at the very start of your init.lua (strongly advised)
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
local api = require('nvim-tree.api')
|
||||
local M = {}
|
||||
|
||||
function M.print_node_path()
|
||||
local node = api.tree.get_node_under_cursor()
|
||||
print(node.absolute_path)
|
||||
end
|
||||
|
||||
function M.on_attach(bufnr)
|
||||
local function opts(desc)
|
||||
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||
end
|
||||
-- vim.keymap.set('n', 'u', api.node.navigate.parent, opts('Parent Directory'))
|
||||
vim.keymap.set('n', 'u', api.tree.change_root_to_parent, opts('Up'))
|
||||
vim.keymap.set('n', 'a', api.fs.create, opts('Create'))
|
||||
vim.keymap.set('n', 'dd', api.fs.remove, opts('Delete'))
|
||||
vim.keymap.set('n', 'rn', api.fs.rename_basename, opts('Rename: Basename'))
|
||||
vim.keymap.set('n', 'I', api.tree.toggle_gitignore_filter, opts('Toggle Git Ignore'))
|
||||
vim.keymap.set('n', 'cd', api.tree.change_root_to_node, opts('CD'))
|
||||
vim.keymap.set('n', 'X', api.tree.collapse_all, opts('Collapse'))
|
||||
vim.keymap.set('n', 'O', api.tree.expand_all, opts('Expand All'))
|
||||
vim.keymap.set('n', 'p', M.print_node_path, opts('Print node path'))
|
||||
vim.keymap.set('n', 'o', api.node.open.edit, opts('Open'))
|
||||
vim.keymap.set('n', '<CR>', api.node.open.edit, opts('Open'))
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<Leader>e', ':NvimTreeFindFileToggle<CR>',
|
||||
{ desc = 'Toggle nvim-tree', noremap = true, silent = true, nowait = true })
|
||||
require("nvim-tree").setup({
|
||||
sort_by = "case_sensitive",
|
||||
on_attach = M.on_attach,
|
||||
view = {
|
||||
width = 30,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
},
|
||||
git = {
|
||||
ignore = false,
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
quit_on_open = true,
|
||||
resize_window = true,
|
||||
window_picker = {
|
||||
exclude = {
|
||||
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame", "vista" },
|
||||
buftype = { "nofile", "terminal", "help" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
if vim_version_minor >= 5 then
|
||||
vim_illuminate_config()
|
||||
transparent_config()
|
||||
github_theme_config()
|
||||
indentline_config()
|
||||
which_key_config()
|
||||
animate_config()
|
||||
nvim_scrollbar_config()
|
||||
lualine_config()
|
||||
end
|
||||
if vim_version_minor >= 7 then
|
||||
nvim_treesitter_config()
|
||||
telescope_config()
|
||||
toggleterm_config()
|
||||
end
|
||||
if vim_version_minor >= 8 then
|
||||
nvim_tree_config()
|
||||
nvim_noice_config()
|
||||
end
|
||||
|
||||
local function late_loading()
|
||||
end
|
||||
|
||||
-- late loading
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" },
|
||||
{ pattern = { "*" }, callback = late_loading, })
|
||||
@@ -24,3 +24,4 @@ To do
|
||||
## Screenshots
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -11,9 +11,6 @@ fzf_command_list_all=(\
|
||||
|
||||
# fzf match files
|
||||
fzf_command_list_file=(\
|
||||
cat \
|
||||
#vim \
|
||||
#nvim \
|
||||
set_wallpaper \
|
||||
)
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"diagnostic.errorSign": ">"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
set __fish_git_prompt_show_informative_status 1
|
||||
function fish_prompt -d "Write out the prompt"
|
||||
# This shows up as USER@HOST /home/user/ >, with the directory colored
|
||||
# $USER and $hostname are set by fish, so you can just use them
|
||||
# instead of using `whoami` and `hostname`
|
||||
printf ' %s%s%s%s$ ' (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) (fish_git_prompt)
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
set runtimepath^=~/.vim runtimepath+=~/.vim/after
|
||||
let &packpath=&runtimepath
|
||||
source ~/.vimrc
|
||||
" set termguicolors
|
||||
" lua require'bufferline'.setup{}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
theme_config.vim
|
||||
@@ -0,0 +1,85 @@
|
||||
" Base16 Classic Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes)
|
||||
" For vim-airline (https://github.com/vim-airline/vim-airline)
|
||||
" By Jason Heeris (http://heeris.id.au)
|
||||
|
||||
let s:scheme_slug = 'sunbather_dark'
|
||||
|
||||
let g:airline#themes#{s:scheme_slug}#palette = {}
|
||||
|
||||
" GUI color definitions
|
||||
let s:gui00 = '#151515'
|
||||
let s:gui01 = '#202020'
|
||||
let s:gui02 = '#303030'
|
||||
let s:gui03 = '#505050'
|
||||
let s:gui04 = '#B0B0B0'
|
||||
let s:gui05 = '#D0D0D0'
|
||||
let s:gui06 = '#E0E0E0'
|
||||
let s:gui07 = '#F5F5F5'
|
||||
let s:gui08 = '#AC4142'
|
||||
let s:gui09 = '#D28445'
|
||||
let s:gui0A = '#F4BF75'
|
||||
let s:gui0B = '#90A959'
|
||||
let s:gui0C = '#75B5AA'
|
||||
let s:gui0D = '#6A9FB5'
|
||||
let s:gui0E = '#AA759F'
|
||||
let s:gui0F = '#8F5536'
|
||||
|
||||
" Terminal color definitions
|
||||
let s:cterm00 = "00"
|
||||
let s:cterm03 = "08"
|
||||
let s:cterm05 = "07"
|
||||
let s:cterm07 = "15"
|
||||
let s:cterm08 = "01"
|
||||
let s:cterm0A = "03"
|
||||
let s:cterm0B = "02"
|
||||
let s:cterm0C = "06"
|
||||
let s:cterm0D = "04"
|
||||
let s:cterm0E = "05"
|
||||
if exists("base16colorspace") && base16colorspace == "256"
|
||||
let s:cterm01 = "18"
|
||||
let s:cterm02 = "19"
|
||||
let s:cterm04 = "20"
|
||||
let s:cterm06 = "21"
|
||||
let s:cterm09 = "16"
|
||||
let s:cterm0F = "17"
|
||||
else
|
||||
let s:cterm01 = "10"
|
||||
let s:cterm02 = "11"
|
||||
let s:cterm04 = "12"
|
||||
let s:cterm06 = "13"
|
||||
let s:cterm09 = "09"
|
||||
let s:cterm0F = "14"
|
||||
endif
|
||||
|
||||
let g:airline#themes#{s:scheme_slug}#palette.normal = airline#themes#generate_color_map(
|
||||
\ [ s:gui01, s:gui04, s:cterm01, s:cterm04 ],
|
||||
\ [ s:gui04, s:gui02, s:cterm04, s:cterm02 ],
|
||||
\ [ s:gui04, s:gui01, s:cterm04, s:cterm01 ])
|
||||
let g:airline#themes#{s:scheme_slug}#palette.normal_modified = {
|
||||
\ 'airline_c' : [ s:gui07, s:gui01, s:cterm07, s:cterm01 ]}
|
||||
|
||||
let g:airline#themes#{s:scheme_slug}#palette.insert = airline#themes#generate_color_map(
|
||||
\ [ s:gui01, s:gui0B, s:cterm01, s:cterm0B ],
|
||||
\ [ s:gui04, s:gui02, s:cterm04, s:cterm02 ],
|
||||
\ [ s:gui04, s:gui01, s:cterm04, s:cterm01 ])
|
||||
let g:airline#themes#{s:scheme_slug}#palette.insert_modified = {
|
||||
\ 'airline_c' : [ s:gui07, s:gui01, s:cterm07, s:cterm01 ]}
|
||||
|
||||
let g:airline#themes#{s:scheme_slug}#palette.replace = airline#themes#generate_color_map(
|
||||
\ [ s:gui01, s:gui0E, s:cterm01, s:cterm0E ],
|
||||
\ [ s:gui04, s:gui02, s:cterm04, s:cterm02 ],
|
||||
\ [ s:gui04, s:gui01, s:cterm04, s:cterm01 ])
|
||||
let g:airline#themes#{s:scheme_slug}#palette.replace_modified = {
|
||||
\ 'airline_c' : [ s:gui07, s:gui01, s:cterm07, s:cterm01 ]}
|
||||
|
||||
let g:airline#themes#{s:scheme_slug}#palette.visual = airline#themes#generate_color_map(
|
||||
\ [ s:gui01, s:gui09, s:cterm01, s:cterm09 ],
|
||||
\ [ s:gui04, s:gui02, s:cterm04, s:cterm02 ],
|
||||
\ [ s:gui04, s:gui01, s:cterm04, s:cterm01 ])
|
||||
let g:airline#themes#{s:scheme_slug}#palette.visual_modified = {
|
||||
\ 'airline_c' : [ s:gui07, s:gui01, s:cterm07, s:cterm01 ]}
|
||||
|
||||
let g:airline#themes#{s:scheme_slug}#palette.inactive = airline#themes#generate_color_map(
|
||||
\ [ s:gui01, s:gui01, s:cterm01, s:cterm01 ],
|
||||
\ [ s:gui04, s:gui01, s:cterm04, s:cterm01 ],
|
||||
\ [ s:gui05, s:gui01, s:cterm05, s:cterm01 ])
|
||||
@@ -0,0 +1,85 @@
|
||||
" Base16 Summerfruit Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes)
|
||||
" For vim-airline (https://github.com/vim-airline/vim-airline)
|
||||
" By Christopher Corley (http://christop.club/)
|
||||
|
||||
let s:scheme_slug = 'sunbather_light'
|
||||
|
||||
let g:airline#themes#{s:scheme_slug}#palette = {}
|
||||
|
||||
" GUI color definitions
|
||||
let s:gui00 = '#FFFFFF'
|
||||
let s:gui01 = '#E0E0E0'
|
||||
let s:gui02 = '#D0D0D0'
|
||||
let s:gui03 = '#B0B0B0'
|
||||
let s:gui04 = '#000000'
|
||||
let s:gui05 = '#101010'
|
||||
let s:gui06 = '#151515'
|
||||
let s:gui07 = '#202020'
|
||||
let s:gui08 = '#FF0086'
|
||||
let s:gui09 = '#FD8900'
|
||||
let s:gui0A = '#ABA800'
|
||||
let s:gui0B = '#00C918'
|
||||
let s:gui0C = '#1FAAAA'
|
||||
let s:gui0D = '#3777E6'
|
||||
let s:gui0E = '#AD00A1'
|
||||
let s:gui0F = '#CC6633'
|
||||
|
||||
" Terminal color definitions
|
||||
let s:cterm00 = "00"
|
||||
let s:cterm03 = "08"
|
||||
let s:cterm05 = "07"
|
||||
let s:cterm07 = "15"
|
||||
let s:cterm08 = "01"
|
||||
let s:cterm0A = "03"
|
||||
let s:cterm0B = "02"
|
||||
let s:cterm0C = "06"
|
||||
let s:cterm0D = "04"
|
||||
let s:cterm0E = "05"
|
||||
if exists("base16colorspace") && base16colorspace == "256"
|
||||
let s:cterm01 = "18"
|
||||
let s:cterm02 = "19"
|
||||
let s:cterm04 = "20"
|
||||
let s:cterm06 = "21"
|
||||
let s:cterm09 = "16"
|
||||
let s:cterm0F = "17"
|
||||
else
|
||||
let s:cterm01 = "10"
|
||||
let s:cterm02 = "11"
|
||||
let s:cterm04 = "12"
|
||||
let s:cterm06 = "13"
|
||||
let s:cterm09 = "09"
|
||||
let s:cterm0F = "14"
|
||||
endif
|
||||
|
||||
let g:airline#themes#{s:scheme_slug}#palette.normal = airline#themes#generate_color_map(
|
||||
\ [ s:gui01, s:gui04, s:cterm01, s:cterm04 ],
|
||||
\ [ s:gui04, s:gui02, s:cterm04, s:cterm02 ],
|
||||
\ [ s:gui04, s:gui01, s:cterm04, s:cterm01 ])
|
||||
let g:airline#themes#{s:scheme_slug}#palette.normal_modified = {
|
||||
\ 'airline_c' : [ s:gui07, s:gui01, s:cterm07, s:cterm01 ]}
|
||||
|
||||
let g:airline#themes#{s:scheme_slug}#palette.insert = airline#themes#generate_color_map(
|
||||
\ [ s:gui01, s:gui0B, s:cterm01, s:cterm0B ],
|
||||
\ [ s:gui04, s:gui02, s:cterm04, s:cterm02 ],
|
||||
\ [ s:gui04, s:gui01, s:cterm04, s:cterm01 ])
|
||||
let g:airline#themes#{s:scheme_slug}#palette.insert_modified = {
|
||||
\ 'airline_c' : [ s:gui07, s:gui01, s:cterm07, s:cterm01 ]}
|
||||
|
||||
let g:airline#themes#{s:scheme_slug}#palette.replace = airline#themes#generate_color_map(
|
||||
\ [ s:gui01, s:gui0E, s:cterm01, s:cterm0E ],
|
||||
\ [ s:gui04, s:gui02, s:cterm04, s:cterm02 ],
|
||||
\ [ s:gui04, s:gui01, s:cterm04, s:cterm01 ])
|
||||
let g:airline#themes#{s:scheme_slug}#palette.replace_modified = {
|
||||
\ 'airline_c' : [ s:gui07, s:gui01, s:cterm07, s:cterm01 ]}
|
||||
|
||||
let g:airline#themes#{s:scheme_slug}#palette.visual = airline#themes#generate_color_map(
|
||||
\ [ s:gui01, s:gui09, s:cterm01, s:cterm09 ],
|
||||
\ [ s:gui04, s:gui02, s:cterm04, s:cterm02 ],
|
||||
\ [ s:gui04, s:gui01, s:cterm04, s:cterm01 ])
|
||||
let g:airline#themes#{s:scheme_slug}#palette.visual_modified = {
|
||||
\ 'airline_c' : [ s:gui07, s:gui01, s:cterm07, s:cterm01 ]}
|
||||
|
||||
let g:airline#themes#{s:scheme_slug}#palette.inactive = airline#themes#generate_color_map(
|
||||
\ [ s:gui01, s:gui01, s:cterm01, s:cterm01 ],
|
||||
\ [ s:gui04, s:gui01, s:cterm04, s:cterm01 ],
|
||||
\ [ s:gui05, s:gui01, s:cterm05, s:cterm01 ])
|
||||
@@ -0,0 +1,27 @@
|
||||
" vim build with clipboard support doesn't need this and it work
|
||||
" better than neovim
|
||||
|
||||
func s:helper()
|
||||
call system('printf "%s" '.shellescape(join(v:event['regcontents'], "\n")).' | xclip -sel clip' )
|
||||
endfunc
|
||||
|
||||
func! clipboard#get()
|
||||
endfunc
|
||||
|
||||
func! clipboard#enable()
|
||||
augroup WSLClipboard
|
||||
au!
|
||||
au TextYankPost * call s:helper()
|
||||
augroup END
|
||||
endfunc
|
||||
|
||||
func! clipboard#disable()
|
||||
augroup WSLClipboard
|
||||
au!
|
||||
augroup END
|
||||
endfunc
|
||||
|
||||
func! clipboard#paste()
|
||||
return system('xclip -o -sel clip' )
|
||||
endfunc
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
let s:path = get(g:, '_config_path', fnamemodify(
|
||||
\ resolve(expand('<sfile>:p')), ':h:h').'/_config.vim')
|
||||
let s:config = {}
|
||||
|
||||
function! config#saveConfig()
|
||||
let p = utils#readvar(s:path)
|
||||
if type(p) != type({})
|
||||
let p = {}
|
||||
endif
|
||||
let vim_type = has('nvim') ? 'nvim' : 'vim'
|
||||
let config = has_key(p, vim_type) && type(p[vim_type]) == v:t_dict
|
||||
\ ? p[vim_type] : {}
|
||||
let config = utils#merge(config, s:config)
|
||||
|
||||
" vim and nvim may have diferenrt available plugins
|
||||
let p[vim_type] = config
|
||||
call utils#savevar(p, s:path)
|
||||
endfunction
|
||||
|
||||
function! s:loadConfig()
|
||||
let result = utils#readvar(s:path)
|
||||
" if it is dictionary
|
||||
let vim_type = has('nvim') ? 'nvim' : 'vim'
|
||||
if type(result) == v:t_dict
|
||||
if has_key(result, vim_type)
|
||||
let config = result[vim_type]
|
||||
if type(config) == v:t_dict
|
||||
let s:config = config
|
||||
return
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! config#setConfig(dict)
|
||||
let s:config = utils#merge(s:config, a:config)
|
||||
endfunction
|
||||
|
||||
function! config#init()
|
||||
call config#loadConfig()
|
||||
augroup config
|
||||
autocmd!
|
||||
autocmd VimLeave * call config#saveConfig()
|
||||
augroup END
|
||||
endfunction
|
||||
@@ -0,0 +1,169 @@
|
||||
|
||||
" this intent to create a list of options that can be toggled on/off
|
||||
|
||||
let s:options = {}
|
||||
|
||||
if !has('nvim')
|
||||
import autoload 'utils/selector.vim'
|
||||
endif
|
||||
|
||||
" opt is a dictionary with the following keys(* = required):
|
||||
" togglefunc and enablefunc/disablefunc are mutually exclusive
|
||||
" params:
|
||||
" - name: name of the option
|
||||
" - opt: a dictionary with following options():
|
||||
" - desc: description,
|
||||
" - togglefunc: function reference, if exists, enablefunc and disablefunc
|
||||
" will be ignored,
|
||||
" - enablefunc: function reference, if this exists, disablefunc must exists
|
||||
" as well and vice verse
|
||||
" - disablefunc: function reference,
|
||||
" - isEnabled: string, true or false or function reference. only needed when
|
||||
" using enablefunc and disablefunc
|
||||
function! options#add(name, opt) abort
|
||||
if (!has_key(a:opt, 'togglefunc')
|
||||
\ && (!has_key(a:opt, 'enablefunc') || !has_key(a:opt, 'disablefunc')))
|
||||
throw 'invalid option (togglefunc or enablefunc/disablefunc must be set))'
|
||||
endif
|
||||
|
||||
if !has_key(a:opt, 'isEnabled') && !has_key(a:opt, 'togglefunc')
|
||||
throw 'specify initial state(isEnabled) or set togglefunc'
|
||||
endif
|
||||
|
||||
for key in ['togglefunc', 'enablefunc', 'disablefunc']
|
||||
if has_key(a:opt, key) && type(a:opt[key]) != v:t_func
|
||||
throw key . ' must be a function reference'
|
||||
endif
|
||||
endfor
|
||||
|
||||
if !has_key(a:opt, 'desc')
|
||||
let a:opt['desc'] = ''
|
||||
endif
|
||||
|
||||
let s:options[a:name] = a:opt
|
||||
endfunction
|
||||
|
||||
" Register a simple vim option
|
||||
" params:
|
||||
" - name: name of the option
|
||||
" - dictionary(optional):
|
||||
" - desc: description of the option
|
||||
function! options#addVimOption(name, ...) abort
|
||||
let opt = {}
|
||||
|
||||
func opt.togglefunc(key)
|
||||
if eval('&' . a:key)
|
||||
execute('set no' . a:key)
|
||||
else
|
||||
execute('set ' . a:key)
|
||||
endif
|
||||
endfunc
|
||||
|
||||
if a:0 > 0
|
||||
let opt['desc'] = a:1
|
||||
endif
|
||||
|
||||
call options#add(a:name, opt)
|
||||
endfunction
|
||||
|
||||
function! options#getAll() abort
|
||||
let list = []
|
||||
for [key, val] in items(s:options)
|
||||
let desc = val.desc != '' ? ' - ' . val.desc : ''
|
||||
call add(list, [key, key . desc])
|
||||
endfor
|
||||
return list
|
||||
endfunction
|
||||
|
||||
function! options#getAllRaw() abort
|
||||
let list = []
|
||||
for [key, val] in items(s:options)
|
||||
call add(list, [key, desc])
|
||||
endfor
|
||||
return list
|
||||
endfunction
|
||||
|
||||
function! options#toggle(name) abort
|
||||
if !has_key(s:options, a:name)
|
||||
throw 'invalid option name: ' . a:name
|
||||
endif
|
||||
|
||||
let opt = s:options[a:name]
|
||||
if has_key(opt, 'togglefunc')
|
||||
call opt.togglefunc(a:name)
|
||||
else
|
||||
if type(opt.isEnabled) == v:t_func
|
||||
let isEnabled = opt.isEnabled()
|
||||
else
|
||||
let isEnabled = opt.isEnabled
|
||||
endif
|
||||
if isEnabled
|
||||
call opt.disablefunc()
|
||||
else
|
||||
call opt.enablefunc()
|
||||
endif
|
||||
if type(opt.isEnabled) != v:t_func
|
||||
let s:options[a:name].isEnabled = opt.isEnabled ? v:false : v:true
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! options#preSet()
|
||||
call options#addVimOption('number', 'show line number')
|
||||
call options#addVimOption('relativenumber')
|
||||
|
||||
let colorcolumnOpt = {
|
||||
\ 'desc': 'show color column',
|
||||
\ 'isEnabled': &colorcolumn != ''
|
||||
\ }
|
||||
function colorcolumnOpt.togglefunc(...)
|
||||
if &colorcolumn == ''
|
||||
let &colorcolumn = '80'
|
||||
else
|
||||
let &colorcolumn = ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
call options#add('colorcolumn', colorcolumnOpt)
|
||||
|
||||
let toggleBgOpt = {
|
||||
\ 'desc': 'toggle dark/light theme',
|
||||
\ }
|
||||
function toggleBgOpt.togglefunc(...)
|
||||
call theme#toggleBg()
|
||||
endfunction
|
||||
call options#add('dark/light', toggleBgOpt)
|
||||
endfunction
|
||||
|
||||
function! s:select(wid, result)
|
||||
let result = a:result[0]
|
||||
if result != v:null
|
||||
let key = s:rmap[result]
|
||||
call options#toggle(key)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! options#fzf_options()
|
||||
let list = []
|
||||
let s:rmap = {}
|
||||
for [key, val] in items(s:options)
|
||||
let desc = val.desc != '' ? key . ' - ' . val.desc : key
|
||||
call add(list, desc)
|
||||
let s:rmap[desc] = key
|
||||
endfor
|
||||
let s:fzf_list = list
|
||||
call selector.Start( list,
|
||||
\ {
|
||||
\ 'select_cb' : function('s:select'),
|
||||
\ 'yoffset' : 0.3,
|
||||
\ 'height' : 0.4,
|
||||
\ 'title' : 'Options',
|
||||
\ 'width' : 0.4
|
||||
\ })
|
||||
endfunc
|
||||
|
||||
function! options#init()
|
||||
call options#preSet()
|
||||
command! -nargs=0 Options call options#fzf_options()
|
||||
nnoremap <silent> <leader>fo :Options<CR>
|
||||
endfunction
|
||||
@@ -0,0 +1,14 @@
|
||||
func! os#getOS()
|
||||
if has("win64") || has("win32") || has("win16")
|
||||
return "Windows"
|
||||
else
|
||||
return substitute(system('uname'), '\n', '', '')
|
||||
endif
|
||||
endfunc
|
||||
|
||||
function! os#setWindows()
|
||||
set updatetime=50
|
||||
set shell=powershell
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -0,0 +1,383 @@
|
||||
let s:path = get(g:, 'theme_config_path', fnamemodify(
|
||||
\ resolve(expand('<sfile>:p')), ':h:h').'/theme_config.vim')
|
||||
|
||||
let s:themefixes = []
|
||||
|
||||
let s:bgType = has('termguicolors') ? 'guibg' : 'ctermbg'
|
||||
|
||||
" sometimes even in termguicolors, when guibg is not set, the bg will fall
|
||||
" back to use ctermbg, so we have to set them both to none
|
||||
let s:bgNonType = !has('termguicolors') ? 'guibg=NONE' : 'ctermbg=NONE'
|
||||
let s:transBlendOpt = has('nvim') ? ' blend=0' : ''
|
||||
|
||||
let s:default_config = {
|
||||
\ 'background': 'dark',
|
||||
\ 'light': {
|
||||
\ 'theme': 'sunbather_light',
|
||||
\ 'default': 'sunbather_light',
|
||||
\ 'transparent': v:false,
|
||||
\ 'airline_theme': 'sunbather_light',
|
||||
\ },
|
||||
\ 'dark': {
|
||||
\ 'theme': 'base16-harmonic-dark',
|
||||
\ 'default': 'base16-harmonic-dark',
|
||||
\ 'transparent': v:false,
|
||||
\ 'airline_theme': 'base16-harmonic-dark',
|
||||
\ },
|
||||
\ }
|
||||
|
||||
" When enable transparent background, these group will be set to transparent
|
||||
let s:transgroups = [
|
||||
\ 'Normal', 'NormalNC', 'Comment', 'Constant', 'Special', 'Identifier',
|
||||
\ 'Folded', 'Statusline', 'StatuslineNC',
|
||||
\ 'Statement', 'PreProc', 'Type', 'Underlined', 'String', 'Function',
|
||||
\ 'Conditional', 'Repeat', 'Operator', 'Structure', 'LineNr', 'NonText',
|
||||
\ 'SignColumn', 'CursorLineNr', 'EndOfBuffer', 'VertSplit',
|
||||
\ 'DiagnosticSignWarn', 'DiagnosticSignError', 'DiagnosticSignInfo',]
|
||||
|
||||
" background group that will be set to normal's background color
|
||||
let s:cleanbg = ['DiagnosticSignWarn', 'DiagnosticSignError', 'DiagnosticSignInfo',
|
||||
\ 'VertSplit', 'LineNr', 'SignColumn', 'NormalFloat']
|
||||
|
||||
let s:config = get(g:, 'theme_config', s:default_config)
|
||||
|
||||
function! theme#setConfig(bg, key, value)
|
||||
let s:config[a:bg][a:key] = a:value
|
||||
endfunction
|
||||
" register extra transparent hi group
|
||||
function! theme#getCleanBg()
|
||||
return s:cleanbg
|
||||
endfunction
|
||||
|
||||
function! theme#getBgType()
|
||||
return s:bgType
|
||||
endfunction
|
||||
|
||||
function! theme#getTransGroup()
|
||||
return s:transgroups
|
||||
endfunction
|
||||
|
||||
" register extra transparent hi group
|
||||
function theme#addCleanBg(group)
|
||||
let li = type(a:group) == 1 ? [a:group] : a:group
|
||||
for hi in li
|
||||
if index(s:cleanbg, hi) == -1
|
||||
call add(s:cleanbg, hi)
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" register extra transparent hi group
|
||||
function theme#addTransGroup(group)
|
||||
let li = type(a:group) == 1 ? [a:group] : a:group
|
||||
for hi in li
|
||||
if index(s:transgroups, hi) == -1
|
||||
call add(s:transgroups, hi)
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! theme#setColor(bg, ...)
|
||||
let colors_name = a:0 > 0 ? a:1 : s:config[a:bg].theme
|
||||
if !utils#hascolorscheme(colors_name)
|
||||
let colors_name = 'default'
|
||||
endif
|
||||
noa let &bg = a:bg
|
||||
call theme#setStlColor(a:bg)
|
||||
let s:config.background = a:bg
|
||||
let s:config[a:bg].theme = colors_name
|
||||
noa execute("colorscheme " . colors_name)
|
||||
if &background != a:bg
|
||||
noa let &bg = a:bg
|
||||
endif
|
||||
" some theme will pick their own airline theme or airline will
|
||||
" automatically pick theme based on colorscheme
|
||||
if exists('g:airline_theme') && g:airline_theme != s:config[a:bg].airline_theme
|
||||
call theme#setStlColor(a:bg, g:airline_theme)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Change bottom airline/lualine theme
|
||||
function! theme#setStlColor(bg, ...)
|
||||
if has('nvim-0.5')
|
||||
" lualine will change theme automatically
|
||||
else
|
||||
if utils#hasplug('vim-airline') && exists(':AirlineTheme')
|
||||
let theme = a:0 > 0 ? a:1 : s:config[a:bg].airline_theme
|
||||
try
|
||||
execute('AirlineTheme ' . theme)
|
||||
catch
|
||||
let theme = s:default_config[a:bg].airline_theme
|
||||
execute('AirlineTheme ' . theme)
|
||||
endtry
|
||||
let s:config[a:bg].airline_theme = theme
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! theme#inTransparent()
|
||||
return s:config[&background].transparent
|
||||
endfunction
|
||||
|
||||
" return 1 if link to other group
|
||||
" return 2 if not exists
|
||||
" return 0 if normal
|
||||
function! s:hiType(group)
|
||||
try
|
||||
let hi = execute('hi '.a:group)
|
||||
if hi =~# 'link'
|
||||
return 2
|
||||
endif
|
||||
catch
|
||||
return 1
|
||||
endtry
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function s:applyTransparent()
|
||||
let tail = ' ' . s:bgType . '=NONE term=NONE gui=NONE cterm=NONE '
|
||||
if has('nvim')
|
||||
let tail .= s:transBlendOpt
|
||||
else
|
||||
let tail .= s:bgNonType
|
||||
endif
|
||||
for group in s:transgroups
|
||||
if s:hiType(group) != 0
|
||||
continue
|
||||
endif
|
||||
" cterm and term sometimes are set to reverse so we need to clean them
|
||||
" too
|
||||
" for the last part, we can't clear all terms or it will fall back to
|
||||
" default which is not transparent
|
||||
execute('hi! '.group . tail)
|
||||
endfor
|
||||
call s:generalThemeFix()
|
||||
" for group in s:cleanbg
|
||||
" if s:hiType(group) != 0
|
||||
" continue
|
||||
" endif
|
||||
" execute('hi! '.group . tail)
|
||||
" endfor
|
||||
endfunction
|
||||
|
||||
" some callback function to enable transparent background
|
||||
" for specific colorscheme
|
||||
|
||||
" or general callback for all colorscheme when specific colorscheme callback
|
||||
" is not available
|
||||
" g:dark_transparent_enable_cb
|
||||
" g:light_transparent_enable_cb
|
||||
|
||||
function! theme#enableTransparent() abort
|
||||
let colorscheme_name = utils#colorschemename()
|
||||
let bg = &background
|
||||
if exists('g:'.bg.'_transparent_enable_cb') && g:dark_transparent_enable_cb != ''
|
||||
let cb_name = get(g:, bg.'_transparent_enable_cb', '')
|
||||
if cb_name != ''
|
||||
execute('call '.cb_name.'()')
|
||||
endif
|
||||
elseif exists('g:Transparent_enable_func')
|
||||
if type(g:Transparent_enable_func) != v:t_func
|
||||
echoerr 'g:Transparent_enable_func is not a function'
|
||||
endif
|
||||
call g:Transparent_enable_func()
|
||||
else
|
||||
call s:applyTransparent()
|
||||
augroup SetTransparent
|
||||
autocmd!
|
||||
autocmd ColorScheme * call s:applyTransparent()
|
||||
augroup END
|
||||
endif
|
||||
let s:config[bg].transparent = v:true
|
||||
endfunction
|
||||
|
||||
function! theme#disableTransparent() abort
|
||||
augroup SetTransparent
|
||||
autocmd!
|
||||
augroup END
|
||||
let bg = &background
|
||||
let s:config[bg].transparent = v:false
|
||||
let colorscheme_name = utils#colorschemename()
|
||||
if exists('g:'.bg.'_transparent_disable_cb')
|
||||
let cb_name = get(g:, bg.'_transparent_disable_cb', '')
|
||||
if cb_name != ''
|
||||
execute('call '.cb_name.'()')
|
||||
endif
|
||||
elseif exists('g:Transparent_disable_func')
|
||||
if type(g:Transparent_disable_func) != v:t_func
|
||||
echoerr 'g:Transparent_disable_func is not a function'
|
||||
endif
|
||||
call g:Transparent_disable_func()
|
||||
else
|
||||
execute('colorscheme ' . s:config[bg].theme)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" ToggleTransparent background
|
||||
function! theme#toggleTransparent()
|
||||
if s:config[&background].transparent
|
||||
call theme#disableTransparent()
|
||||
else
|
||||
call theme#enableTransparent()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Allow to trigger background
|
||||
function! theme#toggleBg()
|
||||
" Inversion
|
||||
let newbg = &background == "dark" ? 'light' : 'dark'
|
||||
call theme#setColor(newbg)
|
||||
if s:config[&background].transparent
|
||||
call theme#enableTransparent()
|
||||
elseif !s:config[&background].transparent
|
||||
call theme#disableTransparent()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! theme#saveConfig()
|
||||
let p = utils#readvar(s:path)
|
||||
if type(p) != type({})
|
||||
let p = {}
|
||||
endif
|
||||
|
||||
let vim_type = has('nvim') ? 'nvim' : 'vim'
|
||||
|
||||
let config = has_key(p, vim_type) && type(p[vim_type]) == 4
|
||||
\ ? p[vim_type] : {}
|
||||
|
||||
let config = utils#merge(config, s:config)
|
||||
|
||||
" vim and nvim may have diferenrt available plugins
|
||||
let p[vim_type] = config
|
||||
call utils#savevar(p, s:path)
|
||||
endfunction
|
||||
|
||||
function! theme#loadConfig()
|
||||
let result = utils#readvar(s:path)
|
||||
" if it is dictionary
|
||||
let vim_type = has('nvim') ? 'nvim' : 'vim'
|
||||
if type(result) == 4
|
||||
if has_key(result, vim_type)
|
||||
let config = result[vim_type]
|
||||
if type(config) == 4
|
||||
return config
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
return {}
|
||||
endfunction
|
||||
|
||||
function! theme#getHiTerms(group)
|
||||
let output = execute('hi ' . a:group)
|
||||
if stridx(output, 'links to') > 0
|
||||
let higroup = matchstr(output, 'links.to.\?\zs\S\+\ze')
|
||||
return theme#getHiTerms(higroup)
|
||||
endif
|
||||
let list = split(output, '')
|
||||
let dict = {}
|
||||
|
||||
for item in list
|
||||
if stridx(item, '=') > 0
|
||||
let splited = split(item, '=')
|
||||
let dict[splited[0]] = splited[1]
|
||||
endif
|
||||
endfor
|
||||
|
||||
for item in ['guibg', 'ctermbg', 'term', 'cterm', 'guifg', 'ctermfg']
|
||||
if ! has_key(dict, item)
|
||||
let dict[item] = 'NONE'
|
||||
endif
|
||||
endfor
|
||||
return dict
|
||||
endfunction
|
||||
|
||||
function! theme#getHiTerm(group, term)
|
||||
" Store output of group to variable
|
||||
let output = theme#getHiTerms(a:group)
|
||||
return output[a:term]
|
||||
endfunction
|
||||
|
||||
function! s:regiesterThemeFix(Func)
|
||||
call add(s:theme_fix, a:Func)
|
||||
endfunction
|
||||
|
||||
function! s:generalThemeFix()
|
||||
" The following is for getting rid of the vim split bar and match its
|
||||
" and number cols' color with backgroud
|
||||
" if theme#inTransparent()
|
||||
" return
|
||||
" endif
|
||||
if &bg != s:config.background
|
||||
execute('set bg=' . s:config.background)
|
||||
endif
|
||||
|
||||
let normal = theme#getHiTerms('normal')
|
||||
let hiTerms = ' '
|
||||
for term in ['guibg', 'ctermbg', 'term', 'cterm']
|
||||
let hiTerms .= term . '=' . normal[term] . ' '
|
||||
endfor
|
||||
|
||||
for group in s:cleanbg
|
||||
" if s:hiType(group) != 0
|
||||
" continue
|
||||
" endif
|
||||
" transBlendOpt is used to prevent hi from being clear
|
||||
execute('hi! ' . group . hiTerms)
|
||||
endfor
|
||||
|
||||
" highlight cursorline number only
|
||||
" this needs option set cursorlineopt=number
|
||||
if s:hiType('CursorLineNr') == 0
|
||||
hi! CursorLineNr guibg=NONE ctermbg=NONE cterm=bold gui=bold
|
||||
endif
|
||||
|
||||
for Func in s:themefixes
|
||||
call Func()
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! theme#Init()
|
||||
if has('termguicolors')
|
||||
set termguicolors
|
||||
endif
|
||||
|
||||
if has('nvim')
|
||||
set fillchars+=stl:\ ,stlnc:\ ,
|
||||
endif
|
||||
|
||||
let s:config = utils#merge(s:default_config, theme#loadConfig())
|
||||
|
||||
let bg = s:config.background
|
||||
if utils#hascolorscheme(s:config[bg].theme)
|
||||
call theme#setColor(bg)
|
||||
else
|
||||
call theme#setColor(bg, s:config[bg].default)
|
||||
endif
|
||||
|
||||
if s:config[bg].transparent
|
||||
call theme#enableTransparent()
|
||||
else
|
||||
call theme#disableTransparent()
|
||||
endif
|
||||
call s:generalThemeFix()
|
||||
|
||||
if exists('*options#add')
|
||||
let toggle_transparent = { 'desc' : 'Toggle transparent background' }
|
||||
func toggle_transparent.togglefunc(...)
|
||||
call theme#toggleTransparent()
|
||||
endfunc
|
||||
call options#add('toggle_transparent', toggle_transparent)
|
||||
endif
|
||||
|
||||
augroup GeneralTheme
|
||||
autocmd!
|
||||
autocmd ColorScheme * call s:generalThemeFix()
|
||||
autocmd ColorScheme * let s:config.background = &bg | call theme#setColor(&bg, expand('<amatch>'))
|
||||
autocmd VimLeave * call theme#saveConfig()
|
||||
augroup END
|
||||
|
||||
endfunction
|
||||
|
||||
function! theme#getConfig()
|
||||
return s:config
|
||||
endfunction
|
||||
@@ -0,0 +1,194 @@
|
||||
|
||||
" return a python version available (from 3 to 2)
|
||||
fun! utils#get_usable_py()
|
||||
let py = ''
|
||||
if executable('python3')
|
||||
let py = 'python3'
|
||||
elseif executable('python2')
|
||||
let py = 'python2'
|
||||
elseif executable('python')
|
||||
let py = 'python'
|
||||
endif
|
||||
return py
|
||||
endfun
|
||||
|
||||
" Check if plugin exists
|
||||
function! utils#hasplug(plug_name, ...)
|
||||
let plug_dir_name = get(a:, 1, a:plug_name) " optional argument for the name of plug's folder
|
||||
if has_key(g:plugs, a:plug_name) && isdirectory(g:plugin_dir . "/" . plug_dir_name)
|
||||
if has_key(g:plugs[a:plug_name], 'for') || has_key(g:plugs[a:plug_name], 'on')
|
||||
if (has_key(g:plugs[a:plug_name], 'for') && len(g:plugs[a:plug_name]['for']) == 0) ||
|
||||
\ (has_key(g:plugs[a:plug_name], 'on') && len(g:plugs[a:plug_name]['on']) == 0)
|
||||
return v:false
|
||||
endif
|
||||
endif
|
||||
return v:true
|
||||
endif
|
||||
return v:false
|
||||
endfunction
|
||||
|
||||
" This function is used to save a variable to a file
|
||||
function! utils#savevar(var, file)
|
||||
let serialized = string(a:var)
|
||||
call writefile([serialized], a:file)
|
||||
endfun
|
||||
|
||||
" This function is used to retrieve a variable from a file
|
||||
" only first line is count
|
||||
function! utils#readvar(file)
|
||||
if !filereadable(a:file)
|
||||
return v:null
|
||||
endif
|
||||
let serialized = readfile(a:file)
|
||||
if(len(serialized) == 0)
|
||||
return v:null
|
||||
endif
|
||||
execute "let result = " . serialized[0]
|
||||
return result
|
||||
endfun
|
||||
|
||||
" Merge two dictionaries, also recursively merging nested keys.
|
||||
" Use extend() if you don't need to merge nested keys.
|
||||
fun! utils#merge(defaults, override)
|
||||
let l:new = copy(a:defaults)
|
||||
for [l:k, l:v] in items(a:override)
|
||||
let l:new[l:k] = (type(l:v) is v:t_dict && type(get(l:new, l:k)) is v:t_dict)
|
||||
\ ? utils#merge(l:new[l:k], l:v)
|
||||
\ : l:v
|
||||
endfor
|
||||
return l:new
|
||||
endfun
|
||||
|
||||
"Remove all trailing whitespace by pressing <leader>ws
|
||||
fun! utils#trimwhitespace()
|
||||
let l:save = winsaveview()
|
||||
keeppatterns %s/\s*\r\=$//e
|
||||
call winrestview(l:save)
|
||||
endfun
|
||||
|
||||
function! utils#hascolorscheme(name)
|
||||
let scheme = a:name
|
||||
let colors = globpath(&runtimepath, printf('colors/%s.vim', scheme), 1, 1)
|
||||
if len(colors) > 0 | return 1 | endif
|
||||
let colors += globpath(&packpath, printf('pack/*/start/*/colors/%s.vim', scheme), 1, 1)
|
||||
if len(colors) > 0 | return 1 | endif
|
||||
let colors += globpath(&packpath, printf('pack/*/opt/*/colors/%s.vim', scheme), 1, 1)
|
||||
if len(colors) > 0 | return 1 | endif
|
||||
if has('nvim')
|
||||
let colors = globpath(&runtimepath, printf('colors/%s.lua', scheme), 1, 1)
|
||||
if len(colors) > 0 | return 1 | endif
|
||||
let colors += globpath(&packpath, printf('pack/*/start/*/colors/%s.lua', scheme), 1, 1)
|
||||
if len(colors) > 0 | return 1 | endif
|
||||
let colors += globpath(&packpath, printf('pack/*/opt/*/colors/%s.lua', scheme), 1, 1)
|
||||
if len(colors) > 0 | return 1 | endif
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" get current colorscheme name
|
||||
" return default if not found
|
||||
function! utils#colorschemename()
|
||||
return execute('colo')[1:]
|
||||
try
|
||||
return g:colors_name
|
||||
catch /^Vim:E121/
|
||||
return "default"
|
||||
catch /.*/
|
||||
return "default"
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" debug function print out highlight group of cursor position
|
||||
function! utils#showHiGroup(...)
|
||||
if !exists("*synstack")
|
||||
return
|
||||
endif
|
||||
let l = a:0 == 2 ? a:1 : line('.')
|
||||
let c = a:0 == 2 ? a:2 : col('.')
|
||||
echo map(synstack(l, c), 'synIDattr(v:val, "name")')
|
||||
|
||||
:echo "hi<" . synIDattr(synID(l,c,1),"name") . '> trans<'
|
||||
\ . synIDattr(synID(l,c,0),"name") . "> lo<"
|
||||
\ . synIDattr(synIDtrans(synID(l,c,1)),"name") . ">"
|
||||
|
||||
endfunc
|
||||
|
||||
" get highlight group information and return as dictionary
|
||||
function! utils#getHi(group)
|
||||
let output = execute('hi ' . a:group)
|
||||
let list = split(output, '\s\+')
|
||||
let dict = {}
|
||||
for item in list
|
||||
if match(item, '=') > 0
|
||||
let splited = split(item, '=')
|
||||
let dict[splited[0]] = splited[1]
|
||||
endif
|
||||
endfor
|
||||
return dict
|
||||
endfunction
|
||||
|
||||
function! utils#isTransparent()
|
||||
let dict = utils#getHi('Normal')
|
||||
let isGui = &termguicolors
|
||||
if isGui
|
||||
if !has_key(dict, 'guibg')
|
||||
return 1
|
||||
endif
|
||||
elseif !isGui
|
||||
if !has_key(dict, 'ctermfg')
|
||||
return 1
|
||||
endif
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! s:scratch()
|
||||
split
|
||||
noswapfile hide enew
|
||||
setlocal buftype=nofile
|
||||
setlocal bufhidden=hide
|
||||
setlocal nobuflisted
|
||||
endfunction
|
||||
|
||||
" search highlight group with pattern
|
||||
function! utils#searchHi(pattern)
|
||||
execute("filter /" . a:pattern . "/ highlight")
|
||||
" color not working
|
||||
" let temp_reg = @"
|
||||
" redir @"
|
||||
" silent! execute("filter /" . a:pattern . "/ highlight")
|
||||
" redir END
|
||||
" let output = copy(@")
|
||||
" let @" = temp_reg
|
||||
" call s:scratch()
|
||||
" put! =output
|
||||
endfunc
|
||||
|
||||
function! utils#swapword()
|
||||
let word = expand("<cword>")
|
||||
let l1 = g:swap_dict[0]
|
||||
let l2 = g:swap_dict[1]
|
||||
let inx = index(l1, word)
|
||||
if inx != -1
|
||||
let newword = l2[inx]
|
||||
else
|
||||
let inx = index(l2, word)
|
||||
if inx != -1
|
||||
let newword = l1[inx]
|
||||
endif
|
||||
endif
|
||||
if inx != -1
|
||||
execute "normal ciw" . newword . "\<Esc>"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! utils#files(...)
|
||||
if a:0 > 0
|
||||
let path = a:1
|
||||
else
|
||||
let path = getcwd()
|
||||
endif
|
||||
let files = glob(path . '/**', 1, 1, 1)
|
||||
return files
|
||||
endfunction
|
||||
|
||||
Executable
+98
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
""" preview.py theme arg
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
class bcolors:
|
||||
HEADER = '\033[95m'
|
||||
OKBLUE = '\033[94m'
|
||||
OKCYAN = '\033[96m'
|
||||
OKGREEN = '\033[92m'
|
||||
WARNING = '\033[93m'
|
||||
RED = '\033[31m'
|
||||
YELLOW = '\033[33m'
|
||||
FAIL = '\033[91m'
|
||||
ENDC = '\033[0m'
|
||||
BOLD = '\033[1m'
|
||||
UNDERLINE = '\033[4m'
|
||||
|
||||
def is_tool(name):
|
||||
"""Check whether `name` is on PATH and marked as executable."""
|
||||
from shutil import which
|
||||
return which(name) is not None
|
||||
|
||||
def get_preview_tool():
|
||||
exec = None
|
||||
if is_tool('bat'):
|
||||
exec = 'bat'
|
||||
elif is_tool('batcat'):
|
||||
exec = 'batcat'
|
||||
elif is_tool('cat'):
|
||||
exec = 'cat'
|
||||
return exec
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
theme = sys.argv[1]
|
||||
if theme == 'light':
|
||||
theme = 'ansi'
|
||||
tcolor = '31'
|
||||
color = bcolors.RED
|
||||
else:
|
||||
theme = '1337'
|
||||
tcolor = '33'
|
||||
color = bcolors.YELLOW
|
||||
|
||||
filepath = ''.join(sys.argv[2:])
|
||||
args = filepath.split(":")
|
||||
args += [None, None]
|
||||
|
||||
file = args[0]
|
||||
center = args[1]
|
||||
# print(sys.argv[2:])
|
||||
# exit(0)
|
||||
# if os.name == 'nt':
|
||||
# file += args[1]
|
||||
# center = args[2]
|
||||
|
||||
if file == None or not os.path.isfile(file):
|
||||
print("File not found {}".format(file))
|
||||
exit(0)
|
||||
|
||||
if center is None: center = 0
|
||||
|
||||
batcmd = get_preview_tool()
|
||||
cmdstr = None
|
||||
|
||||
if file[0] == '-':
|
||||
file = './' + file
|
||||
if batcmd:
|
||||
if batcmd == 'cat':
|
||||
if center:
|
||||
cmdstr = 'cat -n {} | perl -pe "s/^.*?\s{}\s.*?$/\e[1;{}m$&\e[0m/g"'.format(file, center, tcolor)
|
||||
else:
|
||||
cmdstr = 'cat -n {}'.format(file)
|
||||
elif batcmd == 'bat':
|
||||
cmdstr = 'bat --theme={} --style=numbers --color=always \
|
||||
--pager=never --highlight-line={} "{}"'.format(theme, center, file)
|
||||
if cmdstr:
|
||||
os.system(cmdstr)
|
||||
else:
|
||||
f = open(file, 'r')
|
||||
Lines = f.readlines()
|
||||
center = int(center)
|
||||
linenr = 1
|
||||
|
||||
for line in Lines:
|
||||
if linenr == center:
|
||||
print("{}{:4d} {}{}".format(color, linenr, line, bcolors.ENDC), end='')
|
||||
else:
|
||||
print("{:4d} {}".format(linenr, line), end='')
|
||||
linenr += 1
|
||||
f.close()
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
" Name: sunbather.vim
|
||||
" Version: 0.1.0
|
||||
" Maintainer: github.com/nikolvs
|
||||
" License: The MIT License (MIT)
|
||||
"
|
||||
" A minimal pink colorscheme for Vim.
|
||||
"
|
||||
" Forked from paramount:
|
||||
" https://github.com/owickstrom/vim-colors-paramount
|
||||
"
|
||||
"""
|
||||
hi clear
|
||||
|
||||
if exists('syntax on')
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
let g:colors_name='sunbather_dark'
|
||||
|
||||
let s:black = { "gui": "#000000", "cterm": "232" }
|
||||
let s:medium_gray = { "gui": "#767676", "cterm": "243" }
|
||||
let s:white = { "gui": "#F1F1F1", "cterm": "15" }
|
||||
let s:actual_white = { "gui": "#FFFFFF", "cterm": "231" }
|
||||
let s:subtle_black = { "gui": "#121212", "cterm": "233" }
|
||||
let s:light_black = { "gui": "#262626", "cterm": "235" }
|
||||
let s:lighter_black = { "gui": "#4E4E4E", "cterm": "239" }
|
||||
let s:light_gray = { "gui": "#A8A8A8", "cterm": "248" }
|
||||
let s:lighter_gray = { "gui": "#C6C6C6", "cterm": "251" }
|
||||
let s:lightest_gray = { "gui": "#EEEEEE", "cterm": "255" }
|
||||
let s:dark_pink = { "gui": "#ff5f87", "cterm": "204" }
|
||||
let s:light_pink = { "gui": "#d75f87", "cterm": "168" }
|
||||
let s:dark_red = { "gui": "#C30771", "cterm": "1" }
|
||||
let s:light_red = { "gui": "#E32791", "cterm": "1" }
|
||||
let s:orange = { "gui": "#D75F5F", "cterm": "167" }
|
||||
let s:darker_blue = { "gui": "#005F87", "cterm": "18" }
|
||||
let s:dark_blue = { "gui": "#008EC4", "cterm": "32" }
|
||||
let s:blue = { "gui": "#20BBFC", "cterm": "12" }
|
||||
let s:light_blue = { "gui": "#b6d6fd", "cterm": "153" }
|
||||
let s:dark_cyan = { "gui": "#20A5BA", "cterm": "6" }
|
||||
let s:light_cyan = { "gui": "#4FB8CC", "cterm": "14" }
|
||||
let s:dark_green = { "gui": "#10A778", "cterm": "2" }
|
||||
let s:light_green = { "gui": "#5FD7A7", "cterm": "10" }
|
||||
let s:light_purple = { "gui": "#a790d5", "cterm": "140" }
|
||||
let s:yellow = { "gui": "#F3E430", "cterm": "11" }
|
||||
let s:light_yellow = { "gui": "#ffff87", "cterm": "228" }
|
||||
let s:dark_yellow = { "gui": "#A89C14", "cterm": "3" }
|
||||
|
||||
let s:background = 'dark'
|
||||
|
||||
let s:bg = s:black
|
||||
let s:bg_subtle = s:lighter_black
|
||||
let s:bg_very_subtle = s:subtle_black
|
||||
let s:norm = s:lighter_gray
|
||||
let s:norm_subtle = s:medium_gray
|
||||
let s:pink = s:light_pink
|
||||
let s:cyan = s:light_cyan
|
||||
let s:green = s:light_green
|
||||
let s:red = s:light_red
|
||||
let s:visual = s:light_pink
|
||||
let s:yellow = s:light_yellow
|
||||
|
||||
" https://github.com/noahfrederick/vim-hemisu/
|
||||
function! s:h(group, style)
|
||||
execute "highlight" a:group
|
||||
\ "guifg=" (has_key(a:style, "fg") ? a:style.fg.gui : "NONE")
|
||||
\ "guibg=" (has_key(a:style, "bg") ? a:style.bg.gui : "NONE")
|
||||
\ "guisp=" (has_key(a:style, "sp") ? a:style.sp.gui : "NONE")
|
||||
\ "gui=" (has_key(a:style, "gui") ? a:style.gui : "NONE")
|
||||
\ "ctermfg=" (has_key(a:style, "fg") ? a:style.fg.cterm : "NONE")
|
||||
\ "ctermbg=" (has_key(a:style, "bg") ? a:style.bg.cterm : "NONE")
|
||||
\ "cterm=" (has_key(a:style, "cterm") ? a:style.cterm : "NONE")
|
||||
endfunction
|
||||
|
||||
call s:h("Normal", {"bg": s:bg, "fg": s:norm})
|
||||
|
||||
" restore &background's value in case changing Normal changed &background (:help :hi-normal-cterm)
|
||||
execute "set background=" . s:background
|
||||
|
||||
call s:h("Cursor", {"bg": s:pink, "fg": s:norm })
|
||||
call s:h("Comment", {"fg": s:bg_subtle, "gui": "italic"})
|
||||
|
||||
call s:h("Constant", {"fg": s:pink})
|
||||
hi! link Character Constant
|
||||
hi! link Number Constant
|
||||
hi! link Boolean Constant
|
||||
hi! link Float Constant
|
||||
hi! link String Constant
|
||||
|
||||
"call s:h("Identifier", {"fg": s:dark_blue})
|
||||
hi! link Identifier Normal
|
||||
hi! link Function Identifier
|
||||
|
||||
call s:h("Statement", {"fg": s:norm_subtle})
|
||||
hi! link Conditonal Statement
|
||||
hi! link Repeat Statement
|
||||
hi! link Label Statement
|
||||
hi! link Keyword Statement
|
||||
hi! link Exception Statement
|
||||
|
||||
call s:h("Operator", {"fg": s:norm, "cterm": "bold", "gui": "bold"})
|
||||
|
||||
call s:h("PreProc", {"fg": s:norm_subtle})
|
||||
hi! link Include PreProc
|
||||
hi! link Define PreProc
|
||||
hi! link Macro PreProc
|
||||
hi! link PreCondit PreProc
|
||||
|
||||
call s:h("Type", {"fg": s:norm})
|
||||
hi! link StorageClass Type
|
||||
hi! link Structure Type
|
||||
hi! link Typedef Type
|
||||
|
||||
call s:h("Special", {"fg": s:norm_subtle, "gui": "italic"})
|
||||
hi! link SpecialChar Special
|
||||
hi! link Tag Special
|
||||
hi! link Delimiter Special
|
||||
hi! link SpecialComment Special
|
||||
hi! link Debug Special
|
||||
|
||||
call s:h("Underlined", {"fg": s:norm, "gui": "underline", "cterm": "underline"})
|
||||
call s:h("Ignore", {"fg": s:bg})
|
||||
call s:h("Error", {"fg": s:actual_white, "bg": s:red, "cterm": "bold"})
|
||||
call s:h("Todo", {"fg": s:pink, "gui": "underline", "cterm": "underline"})
|
||||
call s:h("SpecialKey", {"fg": s:light_green})
|
||||
call s:h("NonText", {"fg": s:medium_gray})
|
||||
call s:h("Directory", {"fg": s:dark_blue})
|
||||
call s:h("ErrorMsg", {"fg": s:red})
|
||||
call s:h("IncSearch", {"bg": s:yellow, "fg": s:light_black})
|
||||
call s:h("Search", {"bg": s:light_green, "fg": s:light_black})
|
||||
call s:h("MoreMsg", {"fg": s:medium_gray, "cterm": "bold", "gui": "bold"})
|
||||
hi! link ModeMsg MoreMsg
|
||||
call s:h("LineNr", {"fg": s:bg_subtle})
|
||||
call s:h("CursorLineNr", {"fg": s:pink, "bg": s:bg_very_subtle})
|
||||
call s:h("Question", {"fg": s:red})
|
||||
call s:h("StatusLine", {"bg": s:bg_very_subtle})
|
||||
call s:h("StatusLineNC", {"bg": s:bg_very_subtle, "fg": s:medium_gray})
|
||||
call s:h("VertSplit", {"bg": s:bg_very_subtle, "fg": s:bg_very_subtle})
|
||||
call s:h("Title", {"fg": s:dark_blue})
|
||||
call s:h("Visual", {"fg": s:norm, "bg": s:visual})
|
||||
call s:h("VisualNOS", {"bg": s:bg_subtle})
|
||||
call s:h("WarningMsg", {"fg": s:yellow})
|
||||
call s:h("WildMenu", {"fg": s:bg, "bg": s:norm})
|
||||
call s:h("Folded", {"fg": s:medium_gray})
|
||||
call s:h("FoldColumn", {"fg": s:bg_subtle})
|
||||
call s:h("DiffAdd", {"fg": s:green})
|
||||
call s:h("DiffDelete", {"fg": s:red})
|
||||
call s:h("DiffChange", {"fg": s:dark_yellow})
|
||||
call s:h("DiffText", {"fg": s:dark_blue})
|
||||
call s:h("SignColumn", {"fg": s:light_green})
|
||||
|
||||
|
||||
if has("gui_running")
|
||||
call s:h("SpellBad", {"gui": "underline", "sp": s:red})
|
||||
call s:h("SpellCap", {"gui": "underline", "sp": s:light_green})
|
||||
call s:h("SpellRare", {"gui": "underline", "sp": s:light_purple})
|
||||
call s:h("SpellLocal", {"gui": "underline", "sp": s:dark_green})
|
||||
else
|
||||
call s:h("SpellBad", {"cterm": "underline", "fg": s:red})
|
||||
call s:h("SpellCap", {"cterm": "underline", "fg": s:light_green})
|
||||
call s:h("SpellRare", {"cterm": "underline", "fg": s:light_purple})
|
||||
call s:h("SpellLocal", {"cterm": "underline", "fg": s:dark_green})
|
||||
endif
|
||||
|
||||
call s:h("Pmenu", {"fg": s:norm, "bg": s:bg_very_subtle})
|
||||
call s:h("PmenuSel", {"fg": s:subtle_black, "bg": s:pink})
|
||||
call s:h("PmenuSbar", {"fg": s:norm, "bg": s:bg_subtle})
|
||||
call s:h("PmenuThumb", {"fg": s:norm, "bg": s:bg_subtle})
|
||||
call s:h("TabLine", {"fg": s:norm, "bg": s:bg_very_subtle})
|
||||
call s:h("TabLineSel", {"fg": s:subtle_black, "bg": s:pink, "gui": "bold", "cterm": "bold"})
|
||||
call s:h("TabLineFill", {"fg": s:norm, "bg": s:bg_very_subtle})
|
||||
call s:h("CursorColumn", {"bg": s:bg_very_subtle})
|
||||
call s:h("CursorLine", {"bg": s:bg_very_subtle})
|
||||
call s:h("ColorColumn", {"bg": s:bg_subtle})
|
||||
|
||||
call s:h("MatchParen", {"bg": s:bg_subtle, "fg": s:norm})
|
||||
call s:h("qfLineNr", {"fg": s:medium_gray})
|
||||
|
||||
call s:h("htmlH1", {"bg": s:bg, "fg": s:norm})
|
||||
call s:h("htmlH2", {"bg": s:bg, "fg": s:norm})
|
||||
call s:h("htmlH3", {"bg": s:bg, "fg": s:norm})
|
||||
call s:h("htmlH4", {"bg": s:bg, "fg": s:norm})
|
||||
call s:h("htmlH5", {"bg": s:bg, "fg": s:norm})
|
||||
call s:h("htmlH6", {"bg": s:bg, "fg": s:norm})
|
||||
|
||||
" Syntastic
|
||||
call s:h("SyntasticWarningSign", {"fg": s:yellow})
|
||||
call s:h("SyntasticWarning", {"bg": s:yellow, "fg": s:black, "gui": "bold", "cterm": "bold"})
|
||||
call s:h("SyntasticErrorSign", {"fg": s:red})
|
||||
call s:h("SyntasticError", {"bg": s:red, "fg": s:white, "gui": "bold", "cterm": "bold"})
|
||||
|
||||
" which-key.nvim
|
||||
call s:h("WhichKey", {"bg": s:bg, "fg": s:pink, "gui": "bold", "cterm": "bold"})
|
||||
call s:h("WhichKeyDesc", {"bg": s:bg, "fg": s:norm_subtle, "gui": "bold", "cterm": "bold"})
|
||||
call s:h("WhichKeySeparator", {"bg": s:bg, "fg": s:norm, "gui": "bold", "cterm": "bold"})
|
||||
call s:h("WhichKeyFloat", {"bg": s:bg})
|
||||
|
||||
hi link WhichKeyGroup WhichKey
|
||||
|
||||
" Neomake
|
||||
hi link NeomakeWarningSign SyntasticWarningSign
|
||||
hi link NeomakeErrorSign SyntasticErrorSign
|
||||
|
||||
" ALE
|
||||
hi link ALEWarningSign SyntasticWarningSign
|
||||
hi link ALEErrorSign SyntasticErrorSign
|
||||
|
||||
" Signify, git-gutter
|
||||
hi link SignifySignAdd LineNr
|
||||
hi link SignifySignDelete LineNr
|
||||
hi link SignifySignChange LineNr
|
||||
hi link GitGutterAdd LineNr
|
||||
hi link GitGutterDelete LineNr
|
||||
hi link GitGutterChange LineNr
|
||||
hi link GitGutterChangeDelete LineNr
|
||||
@@ -0,0 +1,214 @@
|
||||
" Name: sunbather.vim
|
||||
" Version: 0.1.0
|
||||
" Maintainer: github.com/nikolvs
|
||||
" License: The MIT License (MIT)
|
||||
"
|
||||
" A minimal pink colorscheme for Vim.
|
||||
"
|
||||
" Forked from paramount:
|
||||
" https://github.com/owickstrom/vim-colors-paramount
|
||||
"
|
||||
"""
|
||||
hi clear
|
||||
|
||||
if exists('syntax on')
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
let g:colors_name='sunbather_light'
|
||||
|
||||
let s:black = { "gui": "#000000", "cterm": "232" }
|
||||
let s:medium_gray = { "gui": "#767676", "cterm": "243" }
|
||||
let s:white = { "gui": "#F1F1F1", "cterm": "15" }
|
||||
let s:actual_white = { "gui": "#FFFFFF", "cterm": "231" }
|
||||
let s:subtle_black = { "gui": "#121212", "cterm": "233" }
|
||||
let s:light_black = { "gui": "#262626", "cterm": "235" }
|
||||
let s:lighter_black = { "gui": "#4E4E4E", "cterm": "239" }
|
||||
let s:light_gray = { "gui": "#A8A8A8", "cterm": "248" }
|
||||
let s:lighter_gray = { "gui": "#C6C6C6", "cterm": "251" }
|
||||
let s:lightest_gray = { "gui": "#EEEEEE", "cterm": "255" }
|
||||
let s:dark_pink = { "gui": "#ff5f87", "cterm": "204" }
|
||||
let s:light_pink = { "gui": "#d75f87", "cterm": "168" }
|
||||
let s:dark_red = { "gui": "#C30771", "cterm": "1" }
|
||||
let s:light_red = { "gui": "#E32791", "cterm": "1" }
|
||||
let s:orange = { "gui": "#D75F5F", "cterm": "167" }
|
||||
let s:darker_blue = { "gui": "#005F87", "cterm": "18" }
|
||||
let s:dark_blue = { "gui": "#008EC4", "cterm": "32" }
|
||||
let s:blue = { "gui": "#20BBFC", "cterm": "12" }
|
||||
let s:light_blue = { "gui": "#b6d6fd", "cterm": "153" }
|
||||
let s:dark_cyan = { "gui": "#20A5BA", "cterm": "6" }
|
||||
let s:light_cyan = { "gui": "#4FB8CC", "cterm": "14" }
|
||||
let s:dark_green = { "gui": "#10A778", "cterm": "2" }
|
||||
let s:light_green = { "gui": "#5FD7A7", "cterm": "10" }
|
||||
let s:light_purple = { "gui": "#a790d5", "cterm": "140" }
|
||||
let s:yellow = { "gui": "#F3E430", "cterm": "11" }
|
||||
let s:light_yellow = { "gui": "#ffff87", "cterm": "228" }
|
||||
let s:dark_yellow = { "gui": "#A89C14", "cterm": "3" }
|
||||
|
||||
let s:background = 'light'
|
||||
|
||||
let s:bg = s:actual_white
|
||||
let s:bg_subtle = s:light_gray
|
||||
let s:bg_very_subtle = s:lightest_gray
|
||||
let s:norm = s:light_black
|
||||
let s:norm_subtle = s:medium_gray
|
||||
let s:pink = s:dark_pink
|
||||
let s:cyan = s:dark_cyan
|
||||
let s:green = s:dark_green
|
||||
let s:red = s:dark_red
|
||||
let s:visual = s:dark_pink
|
||||
let s:yellow = s:dark_yellow
|
||||
|
||||
" https://github.com/noahfrederick/vim-hemisu/
|
||||
function! s:h(group, style)
|
||||
execute "highlight" a:group
|
||||
\ "guifg=" (has_key(a:style, "fg") ? a:style.fg.gui : "NONE")
|
||||
\ "guibg=" (has_key(a:style, "bg") ? a:style.bg.gui : "NONE")
|
||||
\ "guisp=" (has_key(a:style, "sp") ? a:style.sp.gui : "NONE")
|
||||
\ "gui=" (has_key(a:style, "gui") ? a:style.gui : "NONE")
|
||||
\ "ctermfg=" (has_key(a:style, "fg") ? a:style.fg.cterm : "NONE")
|
||||
\ "ctermbg=" (has_key(a:style, "bg") ? a:style.bg.cterm : "NONE")
|
||||
\ "cterm=" (has_key(a:style, "cterm") ? a:style.cterm : "NONE")
|
||||
endfunction
|
||||
|
||||
call s:h("Normal", {"bg": s:bg, "fg": s:norm})
|
||||
|
||||
" restore &background's value in case changing Normal changed &background (:help :hi-normal-cterm)
|
||||
execute "set background=" . s:background
|
||||
|
||||
call s:h("Cursor", {"bg": s:pink, "fg": s:norm })
|
||||
call s:h("Comment", {"fg": s:bg_subtle, "gui": "italic"})
|
||||
|
||||
call s:h("Constant", {"fg": s:pink})
|
||||
hi! link Character Constant
|
||||
hi! link Number Constant
|
||||
hi! link Boolean Constant
|
||||
hi! link Float Constant
|
||||
hi! link String Constant
|
||||
|
||||
"call s:h("Identifier", {"fg": s:dark_blue})
|
||||
hi! link Identifier Normal
|
||||
hi! link Function Identifier
|
||||
|
||||
call s:h("Statement", {"fg": s:norm_subtle})
|
||||
hi! link Conditonal Statement
|
||||
hi! link Repeat Statement
|
||||
hi! link Label Statement
|
||||
hi! link Keyword Statement
|
||||
hi! link Exception Statement
|
||||
|
||||
call s:h("Operator", {"fg": s:norm, "cterm": "bold", "gui": "bold"})
|
||||
|
||||
call s:h("PreProc", {"fg": s:norm_subtle})
|
||||
hi! link Include PreProc
|
||||
hi! link Define PreProc
|
||||
hi! link Macro PreProc
|
||||
hi! link PreCondit PreProc
|
||||
|
||||
call s:h("Type", {"fg": s:norm})
|
||||
hi! link StorageClass Type
|
||||
hi! link Structure Type
|
||||
hi! link Typedef Type
|
||||
|
||||
call s:h("Special", {"fg": s:norm_subtle, "gui": "italic"})
|
||||
hi! link SpecialChar Special
|
||||
hi! link Tag Special
|
||||
hi! link Delimiter Special
|
||||
hi! link SpecialComment Special
|
||||
hi! link Debug Special
|
||||
|
||||
call s:h("Underlined", {"fg": s:norm, "gui": "underline", "cterm": "underline"})
|
||||
call s:h("Ignore", {"fg": s:bg})
|
||||
call s:h("Error", {"fg": s:actual_white, "bg": s:red, "cterm": "bold"})
|
||||
call s:h("Todo", {"fg": s:pink, "gui": "underline", "cterm": "underline"})
|
||||
call s:h("SpecialKey", {"fg": s:light_green})
|
||||
call s:h("NonText", {"fg": s:medium_gray})
|
||||
call s:h("Directory", {"fg": s:dark_blue})
|
||||
call s:h("ErrorMsg", {"fg": s:red})
|
||||
call s:h("IncSearch", {"bg": s:yellow, "fg": s:light_black})
|
||||
call s:h("Search", {"bg": s:light_green, "fg": s:light_black})
|
||||
call s:h("MoreMsg", {"fg": s:medium_gray, "cterm": "bold", "gui": "bold"})
|
||||
hi! link ModeMsg MoreMsg
|
||||
call s:h("LineNr", {"fg": s:bg_subtle})
|
||||
call s:h("CursorLineNr", {"fg": s:pink, "bg": s:bg_very_subtle})
|
||||
call s:h("Question", {"fg": s:red})
|
||||
call s:h("StatusLine", {"bg": s:bg_very_subtle})
|
||||
call s:h("StatusLineNC", {"bg": s:bg_very_subtle, "fg": s:medium_gray})
|
||||
call s:h("VertSplit", {"bg": s:bg_very_subtle, "fg": s:bg_very_subtle})
|
||||
call s:h("Title", {"fg": s:dark_blue})
|
||||
call s:h("Visual", {"fg": s:norm, "bg": s:visual})
|
||||
call s:h("VisualNOS", {"bg": s:bg_subtle})
|
||||
call s:h("WarningMsg", {"fg": s:yellow})
|
||||
call s:h("WildMenu", {"fg": s:bg, "bg": s:norm})
|
||||
call s:h("Folded", {"fg": s:medium_gray})
|
||||
call s:h("FoldColumn", {"fg": s:bg_subtle})
|
||||
call s:h("DiffAdd", {"fg": s:green})
|
||||
call s:h("DiffDelete", {"fg": s:red})
|
||||
call s:h("DiffChange", {"fg": s:dark_yellow})
|
||||
call s:h("DiffText", {"fg": s:dark_blue})
|
||||
call s:h("SignColumn", {"fg": s:light_green})
|
||||
|
||||
|
||||
if has("gui_running")
|
||||
call s:h("SpellBad", {"gui": "underline", "sp": s:red})
|
||||
call s:h("SpellCap", {"gui": "underline", "sp": s:light_green})
|
||||
call s:h("SpellRare", {"gui": "underline", "sp": s:light_purple})
|
||||
call s:h("SpellLocal", {"gui": "underline", "sp": s:dark_green})
|
||||
else
|
||||
call s:h("SpellBad", {"cterm": "underline", "fg": s:red})
|
||||
call s:h("SpellCap", {"cterm": "underline", "fg": s:light_green})
|
||||
call s:h("SpellRare", {"cterm": "underline", "fg": s:light_purple})
|
||||
call s:h("SpellLocal", {"cterm": "underline", "fg": s:dark_green})
|
||||
endif
|
||||
|
||||
call s:h("Pmenu", {"fg": s:norm, "bg": s:bg_very_subtle})
|
||||
call s:h("PmenuSel", {"fg": s:subtle_black, "bg": s:pink})
|
||||
call s:h("PmenuSbar", {"fg": s:norm, "bg": s:bg_subtle})
|
||||
call s:h("PmenuThumb", {"fg": s:norm, "bg": s:bg_subtle})
|
||||
call s:h("TabLine", {"fg": s:norm, "bg": s:bg_very_subtle})
|
||||
call s:h("TabLineSel", {"fg": s:subtle_black, "bg": s:pink, "gui": "bold", "cterm": "bold"})
|
||||
call s:h("TabLineFill", {"fg": s:norm, "bg": s:bg_very_subtle})
|
||||
call s:h("CursorColumn", {"bg": s:bg_very_subtle})
|
||||
call s:h("CursorLine", {"bg": s:bg_very_subtle})
|
||||
call s:h("ColorColumn", {"bg": s:bg_subtle})
|
||||
|
||||
call s:h("MatchParen", {"bg": s:bg_subtle, "fg": s:norm})
|
||||
call s:h("qfLineNr", {"fg": s:medium_gray})
|
||||
|
||||
call s:h("htmlH1", {"bg": s:bg, "fg": s:norm})
|
||||
call s:h("htmlH2", {"bg": s:bg, "fg": s:norm})
|
||||
call s:h("htmlH3", {"bg": s:bg, "fg": s:norm})
|
||||
call s:h("htmlH4", {"bg": s:bg, "fg": s:norm})
|
||||
call s:h("htmlH5", {"bg": s:bg, "fg": s:norm})
|
||||
call s:h("htmlH6", {"bg": s:bg, "fg": s:norm})
|
||||
|
||||
" Syntastic
|
||||
call s:h("SyntasticWarningSign", {"fg": s:yellow})
|
||||
call s:h("SyntasticWarning", {"bg": s:yellow, "fg": s:black, "gui": "bold", "cterm": "bold"})
|
||||
call s:h("SyntasticErrorSign", {"fg": s:red})
|
||||
call s:h("SyntasticError", {"bg": s:red, "fg": s:white, "gui": "bold", "cterm": "bold"})
|
||||
|
||||
" which-key.nvim
|
||||
call s:h("WhichKey", {"bg": s:bg, "fg": s:pink, "gui": "bold", "cterm": "bold"})
|
||||
call s:h("WhichKeyDesc", {"bg": s:bg, "fg": s:norm_subtle, "gui": "bold", "cterm": "bold"})
|
||||
call s:h("WhichKeySeparator", {"bg": s:bg, "fg": s:norm, "gui": "bold", "cterm": "bold"})
|
||||
call s:h("WhichKeyFloat", {"bg": s:bg})
|
||||
|
||||
hi link WhichKeyGroup WhichKey
|
||||
|
||||
" Neomake
|
||||
hi link NeomakeWarningSign SyntasticWarningSign
|
||||
hi link NeomakeErrorSign SyntasticErrorSign
|
||||
|
||||
" ALE
|
||||
hi link ALEWarningSign SyntasticWarningSign
|
||||
hi link ALEErrorSign SyntasticErrorSign
|
||||
|
||||
" Signify, git-gutter
|
||||
hi link SignifySignAdd LineNr
|
||||
hi link SignifySignDelete LineNr
|
||||
hi link SignifySignChange LineNr
|
||||
hi link GitGutterAdd LineNr
|
||||
hi link GitGutterDelete LineNr
|
||||
hi link GitGutterChange LineNr
|
||||
hi link GitGutterChangeDelete LineNr
|
||||
@@ -0,0 +1,30 @@
|
||||
if has('gui') || exists('g:neovide')
|
||||
set guifont=Hack\ Nerd\ Font:h13
|
||||
|
||||
" neovide doesn't support copy from host, so we have to map it ourselves
|
||||
|
||||
if exists('g:neovide')
|
||||
|
||||
func! s:enabletp()
|
||||
let g:neovide_transparency=0.9
|
||||
endfunc
|
||||
func! s:disabletp()
|
||||
let g:neovide_transparency=1.0
|
||||
endfunc
|
||||
let g:Transparent_disable_func = function('s:disabletp')
|
||||
let g:Transparent_enable_func = function('s:enabletp')
|
||||
|
||||
let g:neovide_transparency=0.9
|
||||
" let g:neovide_transparency_point=0.8
|
||||
if g:os == 'Darwin'
|
||||
nnoremap <D-v> "+p
|
||||
cnoremap <D-v> <c-r>+
|
||||
inoremap <D-v> <c-r>+
|
||||
else
|
||||
nnoremap <C-v> "+p
|
||||
cnoremap <C-v> <c-r>+
|
||||
inoremap <C-v> <c-r>+
|
||||
endif
|
||||
endif
|
||||
|
||||
endif
|
||||
@@ -0,0 +1,276 @@
|
||||
-- The lua implementation of the fzy string matching algorithm
|
||||
|
||||
local SCORE_GAP_LEADING = -0.005
|
||||
local SCORE_GAP_TRAILING = -0.005
|
||||
local SCORE_GAP_INNER = -0.01
|
||||
local SCORE_MATCH_CONSECUTIVE = 1.0
|
||||
local SCORE_MATCH_SLASH = 0.9
|
||||
local SCORE_MATCH_WORD = 0.8
|
||||
local SCORE_MATCH_CAPITAL = 0.7
|
||||
local SCORE_MATCH_DOT = 0.6
|
||||
local SCORE_MAX = math.huge
|
||||
local SCORE_MIN = -math.huge
|
||||
local MATCH_MAX_LENGTH = 1024
|
||||
|
||||
local fzy = {}
|
||||
|
||||
-- Check if `needle` is a subsequence of the `haystack`.
|
||||
--
|
||||
-- Usually called before `score` or `positions`.
|
||||
--
|
||||
-- Args:
|
||||
-- needle (string)
|
||||
-- haystack (string)
|
||||
-- case_sensitive (bool, optional): defaults to false
|
||||
--
|
||||
-- Returns:
|
||||
-- bool
|
||||
function fzy.has_match(needle, haystack, case_sensitive)
|
||||
if not case_sensitive then
|
||||
needle = string.lower(needle)
|
||||
haystack = string.lower(haystack)
|
||||
end
|
||||
|
||||
local j = 1
|
||||
for i = 1, string.len(needle) do
|
||||
j = string.find(haystack, needle:sub(i, i), j, true)
|
||||
if not j then
|
||||
return false
|
||||
else
|
||||
j = j + 1
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local function is_lower(c)
|
||||
return c:match("%l")
|
||||
end
|
||||
|
||||
local function is_upper(c)
|
||||
return c:match("%u")
|
||||
end
|
||||
|
||||
local function precompute_bonus(haystack)
|
||||
local match_bonus = {}
|
||||
|
||||
local last_char = "/"
|
||||
for i = 1, string.len(haystack) do
|
||||
local this_char = haystack:sub(i, i)
|
||||
if last_char == "/" or last_char == "\\" then
|
||||
match_bonus[i] = SCORE_MATCH_SLASH
|
||||
elseif last_char == "-" or last_char == "_" or last_char == " " then
|
||||
match_bonus[i] = SCORE_MATCH_WORD
|
||||
elseif last_char == "." then
|
||||
match_bonus[i] = SCORE_MATCH_DOT
|
||||
elseif is_lower(last_char) and is_upper(this_char) then
|
||||
match_bonus[i] = SCORE_MATCH_CAPITAL
|
||||
else
|
||||
match_bonus[i] = 0
|
||||
end
|
||||
|
||||
last_char = this_char
|
||||
end
|
||||
|
||||
return match_bonus
|
||||
end
|
||||
|
||||
local function compute(needle, haystack, D, M, case_sensitive)
|
||||
-- Note that the match bonuses must be computed before the arguments are
|
||||
-- converted to lowercase, since there are bonuses for camelCase.
|
||||
local match_bonus = precompute_bonus(haystack)
|
||||
local n = string.len(needle)
|
||||
local m = string.len(haystack)
|
||||
|
||||
if not case_sensitive then
|
||||
needle = string.lower(needle)
|
||||
haystack = string.lower(haystack)
|
||||
end
|
||||
|
||||
-- Because lua only grants access to chars through substring extraction,
|
||||
-- get all the characters from the haystack once now, to reuse below.
|
||||
local haystack_chars = {}
|
||||
for i = 1, m do
|
||||
haystack_chars[i] = haystack:sub(i, i)
|
||||
end
|
||||
|
||||
for i = 1, n do
|
||||
D[i] = {}
|
||||
M[i] = {}
|
||||
|
||||
local prev_score = SCORE_MIN
|
||||
local gap_score = i == n and SCORE_GAP_TRAILING or SCORE_GAP_INNER
|
||||
local needle_char = needle:sub(i, i)
|
||||
|
||||
for j = 1, m do
|
||||
if needle_char == haystack_chars[j] then
|
||||
local score = SCORE_MIN
|
||||
if i == 1 then
|
||||
score = ((j - 1) * SCORE_GAP_LEADING) + match_bonus[j]
|
||||
elseif j > 1 then
|
||||
local a = M[i - 1][j - 1] + match_bonus[j]
|
||||
local b = D[i - 1][j - 1] + SCORE_MATCH_CONSECUTIVE
|
||||
score = math.max(a, b)
|
||||
end
|
||||
D[i][j] = score
|
||||
prev_score = math.max(score, prev_score + gap_score)
|
||||
M[i][j] = prev_score
|
||||
else
|
||||
D[i][j] = SCORE_MIN
|
||||
prev_score = prev_score + gap_score
|
||||
M[i][j] = prev_score
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Compute a matching score.
|
||||
--
|
||||
-- Args:
|
||||
-- needle (string): must be a subequence of `haystack`, or the result is
|
||||
-- undefined.
|
||||
-- haystack (string)
|
||||
-- case_sensitive (bool, optional): defaults to false
|
||||
--
|
||||
-- Returns:
|
||||
-- number: higher scores indicate better matches. See also `get_score_min`
|
||||
-- and `get_score_max`.
|
||||
function fzy.score(needle, haystack, case_sensitive)
|
||||
local n = string.len(needle)
|
||||
local m = string.len(haystack)
|
||||
|
||||
if n == 0 or m == 0 or m > MATCH_MAX_LENGTH or n > m then
|
||||
return SCORE_MIN
|
||||
elseif n == m then
|
||||
return SCORE_MAX
|
||||
else
|
||||
local D = {}
|
||||
local M = {}
|
||||
compute(needle, haystack, D, M, case_sensitive)
|
||||
return M[n][m]
|
||||
end
|
||||
end
|
||||
|
||||
-- Compute the locations where fzy matches a string.
|
||||
--
|
||||
-- Determine where each character of the `needle` is matched to the `haystack`
|
||||
-- in the optimal match.
|
||||
--
|
||||
-- Args:
|
||||
-- needle (string): must be a subequence of `haystack`, or the result is
|
||||
-- undefined.
|
||||
-- haystack (string)
|
||||
-- case_sensitive (bool, optional): defaults to false
|
||||
--
|
||||
-- Returns:
|
||||
-- {int,...}: indices, where `indices[n]` is the location of the `n`th
|
||||
-- character of `needle` in `haystack`.
|
||||
-- number: the same matching score returned by `score`
|
||||
function fzy.positions(needle, haystack, case_sensitive)
|
||||
local n = string.len(needle)
|
||||
local m = string.len(haystack)
|
||||
|
||||
if n == 0 or m == 0 or m > MATCH_MAX_LENGTH or n > m then
|
||||
return {}, SCORE_MIN
|
||||
elseif n == m then
|
||||
local consecutive = {}
|
||||
for i = 1, n do
|
||||
consecutive[i] = i
|
||||
end
|
||||
return consecutive, SCORE_MAX
|
||||
end
|
||||
|
||||
local D = {}
|
||||
local M = {}
|
||||
compute(needle, haystack, D, M, case_sensitive)
|
||||
|
||||
local positions = {}
|
||||
local match_required = false
|
||||
local j = m
|
||||
for i = n, 1, -1 do
|
||||
while j >= 1 do
|
||||
if D[i][j] ~= SCORE_MIN and (match_required or D[i][j] == M[i][j]) then
|
||||
match_required = (i ~= 1) and (j ~= 1) and (
|
||||
M[i][j] == D[i - 1][j - 1] + SCORE_MATCH_CONSECUTIVE)
|
||||
positions[i] = j
|
||||
j = j - 1
|
||||
break
|
||||
else
|
||||
j = j - 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return positions, M[n][m]
|
||||
end
|
||||
|
||||
-- Apply `has_match` and `positions` to an array of haystacks.
|
||||
--
|
||||
-- Args:
|
||||
-- needle (string)
|
||||
-- haystack ({string, ...})
|
||||
-- case_sensitive (bool, optional): defaults to false
|
||||
--
|
||||
-- Returns:
|
||||
-- {{idx, positions, score}, ...}: an array with one entry per matching line
|
||||
-- in `haystacks`, each entry giving the index of the line in `haystacks`
|
||||
-- as well as the equivalent to the return value of `positions` for that
|
||||
-- line.
|
||||
function fzy.filter(needle, haystacks, case_sensitive)
|
||||
local result = {}
|
||||
local idx = 1
|
||||
for line in haystacks() do
|
||||
if fzy.has_match(needle, line, case_sensitive) then
|
||||
local p, s = fzy.positions(needle, line, case_sensitive)
|
||||
table.insert(result, vim.list({idx, vim.list(p), s}))
|
||||
end
|
||||
idx = idx + 1
|
||||
end
|
||||
table.sort(result, function(a,b) return a[3] > b[3] end)
|
||||
return vim.list(result)
|
||||
end
|
||||
|
||||
-- The lowest value returned by `score`.
|
||||
--
|
||||
-- In two special cases:
|
||||
-- - an empty `needle`, or
|
||||
-- - a `needle` or `haystack` larger than than `get_max_length`,
|
||||
-- the `score` function will return this exact value, which can be used as a
|
||||
-- sentinel. This is the lowest possible score.
|
||||
function fzy.get_score_min()
|
||||
return SCORE_MIN
|
||||
end
|
||||
|
||||
-- The score returned for exact matches. This is the highest possible score.
|
||||
function fzy.get_score_max()
|
||||
return SCORE_MAX
|
||||
end
|
||||
|
||||
-- The maximum size for which `fzy` will evaluate scores.
|
||||
function fzy.get_max_length()
|
||||
return MATCH_MAX_LENGTH
|
||||
end
|
||||
|
||||
-- The minimum score returned for normal matches.
|
||||
--
|
||||
-- For matches that don't return `get_score_min`, their score will be greater
|
||||
-- than than this value.
|
||||
function fzy.get_score_floor()
|
||||
return MATCH_MAX_LENGTH * SCORE_GAP_INNER
|
||||
end
|
||||
|
||||
-- The maximum score for non-exact matches.
|
||||
--
|
||||
-- For matches that don't return `get_score_max`, their score will be less than
|
||||
-- this value.
|
||||
function fzy.get_score_ceiling()
|
||||
return MATCH_MAX_LENGTH * SCORE_MATCH_CONSECUTIVE
|
||||
end
|
||||
|
||||
-- The name of the currently-running implmenetation, "lua" or "native".
|
||||
function fzy.get_implementation_name()
|
||||
return "lua"
|
||||
end
|
||||
|
||||
return fzy
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
if HasPlug('github-nvim-theme') then
|
||||
require('aerial').setup({
|
||||
-- optionally use on_attach to set keymaps when aerial has attached to a buffer
|
||||
layout = {
|
||||
width = 50,
|
||||
default_direction = "right",
|
||||
preserve_equality = true,
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
-- Jump forwards/backwards with '{' and '}'
|
||||
vim.keymap.set('n', '{', '<cmd>AerialPrev<CR>', { buffer = bufnr })
|
||||
vim.keymap.set('n', '}', '<cmd>AerialNext<CR>', { buffer = bufnr })
|
||||
end
|
||||
})
|
||||
-- You probably also want to set a keymap to toggle aerial
|
||||
vim.keymap.set('n', '<leader>v', '<cmd>AerialToggle!<CR>')
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
if HasPlug('github-nvim-theme') then
|
||||
-- Example config in Lua
|
||||
require("github-theme").setup({
|
||||
-- Overwrite the highlight groups
|
||||
overrides = function(c)
|
||||
return {
|
||||
NormalFloat = { link = 'Pmenu' },
|
||||
}
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
if HasPlug('gitsigns.nvim') then
|
||||
require('gitsigns').setup({
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then return ']c' end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then return '[c' end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true })
|
||||
|
||||
-- Actions
|
||||
map({ 'n', 'v' }, '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||
map({ 'n', 'v' }, '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||
map('n', '<leader>hS', gs.stage_buffer)
|
||||
map('n', '<leader>hu', gs.undo_stage_hunk)
|
||||
map('n', '<leader>hR', gs.reset_buffer)
|
||||
map('n', '<leader>hp', gs.preview_hunk)
|
||||
map('n', '<leader>hb', function() gs.blame_line { full = true } end)
|
||||
map('n', '<leader>tb', gs.toggle_current_line_blame)
|
||||
map('n', '<leader>hd', gs.diffthis)
|
||||
map('n', '<leader>hD', function() gs.diffthis('~') end)
|
||||
map('n', '<leader>td', gs.toggle_deleted)
|
||||
|
||||
-- Text object
|
||||
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
end
|
||||
})
|
||||
vim.fn['theme#addCleanBg']({ 'GitSignsAdd', 'GitSignsStagedChange',
|
||||
'GitSignsStagedDelete', 'GitSignsDelete', 'GitSignsChange',
|
||||
'GitGutterAdd', 'GitGutterChange', 'GitGutterDelete', 'GitGutterChangeDelete',
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
if HasPlug('impatient.nvim') then
|
||||
require('impatient')
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
if not Animation_enable then
|
||||
if HasPlug('indent-blankline.nvim') then
|
||||
-- Example config in Lua
|
||||
require("indent_blankline").setup {
|
||||
show_current_context = true,
|
||||
use_treesitter = true,
|
||||
filetype_exclude = { "lspinfo", "packer", "checkhealth",
|
||||
"help", "man", "", "startify", }
|
||||
-- use_treesitter = true,
|
||||
}
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,60 @@
|
||||
-------------------OPTIONS-----------------------
|
||||
|
||||
-- enable animation of command like "<C-u>" and "<C-d>", or cursor
|
||||
-- jump animation. (Performence will be effected)
|
||||
Animation_enable = vim.g.animation_enable
|
||||
High_performence = vim.g.high_performence
|
||||
|
||||
-- false basicly enable plugins like noice, nvim-notify etc.
|
||||
Classic_vim_ui = vim.g.classic_vim_ui
|
||||
|
||||
|
||||
------------------VIM OPTIONS-----------------------
|
||||
|
||||
vim.o.signcolumn = 'auto:2'
|
||||
|
||||
------------------UTILITIES----------------------
|
||||
|
||||
Vim_version = vim.version()
|
||||
Vim_version_minor = Vim_version['minor']
|
||||
|
||||
function HasPlug(name)
|
||||
return vim.fn['utils#hasplug'](name)
|
||||
end
|
||||
|
||||
-- use to print object
|
||||
function _G.put(...)
|
||||
local objects = {}
|
||||
for i = 1, select('#', ...) do
|
||||
local v = select(i, ...)
|
||||
table.insert(objects, vim.inspect(v))
|
||||
end
|
||||
|
||||
print(table.concat(objects, '\n'))
|
||||
return ...
|
||||
end
|
||||
|
||||
Which_key = nil
|
||||
function Wk_register(opt)
|
||||
if Which_key == nil then
|
||||
return
|
||||
end
|
||||
Which_key.register(opt)
|
||||
end
|
||||
|
||||
Show_icon = false
|
||||
if HasPlug('nvim-web-devicons') then
|
||||
Show_icon = true
|
||||
end
|
||||
|
||||
|
||||
----------------CONFIGURATION--------------------
|
||||
|
||||
local plugin_setting_paths = vim.fn.split(vim.fn.glob(vim.g.dotvimdir
|
||||
.. "/lua/lua-plugin-settings/*config.lua"), '\n')
|
||||
local plugin_settings = vim.fn.map(plugin_setting_paths, 'fnamemodify(v:val, ":t:r")')
|
||||
|
||||
for _idx, name in pairs(plugin_settings) do
|
||||
require('lua-plugin-settings.'..name)
|
||||
end
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
if HasPlug('iron.nvim') then
|
||||
local iron = require("iron.core")
|
||||
|
||||
iron.setup {
|
||||
config = {
|
||||
-- Whether a repl should be discarded or not
|
||||
scratch_repl = true,
|
||||
-- Your repl definitions come here
|
||||
repl_definition = {
|
||||
sh = {
|
||||
-- Can be a table or a function that
|
||||
-- returns a table (see below)
|
||||
command = { "zsh" }
|
||||
}
|
||||
},
|
||||
-- How the repl window will be displayed
|
||||
-- See below for more information
|
||||
repl_open_cmd = require('iron.view').bottom(40),
|
||||
},
|
||||
-- Iron doesn't set keymaps by default anymore.
|
||||
-- You can set them here or manually add keymaps to the functions in iron.core
|
||||
keymaps = {
|
||||
send_motion = "<space>sc",
|
||||
visual_send = "<space>sc",
|
||||
send_file = "<space>sf",
|
||||
send_line = "<space>sl",
|
||||
send_mark = "<space>sm",
|
||||
mark_motion = "<space>mc",
|
||||
mark_visual = "<space>mc",
|
||||
remove_mark = "<space>md",
|
||||
cr = "<space>s<cr>",
|
||||
interrupt = "<space>s<space>",
|
||||
exit = "<space>sq",
|
||||
clear = "<space>cl",
|
||||
},
|
||||
-- If the highlight is on, you can change how it looks
|
||||
-- For the available options, check nvim_set_hl
|
||||
highlight = {
|
||||
italic = true
|
||||
},
|
||||
ignore_blank_lines = true, -- ignore blank lines when sending visual select lines
|
||||
}
|
||||
|
||||
-- iron also has a list of commands, see :h iron-commands for all available commands
|
||||
vim.keymap.set('n', '<space>rs', '<cmd>IronRepl<cr>')
|
||||
vim.keymap.set('n', '<space>rr', '<cmd>IronRestart<cr>')
|
||||
vim.keymap.set('n', '<space>rf', '<cmd>IronFocus<cr>')
|
||||
vim.keymap.set('n', '<space>rh', '<cmd>IronHide<cr>')
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
if HasPlug('leap.nvim') then
|
||||
require('leap').add_default_mappings()
|
||||
end
|
||||
@@ -0,0 +1,108 @@
|
||||
|
||||
if HasPlug('lualine.nvim') then
|
||||
|
||||
-- custom lualine plugin show coc lsp status
|
||||
local function cocstatus()
|
||||
local loading = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" }
|
||||
local step = #loading
|
||||
local ok, result = pcall(vim.fn.CocAction, 'services')
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
local ft = vim.bo.filetype
|
||||
local state, id
|
||||
for _, entry in ipairs(result) do
|
||||
if entry['languageIds'][1] == ft then
|
||||
state = entry['state']
|
||||
id = entry['id']
|
||||
break
|
||||
end
|
||||
end
|
||||
local speed = 1600
|
||||
local loadidx = (vim.loop.now() % speed)
|
||||
local msg = id
|
||||
if state == "starting" then
|
||||
return msg .. " " .. loading[math.floor(loadidx / (step * (speed / 100))) + 1]
|
||||
elseif state == "running" then
|
||||
return msg
|
||||
end
|
||||
return ''
|
||||
end
|
||||
|
||||
local _section_x = {}
|
||||
local _section_y = {}
|
||||
-- if HasPlug('coc.nvim') then table.insert(_section_x, cocstatus) end
|
||||
table.insert(_section_x, cocstatus)
|
||||
local disabled_filetypes_data = {}
|
||||
if Vim_version_minor < 7 then
|
||||
-- globalstatus only work for nvim >= 0.7
|
||||
disabled_filetypes_data = { -- Filetypes to disable lualine for.
|
||||
statusline = {}, -- only ignores the ft for statusline.
|
||||
winbar = {}, -- only ignores the ft for winbar.
|
||||
'NvimTree',
|
||||
'vista',
|
||||
}
|
||||
end
|
||||
|
||||
local opt = {
|
||||
options = {
|
||||
icons_enabled = Show_icon,
|
||||
theme = 'auto', -- lualine theme
|
||||
-- component_separators = { left = '', right = ''},
|
||||
-- section_separators = { left = '', right = ''},
|
||||
component_separators = { left = '', right = '' },
|
||||
section_separators = { left = '', right = '' },
|
||||
always_divide_middle = false,
|
||||
globalstatus = true,
|
||||
disabled_filetypes = disabled_filetypes_data,
|
||||
refresh = { statusline = 200 }
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = {},
|
||||
lualine_c = {
|
||||
{
|
||||
'buffers',
|
||||
mode = 2,
|
||||
max_length = function()
|
||||
return vim.o.columns - 30
|
||||
end,
|
||||
filetype_names = {
|
||||
TelescopePrompt = 'Telescope',
|
||||
dashboard = 'Dashboard',
|
||||
packer = 'Packer',
|
||||
fzf = 'FZF',
|
||||
alpha = 'Alpha',
|
||||
NvimTree = 'NvimTree',
|
||||
vista = 'Vista',
|
||||
},
|
||||
symbols = {
|
||||
alternate_file = '',
|
||||
},
|
||||
}
|
||||
},
|
||||
-- lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_x = _section_x,
|
||||
lualine_y = _section_y,
|
||||
lualine_z = { 'location' }
|
||||
},
|
||||
}
|
||||
|
||||
require('lualine').setup(opt)
|
||||
|
||||
vim.fn['theme#addTransGroup']({'lualine_c_inactive', 'lualine_c_normal'})
|
||||
|
||||
vim.o.fillchars ='eob: ,vert:│,stl: ,stlnc: ,'
|
||||
|
||||
for i = 1, 9 do
|
||||
-- :nnoremap <silent> <Leader>1 :LualineBuffersJump 1<CR>
|
||||
vim.api.nvim_set_keymap('n', '<Leader>' .. i, ':LualineBuffersJump ' .. i .. '<CR>',
|
||||
{ noremap = true, silent = true, nowait = true })
|
||||
end
|
||||
for i = 10, 20 do
|
||||
-- :nnoremap <silent> <Leader>1 :LualineBuffersJump 1<CR>
|
||||
vim.api.nvim_set_keymap('n', '<Space>' .. i, ':LualineBuffersJump ' .. i .. '<CR>',
|
||||
{ noremap = true, silent = true, nowait = true })
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
if HasPlug('mini.animate') and Animation_enable then
|
||||
local animate = require('mini.animate')
|
||||
animate.setup({
|
||||
cursor = {
|
||||
-- Whether to enable this animation
|
||||
enable = true,
|
||||
-- Timing of animation (how steps will progress in time)
|
||||
-- timing = --<function: implements linear total 250ms animation duration>,
|
||||
},
|
||||
scroll = {
|
||||
-- Whether to enable this animation
|
||||
enable = true,
|
||||
-- Timing of animation (how steps will progress in time)
|
||||
timing = animate.gen_timing.linear({ duration = 150, unit = 'total' }),
|
||||
},
|
||||
open = {
|
||||
-- Whether to enable this animation
|
||||
enable = false,
|
||||
},
|
||||
})
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy", "mason",
|
||||
"NvimTree", "vista", "toggleterm", "noice" },
|
||||
callback = function()
|
||||
vim.b.minianimate_disable = true
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
if HasPlug('mini.colors') then
|
||||
require('mini.colors').setup()
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
if HasPlug('mini.indentscope') then
|
||||
MiniIndentscope = require('mini.indentscope')
|
||||
MiniIndentscope.setup({
|
||||
symbol = '│',
|
||||
-- draw = {
|
||||
-- animation = MiniIndentscope.gen_animation.linear({
|
||||
-- easing = 'out',
|
||||
-- duration = 150,
|
||||
-- unit = 'total'
|
||||
-- })
|
||||
-- },
|
||||
})
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy", "mason",
|
||||
"NvimTree", "vista", "startify", "toggleterm" },
|
||||
callback = function()
|
||||
vim.b.miniindentscope_disable = true
|
||||
end,
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,47 @@
|
||||
if not Classic_vim_ui
|
||||
and HasPlug('noice.nvim')
|
||||
and HasPlug('nvim-notify')
|
||||
and HasPlug('nui.nvim') then
|
||||
|
||||
require("noice").setup({
|
||||
lsp = {
|
||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
bottom_search = true, -- use a classic bottom cmdline for search
|
||||
-- command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
cmdline = {
|
||||
enabled = true, -- enables the Noice cmdline UI
|
||||
view = "cmdline", -- view for rendering the cmdline. Change to `cmdline` to get a classic cmdline at the bottom
|
||||
opts = {}, -- global options for the cmdline. See section on views
|
||||
format = {
|
||||
-- cmdline = false,
|
||||
search_down = false,
|
||||
search_up = false,
|
||||
help = { pattern = '', icon = '' },
|
||||
},
|
||||
},
|
||||
messages = {
|
||||
-- NOTE: If you enable messages, then the cmdline is enabled automatically.
|
||||
-- This is a current Neovim limitation.
|
||||
enabled = true, -- enables the Noice messages UI
|
||||
view = "notify", -- default view for messages
|
||||
view_error = "notify", -- view for errors
|
||||
view_warn = "notify", -- view for warnings
|
||||
view_history = "messages", -- view for :messages
|
||||
view_search = false, -- view for search count messages. Set to `false` to disable
|
||||
},
|
||||
})
|
||||
|
||||
vim.fn['theme#addTransGroup']({'NotifyERRORBody', 'NotifyWARNBody', 'NotifyINFOBody', 'NotifyDEBUGBody', 'NotifyTRACEBody',
|
||||
'NotifyERRORBorder', 'NotifyWARNBorder', 'NotifyINFOBorder', 'NotifyDEBUGBorder', 'NotifyTRACEBorder'})
|
||||
end
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
if HasPlug('nvim-scrollbar') then
|
||||
require("scrollbar").setup({
|
||||
excluded_filetypes = {
|
||||
"prompt",
|
||||
"TelescopePrompt",
|
||||
"noice",
|
||||
"startify",
|
||||
"vista",
|
||||
},
|
||||
excluded_buftypes = {
|
||||
"terminal",
|
||||
"nofile",
|
||||
"help",
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,68 @@
|
||||
|
||||
if HasPlug('nvim-tree.lua') then
|
||||
|
||||
local api = require('nvim-tree.api')
|
||||
local M = {}
|
||||
|
||||
function M.print_node_path()
|
||||
local node = api.tree.get_node_under_cursor()
|
||||
print(node.absolute_path)
|
||||
end
|
||||
|
||||
function M.on_attach(bufnr)
|
||||
local function opts(desc)
|
||||
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||
end
|
||||
-- vim.keymap.set('n', 'u', api.node.navigate.parent, opts('Parent Directory'))
|
||||
vim.keymap.set('n', 'u', api.tree.change_root_to_parent, opts('Up'))
|
||||
vim.keymap.set('n', 'a', api.fs.create, opts('Create'))
|
||||
vim.keymap.set('n', 'dd', api.fs.remove, opts('Delete'))
|
||||
vim.keymap.set('n', 'rn', api.fs.rename_basename, opts('Rename: Basename'))
|
||||
vim.keymap.set('n', 'I', api.tree.toggle_gitignore_filter, opts('Toggle Git Ignore'))
|
||||
vim.keymap.set('n', 'cd', api.tree.change_root_to_node, opts('CD'))
|
||||
vim.keymap.set('n', 'X', api.tree.collapse_all, opts('Collapse'))
|
||||
vim.keymap.set('n', 'O', api.tree.expand_all, opts('Expand All'))
|
||||
vim.keymap.set('n', 'p', M.print_node_path, opts('Print node path'))
|
||||
vim.keymap.set('n', 'o', api.node.open.edit, opts('Open'))
|
||||
vim.keymap.set('n', '<CR>', api.node.open.edit, opts('Open'))
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<Leader>e', ':NvimTreeFindFileToggle<CR>',
|
||||
{ desc = 'Toggle nvim-tree', noremap = true, silent = true, nowait = true })
|
||||
|
||||
require("nvim-tree").setup({
|
||||
sync_root_with_cwd = true,
|
||||
respect_buf_cwd = true,
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_root = true,
|
||||
},
|
||||
sort_by = "case_sensitive",
|
||||
on_attach = M.on_attach,
|
||||
view = {
|
||||
width = 30,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
},
|
||||
git = {
|
||||
ignore = false,
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
quit_on_open = true,
|
||||
resize_window = true,
|
||||
window_picker = {
|
||||
exclude = {
|
||||
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame", "vista" },
|
||||
buftype = { "nofile", "terminal", "help" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.fn['theme#addTransGroup']({'NvimTreeWinSeparator', 'NvimTreeNormal', 'NvimTreeNormalNC'})
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
if HasPlug('nvim-treesitter') then
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = { "c", "bash", "lua", "python", "vim" },
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
vim.o.foldmethod = 'expr'
|
||||
vim.o.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||
end
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
if HasPlug('project.nvim') then
|
||||
require("project_nvim").setup {
|
||||
detection_methods = { "lsp", "pattern" },
|
||||
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json", "src" },
|
||||
|
||||
-- Don't calculate root dir on specific directories
|
||||
-- Ex: { "~/.cargo/*", ... }
|
||||
exclude_dirs = {},
|
||||
-- Show hidden files in telescope
|
||||
show_hidden = false,
|
||||
-- When set to false, you will get a message when project.nvim changes your
|
||||
-- directory.
|
||||
silent_chdir = false,
|
||||
-- Path where project.nvim will store the project history for use in
|
||||
-- telescope
|
||||
datapath = vim.g.vim_dir .. "/.vimproject/"
|
||||
}
|
||||
|
||||
-- if HasPlug('telescope.nvim') then
|
||||
-- require('telescope').load_extension('projects')
|
||||
-- vim.keymap.set('n', '<leader>fp', require'telescope'.extensions.projects.projects,
|
||||
-- { desc = "Lists projects" })
|
||||
-- end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,113 @@
|
||||
if HasPlug('telescope.nvim') then
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require "telescope.actions.state"
|
||||
local telescope = require("telescope")
|
||||
local builtin = require('telescope.builtin')
|
||||
local telescopeConfig = require("telescope.config")
|
||||
local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }
|
||||
table.insert(vimgrep_arguments, "--hidden")
|
||||
|
||||
require('telescope.pickers.layout_strategies').horizontal_merged = function(picker, max_columns, max_lines,
|
||||
layout_config)
|
||||
local layout = require('telescope.pickers.layout_strategies').horizontal(picker, max_columns, max_lines,
|
||||
layout_config)
|
||||
layout.prompt.title = ''
|
||||
layout.results.title = ''
|
||||
layout.preview.title = ''
|
||||
-- layout.prompt.borderchars = { '─', '│', '─', '│', '┌', '┐', '┘', '└' }
|
||||
return layout
|
||||
end
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
hidden = true,
|
||||
vimgrep_arguments = vimgrep_arguments,
|
||||
file_ignore_patterns = {"node_modules/", ".git/"},
|
||||
layout_config = {
|
||||
-- prompt_position = "top",
|
||||
},
|
||||
layout_strategy = "horizontal_merged",
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true,
|
||||
},
|
||||
colorscheme = {
|
||||
enable_preview = true,
|
||||
mappings = {
|
||||
i = {
|
||||
["<CR>"] = function(bufnr)
|
||||
local selection = action_state.get_selected_entry()
|
||||
actions.select_default()
|
||||
local bg = vim.o.background
|
||||
vim.fn['theme#setColor'](bg, selection.value)
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
}
|
||||
}
|
||||
}
|
||||
if HasPlug('telescope-fzf-native.nvim') then
|
||||
telescope.load_extension('fzf')
|
||||
end
|
||||
|
||||
vim.fn['theme#addCleanBg']({ 'TelescopeNormal', 'TelescopeBorder', 'TelescopePromptNormal',
|
||||
'TelescopePromptBorder', 'TelescopePromptPrefix', 'TelescopeResultsTitle', 'TelescopePreviewTitle',
|
||||
'TelescopePromptTitle', 'TelescopePromptCounter' })
|
||||
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = "Search files inside cwd" })
|
||||
-- need to install ripgrep
|
||||
vim.keymap.set('n', '<leader>fr', builtin.live_grep, { desc = "Regex search inside files" })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = "Search buffers" })
|
||||
vim.keymap.set('n', '<leader>fc', builtin.colorscheme, { desc = "Search colorscheme" })
|
||||
vim.keymap.set('n', '<leader>fs', builtin.treesitter, { desc = "Lists Function names, variables, from Treesitter!" })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.highlights, { desc = "Lists highlight" })
|
||||
vim.keymap.set('n', '<leader>fd', builtin.help_tags, { desc = "Lists highlight" })
|
||||
|
||||
Wk_register({ ["<leader>f"] = { name = "+Telescope" } })
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "TelescopePreviewerLoaded",
|
||||
command = "setlocal wrap number"
|
||||
})
|
||||
|
||||
-- options picker
|
||||
local pickers = require "telescope.pickers"
|
||||
local finders = require "telescope.finders"
|
||||
local conf = require("telescope.config").values
|
||||
|
||||
function _G.telescope_option_picker()
|
||||
local opts = require("telescope.themes").get_dropdown {}
|
||||
pickers.new(opts, {
|
||||
prompt_title = "Options",
|
||||
finder = finders.new_table {
|
||||
results = vim.fn['options#getAll'](),
|
||||
entry_maker = function(entry)
|
||||
return {
|
||||
value = entry,
|
||||
display = entry[2],
|
||||
ordinal = entry[2],
|
||||
}
|
||||
end
|
||||
},
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(prompt_bufnr, map)
|
||||
actions.select_default:replace(function()
|
||||
actions.close(prompt_bufnr)
|
||||
local selection = action_state.get_selected_entry()
|
||||
vim.fn['options#toggle'](selection['value'][1])
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
}):find()
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<leader>fo', telescope_option_picker, { desc = "Lists Function names, variables, from Treesitter!" })
|
||||
end
|
||||
@@ -0,0 +1,65 @@
|
||||
|
||||
if HasPlug('toggleterm.nvim') then
|
||||
require("toggleterm").setup({
|
||||
|
||||
open_mapping = [[<c-\>]],
|
||||
direction = 'float',
|
||||
float_opts = {
|
||||
border = 'rounded',
|
||||
width = function(term) return math.floor(vim.o.columns * 0.5) end,
|
||||
height = function(term) return math.floor(vim.o.lines * 0.5) end,
|
||||
winblend = 20,
|
||||
row = vim.o.lines * 0.5 - 3,
|
||||
col = vim.o.columns * 0.5,
|
||||
},
|
||||
})
|
||||
function _G.set_terminal_keymaps()
|
||||
local opts = { buffer = 0 }
|
||||
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
|
||||
vim.keymap.set('t', 'jk', [[<C-\><C-n>]], opts)
|
||||
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts)
|
||||
end
|
||||
|
||||
-- vim.cmd('autocmd TermOpen term://* lua set_terminal_keymaps()')
|
||||
vim.cmd('autocmd FileType toggleterm lua set_terminal_keymaps()')
|
||||
|
||||
local Terminal = require('toggleterm.terminal').Terminal
|
||||
|
||||
local ipythonId = 779
|
||||
local ipython = Terminal:new({
|
||||
size = function(term)
|
||||
if term.direction == "horizontal" then
|
||||
return 15 elseif term.direction == "vertical" then
|
||||
return vim.o.columns * 0.4
|
||||
end
|
||||
end,
|
||||
cmd = "ipython",
|
||||
hidden = true,
|
||||
direction = "vertical",
|
||||
close_on_exit = false,
|
||||
auto_scroll = true,
|
||||
id = ipythonId,
|
||||
})
|
||||
|
||||
function _ipython_toggle()
|
||||
local currentWindow=vim.fn.winnr()
|
||||
ipython:toggle(vim.o.columns * 0.5, 'vertical')
|
||||
vim.cmd(currentWindow .. "wincmd w")
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<leader>tp", "<cmd>lua _ipython_toggle()<CR>", { noremap = true, silent = true })
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<leader>tl", string.format("<cmd>ToggleTermSendCurrentLine %d<CR>", ipythonId),
|
||||
{ noremap = true, silent = true })
|
||||
-- sends all the (whole) lines in your visual selection
|
||||
vim.api.nvim_set_keymap("v", "<leader>tl", string.format(":ToggleTermSendVisualLines %d<CR>", ipythonId),
|
||||
{ noremap = true, silent = true })
|
||||
-- sends only the visually selected text (this can be a block of text
|
||||
vim.api.nvim_set_keymap("x", "<leader>tl", string.format(":ToggleTermSendVisualSelection %d<CR>", ipythonId),
|
||||
{ noremap = true, silent = true })
|
||||
|
||||
end
|
||||
@@ -0,0 +1,30 @@
|
||||
if HasPlug('vim-illuminate') then
|
||||
local illuminate = require('illuminate')
|
||||
illuminate.configure({
|
||||
providers = {
|
||||
'lsp',
|
||||
'treesitter',
|
||||
'regex',
|
||||
},
|
||||
delay = 0,
|
||||
filetype_overrides = {},
|
||||
filetypes_denylist = {
|
||||
'dirvish',
|
||||
'fugitive',
|
||||
'NvimTree',
|
||||
'help',
|
||||
'vista',
|
||||
'aerial',
|
||||
},
|
||||
filetypes_allowlist = {},
|
||||
modes_denylist = {},
|
||||
modes_allowlist = {},
|
||||
providers_regex_syntax_denylist = {},
|
||||
providers_regex_syntax_allowlist = {},
|
||||
under_cursor = true,
|
||||
large_file_cutoff = nil,
|
||||
large_file_overrides = nil,
|
||||
min_count_to_highlight = 1,
|
||||
})
|
||||
end
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
if HasPlug('vim-illuminate') then
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
matchup = {
|
||||
enable = true,
|
||||
disable = { },
|
||||
},
|
||||
}
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
if HasPlug('which-key.nvim') then
|
||||
Which_key = require("which-key")
|
||||
Which_key.setup({
|
||||
triggers_blacklist = {
|
||||
i = { "j", "k" },
|
||||
v = { "j", "k" },
|
||||
c = { "w" },
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
if exists("g:loaded_vim_config")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_vim_config = 1
|
||||
|
||||
let os = os#getOS()
|
||||
|
||||
if os == 'Windows'
|
||||
call os#setWindows()
|
||||
endif
|
||||
|
||||
call options#init()
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
if utils#hasplug('Copilot.vim')
|
||||
" imap <expr> <C-n> <Plug>(copilot-next)
|
||||
" imap <expr> <C-p> <Plug>(copilot-prev)
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
if utils#hasplug('coc-fzf')
|
||||
|
||||
let g:coc_fzf_preview = 'right:50%'
|
||||
nnoremap <silent> <leader>fs :CocFzfList outline<CR>
|
||||
let s:preview_exe = expand(g:dotvimdir.'/bin/preview.py')
|
||||
let g:coc_fzf_opts = ['--border-label', 'Coc Outlines', '--border-label-pos', '9', '--no-scrollbar', '--no-hscroll', '--no-separator']
|
||||
endif
|
||||
@@ -1,6 +1,13 @@
|
||||
if utils#hasplug('coc.nvim')
|
||||
" let g:coc_global_extensions = ['coc-pyright', 'coc-tsserver', 'coc-vimlsp',
|
||||
" \ 'coc-marksman']
|
||||
|
||||
" let g:coc_global_extensions = ['coc-pyright', 'coc-rls', 'coc-clangd', 'coc-tsserver', 'coc-html', 'coc-cmake', 'coc-json', 'coc-sh', 'coc-java']
|
||||
" let g:coc_global_extensions = ['coc-pyright', 'coc-tsserver']
|
||||
" for tabline info
|
||||
" coc-sumneko-lua offers autocomplete for neovim lua api
|
||||
let g:coc_global_extensions = ['coc-nav', 'coc-sumneko-lua']
|
||||
|
||||
" warning that coc work best for vim >= 8.3
|
||||
let g:coc_disable_startup_warning = 1
|
||||
|
||||
let g:coc_data_home = g:vim_dir . '/coc'
|
||||
let g:coc_config_home = g:vim_dir . '/coc'
|
||||
@@ -88,15 +95,90 @@ let g:coc_user_config = {
|
||||
\ 'suggest.noselect': v:true,
|
||||
\ 'suggest.enablePreselect': v:false, }
|
||||
|
||||
call coc#config("java.jdt.ls.vmargs", '-javaagent:' . g:mydotfiles_directory . '/config/coc/java/lombok-1.18.26.jar')
|
||||
call coc#config("java.jdt.ls.vmargs", '-javaagent:' . g:dotfiledir . '/config/coc/java/lombok-1.18.26.jar')
|
||||
call coc#config("java.jdt.ls.lombokSupport.enabled", v:false)
|
||||
call coc#config("java.inlayHints.parameterNames.enabled", v:false)
|
||||
call coc#config("inlayHint.enable", v:false)
|
||||
|
||||
if has('nvim')
|
||||
" nvim has tree-sitter
|
||||
call coc#config("semanticTokens.enable", v:false)
|
||||
else
|
||||
call coc#config("semanticTokens.enable", v:true)
|
||||
endif
|
||||
|
||||
call coc#config("sumneko-lua.enableNvimLuaDev", v:true)
|
||||
|
||||
for section in ['suggest', 'diagnostic', 'signature', 'hover']
|
||||
call coc#config(section.'.floatConfig.border', v:true)
|
||||
call coc#config(section.'.floatConfig.rounded', v:true)
|
||||
call coc#config(section.'.floatConfig.highlight', 'Normal')
|
||||
|
||||
" transparent setting (only for neovim)
|
||||
call coc#config(section.'.floatConfig.winblend', 6)
|
||||
" call coc#config(section.'.floatConfig.winblend', 6)
|
||||
endfor
|
||||
|
||||
function! CocHighlight()
|
||||
hi! CocErrorHighlight guifg=#E74C3C term=underline,bold gui=underline,bold cterm=underline,bold
|
||||
hi! CocErrorSign guifg=#E74C3C
|
||||
|
||||
hi! CocWarningHighlight guifg=#E74C3C term=underline gui=underline cterm=underline
|
||||
hi! CocWarningSign guifg=#E67E22
|
||||
|
||||
hi CocInfoHighlight term=underline gui=underline cterm=underline
|
||||
hi CocHintHighlight term=underline gui=underline cterm=underline
|
||||
hi CocUnusedHighlight term=underline gui=underline cterm=underline
|
||||
endfunction
|
||||
|
||||
call theme#addCleanBg(['CocWarningSign', 'CocErrorSign'])
|
||||
|
||||
augroup CocHighlight
|
||||
autocmd!
|
||||
autocmd ColorScheme * call CocHighlight()
|
||||
augroup END
|
||||
|
||||
function! Breadcrumbs()
|
||||
if ! exists('b:coc_nav')
|
||||
return ''
|
||||
endif
|
||||
let items = b:coc_nav
|
||||
" let t = ' '
|
||||
let t = ' '
|
||||
let c = 0
|
||||
for obj in items
|
||||
let hi = obj['highlight']
|
||||
let name = obj['name']
|
||||
if c == 0
|
||||
let t ..= '%#'.. hi ..'#' .. name .. '%#Normal#'
|
||||
else
|
||||
let t ..= ' %#'.. hi ..'#' .. name .. '%#Normal#'
|
||||
endif
|
||||
let c += 1
|
||||
endfor
|
||||
return t
|
||||
endfunction
|
||||
|
||||
func! s:sigbar_enable()
|
||||
set tabline=%#Normal#🌠%{%Breadcrumbs()%}
|
||||
set showtabline=2
|
||||
endfunc
|
||||
|
||||
func! s:sigbar_disable()
|
||||
set tabline=
|
||||
set showtabline=1
|
||||
endfunc
|
||||
|
||||
" set tabline=%=%#Normal#%=%{%Breadcrumbs()%}
|
||||
" set showtabline=2
|
||||
|
||||
let sigbar_opt = {
|
||||
\ 'desc': 'Show function signature bar',
|
||||
\ 'enablefunc': function('s:sigbar_enable'),
|
||||
\ 'disablefunc': function('s:sigbar_disable'),
|
||||
\ 'isEnabled': 0,
|
||||
\ }
|
||||
call options#add('signature bar', sigbar_opt)
|
||||
|
||||
call theme#addTransGroup(['CocFloating'])
|
||||
|
||||
endif
|
||||
@@ -0,0 +1,3 @@
|
||||
if utils#hasplug('coc.nvim')
|
||||
let g:codi#virtual_text = 0
|
||||
endif
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
if utils#hasplug('ctrlp.vim')
|
||||
let g:ctrlp_map = '<leader>ff'
|
||||
endif
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
if utils#hasplug('everforest')
|
||||
let g:everforest_better_performance = 1
|
||||
let g:everforest_background = 'hard'
|
||||
" let g:everforest_enable_italic = 1
|
||||
function! Everforest_trans_enable()
|
||||
let g:everforest_transparent_background = 2
|
||||
colorscheme everforest
|
||||
call theme#setStlColor(&background, 'everforest')
|
||||
" hack to fix caret characters appearing in the statusline when StatusLine
|
||||
" and StatusLineNC has same highlight(https://vi.stackexchange.com/questions/15873/carets-in-status-line)
|
||||
hi StatusLine guifg=#d3c6aa ctermfg=223
|
||||
endfunction
|
||||
function! Everforest_trans_disable()
|
||||
let g:everforest_transparent_background = 0
|
||||
colorscheme everforest
|
||||
call theme#setStlColor(&background, 'everforest')
|
||||
endfunction
|
||||
function! CB_dark_tb_enable_everforest()
|
||||
call Everforest_trans_enable()
|
||||
endfunction
|
||||
function! CB_light_tb_enable_everforest()
|
||||
call Everforest_trans_enable()
|
||||
endfunction
|
||||
function! CB_dark_tb_disable_everforest()
|
||||
call Everforest_trans_disable()
|
||||
endfunction
|
||||
function! CB_light_tb_disable_everforest()
|
||||
call Everforest_trans_disable()
|
||||
endfunction
|
||||
|
||||
endif
|
||||
@@ -0,0 +1,121 @@
|
||||
|
||||
if utils#hasplug("fzf") && utils#hasplug("fzf.vim")
|
||||
" [Buffers] Jump to the existing window if possible
|
||||
let g:fzf_buffers_jump = 1
|
||||
"let $FZF_DEFAULT_COMMAND='find . \( -name node_modules -o -name .git \) -prune -o -print'
|
||||
|
||||
" - CTRL-/ will toggle preview window.
|
||||
let g:fzf_preview_window = ['right:50%']
|
||||
|
||||
hi! fzfborderhi term=bold cterm=bold ctermbg=236 gui=bold guibg=#272c42
|
||||
hi! fzfqueryhi term=underline cterm=underline gui=underline
|
||||
|
||||
let g:fzf_force_termguicolors = 1
|
||||
|
||||
if g:os != 'Windows'
|
||||
let $FZF_DEFAULT_COMMAND = "find . -type f -not -path '*/\.git/*'"
|
||||
endif
|
||||
|
||||
let s:preview_exe = expand(g:dotvimdir.'/bin/preview.py')
|
||||
let s:color_opts = ['--color', 'gutter:-1,bg+:-1,bg:-1,preview-bg:-1,preview-fg:-1,fg+:-1']
|
||||
|
||||
" check if ripgrep is installed
|
||||
function! FzfRg()
|
||||
let s:previewcmd = join([utils#get_usable_py(), s:preview_exe, &bg, '{}'])
|
||||
if ! executable('rg')
|
||||
let cmd = 'grep -R --line-number --exclude-dir=".git;.svn" --color=always -- '.shellescape('')
|
||||
else
|
||||
let cmd = "rg --column --line-number --no-heading --color=always --smart-case -- ".shellescape('')
|
||||
endif
|
||||
|
||||
let options = s:color_opts + ['--border-label', 'Grep', '--border-label-pos', '9', '--no-scrollbar',
|
||||
\ '--no-hscroll', '--no-separator', '--preview', s:previewcmd]
|
||||
let with_preview = fzf#vim#with_preview()
|
||||
if len(with_preview) == 0
|
||||
let with_preview = {'options':['--preview-window','right:50%' ] + options}
|
||||
else
|
||||
" make fzf preview repect colorsheme
|
||||
let with_preview.options = with_preview.options[:-3] + options
|
||||
endif
|
||||
call fzf#vim#grep(cmd, 1, with_preview, 0)
|
||||
endfunction
|
||||
|
||||
function! FzfFiles(...)
|
||||
let s:previewcmd = join([utils#get_usable_py(), s:preview_exe, &bg, '{}'])
|
||||
let options = s:color_opts + ['--border-label', 'Files', '--border-label-pos', '9', '--no-scrollbar',
|
||||
\ '--no-hscroll', '--no-separator', '--preview', s:previewcmd]
|
||||
let with_preview = fzf#vim#with_preview()
|
||||
if len(with_preview) == 0
|
||||
" in windows with_preview return empty dict
|
||||
let with_preview = {'options':['--preview-window','right:50%' ] + options}
|
||||
else
|
||||
let with_preview.options = with_preview.options[:-3] + options
|
||||
endif
|
||||
let dir = ''
|
||||
if a:0 >= 1 && isdirectory(expand(a:1))
|
||||
let dir = a:1
|
||||
endif
|
||||
call fzf#vim#files(dir, with_preview, 0)
|
||||
endfunction
|
||||
|
||||
function! FzfColorSelect(color_name)
|
||||
call theme#setColor(&bg, a:color_name)
|
||||
endfunction
|
||||
|
||||
function! FzfAirlineColorSelect(color_name)
|
||||
call theme#setStlColor(&background, a:color_name)
|
||||
endfunction
|
||||
|
||||
let $FZF_DEFAULT_OPTS='--color=' . s:color_opts[1]
|
||||
|
||||
function! FzfHelpTags()
|
||||
let s:previewcmd = join([utils#get_usable_py(), s:preview_exe, &bg, '{}'])
|
||||
let options = s:color_opts + ['--border-label', 'Files', '--border-label-pos', '9', '--no-scrollbar',
|
||||
\ '--no-hscroll', '--no-separator']
|
||||
let with_preview = fzf#vim#with_preview({ "placeholder": "--tag {2}:{3}:{4}" })
|
||||
if len(with_preview) == 0
|
||||
" in windows with_preview return empty dict
|
||||
let with_preview = {'options':['--preview-window','right:50%' ] + options}
|
||||
else
|
||||
let with_preview.options = with_preview.options + options
|
||||
endif
|
||||
call fzf#vim#helptags(with_preview, 0)
|
||||
endfunction
|
||||
|
||||
let s:optionmap = {}
|
||||
let s:feedfzf = []
|
||||
func! s:optioncb(str)
|
||||
call options#toggle(s:optionmap[a:str])
|
||||
endfunc
|
||||
func! FzfOptions()
|
||||
let s:feedfzf = []
|
||||
let s:optsource = options#getAll()
|
||||
for e in s:optsource
|
||||
let s:optionmap[e[1]] = e[0]
|
||||
call add(s:feedfzf, e[1])
|
||||
endfor
|
||||
call fzf#run(fzf#wrap({
|
||||
\ 'source': s:feedfzf,
|
||||
\ 'sink': function('s:optioncb'),
|
||||
\ 'options': ['--border-label', 'Options'],
|
||||
\ 'window': { 'width': 0.4, 'height': 0.6 }
|
||||
\ }))
|
||||
endfunc
|
||||
|
||||
" noremap <leader>fo :call FzfOptions()<CR>
|
||||
" noremap <leader>fr :call FzfRg()<CR>
|
||||
" noremap <leader>ff :call FzfFiles()<CR>
|
||||
noremap <leader>fh :call FzfHelpTags()<CR>
|
||||
" noremap <leader>fb :BLines<CR>
|
||||
noremap <leader>fu :call FzfFiles('~')<CR>
|
||||
|
||||
if utils#hasplug('fzf-color-preview')
|
||||
let g:FzfColorComfirmCb = function('FzfColorSelect')
|
||||
let g:FzfAirlineComfirmCb = function('FzfAirlineColorSelect')
|
||||
noremap <leader>fa :AirlinePreview<CR>
|
||||
noremap <leader>fc :ColorsPreview<CR>
|
||||
else
|
||||
noremap <leader>fc :Colors<CR>
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
if utils#hasplug('goyo.vim')
|
||||
nnoremap <leader><leader>g :Goyo<CR>
|
||||
let g:goyo_width= floor(&co * 0.65)
|
||||
|
||||
function! s:fix()
|
||||
" resize the goyo after being messed up by other plugins
|
||||
au BufEnter * if winnr('$') == '5' | exe "normal \<c-w>=" | endif
|
||||
endfunction
|
||||
augroup GoyoAu
|
||||
au!
|
||||
augroup END
|
||||
|
||||
autocmd User GoyoEnter au GoyoAu BufEnter * if winnr('$') == '5' | exe "normal \<c-w>=" | endif
|
||||
autocmd User GoyoLeave augroup GoyoAu | au! | augroup END
|
||||
endif
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
if utils#hasplug('indentLine')
|
||||
let g:indentLine_char = '│'
|
||||
let g:indentLine_setConceal = 0
|
||||
endif
|
||||
@@ -0,0 +1,136 @@
|
||||
|
||||
" giveup
|
||||
if utils#hasplug('lightline.vim')
|
||||
set noshowmode
|
||||
set laststatus=2
|
||||
|
||||
" enable bufferline
|
||||
" let g:bufferline_echo = 1
|
||||
|
||||
let g:bufferline_inactive_highlight = 'Search'
|
||||
let g:bufferline_active_highlight = 'Search'
|
||||
let g:bufferline_forbided_col = 32
|
||||
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'wombat',
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode'],
|
||||
\ [ 'bufferline'] ],
|
||||
\ 'right': [['lineinfo'], ['cocstatus']],
|
||||
\ },
|
||||
\ 'inactive': {
|
||||
\ 'left': [],
|
||||
\ 'right': [],
|
||||
\ },
|
||||
\ 'component_expand': {
|
||||
\ 'bufferline': 'BufferlineStr',
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'cocstatus': 'AirlineCocStatus',
|
||||
\ },
|
||||
\ }
|
||||
|
||||
|
||||
function! s:restore()
|
||||
let g:lightline.active = {
|
||||
\ 'left': [ [ 'mode'],
|
||||
\ [ 'bufferline'] ],
|
||||
\ 'right': [['lineinfo'], ['cocstatus']],
|
||||
\ }
|
||||
call lightline#init()
|
||||
call lightline#update()
|
||||
endfunction
|
||||
|
||||
let s:special_ft = ['nerdtree', 'vista']
|
||||
let s:special_bt = ['nofile']
|
||||
function! s:lightlineInit()
|
||||
let g:lightline.active = {
|
||||
\ 'left': [],
|
||||
\ 'right': [],
|
||||
\ }
|
||||
call lightline#init()
|
||||
call lightline#update()
|
||||
echom 'hello'. &bt
|
||||
autocmd WinLeave * ++once call s:restore()
|
||||
endfunction
|
||||
|
||||
" \ 'bufferline': 'lightline#bufferline#buffers'
|
||||
augroup Lightline
|
||||
autocmd!
|
||||
" autocmd BufWinEnter * call s:lightlineInit()
|
||||
" autocmd WinNew * call s:funck()
|
||||
autocmd FileType nerdtree call s:lightlineInit()
|
||||
" autocmd BufWritePost,TextChanged,TextChangedI,BufNew,BufEnter * call lightline#update()
|
||||
augroup END
|
||||
|
||||
function! BufferlineStr()
|
||||
call bufferline#get_echo_string()
|
||||
let s = bufferline#get_status_string()
|
||||
return s
|
||||
endfunction
|
||||
|
||||
function! s:lightline_update()
|
||||
if !exists('g:loaded_lightline')
|
||||
return
|
||||
endif
|
||||
try
|
||||
if g:colors_name =~# 'wombat\|solarized\|landscape\|jellybeans\|seoul256\|Tomorrow'
|
||||
let g:lightline.colorscheme =
|
||||
\ substitute(substitute(g:colors_name, '-', '_', 'g'), '256.*', '', '')
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#update()
|
||||
endif
|
||||
catch
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
augroup LightlineColorscheme
|
||||
autocmd!
|
||||
autocmd ColorScheme * call s:lightline_update()
|
||||
augroup END
|
||||
|
||||
function! AirlineCocStatus()
|
||||
if ! exists('*CocAction')
|
||||
return
|
||||
endif
|
||||
let loading = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
|
||||
try
|
||||
let result = CocAction('services')
|
||||
catch
|
||||
" call timer_start(200, {->execute('AirlineRefresh')})
|
||||
return 'no coc '
|
||||
endtry
|
||||
let state = ''
|
||||
let id = ''
|
||||
for e in result
|
||||
if e['languageIds'][0] == &ft
|
||||
let state = e['state']
|
||||
let id = e['id']
|
||||
endif
|
||||
endfor
|
||||
if id == ''
|
||||
return 'no lsp '
|
||||
endif
|
||||
|
||||
" messy way to get time in millisecond in vim
|
||||
let time = float2nr(str2float(reltime()->reltimestr()[4:]) * 1000)
|
||||
let speed = 800
|
||||
let loadidx = time % speed
|
||||
let msg = id
|
||||
if state == "starting"
|
||||
if ! exists('s:cocstatustimer') || len(timer_info(s:cocstatustimer)) == 0
|
||||
let s:cocstatustimer = timer_start(100, {->execute('AirlineRefresh')}, {'repeat': 800})
|
||||
endif
|
||||
return msg . " " . loading[loadidx/(speed/10)] . " "
|
||||
elseif state == "running"
|
||||
if exists('s:cocstatustimer')
|
||||
call timer_stop(s:cocstatustimer)
|
||||
unlet s:cocstatustimer
|
||||
endif
|
||||
return msg . " ✔ "
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
endif
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
if utils#hasplug('minimap.vim')
|
||||
nnoremap <silent> mm :MinimapToggle<CR>
|
||||
let g:minimap_highlight_search = 1
|
||||
let g:minimap_git_colors = 1
|
||||
let g:minimap_enable_highlight_colorgroup = 1
|
||||
let g:minimap_block_filetypes = ['fugitive', 'nvim-tree', 'tagbar', 'fzf', 'telescope', 'NvimTree', 'nerdtree']
|
||||
let g:minimap_block_buftypes = ['help', 'nerdtree', 'nofile', 'nowrite', 'quickfix', 'terminal', 'prompt', 'NvimTree']
|
||||
let g:minimap_close_filetypes = ['startify', 'netrw', 'vim-plug', 'NvimTree']
|
||||
let g:minimap_range_color = 'Visual'
|
||||
let g:minimap_cursor_color = 'Cursor'
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
if utils#hasplug('nerdtree')
|
||||
if utils#hasplug('vim-nerdtree-syntax-highlight')
|
||||
let g:NERDTreeLimitedSyntax = 1
|
||||
endif
|
||||
let g:NERDShutUp=1
|
||||
|
||||
" work around for nerdtree bug: https://github.com/preservim/nerdtree/issues/1321
|
||||
let g:NERDTreeMinimalMenu = v:true
|
||||
let g:NERDTreeMinimalUI = v:true
|
||||
|
||||
function! NERDTreeFindToggle()
|
||||
let has_nerdtree = 0
|
||||
let winfo = getwininfo()
|
||||
for obj in winfo
|
||||
let bufnr = obj['bufnr']
|
||||
let ft = getbufvar(bufnr, '&filetype')
|
||||
if ft == 'nerdtree'
|
||||
let has_nerdtree = 1
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
if has_nerdtree
|
||||
:NERDTreeClose
|
||||
else
|
||||
" we cannot use NERDTreeFind on startify as it is not a file
|
||||
if &ft == 'startify' || &ft == ''
|
||||
:NERDTreeToggle
|
||||
else
|
||||
:NERDTreeFind
|
||||
" NERDTreeToggleVCS
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
nnoremap <silent> <leader>e :call NERDTreeFindToggle()<CR>
|
||||
|
||||
"let NERDTreeShowBookmarks=1
|
||||
let NERDTreeChDirMode = 0
|
||||
let NERDTreeQuitOnOpen = 1
|
||||
let NERDTreeMouseMode = 2
|
||||
let NERDTreeShowHidden = 1
|
||||
|
||||
" remapping
|
||||
let g:NERDTreeMapOpenExpl = ''
|
||||
if utils#hasplug('vim-devicons') || utils#hasplug('nerdfont.vim')
|
||||
let NERDTreeDirArrowCollapsible = ''
|
||||
let NERDTreeDirArrowExpandable = ''
|
||||
else
|
||||
" let NERDTreeDirArrowCollapsible = ''
|
||||
" let NERDTreeDirArrowExpandable = ''
|
||||
endif
|
||||
" Exit Vim if NERDTree is the only window remaining in the only tab.
|
||||
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
|
||||
endif
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
if utils#hasplug('papercolor-theme')
|
||||
function! CB_dark_tb_enable_PaperColor()
|
||||
let g:PaperColor_Theme_Options = {
|
||||
\ 'theme': {'default.dark': { 'transparent_background': 1 }}}
|
||||
colorscheme PaperColor
|
||||
endfunction
|
||||
function! CB_light_tb_enable_PaperColor()
|
||||
let g:PaperColor_Theme_Options = {
|
||||
\ 'theme': {'default.light': { 'transparent_background': 1 }}}
|
||||
colorscheme PaperColor
|
||||
endfunction
|
||||
function! CB_dark_tb_disable_PaperColor()
|
||||
let g:PaperColor_Theme_Options = {
|
||||
\ 'theme': {'default.dark': { 'transparent_background': 0 }}}
|
||||
colorscheme PaperColor
|
||||
endfunction
|
||||
function! CB_light_tb_disable_PaperColor()
|
||||
let g:PaperColor_Theme_Options = {
|
||||
\ 'theme': {'default.light': { 'transparent_background': 0 }}}
|
||||
colorscheme PaperColor
|
||||
endfunction
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
if utils#hasplug('tagbar')
|
||||
let g:tagbar_width = 30
|
||||
let g:tagbar_sort = 0
|
||||
let g:tagbar_compact = 2
|
||||
let g:tagbar_autoshowtag = 1
|
||||
let g:tagbar_foldlevel = 99
|
||||
let g:tagbar_no_status_line = 1
|
||||
let g:tagbar_visibility_symbols = {
|
||||
\ 'public' : '+',
|
||||
\ 'protected' : '#',
|
||||
\ 'private' : '-'
|
||||
\ }
|
||||
nnoremap <silent> <leader>v <cmd>TagbarToggle<CR>
|
||||
endif
|
||||
@@ -0,0 +1,159 @@
|
||||
|
||||
if utils#hasplug("vim-airline")
|
||||
|
||||
" Extensions
|
||||
function! AirlineCocStatus()
|
||||
if ! exists('*CocAction')
|
||||
return
|
||||
endif
|
||||
let loading = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
|
||||
try
|
||||
let result = CocAction('services')
|
||||
catch
|
||||
" call timer_start(200, {->execute('AirlineRefresh')})
|
||||
return 'no coc '
|
||||
endtry
|
||||
let state = ''
|
||||
let id = ''
|
||||
for e in result
|
||||
if e['languageIds'][0] == &ft
|
||||
let state = e['state']
|
||||
let id = e['id']
|
||||
endif
|
||||
endfor
|
||||
if id == ''
|
||||
return 'no lsp '
|
||||
endif
|
||||
|
||||
" messy way to get time in millisecond in vim
|
||||
let time = float2nr(str2float(reltime()->reltimestr()[4:]) * 1000)
|
||||
let speed = 800
|
||||
let loadidx = time % speed
|
||||
let msg = id
|
||||
if state == "starting"
|
||||
if ! exists('s:cocstatustimer') || len(timer_info(s:cocstatustimer)) == 0
|
||||
let s:cocstatustimer = timer_start(100, {->execute('AirlineRefresh')}, {'repeat': 800})
|
||||
endif
|
||||
return msg . " " . loading[loadidx/(speed/10)] . " "
|
||||
elseif state == "running"
|
||||
if exists('s:cocstatustimer')
|
||||
call timer_stop(s:cocstatustimer)
|
||||
unlet s:cocstatustimer
|
||||
endif
|
||||
return msg . " ✔ "
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! AirlineBufferNumber()
|
||||
return len(g:index_to_buffer)
|
||||
endfunction
|
||||
|
||||
" This must use my fork version of bufferline
|
||||
" the number of cols bufferline cannot use out of max of screen cols
|
||||
let g:bufferline_forbided_col = 32
|
||||
|
||||
let g:airline_experimental = g:vim_v >= 900 ? 1 : 0
|
||||
|
||||
function! AirlineInit()
|
||||
" call airline#parts#define_function('bufnum', 'AirlineBufferNumber')
|
||||
call airline#parts#define_function('cocstatus', 'AirlineCocStatus')
|
||||
call airline#parts#define_minwidth('mode', 10)
|
||||
let _airline_section_y = ''
|
||||
if utils#hasplug('coc.nvim')
|
||||
" let _airline_section_y = airline#section#create(['cocstatus'])
|
||||
endif
|
||||
let g:airline_section_a = airline#section#create(['mode'])
|
||||
let g:airline_section_b = ''
|
||||
let g:airline_section_error = ''
|
||||
let g:airline_section_warning = ''
|
||||
" let g:airline_section_x = airline#section#create(['bufnum'])
|
||||
let g:airline_section_x = ''
|
||||
let g:airline_section_y = _airline_section_y
|
||||
let g:airline_section_z = airline#section#create(['cocstatus', '│ ', '%(%l:%c%)'])
|
||||
|
||||
endfunction
|
||||
|
||||
function! AirlineColouriseSplits()
|
||||
" get rid of the vertical split between two windows in statusline
|
||||
hi! link StatusLine airline_z
|
||||
hi! link StatusLineNC airline_z_inactive
|
||||
endfunction
|
||||
|
||||
augroup AirlineAu
|
||||
autocmd!
|
||||
autocmd ColorScheme * call AirlineColouriseSplits()
|
||||
autocmd User AirlineAfterInit ++once call AirlineInit()
|
||||
augroup end
|
||||
|
||||
" let g:airline_left_sep = ''
|
||||
" let g:airline_left_alt_sep = ''
|
||||
" let g:airline_right_sep = ''
|
||||
" let g:airline_right_alt_sep = ''
|
||||
|
||||
function s:airline_refresh(...)
|
||||
" this has to be set late otherwise it will cause 'mode' extension be
|
||||
" skipped at startup
|
||||
let g:airline_skip_empty_sections = 1
|
||||
endfunction
|
||||
call RegisterLateInit(function('s:airline_refresh'), 1)
|
||||
|
||||
" let g:airline_skip_empty_sections = 1
|
||||
|
||||
let g:airline_inactive_collapse = 1
|
||||
let g:airline_focuslost_inactive = 0
|
||||
let g:airline_extensions = ['bufferline']
|
||||
|
||||
let g:airline_filetype_overrides = {
|
||||
\ 'vista': ['Vista', ''],
|
||||
\ 'minimap': ['', ''],
|
||||
\ 'nerdtree': [ get(g:, 'NERDTreeStatusline', 'NERD'), ''],
|
||||
\ }
|
||||
|
||||
" hide airline in startify
|
||||
function! HideStartify(...)
|
||||
let ctx = a:2
|
||||
if ! ctx.active
|
||||
return 1
|
||||
end
|
||||
if &filetype == 'startify'
|
||||
let builder = a:1
|
||||
call builder.add_section('Normal', '')
|
||||
return 1
|
||||
endif
|
||||
if &filetype == 'help'
|
||||
let builder = a:1
|
||||
call builder.add_section('airline_a_bold', ' Help ')
|
||||
call builder.add_section('airline_c', ' %f')
|
||||
return 1
|
||||
endif
|
||||
|
||||
endfunction
|
||||
call airline#add_statusline_func('HideStartify')
|
||||
|
||||
" " without this airline will overwrite some setting like bufferline_active_buffer_left, etc.
|
||||
let g:airline#extensions#bufferline#overwrite_variables = 0
|
||||
" call theme#addTransGroup(['airline_c', 'airline_c_bold'])
|
||||
" let g:airline_mode_map = {
|
||||
" \ '__' : '-',
|
||||
" \ 'c' : 'C',
|
||||
" \ 'i' : 'I',
|
||||
" \ 'ic' : 'I',
|
||||
" \ 'ix' : 'I',
|
||||
" \ 'n' : 'N',
|
||||
" \ 'multi' : 'M',
|
||||
" \ 'ni' : 'N',
|
||||
" \ 'no' : 'N',
|
||||
" \ 'R' : 'R',
|
||||
" \ 'Rv' : 'R',
|
||||
" \ 's' : 'S',
|
||||
" \ 'S' : 'S',
|
||||
" \ '' : 'S',
|
||||
" \ 't' : 'T',
|
||||
" \ 'v' : 'V',
|
||||
" \ 'V' : 'V',
|
||||
" \ '' : 'V',
|
||||
" \ }
|
||||
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
if utils#hasplug("vim-bufferline")
|
||||
let g:bufferline_echo = 0
|
||||
let g:bufferline_modified = '+'
|
||||
|
||||
" scrolling with fixed current buffer position
|
||||
|
||||
let g:bufferline_active_buffer_left = '['
|
||||
let g:bufferline_active_buffer_right = ']'
|
||||
if utils#hasplug("vim-airline")
|
||||
let g:bufferline_inactive_highlight = 'airline_c'
|
||||
let g:bufferline_active_highlight = 'airline_c_bold'
|
||||
elseif ! utils#hasplug("vim-global-statusline")
|
||||
call bufferline#init_echo()
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
if utils#hasplug("vim-devicons")
|
||||
let g:webdevicons_enable_airline_statusline = 0
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
|
||||
if utils#hasplug('vim-floaterm')
|
||||
let g:floaterm_keymap_toggle = '<C-\>'
|
||||
let g:floaterm_wintype = 'float'
|
||||
let g:floaterm_position = 'bottomright'
|
||||
let g:floaterm_width = 0.5
|
||||
let g:floaterm_height = 0.5
|
||||
let g:floaterm_autohide = 2
|
||||
|
||||
call theme#addCleanBg(['FloatermBorder', 'Floaterm'])
|
||||
|
||||
autocmd QuitPre * :FloatermKill!<CR>
|
||||
|
||||
" press <c-[> ener normal mode in terminal. autocmd prevent this key map
|
||||
" in other plugin like fzf
|
||||
autocmd FileType floaterm tmap <buffer> <C-[> <C-w>N
|
||||
|
||||
function! s:hasterm(name)
|
||||
let bufs = floaterm#buflist#gather()
|
||||
for bufnr in bufs
|
||||
let bufinfo = getbufinfo(bufnr)[0]
|
||||
let termname = bufinfo['variables']['floaterm_name']
|
||||
if termname == a:name
|
||||
return v:true
|
||||
endif
|
||||
endfor
|
||||
return v:false
|
||||
endfunction
|
||||
|
||||
function! ToggleRepl()
|
||||
let name = 'REPL'
|
||||
let currentWindow=winnr()
|
||||
if s:hasterm(name)
|
||||
execute('FloatermToggle ' . name)
|
||||
else
|
||||
:FloatermNew --name=REPL --width=0.5 --wintype=vsplit --position=botright --autoclose=2 ipython
|
||||
endif
|
||||
exe currentWindow . "wincmd w"
|
||||
endfunction
|
||||
|
||||
function! ToggleNormal()
|
||||
let name = 'normalterm'
|
||||
if s:hasterm(name)
|
||||
execute('FloatermToggle ' . name)
|
||||
else
|
||||
:FloatermNew --name=normalterm --width=0.5 --height=0.5 --wintype=float --position=bottomright --autoclose=2
|
||||
endif
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> <leader>tp :call ToggleRepl()<CR>
|
||||
nnoremap <silent> <leader>tn :call ToggleNormal()<CR>
|
||||
vnoremap <silent> <leader>tl :FloatermSend --name=REPL<CR>
|
||||
endif
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
if utils#hasplug('vim-gitgutter')
|
||||
call theme#addCleanBg(['GitGutterAdd', 'GitGutterChange', 'GitGutterDelete', 'GitGutterChangeDelete'])
|
||||
nnoremap <leader>gt :GitGutterBufferToggle<CR>
|
||||
endif
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
if utils#hasplug("vim-gutentags")
|
||||
if exists("*gutentags#statusline()")
|
||||
set statusline+=%{gutentags#statusline()}
|
||||
endif
|
||||
let g:gutentags_trace = 1
|
||||
let g:gutentags_cache_dir=g:vim_dir . '/.vimtags/'
|
||||
let g:gutentags_project_root=['.git', '.hg', '.svn', '.bzr', '_darcs', '_FOSSIL_', '.fslckout', 'src']
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
if utils#hasplug('vim-illuminate') && g:vim_type == 'vim' " nvim doesn't need this config
|
||||
let g:Illuminate_highlightUnderCursor = 1
|
||||
let g:Illuminate_ftHighlightGroups = {
|
||||
\ 'vim:blacklist': ['vimLet', 'vimFuncKey', 'vimNotFunc', 'vimOperParen', 'vimLineComment'],
|
||||
\ 'java:blacklist' : [ 'javaType', 'javaScopeDecl', 'javaMethodDecl',
|
||||
\ 'javaComment', 'javaStorageClass', 'javaClassDecl', 'javaExternal',
|
||||
\ 'javaTypedef', 'javaLineComment', 'javaStatement', 'javaCommentTitle', 'javaDocComment' ],
|
||||
\ 'lua:blacklist' : [ 'luaComment', 'luaCond', 'luaStatement', 'luaFunction' ]
|
||||
\ }
|
||||
let g:Illuminate_ftwhitelist = ['vim', 'sh', 'python', 'rust', 'java',
|
||||
\ 'c', 'cpp', 'javascript', 'typescript', 'lua']
|
||||
|
||||
" ugly workaround for the bug that illuminate not working after first enter vim
|
||||
" {
|
||||
function s:init_illuminate(...)
|
||||
let bgType = theme#getBgType()
|
||||
let bg = theme#getHiTerm('Visual', bgType)
|
||||
if bg != 'NONE' && &bg == 'dark'
|
||||
execute('hi illuminatedWord '.bgType.'='.bg)
|
||||
execute('hi illuminatedCurWord '.bgType.'='.bg)
|
||||
else
|
||||
hi illuminatedWord cterm=underline gui=underline
|
||||
hi illuminatedCurWord cterm=underline gui=underline
|
||||
end
|
||||
endfunction
|
||||
call RegisterLateInit(function('s:init_illuminate'), 0)
|
||||
" }
|
||||
|
||||
augroup illuminate_augroup
|
||||
autocmd!
|
||||
autocmd ColorScheme * call s:init_illuminate()
|
||||
augroup END
|
||||
|
||||
endif
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
if utils#hasplug('vim-matchup')
|
||||
let g:matchup_matchparen_offscreen = {}
|
||||
call theme#addCleanBg('MatchWord')
|
||||
endif
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
if utils#hasplug("vim-rooter")
|
||||
let g:rooter_patterns = ['.vscode', '.git', '*.sln', 'src']
|
||||
let g:rooter_change_directory_for_non_project_files = ''
|
||||
let g:rooter_silent_chdir = 0
|
||||
" let g:rooter_manual_only = 1
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
if utils#hasplug("vim-sneak")
|
||||
let g:sneak#label = 1
|
||||
" map f <Plug>Sneak_s
|
||||
" map F <Plug>Sneak_S
|
||||
endif
|
||||
@@ -0,0 +1,58 @@
|
||||
|
||||
if utils#hasplug("vim-startify")
|
||||
if has('nvim')
|
||||
let buffer_str_len = (&columns - 60) / 2
|
||||
let buf_str = repeat(' ', buffer_str_len)
|
||||
let ascii_art = [
|
||||
\ buf_str . '',
|
||||
\ buf_str . '',
|
||||
\ buf_str . ' __ __ ________ ______ __ __ ______ __ __ ',
|
||||
\ buf_str . '| \ | \| \ / \ | \ | \| \| \ / \',
|
||||
\ buf_str . '| $$\ | $$| $$$$$$$$| $$$$$$\| $$ | $$ \$$$$$$| $$\ / $$',
|
||||
\ buf_str . '| $$$\| $$| $$__ | $$ | $$| $$ | $$ | $$ | $$$\ / $$$',
|
||||
\ buf_str . '| $$$$\ $$| $$ \ | $$ | $$ \$$\ / $$ | $$ | $$$$\ $$$$',
|
||||
\ buf_str . '| $$\$$ $$| $$$$$ | $$ | $$ \$$\ $$ | $$ | $$\$$ $$ $$',
|
||||
\ buf_str . '| $$ \$$$$| $$_____ | $$__/ $$ \$$ $$ _| $$_ | $$ \$$$| $$',
|
||||
\ buf_str . '| $$ \$$$| $$ \ \$$ $$ \$$$ | $$ \| $$ \$ | $$',
|
||||
\ buf_str . ' \$$ \$$ \$$$$$$$$ \$$$$$$ \$ \$$$$$$ \$$ \$$',
|
||||
\]
|
||||
else
|
||||
let buffer_str_len = (&columns - 30) / 2
|
||||
let buf_str = repeat(' ', buffer_str_len)
|
||||
let ascii_art = [
|
||||
\ buf_str . '',
|
||||
\ buf_str . '',
|
||||
\ buf_str . ' __ __ ______ __ __ ',
|
||||
\ buf_str . '| \ | \| \| \ / \',
|
||||
\ buf_str . '| $$ | $$ \$$$$$$| $$\ / $$',
|
||||
\ buf_str . '| $$ | $$ | $$ | $$$\ / $$$',
|
||||
\ buf_str . ' \$$\ / $$ | $$ | $$$$\ $$$$',
|
||||
\ buf_str . ' \$$\ $$ | $$ | $$\$$ $$ $$',
|
||||
\ buf_str . ' \$$ $$ _| $$_ | $$ \$$$| $$',
|
||||
\ buf_str . ' \$$$ | $$ \| $$ \$ | $$',
|
||||
\ buf_str . ' \$ \$$$$$$ \$$ \$$',
|
||||
\]
|
||||
endif
|
||||
|
||||
let g:startify_padding_left = &columns / 2 - &columns / 4 - &columns / 8
|
||||
let g:startify_custom_header = ascii_art
|
||||
let g:startify_change_to_dir = 0
|
||||
let g:startify_files_number = 5
|
||||
|
||||
let g:startify_bookmarks = [ g:dotfiledir . 'main.vim' ]
|
||||
let g:startify_lists = [
|
||||
\ { 'header': startify#pad([' RECENT']), 'type': 'files' },
|
||||
\ { 'header': startify#pad([' SESSIONS']), 'type': 'sessions' },
|
||||
\ { 'header': startify#pad([' BOOKMARKS']), 'type': 'bookmarks' },
|
||||
\ ]
|
||||
|
||||
" session related KeyBinding. These KeyBinding uses function from startify
|
||||
nnoremap <silent> <leader><leader>s :SSave!<CR>
|
||||
nnoremap <silent> <leader><leader>l :SLoad<CR>
|
||||
nnoremap <silent> <leader><leader>d :SDelete!<CR>
|
||||
nnoremap <silent> <leader><leader>c :SClose<CR>
|
||||
|
||||
au VimLeave * SSave! last
|
||||
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
if utils#hasplug('vim-tmux-navigator')
|
||||
let g:tmux_navigator_no_mappings = 1
|
||||
|
||||
noremap <silent> <c-h> :<C-U>TmuxNavigateLeft<cr>
|
||||
noremap <silent> <c-j> :<C-U>TmuxNavigateDown<cr>
|
||||
noremap <silent> <c-k> :<C-U>TmuxNavigateUp<cr>
|
||||
noremap <silent> <c-l> :<C-U>TmuxNavigateRight<cr>
|
||||
" noremap <silent> {Previous-Mapping} :<C-U>TmuxNavigatePrevious<cr>
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
vim9script
|
||||
|
||||
if utils#hasplug('fuzzyy')
|
||||
g:files_respect_gitignore = 1
|
||||
g:fuzzyy_menu_matched_hl = 'error'
|
||||
g:fuzzyy_dropdown = 1
|
||||
endif
|
||||
@@ -0,0 +1,188 @@
|
||||
vim9script
|
||||
|
||||
if utils#hasplug('vim-global-statusline')
|
||||
|
||||
g:stl_nonbtbg = 'folded'
|
||||
g:stl_bg = 'normal'
|
||||
g:bufferline_forbided_col = 32
|
||||
|
||||
def ReverseHl(name: string, hl: string)
|
||||
var hl_terms = theme#getHiTerms(hl)
|
||||
var normal_terms = theme#getHiTerms('normal')
|
||||
for [term, val] in items(hl_terms)
|
||||
if val == 'NONE'
|
||||
hl_terms[term] = normal_terms[term]
|
||||
endif
|
||||
endfor
|
||||
exe 'hi ' .. name .. ' guibg=' .. hl_terms['guifg'] .. ' guifg='
|
||||
.. hl_terms['guibg'] .. ' ctermbg=' .. hl_terms['ctermfg']
|
||||
.. ' ctermfg=' .. hl_terms['ctermbg']
|
||||
enddef
|
||||
|
||||
def StlHighlight()
|
||||
hi normalModeGstl cterm=reverse gui=reverse
|
||||
ReverseHl('insertModeGstl', 'function')
|
||||
ReverseHl('visualModeGstl', 'statement')
|
||||
ReverseHl('commandModeGstl', 'number')
|
||||
enddef
|
||||
autocmd ColorScheme * StlHighlight()
|
||||
var mode_color = {
|
||||
n: 'normalModeGstl',
|
||||
i: 'insertModeGstl',
|
||||
v: 'visualModeGstl',
|
||||
V: 'visualModeGstl',
|
||||
c: 'commandModeGstl',
|
||||
}
|
||||
var mode_str = {
|
||||
n: ' NORMAL ',
|
||||
i: ' INSERT ',
|
||||
v: ' VISUAL ',
|
||||
V: ' V-LINE ',
|
||||
c: ' COMMAND ',
|
||||
}
|
||||
mode_str[nr2char(22)] = ' V-BLOCK '
|
||||
mode_color[nr2char(22)] = 'curSearch'
|
||||
def Modestr(): void
|
||||
var m = mode()
|
||||
if has_key(mode_str, m)
|
||||
g:StlSetPart(0, mode_str[m], mode_color[m], 'mode')
|
||||
else
|
||||
echom char2nr(m)
|
||||
g:StlSetPart(0, ' ' .. &ft .. ' ', 'TabLineSel', 'mode')
|
||||
endif
|
||||
g:StlRefresh()
|
||||
enddef
|
||||
|
||||
def Fnstr(): void
|
||||
g:StlSetPart(10, 'filename: ' .. bufname(), '', 'filename')
|
||||
g:StlRefresh()
|
||||
enddef
|
||||
|
||||
def Bufstr(): void
|
||||
var bufstr = bufferline#get_echo_string()
|
||||
g:StlSetPart(9, ' ' .. bufstr, '', 'bufstr')
|
||||
g:StlRefresh()
|
||||
enddef
|
||||
|
||||
def Lncol(): void
|
||||
var col = virtcol(".")
|
||||
var ln = line('.')
|
||||
var m = mode()
|
||||
var color = ''
|
||||
if has_key(mode_color, m)
|
||||
color = mode_color[m]
|
||||
else
|
||||
color = 'TabLineSel'
|
||||
endif
|
||||
g:StlSetPart(&co - 9, printf(" %d:%d", ln, col), color, 'linenr')
|
||||
g:StlRefresh()
|
||||
enddef
|
||||
|
||||
var cocstatustimer = -1
|
||||
|
||||
def Cocstatus(): string
|
||||
const loading = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
|
||||
var results = []
|
||||
var result = '𐄂'
|
||||
var fticon = '𐄂'
|
||||
try
|
||||
if exists('g:CocAction')
|
||||
results = g:CocAction('services')
|
||||
endif
|
||||
catch
|
||||
endtry
|
||||
var state = ''
|
||||
var id = ''
|
||||
if len(results) == 0
|
||||
timer_start(100, function(Lsp))
|
||||
endif
|
||||
for e in results
|
||||
if e['languageIds'][0] == &ft
|
||||
state = e['state']
|
||||
id = e['id']
|
||||
endif
|
||||
endfor
|
||||
|
||||
# messy way to get time in millisecond in vim
|
||||
var time = float2nr(str2float(reltime()->reltimestr()[4 : ]) * 1000)
|
||||
var speed = 800
|
||||
var loadidx = time % speed
|
||||
var msg = id
|
||||
if state == "starting"
|
||||
if len(timer_info(cocstatustimer)) == 0
|
||||
cocstatustimer = timer_start(100, function(Lsp), {'repeat': 800})
|
||||
endif
|
||||
fticon = loading[loadidx / (speed / 10)]
|
||||
elseif state == "running"
|
||||
if len(timer_info(cocstatustimer)) != 0
|
||||
timer_stop(cocstatustimer)
|
||||
cocstatustimer = -1
|
||||
endif
|
||||
if exists('g:WebDevIconsGetFileTypeSymbol')
|
||||
fticon = g:WebDevIconsGetFileTypeSymbol()
|
||||
endif
|
||||
endif
|
||||
# return fticon .. ' ' .. result
|
||||
return 'lsp ' .. fticon
|
||||
enddef
|
||||
|
||||
def Lsp(...timer: list<any>): void
|
||||
var s = Cocstatus()
|
||||
g:StlSetPart(&co - 17, ' ' .. s .. ' ', '', 'lsp')
|
||||
g:StlRefresh()
|
||||
enddef
|
||||
|
||||
var fancytimer = 0
|
||||
def Fancy(...timer: list<any>): void
|
||||
var expressions = [' (◕_◕)', ' (◕‿◕)', '\(◕◡◕\)', ' (◣_◢)', ' (◣‿◢)', '\(◣◡◣\)', ' (◠‿◠)', ' (◠_◠)', '\(◠◡◠\)', ' (◡‿◡)', ' (◡_◡)', '\(◡◡◡\)', ' (┳Д┳)', ' (个_个)', ' ( ≧Д≦)', ' 흫_흫', ' 句_句']
|
||||
|
||||
# var letters = [𝔞 𝔟 𝔠 𝔡 𝔢 𝔣 𝔤 𝔥 𝔦 𝔧 𝔨 𝔩 𝔪 𝔫 𝔬 𝔭 𝔮 𝔯 𝔰 𝔱 𝔲 𝔳 𝔴 𝔵 𝔶 𝔷]
|
||||
|
||||
# string "I love you" using unicode letters
|
||||
var lang = ''
|
||||
if &ft == 'python'
|
||||
lang = '𝕻𝖞𝖙𝖍𝖔𝖓'
|
||||
elseif &ft == 'java'
|
||||
lang = '𝕵𝖆𝖛𝖆'
|
||||
elseif &ft == 'javascript'
|
||||
lang = '𝕵𝖆𝖛𝖆𝖘𝖈𝖗𝖎𝖕𝖙'
|
||||
elseif &ft == 'lua'
|
||||
lang = '𝕷𝖚𝖆'
|
||||
elseif &ft == 'vim'
|
||||
lang = '𝓥𝓲𝓶 𝓢𝓬𝓻𝓲𝓹𝓽'
|
||||
else
|
||||
lang = &ft
|
||||
endif
|
||||
var str = lang .. ' 𝔦𝔰 𝔱𝔥𝔢 𝔟𝔢𝔰𝔱 𝔩𝔞𝔫𝔤𝔲𝔞𝔤𝔢'
|
||||
|
||||
# fancytimer = (fancytimer + 1) % len(str)
|
||||
g:StlSetPart(&co - 27 - strcharlen(str), str, '', 'fancy')
|
||||
enddef
|
||||
|
||||
def Theme(): void
|
||||
# const light = '☀'
|
||||
# const dark = '☽'
|
||||
const light = '🌕'
|
||||
const dark = '🌑'
|
||||
var theme = &bg == 'light' ? light : dark
|
||||
g:StlSetPart(&co - 23, '│ ' .. theme, '', 'bgc')
|
||||
g:StlRefresh()
|
||||
enddef
|
||||
|
||||
def EnterInit(): void
|
||||
# Theme()
|
||||
Lncol()
|
||||
Lsp()
|
||||
# autocmd GlobalStl ColorScheme * Theme()
|
||||
enddef
|
||||
|
||||
augroup GlobalStl
|
||||
autocmd!
|
||||
autocmd VimEnter,ModeChanged * Modestr() | Lncol()
|
||||
autocmd BufEnter,BufDelete,BufWritePost * Bufstr() | Modestr()
|
||||
autocmd CursorHold * Lncol()
|
||||
autocmd BufEnter,BufReadPost * Lsp()
|
||||
autocmd VimEnter * EnterInit()
|
||||
augroup END
|
||||
|
||||
endif
|
||||
@@ -0,0 +1,7 @@
|
||||
if utils#hasplug('vimtex')
|
||||
noremap <leader>lc :VimtexCompile<CR>
|
||||
noremap <leader>lv :VimtexView<CR>
|
||||
if g:os == 'Darwin'
|
||||
let g:vimtex_view_method = 'skim'
|
||||
endif
|
||||
endif
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
if utils#hasplug('vista.vim')
|
||||
let g:vista_default_executive = 'vim_lsp'
|
||||
if utils#hasplug('coc.nvim')
|
||||
let g:vista_default_executive = 'coc'
|
||||
elseif executable('ctags')
|
||||
let g:vista_default_executive = 'ctags'
|
||||
endif
|
||||
nnoremap <silent> <leader>v :Vista!!<CR>
|
||||
let g:vista_cursor_delay = 0
|
||||
let g:vista_echo_cursor = 0
|
||||
let g:vista_echo_cursor_strategy = 'floating_win'
|
||||
let g:vista_close_on_jump = 0
|
||||
let g:vista_floating_delay = 0
|
||||
let g:vista_ignore_kinds = ['Variable', 'Field', 'EnumMember',
|
||||
\ 'String', 'Object', 'Array', 'Constant', 'Package', 'Boolean', 'Number'
|
||||
\ ]
|
||||
let g:vista_floating_border = 'rounded'
|
||||
let g:vista_disable_statusline = 1
|
||||
" let g:vista_keep_fzf_colors = 1
|
||||
let g:vista_update_on_text_changed_delay = 0
|
||||
let g:vista_update_on_text_changed = 1
|
||||
let g:vista#renderer#enable_kind = 1
|
||||
let g:vista#renderer#enable_icon = 1
|
||||
|
||||
" return to last position of vista
|
||||
let g:vista_last_row = v:null
|
||||
function! VistaCursorJump()
|
||||
" let found = vista#util#BinarySearch(g:vista.raw, line('.'), 'line', '')
|
||||
let found = g:vista_last_row
|
||||
if empty(found)
|
||||
return
|
||||
endif
|
||||
let vlnum = get(found, 'vlnum', v:null)
|
||||
call cursor(vlnum, 3)
|
||||
endfunction
|
||||
|
||||
" save tag for VistaCursorJump use
|
||||
function! VistaH2()
|
||||
if exists('*vista#util#BinarySearch')
|
||||
let bufs = map(filter(copy(getbufinfo()), 'v:val.listed'), 'v:val.bufnr')
|
||||
if index(bufs, bufnr('%')) < 0
|
||||
return
|
||||
endif
|
||||
let found = vista#util#BinarySearch(g:vista.raw, line('.'), 'line', '')
|
||||
if empty(found)
|
||||
return
|
||||
endif
|
||||
let g:vista_last_row = found
|
||||
endif
|
||||
endfunction
|
||||
|
||||
augroup VistaAu
|
||||
autocmd!
|
||||
autocmd BufLeave * call VistaH2()
|
||||
autocmd FileType vista call VistaCursorJump()
|
||||
augroup END
|
||||
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
if utils#hasplug('wilder.nvim')
|
||||
|
||||
call wilder#setup({
|
||||
\ 'modes': [':'],
|
||||
\ 'next_key': '<tab>',
|
||||
\ 'previous_key': '<S-Tab>',
|
||||
\ 'enable_cmdline_enter': 0,
|
||||
\ })
|
||||
|
||||
call wilder#set_option('pipeline', [
|
||||
\ wilder#debounce(10),
|
||||
\ wilder#branch(
|
||||
\ wilder#cmdline_pipeline({'language': g:vim_type == 'nvim' ? 'python' : 'vim'}),
|
||||
\ ),
|
||||
\ ])
|
||||
|
||||
if g:vim_type == 'vim'
|
||||
call wilder#set_option('renderer', wilder#popupmenu_renderer())
|
||||
else
|
||||
call wilder#set_option('renderer', wilder#popupmenu_renderer(
|
||||
\ wilder#popupmenu_border_theme({
|
||||
\ 'highlights': {
|
||||
\ 'default': 'Normal',
|
||||
\ },
|
||||
\ 'pumblend': 20,
|
||||
\ 'border': 'rounded',
|
||||
\ })))
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
if utils#hasplug("winresizer")
|
||||
let g:winresizer_vert_resize = 2
|
||||
let g:winresizer_horiz_resize = 2
|
||||
" nnoremap <C-w>r :WinResizerStartResize<CR>
|
||||
let g:winresizer_start_key = '<C-w>r'
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
if utils#hasplug("zoxide.vim")
|
||||
|
||||
endif
|
||||
@@ -0,0 +1 @@
|
||||
local wezterm = require 'wezterm'
|
||||
+97
-31
@@ -5,8 +5,10 @@
|
||||
app_name='dotfiles'
|
||||
|
||||
[ -z "$APP_PATH" ] && APP_PATH="$HOME/.$app_name"
|
||||
[ -z "$REPO_URI" ] && REPO_URI="https://github.com/Donaldttt/$app_name"
|
||||
[ -z "$REPO_BRANCH" ] && REPO_BRANCH='dev'
|
||||
# [ -z "$REPO_URI" ] && REPO_URI="https://github.com/Donaldttt/$app_name"
|
||||
# [ -z "$REPO_BRANCH" ] && REPO_BRANCH='dev'
|
||||
[ -z "$REPO_URI" ] && REPO_URI="https://gitlab.com/tangnachuan1208/$app_name"
|
||||
[ -z "$REPO_BRANCH" ] && REPO_BRANCH='gitlab'
|
||||
[ -z "$VIM_RTPATH" ] && VIM_RTPATH="$HOME/.vim"
|
||||
|
||||
|
||||
@@ -45,7 +47,7 @@ program_exists() {
|
||||
# 2 file not exist
|
||||
# when using this function:
|
||||
# file path should not be quoted but like this:
|
||||
# file_contains 'abc' file_path
|
||||
# file_contains 'abc' file_path
|
||||
file_contains(){
|
||||
if [ -f "$2" ]; then
|
||||
a=`grep "$1" $2`
|
||||
@@ -95,7 +97,7 @@ backup_file() {
|
||||
|
||||
# Usage: sync_repo path url
|
||||
#
|
||||
# This function try to clone git repo host in @url
|
||||
# This function try to clone git repo host in @url
|
||||
# to @path. If @path alreay exsits, it will simply
|
||||
# update the repo
|
||||
sync_repo() {
|
||||
@@ -118,6 +120,25 @@ sync_repo() {
|
||||
fi
|
||||
}
|
||||
|
||||
# simply clone a repo
|
||||
sync_repo_default() {
|
||||
local repo_uri="$1"
|
||||
local repo_path="$2"
|
||||
|
||||
if [ ! -e "$repo_path" ]; then
|
||||
msg "Trying to clone repo"
|
||||
mkdir -p "$repo_path"
|
||||
git clone "$repo_uri" "$repo_path"
|
||||
ret="$?"
|
||||
success "Successfully cloned repo."
|
||||
else
|
||||
msg "Trying to update repo"
|
||||
cd "$repo_path" && git pull
|
||||
ret="$?"
|
||||
success "Successfully updated repo"
|
||||
fi
|
||||
}
|
||||
|
||||
setup_vimplug() {
|
||||
|
||||
# if vimplug is already installed
|
||||
@@ -127,7 +148,7 @@ setup_vimplug() {
|
||||
#fi
|
||||
|
||||
mkdir -p "$VIM_RTPATH/autoload"
|
||||
# setup for vim
|
||||
# setup for vim
|
||||
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim > /dev/null 2>&1
|
||||
|
||||
@@ -162,11 +183,26 @@ source ~/.vimrc" > $nvim_config
|
||||
fi
|
||||
}
|
||||
|
||||
# tmux plugin manager
|
||||
set_up_tpm() {
|
||||
|
||||
echo "Install TPM(tmux plugin manager)?('y' install; 'other keys' nope)"
|
||||
read -r respond
|
||||
if [ "$respond" = "y" ] || [ "$respond" = "yes" ]; then
|
||||
local url="https://github.com/tmux-plugins/tpm"
|
||||
sync_repo_default "$url" "$HOME/.tmux/plugins/tpm"
|
||||
success "TPM installed"
|
||||
else
|
||||
fail "TPM not installed"
|
||||
fi
|
||||
}
|
||||
|
||||
set_up_tmux() {
|
||||
if program_exists "tmux"; then
|
||||
backup_file "$HOME/.tmux.conf"
|
||||
try_symlink "$APP_PATH/.tmux.conf" "$HOME/.tmux.conf" && \
|
||||
success "Tmux config setup successed"
|
||||
set_up_tpm
|
||||
else
|
||||
fail "Tmux config is not setup(tmux not installed)"
|
||||
fi
|
||||
@@ -187,7 +223,7 @@ set_up_vim() {
|
||||
backup_file "$HOME/.vimrc"
|
||||
backup_file "$HOME/.vimrc.bundles"
|
||||
|
||||
try_symlink "$APP_PATH/.vimrc" "$HOME/.vimrc"
|
||||
try_symlink "$APP_PATH/.vimrc" "$HOME/.vimrc"
|
||||
try_symlink "$APP_PATH/.vimrc.bundles" "$HOME/.vimrc.bundles"
|
||||
|
||||
success "Setting up symlinks for vim configuration"
|
||||
@@ -201,33 +237,37 @@ set_up_zoxide_shell_config() {
|
||||
local source_cmd_bash='eval "$(zoxide init bash)"'
|
||||
if program_exists "zsh"; then
|
||||
# if not already contain source command
|
||||
file_contains "$source_cmd_zsh" ~/.zshrc
|
||||
file_contains "$source_cmd_zsh" ~/.zshrc
|
||||
status_code=$?
|
||||
if [ "$status_code" != '0' ]; then
|
||||
echo "Install zoxide source command ($source_cmd_zsh) for zsh shell?('y' install; 'q' quit the scrip)"
|
||||
echo "Install zoxide source command ($source_cmd_zsh) for zsh shell?('y' install; others no)"
|
||||
read -r respond
|
||||
if [ "$respond" = "y" ] || [ "$respond" = "yes" ]; then
|
||||
echo "$source_cmd_zsh" >> $HOME/.zshrc
|
||||
elif [ "$respond" = "q" ]; then
|
||||
exit 0
|
||||
success "add ($source_cmd_zsh) to zsh"
|
||||
else
|
||||
fail "not adding ($source_cmd_zsh) to zsh"
|
||||
fi
|
||||
success "add ($source_cmd_zsh) to zsh"
|
||||
else
|
||||
success "($source_cmd_zsh) is already in zsh"
|
||||
fi
|
||||
fi
|
||||
|
||||
if program_exists "bash"; then
|
||||
# if not already contain source command
|
||||
file_contains "$source_cmd_bash" ~/.bashrc
|
||||
file_contains "$source_cmd_bash" ~/.bashrc
|
||||
status_code=$?
|
||||
if [ "$status_code" != '0' ]; then
|
||||
echo "Install zoxide source command ($source_cmd_bash) for bash shell?('y' install; 'q' quit the scrip)"
|
||||
echo "Install zoxide source command ($source_cmd_bash) for bash shell?('y' install; others no)"
|
||||
read -r respond
|
||||
if [ "$respond" = "y" ] || [ "$respond" = "yes" ]; then
|
||||
echo "$source_cmd_bash" >> $HOME/.bashrc
|
||||
elif [ "$respond" = "q" ]; then
|
||||
exit 0
|
||||
success "add ($source_cmd_bash) to bash"
|
||||
else
|
||||
fail "not adding ($source_cmd_bash) to bash"
|
||||
fi
|
||||
success "add ($source_cmd_bash) to bash"
|
||||
else
|
||||
success "($source_cmd_bash) is already in bash"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -241,7 +281,7 @@ set_up_zoxide() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Install zoxide (smart cd like autojump)?('y' install; 'q' quit the scrip)"
|
||||
echo "Install zoxide (smart cd like autojump)?('y' install; 'other keys' nope)"
|
||||
read -r respond
|
||||
if [ "$respond" = "y" ] || [ "$respond" = "yes" ]; then
|
||||
program_must_exist "curl"
|
||||
@@ -249,8 +289,29 @@ set_up_zoxide() {
|
||||
curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash
|
||||
set_up_zoxide_shell_config
|
||||
|
||||
elif [ "$respond" = "q" ]; then
|
||||
exit 0
|
||||
else
|
||||
fail "zoxide is not installed"
|
||||
fi
|
||||
}
|
||||
set_up_fish(){
|
||||
local source_cmd="source $APP_PATH/config/fish/config.fish"
|
||||
local fish_config="$HOME/.config/fish/config.fish"
|
||||
if program_exists "fish"; then
|
||||
# if not already contain source command
|
||||
file_contains "$source_cmd" $fish_config
|
||||
status_code=$?
|
||||
if [ "$status_code" != '0' ]; then
|
||||
echo "Install fish configuration script for fish shell?('y' install; 'other keys' nope)"
|
||||
read -r respond
|
||||
if [ "$respond" = "y" ] || [ "$respond" = "yes" ]; then
|
||||
echo "$source_cmd" >> $fish_config
|
||||
success "fish configuration is sourced in $fish_config"
|
||||
else
|
||||
fail "Configuration is not sourced in fish"
|
||||
fi
|
||||
else
|
||||
success "fish script is already sourced"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -259,41 +320,45 @@ set_up_bash_tool(){
|
||||
local source_cmd2="source ~/.$app_name/bash_tools.sh"
|
||||
if program_exists "zsh"; then
|
||||
# if not already contain source command
|
||||
file_contains "$source_cmd" ~/.zshrc
|
||||
file_contains "$source_cmd" ~/.zshrc
|
||||
status_code=$?
|
||||
if [ "$status_code" != '0' ]; then
|
||||
file_contains "$source_cmd2" ~/.zshrc
|
||||
file_contains "$source_cmd2" ~/.zshrc
|
||||
status_code=$?
|
||||
fi
|
||||
if [ "$status_code" != '0' ]; then
|
||||
echo "Install terminal configuration script for zsh shell?('y' install; 'q' quit the scrip)"
|
||||
echo "Install terminal configuration script for zsh shell?('y' install; 'other keys' nope)"
|
||||
read -r respond
|
||||
if [ "$respond" = "y" ] || [ "$respond" = "yes" ]; then
|
||||
echo "$source_cmd" >> $HOME/.zshrc
|
||||
elif [ "$respond" = "q" ]; then
|
||||
exit 0
|
||||
success "Terminal configuration is sourced in zsh"
|
||||
else
|
||||
fail "Configuration is not sourced in zsh"
|
||||
fi
|
||||
success "Terminal configuration is sourced in zsh"
|
||||
else
|
||||
success "zsh script is already sourced"
|
||||
fi
|
||||
fi
|
||||
|
||||
if program_exists "bash"; then
|
||||
# if not already contain source command
|
||||
file_contains "$source_cmd" ~/.bashrc
|
||||
file_contains "$source_cmd" ~/.bashrc
|
||||
status_code=$?
|
||||
if [ "$status_code" != '0' ]; then
|
||||
file_contains "$source_cmd2" ~/.bashrc
|
||||
file_contains "$source_cmd2" ~/.bashrc
|
||||
status_code=$?
|
||||
fi
|
||||
if [ "$status_code" != '0' ]; then
|
||||
echo "Install terminal configuration script for bash shell?('y' install; 'q' quit the scrip)"
|
||||
echo "Install terminal configuration script for bash shell?('y' install; 'other keys' nope)"
|
||||
read -r respond
|
||||
if [ "$respond" = "y" ] || [ "$respond" = "yes" ]; then
|
||||
echo "$source_cmd" >> $HOME/.bashrc
|
||||
elif [ "$respond" = "q" ]; then
|
||||
exit 0
|
||||
success "Terminal configuration is sourced in bash"
|
||||
else
|
||||
fail "Configuration is not sourced in bash"
|
||||
fi
|
||||
success "Terminal configuration is sourced in bash"
|
||||
else
|
||||
success "bash script is already sourced"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -304,6 +369,7 @@ env_set "$HOME"
|
||||
set_up_vim
|
||||
set_up_tmux
|
||||
set_up_bash_tool
|
||||
set_up_fish
|
||||
set_up_zoxide
|
||||
|
||||
msg "\nThanks for installing $app_name."
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
" (jump to the topic)
|
||||
"
|
||||
" OPTIONS
|
||||
" PLUGIN_INSTALL
|
||||
" UTILITIES
|
||||
" PLUGIN_CONFIGURATION " THEME_CONFIGURATION
|
||||
" KEY_MAPS
|
||||
" OTHER_CONFIGS
|
||||
|
||||
let g:high_performence = v:false
|
||||
let g:autocomplte_enable = v:true
|
||||
let g:copilot_enable = v:true
|
||||
|
||||
" only in nvim (using which-key)
|
||||
let g:key_prompt = v:false
|
||||
|
||||
" only used by neovim
|
||||
let g:classic_vim_ui = v:true
|
||||
let g:animation_enable = v:false
|
||||
|
||||
let g:swap_dict = [
|
||||
\ ['v:false', '0', 'dark', 'false' ],
|
||||
\ ['v:true' , '1', 'light', 'true']]
|
||||
" convinient function to swap between two options
|
||||
nmap <leader><leader>t :call utils#swapword()<CR>
|
||||
|
||||
"""""" PLUGIN_INSTALL """"""
|
||||
|
||||
let g:dotvimdir = expand(g:dotfiledir . 'config/vim/')
|
||||
let g:plugin_dir = expand(g:vim_dir . 'plugged/')
|
||||
|
||||
let g:theme_config_path = expand(g:vim_dir . ".config.vim")
|
||||
|
||||
call plug#begin(g:plugin_dir)
|
||||
" https://github.com/junegunn/vim-plug/wiki/tips
|
||||
function! Cond(cond, ...)
|
||||
let opts = get(a:000, 0, {})
|
||||
return a:cond ? opts : extend(opts, { 'on': [], 'for': [] })
|
||||
endfunction
|
||||
let g:animation_enable = g:high_performence ? v:false : g:animation_enable
|
||||
|
||||
if !g:high_performence
|
||||
Plug 'aditya-azad/candle-grey'
|
||||
Plug 't184256/vim-boring'
|
||||
Plug 'tek256/simple-dark'
|
||||
Plug 'sainnhe/everforest'
|
||||
Plug 'bluz71/vim-moonfly-colors', { 'as': 'moonfly' }
|
||||
" Plug 'jacoborus/tender.vim'
|
||||
Plug 'cocopon/iceberg.vim'
|
||||
Plug 'catppuccin/nvim', Cond( has('nvim-0.8.2') \|\| g:vim_v >= 900 , { 'as': 'catppuccin' })
|
||||
Plug 'NLKNguyen/papercolor-theme'
|
||||
Plug 'EdenEast/nightfox.nvim', Cond(has('nvim-0.5'))
|
||||
Plug 'projekt0n/github-nvim-theme', Cond(has('nvim-0.5'), { 'tag': 'v0.0.7' })
|
||||
Plug 'folke/tokyonight.nvim', Cond(g:vim_type == 'nvim', { 'branch': 'main' })
|
||||
" Plug 'junegunn/goyo.vim', { 'on': ['Goyo'] }
|
||||
Plug 'andymass/vim-matchup'
|
||||
endif
|
||||
Plug 'Donaldttt/fuzzyy'
|
||||
Plug 'tpope/vim-repeat'
|
||||
Plug 'tpope/vim-fugitive'
|
||||
Plug 'tpope/vim-surround'
|
||||
" Plug 'lervag/vimtex'
|
||||
Plug 'github/copilot.vim', Cond(( g:vim_type == 'nvim' \|\| g:vim_v >= 900 )
|
||||
\ && g:copilot_enable && executable('node'))
|
||||
|
||||
Plug 'nanotee/zoxide.vim', Cond(executable('zoxide'))
|
||||
|
||||
Plug 'godlygeek/tabular'
|
||||
|
||||
Plug 'preservim/vim-markdown'
|
||||
|
||||
Plug 'dstein64/vim-startuptime', Cond(!g:high_performence)
|
||||
Plug 'simeji/winresizer', Cond(!g:high_performence)
|
||||
Plug 'rust-lang/rust.vim', { 'for': ['rust'] }
|
||||
|
||||
Plug 'rhysd/conflict-marker.vim'
|
||||
|
||||
Plug 'jiangmiao/auto-pairs'
|
||||
" Plug 'mg979/vim-visual-multi'
|
||||
Plug 'RRethy/vim-illuminate', Cond(!g:high_performence)
|
||||
" Plug 'ludovicchabant/vim-gutentags'
|
||||
" Plug 'ctrlpvim/ctrlp.vim'
|
||||
|
||||
"" ESSENTIAL_PLUGINS ""
|
||||
|
||||
Plug 'mhinz/vim-startify'
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
" Comment stuff out
|
||||
Plug 'tpope/vim-commentary'
|
||||
Plug 'vim-scripts/restore_view.vim'
|
||||
|
||||
" vim only plugins
|
||||
Plug 'scrooloose/nerdtree', Cond(g:vim_type == 'vim' \|\| !has('nvim-0.8'), { 'on' : ['NERDTreeToggle', 'NERDTreeFind'] })
|
||||
Plug 'tiagofumo/vim-nerdtree-syntax-highlight', Cond(g:vim_type == 'vim' && !g:high_performence)
|
||||
|
||||
Plug 'neoclide/coc.nvim', Cond(g:autocomplte_enable && executable('node'), {'branch': 'release'})
|
||||
" only work with vim
|
||||
if g:vim_type == 'vim'
|
||||
if executable('ctags')
|
||||
Plug 'preservim/tagbar'
|
||||
else
|
||||
Plug 'liuchengxu/vista.vim', Cond(!g:high_performence)
|
||||
endif
|
||||
|
||||
Plug 'airblade/vim-rooter'
|
||||
Plug 'justinmk/vim-sneak'
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
Plug 'chriskempson/base16-vim'
|
||||
" Plug 'Yggdroot/indentLine'
|
||||
" Plug 'Donaldttt/fzf-color-preview', Cond(g:vim_v >= 800, { 'on': ['ColorsPreview', 'AirlinePreview'] })
|
||||
|
||||
Plug 'markonm/traces.vim'
|
||||
Plug 'voldikss/vim-floaterm', Cond(has('terminal') && g:vim_type == 'vim')
|
||||
set encoding=UTF-8
|
||||
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'antoinemadec/coc-fzf', Cond(g:os != 'Windows', {'on': ['CocFzfList']})
|
||||
|
||||
Plug 'Donaldttt/vim-bufferline'
|
||||
|
||||
Plug 'Donaldttt/vim-global-statusline', { 'branch': 'vim9' }
|
||||
" Plug 'vim-airline/vim-airline'
|
||||
" Plug 'vim-airline/vim-airline-themes'
|
||||
|
||||
Plug 'ryanoasis/vim-devicons'
|
||||
Plug 'wfxr/minimap.vim', Cond(executable('code-minimap'), {'on' : ['MinimapToggle']})
|
||||
endif
|
||||
|
||||
if g:vim_type == 'nvim'
|
||||
Plug 'RRethy/nvim-base16'
|
||||
|
||||
if has('nvim-0.5')
|
||||
" Plug 'hkupty/iron.nvim'
|
||||
" Plug 'metakirby5/codi.vim'
|
||||
Plug 'lukas-reineke/indent-blankline.nvim', Cond(!g:animation_enable)
|
||||
Plug 'echasnovski/mini.indentscope', Cond(g:animation_enable)
|
||||
Plug 'echasnovski/mini.animate', Cond(g:animation_enable)
|
||||
|
||||
Plug 'nvim-lualine/lualine.nvim'
|
||||
Plug 'petertriho/nvim-scrollbar', Cond(g:animation_enable)
|
||||
Plug 'folke/which-key.nvim', Cond(!g:high_performence && g:key_prompt)
|
||||
Plug 'ahmedkhalf/project.nvim'
|
||||
endif
|
||||
if has('nvim-0.7')
|
||||
Plug 'stevearc/aerial.nvim'
|
||||
Plug 'nvim-treesitter/nvim-treesitter', Cond(executable('make'), {'do': ':TSUpdate'})
|
||||
|
||||
" for telescope
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
Plug 'nvim-telescope/telescope.nvim', Cond(g:vim_type == 'nvim', { 'branch': '0.1.x' })
|
||||
" c plugin for telescope to make it faster
|
||||
Plug 'nvim-telescope/telescope-fzf-native.nvim', Cond(executable('make'), { 'do': 'make' })
|
||||
|
||||
" comment out this plugin if the machine doesn't have required
|
||||
" font install
|
||||
Plug 'nvim-tree/nvim-web-devicons'
|
||||
Plug 'akinsho/toggleterm.nvim', Cond(g:vim_type == 'nvim', {'tag' : '*'})
|
||||
|
||||
Plug 'ggandor/leap.nvim'
|
||||
endif
|
||||
if has('nvim-0.8')
|
||||
Plug 'nvim-tree/nvim-tree.lua'
|
||||
Plug 'lewis6991/gitsigns.nvim'
|
||||
|
||||
Plug 'rcarriga/nvim-notify', Cond(!g:high_performence && !g:classic_vim_ui)
|
||||
Plug 'folke/noice.nvim', Cond(!g:high_performence && !g:classic_vim_ui)
|
||||
Plug 'MunifTanjim/nui.nvim', Cond(!g:high_performence && !g:classic_vim_ui)
|
||||
endif
|
||||
|
||||
" nvim theme
|
||||
if has('nvim-0.9')
|
||||
Plug 'rebelot/kanagawa.nvim'
|
||||
Plug 'rose-pine/neovim', { 'as': 'rose-pine' }
|
||||
endif
|
||||
endif
|
||||
|
||||
" custom plugin
|
||||
Plug g:dotvimdir
|
||||
call plug#end()
|
||||
|
||||
augroup InitConfig
|
||||
" Automatically install missing plugins at startup
|
||||
autocmd VimEnter *
|
||||
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||
\| PlugInstall --sync | q
|
||||
\| endif
|
||||
augroup end
|
||||
|
||||
"""""" UTILITIES """"""
|
||||
|
||||
" a list of funcref that will be initilized late
|
||||
let g:post_init_func = []
|
||||
|
||||
function RegisterLateInit(func, delay, ...)
|
||||
let Funcref = type(a:func) == 10 ? func : function(a:func)
|
||||
let obj = [Funcref, a:delay, a:000]
|
||||
call add(g:post_init_func, obj)
|
||||
endfunction
|
||||
|
||||
function s:executeLateInit()
|
||||
function s:lateInitHelper(...)
|
||||
for obj in g:post_init_func
|
||||
let Funcref = obj[0]
|
||||
let delay = obj[1]
|
||||
let args = obj[2]
|
||||
if delay == 0
|
||||
if len(args) > 0
|
||||
call Funcref(args)
|
||||
else
|
||||
call Funcref()
|
||||
endif
|
||||
else
|
||||
call timer_start(delay, Funcref)
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
autocmd VimEnter * call s:lateInitHelper()
|
||||
endfunction
|
||||
|
||||
" source all vim specific config eg. gui vim
|
||||
for f in split(glob(g:dotvimdir.'/configs/*-config.vim'), '\n')
|
||||
exe 'source' f
|
||||
endfor
|
||||
|
||||
" source all vim plugin config
|
||||
for f in split(glob(g:dotvimdir.'/vim-plugin-settings/*.config.vim'), '\n')
|
||||
exe 'source' f
|
||||
endfor
|
||||
|
||||
" source all vim9 plugin configs
|
||||
if g:vim_v >= 900
|
||||
for f in split(glob(g:dotvimdir.'/vim-plugin-settings/vim9/*.config.vim'), '\n')
|
||||
exe 'source' f
|
||||
endfor
|
||||
endif
|
||||
|
||||
" source lua plugins if in neovim
|
||||
if has('nvim')
|
||||
lua require('lua-plugin-settings')
|
||||
endif
|
||||
|
||||
" source lua library
|
||||
|
||||
"""""" THEME_CONFIGURATION """"""
|
||||
nmap <Leader>db :call utils#showHiGroup()<CR>
|
||||
|
||||
""" THEME_OPTIONS """
|
||||
|
||||
call theme#Init()
|
||||
|
||||
"""""" KEY_MAPS """"""
|
||||
" (This doesn't include plugin specific mapping.
|
||||
" For them check plugin Preferences)
|
||||
|
||||
nnoremap <leader>ws :call utils#trimwhitespace()<CR>
|
||||
|
||||
" Toggle dark/light theme
|
||||
noremap <silent> <leader>cbg :call theme#toggleBg()<CR>
|
||||
|
||||
" Toggle transparent background
|
||||
noremap <silent> <leader>ctb :call theme#toggleTransparent()<CR>
|
||||
|
||||
" Buffer navigation
|
||||
nnoremap <silent> <space>q :bprevious<CR>
|
||||
nnoremap <silent> <space>e :bnext<CR>
|
||||
|
||||
" leader s change all occurence
|
||||
nnoremap <Leader>s :%s/\<<C-r><C-w>\>/<C-r><C-w>
|
||||
|
||||
noremap <leader>h :noh<CR> " turn off highlight
|
||||
|
||||
" disable two easily mispressed yet useless key
|
||||
nnoremap q: <nop>
|
||||
nnoremap Q <nop>
|
||||
|
||||
" we often press shift key by mistake
|
||||
command WQ wq
|
||||
command Wq wq
|
||||
command W w
|
||||
command Q q
|
||||
|
||||
" leader num change tab
|
||||
" only for vim or nvim without lualine
|
||||
|
||||
if (g:vim_type == 'vim' || !has('nvim-0.5')) && utils#hasplug('vim-bufferline')
|
||||
for i in range(1, 9)
|
||||
execute "nnoremap <silent> <nowait> <leader>" . i .
|
||||
\ " :call bufferline#jump(" . i . ")<CR>"
|
||||
endfor
|
||||
for i in range(10, 20)
|
||||
execute "nnoremap <silent> <nowait> <leader><leader>" . i .
|
||||
\ " :call bufferline#jump(" . i . ")<CR>"
|
||||
endfor
|
||||
end
|
||||
|
||||
" split window comform with other window management shortcuts
|
||||
nnoremap <silent> <C-w>% :vsplit<CR>
|
||||
nnoremap <silent> <C-w>" :split<CR>
|
||||
|
||||
call s:executeLateInit()
|
||||
@@ -0,0 +1,32 @@
|
||||
vim9script
|
||||
|
||||
def Fuzzysearch9(li: list<string>, pattern: string, limit: number): list<any>
|
||||
var opts = {}
|
||||
if limit > 0
|
||||
opts['limit'] = limit
|
||||
endif
|
||||
var results: list<any> = matchfuzzypos(li, pattern, opts)
|
||||
var strs = results[0]
|
||||
var poss = results[1]
|
||||
var scores = results[2]
|
||||
|
||||
# if limit > 0
|
||||
# strs = strs[: limit]
|
||||
# poss = poss[: limit]
|
||||
# scores = scores[: limit]
|
||||
# endif
|
||||
|
||||
var str_list = []
|
||||
var hl_list = []
|
||||
var idx = 0
|
||||
for str in strs
|
||||
add(str_list, str)
|
||||
add(
|
||||
hl_list,
|
||||
[idx + 1, reduce(poss[idx], (acc, val) => add(acc, val + 1), [])])
|
||||
idx += 1
|
||||
endfor
|
||||
return [str_list, hl_list]
|
||||
enddef
|
||||
|
||||
Fuzzysearch9(['foo', 'bar', 'baz'], 'ba', 0)
|
||||
@@ -1,268 +0,0 @@
|
||||
|
||||
" This file stores helper functions
|
||||
|
||||
function! Notify(msg)
|
||||
echo msg
|
||||
endfunction
|
||||
|
||||
" Check if plugin exists
|
||||
function! HasPlug(plug_name, ...)
|
||||
let plug_dir_name = get(a:, 1, a:plug_name) " optional argument for the name of plug's folder
|
||||
if has_key(g:plugs, a:plug_name) && isdirectory(g:plugin_dir . "/" . plug_dir_name)
|
||||
if has_key(g:plugs[a:plug_name], 'for') || has_key(g:plugs[a:plug_name], 'on')
|
||||
if (has_key(g:plugs[a:plug_name], 'for') && len(g:plugs[a:plug_name]['for']) == 0) ||
|
||||
\ (has_key(g:plugs[a:plug_name], 'on') && len(g:plugs[a:plug_name]['on']) == 0)
|
||||
return v:false
|
||||
endif
|
||||
endif
|
||||
return v:true
|
||||
endif
|
||||
return v:false
|
||||
endfunction
|
||||
|
||||
" This function is used to save a variable to a file
|
||||
function! SaveVariable(var, file)
|
||||
let serialized = string(a:var)
|
||||
call writefile([serialized], a:file)
|
||||
endfun
|
||||
|
||||
" This function is used to retrieve a variable from a file
|
||||
" only first line is count
|
||||
function! ReadVariable(file)
|
||||
if !filereadable(a:file)
|
||||
return v:null
|
||||
endif
|
||||
let serialized = readfile(a:file)
|
||||
if(len(serialized) == 0)
|
||||
return v:null
|
||||
endif
|
||||
execute "let result = " . serialized[0]
|
||||
return result
|
||||
endfun
|
||||
|
||||
" Merge two dictionaries, also recursively merging nested keys.
|
||||
" Use extend() if you don't need to merge nested keys.
|
||||
fun! Merge(defaults, override)
|
||||
let l:new = copy(a:defaults)
|
||||
for [l:k, l:v] in items(a:override)
|
||||
let l:new[l:k] = (type(l:v) is v:t_dict && type(get(l:new, l:k)) is v:t_dict)
|
||||
\ ? Merge(l:new[l:k], l:v)
|
||||
\ : l:v
|
||||
endfor
|
||||
return l:new
|
||||
endfun
|
||||
|
||||
function! Sh(pattern)
|
||||
execute("filter /" . a:pattern . "/ highlight")
|
||||
endfunc
|
||||
|
||||
" get current colorscheme name
|
||||
function! ColourSchemeName()
|
||||
try
|
||||
return g:colors_name
|
||||
catch /^Vim:E121/
|
||||
return "default"
|
||||
catch /.*/
|
||||
return "default"
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" debug function print out highlight group of cursor position
|
||||
function! ShowHighLightGroup()
|
||||
if !exists("*synstack")
|
||||
return
|
||||
endif
|
||||
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
||||
|
||||
:echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
|
||||
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
|
||||
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"
|
||||
|
||||
endfunc
|
||||
|
||||
" get highlight group information and return as dictionary
|
||||
function! GetHighlight(group)
|
||||
let output = execute('hi ' . a:group)
|
||||
let list = split(output, '\s\+')
|
||||
let dict = {}
|
||||
for item in list
|
||||
if match(item, '=') > 0
|
||||
let splited = split(item, '=')
|
||||
let dict[splited[0]] = splited[1]
|
||||
endif
|
||||
endfor
|
||||
return dict
|
||||
endfunction
|
||||
|
||||
function! InTransparentMode()
|
||||
let dict = GetHighlight('Normal')
|
||||
let isGui = &termguicolors
|
||||
if isGui
|
||||
if !has_key(dict, 'guibg')
|
||||
return 1
|
||||
endif
|
||||
elseif !isGui
|
||||
if !has_key(dict, 'ctermfg')
|
||||
return 1
|
||||
endif
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! HasColorscheme(name)
|
||||
let scheme = a:name
|
||||
let colors = globpath(&runtimepath, printf('colors/%s.vim', scheme), 1, 1)
|
||||
if len(colors) > 0 | return 1 | endif
|
||||
let colors += globpath(&packpath, printf('pack/*/start/*/colors/%s.vim', scheme), 1, 1)
|
||||
if len(colors) > 0 | return 1 | endif
|
||||
let colors += globpath(&packpath, printf('pack/*/opt/*/colors/%s.vim', scheme), 1, 1)
|
||||
if len(colors) > 0 | return 1 | endif
|
||||
if has('nvim')
|
||||
let colors = globpath(&runtimepath, printf('colors/%s.lua', scheme), 1, 1)
|
||||
if len(colors) > 0 | return 1 | endif
|
||||
let colors += globpath(&packpath, printf('pack/*/start/*/colors/%s.lua', scheme), 1, 1)
|
||||
if len(colors) > 0 | return 1 | endif
|
||||
let colors += globpath(&packpath, printf('pack/*/opt/*/colors/%s.lua', scheme), 1, 1)
|
||||
if len(colors) > 0 | return 1 | endif
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" delete signal file if exist
|
||||
function! DeleteSignalFile(name)
|
||||
if filereadable(g:vim_dir . a:name)
|
||||
call delete(g:vim_dir . a:name)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Create signal file if not exist
|
||||
function! CreateSignalFile(name)
|
||||
call system("touch " . g:vim_dir . a:name)
|
||||
endfunction
|
||||
|
||||
function! SignalFileExists(filename)
|
||||
if filereadable(g:vim_dir . a:filename)
|
||||
return v:true
|
||||
endif
|
||||
return v:false
|
||||
endfunction
|
||||
|
||||
" Debug related
|
||||
if g:debug_mode
|
||||
let g:debug_logs = []
|
||||
|
||||
function! Debugstats()
|
||||
let d = {}
|
||||
let d['filetype'] = &ft
|
||||
let d['buftype'] = &buftype
|
||||
let d['winid'] = win_getid()
|
||||
return d
|
||||
endfunction
|
||||
endif
|
||||
|
||||
|
||||
" Swap values under cursor according to g:swap_dict
|
||||
" {
|
||||
function SwapWord()
|
||||
let word = expand("<cword>")
|
||||
let l1 = g:swap_dict[0]
|
||||
let l2 = g:swap_dict[1]
|
||||
let inx = index(l1, word)
|
||||
if inx != -1
|
||||
let newword = l2[inx]
|
||||
else
|
||||
let inx = index(l2, word)
|
||||
if inx != -1
|
||||
let newword = l1[inx]
|
||||
endif
|
||||
endif
|
||||
if inx != -1
|
||||
execute "normal ciw" . newword . "\<Esc>"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" }
|
||||
|
||||
function! GenVimAsciiArt(buffer_str_len)
|
||||
let buf_str = repeat(' ', a:buffer_str_len)
|
||||
if has('nvim')
|
||||
let ascii_art = [
|
||||
\ buf_str . ' __ __ ________ ______ __ __ ______ __ __ ',
|
||||
\ buf_str . '| \ | \| \ / \ | \ | \| \| \ / \',
|
||||
\ buf_str . '| $$\ | $$| $$$$$$$$| $$$$$$\| $$ | $$ \$$$$$$| $$\ / $$',
|
||||
\ buf_str . '| $$$\| $$| $$__ | $$ | $$| $$ | $$ | $$ | $$$\ / $$$',
|
||||
\ buf_str . '| $$$$\ $$| $$ \ | $$ | $$ \$$\ / $$ | $$ | $$$$\ $$$$',
|
||||
\ buf_str . '| $$\$$ $$| $$$$$ | $$ | $$ \$$\ $$ | $$ | $$\$$ $$ $$',
|
||||
\ buf_str . '| $$ \$$$$| $$_____ | $$__/ $$ \$$ $$ _| $$_ | $$ \$$$| $$',
|
||||
\ buf_str . '| $$ \$$$| $$ \ \$$ $$ \$$$ | $$ \| $$ \$ | $$',
|
||||
\ buf_str . ' \$$ \$$ \$$$$$$$$ \$$$$$$ \$ \$$$$$$ \$$ \$$',
|
||||
\]
|
||||
else
|
||||
let ascii_art = [
|
||||
\ buf_str . ' __ __ ______ __ __ ',
|
||||
\ buf_str . '| \ | \| \| \ / \',
|
||||
\ buf_str . '| $$ | $$ \$$$$$$| $$\ / $$',
|
||||
\ buf_str . '| $$ | $$ | $$ | $$$\ / $$$',
|
||||
\ buf_str . ' \$$\ / $$ | $$ | $$$$\ $$$$',
|
||||
\ buf_str . ' \$$\ $$ | $$ | $$\$$ $$ $$',
|
||||
\ buf_str . ' \$$ $$ _| $$_ | $$ \$$$| $$',
|
||||
\ buf_str . ' \$$$ | $$ \| $$ \$ | $$',
|
||||
\ buf_str . ' \$ \$$$$$$ \$$ \$$',
|
||||
\]
|
||||
endif
|
||||
return ascii_art
|
||||
endfunction
|
||||
|
||||
"Remove all trailing whitespace by pressing <leader>ws
|
||||
fun! TrimWhitespace()
|
||||
let l:save = winsaveview()
|
||||
keeppatterns %s/\s\+$//e
|
||||
call winrestview(l:save)
|
||||
endfun
|
||||
|
||||
|
||||
""" AIRLINE EXTENSIONS """
|
||||
if HasPlug('vim-airline')
|
||||
|
||||
function! AirlineCocStatus()
|
||||
if ! exists('*CocAction')
|
||||
return
|
||||
endif
|
||||
" let loading = ["⢿", "⣻", "⣽", "⣾", "⣷", "⣯", "⣟", "⡿"]
|
||||
let loading = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
|
||||
try
|
||||
let result = CocAction('services')
|
||||
catch
|
||||
return
|
||||
endtry
|
||||
let state = ''
|
||||
let id = ''
|
||||
for e in result
|
||||
if e['languageIds'][0] == &ft
|
||||
let state = e['state']
|
||||
let id = e['id']
|
||||
endif
|
||||
endfor
|
||||
|
||||
" messy way to get time in millisecond in vim
|
||||
let time = float2nr(str2float(reltime()->reltimestr()[4:]) * 1000)
|
||||
let speed = 800
|
||||
let loadidx = time % speed
|
||||
let msg = 'lsp:' . id
|
||||
if state == "starting"
|
||||
let s:coc_lsp_loading = 1
|
||||
return msg . " " . loading[loadidx/(speed/10)] . " "
|
||||
elseif state == "running"
|
||||
if exists('s:coc_lsp_loading')
|
||||
unlet s:coc_lsp_loading
|
||||
endif
|
||||
return msg . " ✔ "
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! AirlineBufferNumber()
|
||||
return len(g:index_to_buffer)
|
||||
endfunction
|
||||
endif
|
||||
""" AIRLINE EXTENSIONS END """
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
rm -rf ~/.vim/.vim*
|
||||
rm ~/.viminfo
|
||||
@@ -1,18 +0,0 @@
|
||||
|
||||
# Windows Tips
|
||||
|
||||
## Install vim
|
||||
|
||||
Probably need to install bulid tool through scoop(like gcc)
|
||||
|
||||
Config powershell as emac style
|
||||
|
||||
put this line into powershell's config file(which is in $profile)
|
||||
`batch
|
||||
Set-PSReadLineOption -EditMode Emacs
|
||||
`
|
||||
|
||||
*you may run into error about execution policy, then you need to set the policy with this command*
|
||||
`
|
||||
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
|
||||
`
|
||||
Reference in New Issue
Block a user