retrovim 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.conda/retrovim.yaml +259 -0
- package/.conda/terax.icns +0 -0
- package/.conda/terax.ico +0 -0
- package/.conda/terax.png +0 -0
- package/.github/workflows/release.yml +95 -0
- package/.gitmodules +3 -0
- package/.npm/kanata_touchcursor.js +28 -0
- package/.npm/nvim.js +26 -0
- package/.npm/yazi.js +26 -0
- package/.npm/zsh.js +17 -0
- package/.pip/kanata_touchcursor/__init__.py +28 -0
- package/.pip/nvim/__init__.py +31 -0
- package/.pip/yazi/__init__.py +31 -0
- package/.pip/zsh/__init__.py +22 -0
- package/CHANGELOG.md +26 -0
- package/LICENSE +674 -0
- package/README.md +336 -0
- package/kanata/touchcursor.kbd +164 -0
- package/nvim/init.lua +813 -0
- package/nvim/plugins/mini.nvim/.github/DISCUSSION_TEMPLATE/q-a.yml +72 -0
- package/nvim/plugins/mini.nvim/.github/ISSUE_TEMPLATE/bug-report.yml +136 -0
- package/nvim/plugins/mini.nvim/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/nvim/plugins/mini.nvim/.github/ISSUE_TEMPLATE/feature-request.yml +75 -0
- package/nvim/plugins/mini.nvim/.github/PULL_REQUEST_TEMPLATE.md +2 -0
- package/nvim/plugins/mini.nvim/.github/workflows/quality-control.yml +150 -0
- package/nvim/plugins/mini.nvim/.pre-commit-config.yaml +20 -0
- package/nvim/plugins/mini.nvim/.stylua.toml +7 -0
- package/nvim/plugins/mini.nvim/.styluaignore +1 -0
- package/nvim/plugins/mini.nvim/CHANGELOG.md +1894 -0
- package/nvim/plugins/mini.nvim/CODE_OF_CONDUCT.md +132 -0
- package/nvim/plugins/mini.nvim/CONTRIBUTING.md +331 -0
- package/nvim/plugins/mini.nvim/LICENSE +21 -0
- package/nvim/plugins/mini.nvim/MAINTAINING.md +330 -0
- package/nvim/plugins/mini.nvim/Makefile +51 -0
- package/nvim/plugins/mini.nvim/README.md +261 -0
- package/nvim/plugins/mini.nvim/TESTING.md +1011 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/README.md +35 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/benchmark.sh +56 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_dashboard-alpha.lua +21 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_dashboard-original.lua +17 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_dashboard-starter.lua +18 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_empty.lua +4 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_starter-default.lua +7 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_startify-alpha.lua +10 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_startify-original.lua +7 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_startify-starter.lua +20 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/install.sh +10 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/make_summary.py +68 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/startup-summary.md +10 -0
- package/nvim/plugins/mini.nvim/colors/miniautumn.lua +55 -0
- package/nvim/plugins/mini.nvim/colors/minicyan.lua +95 -0
- package/nvim/plugins/mini.nvim/colors/minischeme.lua +95 -0
- package/nvim/plugins/mini.nvim/colors/minispring.lua +53 -0
- package/nvim/plugins/mini.nvim/colors/minisummer.lua +49 -0
- package/nvim/plugins/mini.nvim/colors/miniwinter.lua +51 -0
- package/nvim/plugins/mini.nvim/colors/randomhue.lua +16 -0
- package/nvim/plugins/mini.nvim/doc/mini-ai.txt +889 -0
- package/nvim/plugins/mini.nvim/doc/mini-align.txt +923 -0
- package/nvim/plugins/mini.nvim/doc/mini-animate.txt +937 -0
- package/nvim/plugins/mini.nvim/doc/mini-base16.txt +285 -0
- package/nvim/plugins/mini.nvim/doc/mini-basics.txt +359 -0
- package/nvim/plugins/mini.nvim/doc/mini-bracketed.txt +622 -0
- package/nvim/plugins/mini.nvim/doc/mini-bufremove.txt +123 -0
- package/nvim/plugins/mini.nvim/doc/mini-clue.txt +760 -0
- package/nvim/plugins/mini.nvim/doc/mini-cmdline.txt +392 -0
- package/nvim/plugins/mini.nvim/doc/mini-colors.txt +880 -0
- package/nvim/plugins/mini.nvim/doc/mini-comment.txt +230 -0
- package/nvim/plugins/mini.nvim/doc/mini-completion.txt +477 -0
- package/nvim/plugins/mini.nvim/doc/mini-cursorword.txt +105 -0
- package/nvim/plugins/mini.nvim/doc/mini-deps.txt +590 -0
- package/nvim/plugins/mini.nvim/doc/mini-diff.txt +661 -0
- package/nvim/plugins/mini.nvim/doc/mini-doc.txt +434 -0
- package/nvim/plugins/mini.nvim/doc/mini-extra.txt +856 -0
- package/nvim/plugins/mini.nvim/doc/mini-files.txt +1018 -0
- package/nvim/plugins/mini.nvim/doc/mini-fuzzy.txt +160 -0
- package/nvim/plugins/mini.nvim/doc/mini-git.txt +425 -0
- package/nvim/plugins/mini.nvim/doc/mini-hipatterns.txt +489 -0
- package/nvim/plugins/mini.nvim/doc/mini-hues.txt +420 -0
- package/nvim/plugins/mini.nvim/doc/mini-icons.txt +508 -0
- package/nvim/plugins/mini.nvim/doc/mini-indentscope.txt +485 -0
- package/nvim/plugins/mini.nvim/doc/mini-input.txt +932 -0
- package/nvim/plugins/mini.nvim/doc/mini-jump.txt +202 -0
- package/nvim/plugins/mini.nvim/doc/mini-jump2d.txt +525 -0
- package/nvim/plugins/mini.nvim/doc/mini-keymap.txt +449 -0
- package/nvim/plugins/mini.nvim/doc/mini-map.txt +717 -0
- package/nvim/plugins/mini.nvim/doc/mini-misc.txt +431 -0
- package/nvim/plugins/mini.nvim/doc/mini-move.txt +181 -0
- package/nvim/plugins/mini.nvim/doc/mini-notify.txt +434 -0
- package/nvim/plugins/mini.nvim/doc/mini-nvim.txt +431 -0
- package/nvim/plugins/mini.nvim/doc/mini-operators.txt +472 -0
- package/nvim/plugins/mini.nvim/doc/mini-pairs.txt +346 -0
- package/nvim/plugins/mini.nvim/doc/mini-pick.txt +1535 -0
- package/nvim/plugins/mini.nvim/doc/mini-sessions.txt +239 -0
- package/nvim/plugins/mini.nvim/doc/mini-snippets.txt +1291 -0
- package/nvim/plugins/mini.nvim/doc/mini-splitjoin.txt +536 -0
- package/nvim/plugins/mini.nvim/doc/mini-starter.txt +618 -0
- package/nvim/plugins/mini.nvim/doc/mini-statusline.txt +361 -0
- package/nvim/plugins/mini.nvim/doc/mini-surround.txt +863 -0
- package/nvim/plugins/mini.nvim/doc/mini-tabline.txt +151 -0
- package/nvim/plugins/mini.nvim/doc/mini-test.txt +966 -0
- package/nvim/plugins/mini.nvim/doc/mini-trailspace.txt +91 -0
- package/nvim/plugins/mini.nvim/doc/mini-visits.txt +937 -0
- package/nvim/plugins/mini.nvim/logo.png +0 -0
- package/nvim/plugins/mini.nvim/lua/mini/ai.lua +2244 -0
- package/nvim/plugins/mini.nvim/lua/mini/align.lua +2076 -0
- package/nvim/plugins/mini.nvim/lua/mini/animate.lua +2127 -0
- package/nvim/plugins/mini.nvim/lua/mini/base16.lua +1752 -0
- package/nvim/plugins/mini.nvim/lua/mini/basics.lua +772 -0
- package/nvim/plugins/mini.nvim/lua/mini/bracketed.lua +2013 -0
- package/nvim/plugins/mini.nvim/lua/mini/bufremove.lua +283 -0
- package/nvim/plugins/mini.nvim/lua/mini/clue.lua +2096 -0
- package/nvim/plugins/mini.nvim/lua/mini/cmdline.lua +1182 -0
- package/nvim/plugins/mini.nvim/lua/mini/colors.lua +2483 -0
- package/nvim/plugins/mini.nvim/lua/mini/comment.lua +586 -0
- package/nvim/plugins/mini.nvim/lua/mini/completion.lua +2094 -0
- package/nvim/plugins/mini.nvim/lua/mini/cursorword.lua +311 -0
- package/nvim/plugins/mini.nvim/lua/mini/deps.lua +1660 -0
- package/nvim/plugins/mini.nvim/lua/mini/diff.lua +1938 -0
- package/nvim/plugins/mini.nvim/lua/mini/doc.lua +1371 -0
- package/nvim/plugins/mini.nvim/lua/mini/extra.lua +2290 -0
- package/nvim/plugins/mini.nvim/lua/mini/files.lua +3145 -0
- package/nvim/plugins/mini.nvim/lua/mini/fuzzy.lua +356 -0
- package/nvim/plugins/mini.nvim/lua/mini/git.lua +1737 -0
- package/nvim/plugins/mini.nvim/lua/mini/hipatterns.lua +1042 -0
- package/nvim/plugins/mini.nvim/lua/mini/hues.lua +2088 -0
- package/nvim/plugins/mini.nvim/lua/mini/icons.lua +2254 -0
- package/nvim/plugins/mini.nvim/lua/mini/indentscope.lua +1158 -0
- package/nvim/plugins/mini.nvim/lua/mini/init.lua +427 -0
- package/nvim/plugins/mini.nvim/lua/mini/input.lua +2183 -0
- package/nvim/plugins/mini.nvim/lua/mini/jump.lua +609 -0
- package/nvim/plugins/mini.nvim/lua/mini/jump2d.lua +1244 -0
- package/nvim/plugins/mini.nvim/lua/mini/keymap.lua +880 -0
- package/nvim/plugins/mini.nvim/lua/mini/map.lua +1709 -0
- package/nvim/plugins/mini.nvim/lua/mini/misc.lua +969 -0
- package/nvim/plugins/mini.nvim/lua/mini/move.lua +509 -0
- package/nvim/plugins/mini.nvim/lua/mini/notify.lua +938 -0
- package/nvim/plugins/mini.nvim/lua/mini/operators.lua +1349 -0
- package/nvim/plugins/mini.nvim/lua/mini/pairs.lua +657 -0
- package/nvim/plugins/mini.nvim/lua/mini/pick.lua +3876 -0
- package/nvim/plugins/mini.nvim/lua/mini/sessions.lua +689 -0
- package/nvim/plugins/mini.nvim/lua/mini/snippets.lua +2828 -0
- package/nvim/plugins/mini.nvim/lua/mini/splitjoin.lua +1132 -0
- package/nvim/plugins/mini.nvim/lua/mini/starter.lua +1599 -0
- package/nvim/plugins/mini.nvim/lua/mini/statusline.lua +686 -0
- package/nvim/plugins/mini.nvim/lua/mini/surround.lua +2388 -0
- package/nvim/plugins/mini.nvim/lua/mini/tabline.lua +564 -0
- package/nvim/plugins/mini.nvim/lua/mini/test.lua +2516 -0
- package/nvim/plugins/mini.nvim/lua/mini/trailspace.lua +215 -0
- package/nvim/plugins/mini.nvim/lua/mini/visits.lua +1577 -0
- package/nvim/plugins/mini.nvim/readmes/mini-ai.md +190 -0
- package/nvim/plugins/mini.nvim/readmes/mini-align.md +203 -0
- package/nvim/plugins/mini.nvim/readmes/mini-animate.md +214 -0
- package/nvim/plugins/mini.nvim/readmes/mini-base16.md +198 -0
- package/nvim/plugins/mini.nvim/readmes/mini-basics.md +184 -0
- package/nvim/plugins/mini.nvim/readmes/mini-bracketed.md +193 -0
- package/nvim/plugins/mini.nvim/readmes/mini-bufremove.md +139 -0
- package/nvim/plugins/mini.nvim/readmes/mini-clue.md +260 -0
- package/nvim/plugins/mini.nvim/readmes/mini-cmdline.md +183 -0
- package/nvim/plugins/mini.nvim/readmes/mini-colors.md +169 -0
- package/nvim/plugins/mini.nvim/readmes/mini-comment.md +183 -0
- package/nvim/plugins/mini.nvim/readmes/mini-completion.md +217 -0
- package/nvim/plugins/mini.nvim/readmes/mini-cursorword.md +137 -0
- package/nvim/plugins/mini.nvim/readmes/mini-deps.md +271 -0
- package/nvim/plugins/mini.nvim/readmes/mini-diff.md +289 -0
- package/nvim/plugins/mini.nvim/readmes/mini-doc.md +198 -0
- package/nvim/plugins/mini.nvim/readmes/mini-extra.md +158 -0
- package/nvim/plugins/mini.nvim/readmes/mini-files.md +247 -0
- package/nvim/plugins/mini.nvim/readmes/mini-fuzzy.md +134 -0
- package/nvim/plugins/mini.nvim/readmes/mini-git.md +168 -0
- package/nvim/plugins/mini.nvim/readmes/mini-hipatterns.md +176 -0
- package/nvim/plugins/mini.nvim/readmes/mini-hues.md +285 -0
- package/nvim/plugins/mini.nvim/readmes/mini-icons.md +183 -0
- package/nvim/plugins/mini.nvim/readmes/mini-indentscope.md +191 -0
- package/nvim/plugins/mini.nvim/readmes/mini-input.md +163 -0
- package/nvim/plugins/mini.nvim/readmes/mini-jump.md +161 -0
- package/nvim/plugins/mini.nvim/readmes/mini-jump2d.md +197 -0
- package/nvim/plugins/mini.nvim/readmes/mini-keymap.md +205 -0
- package/nvim/plugins/mini.nvim/readmes/mini-map.md +191 -0
- package/nvim/plugins/mini.nvim/readmes/mini-misc.md +145 -0
- package/nvim/plugins/mini.nvim/readmes/mini-move.md +163 -0
- package/nvim/plugins/mini.nvim/readmes/mini-notify.md +175 -0
- package/nvim/plugins/mini.nvim/readmes/mini-operators.md +193 -0
- package/nvim/plugins/mini.nvim/readmes/mini-pairs.md +158 -0
- package/nvim/plugins/mini.nvim/readmes/mini-pick.md +340 -0
- package/nvim/plugins/mini.nvim/readmes/mini-sessions.md +164 -0
- package/nvim/plugins/mini.nvim/readmes/mini-snippets.md +373 -0
- package/nvim/plugins/mini.nvim/readmes/mini-splitjoin.md +194 -0
- package/nvim/plugins/mini.nvim/readmes/mini-starter.md +176 -0
- package/nvim/plugins/mini.nvim/readmes/mini-statusline.md +155 -0
- package/nvim/plugins/mini.nvim/readmes/mini-surround.md +190 -0
- package/nvim/plugins/mini.nvim/readmes/mini-tabline.md +156 -0
- package/nvim/plugins/mini.nvim/readmes/mini-test.md +175 -0
- package/nvim/plugins/mini.nvim/readmes/mini-trailspace.md +137 -0
- package/nvim/plugins/mini.nvim/readmes/mini-visits.md +243 -0
- package/nvim/plugins/mini.nvim/scripts/dual_log.sh +13 -0
- package/nvim/plugins/mini.nvim/scripts/dual_push.sh +15 -0
- package/nvim/plugins/mini.nvim/scripts/dual_release.sh +102 -0
- package/nvim/plugins/mini.nvim/scripts/dual_sync.sh +115 -0
- package/nvim/plugins/mini.nvim/scripts/init-deps-example.lua +59 -0
- package/nvim/plugins/mini.nvim/scripts/lint-filename-length.sh +16 -0
- package/nvim/plugins/mini.nvim/scripts/lintcommit-ci.sh +18 -0
- package/nvim/plugins/mini.nvim/scripts/lintcommit.lua +393 -0
- package/nvim/plugins/mini.nvim/scripts/minidoc.lua +57 -0
- package/nvim/plugins/mini.nvim/scripts/minimal_init.lua +28 -0
- package/nvim/plugins/mini.nvim/scripts/minitest.lua +4 -0
- package/package.json +16 -0
- package/pyproject.toml +43 -0
- package/yazi/init.lua +12 -0
- package/yazi/keymap.toml +114 -0
- package/yazi/lesskey +5 -0
- package/yazi/plugins/bookmarks.yazi/main.lua +86 -0
- package/yazi/plugins/cd-git-root.yazi/main.lua +31 -0
- package/yazi/plugins/smart-enter.yazi/main.lua +11 -0
- package/yazi/theme.toml +26 -0
- package/yazi/yazi.toml +15 -0
- package/zsh/.zshrc +145 -0
- package/zsh/starship.toml +20 -0
- package/zsh/zsh-patina.toml +2 -0
|
@@ -0,0 +1,938 @@
|
|
|
1
|
+
--- *mini.notify* Show notifications
|
|
2
|
+
---
|
|
3
|
+
--- MIT License Copyright (c) 2024 Evgeni Chasnovski
|
|
4
|
+
|
|
5
|
+
--- Features:
|
|
6
|
+
---
|
|
7
|
+
--- - Show one or more highlighted notifications in a single floating window.
|
|
8
|
+
---
|
|
9
|
+
--- - Manage notifications (add, update, remove, clear).
|
|
10
|
+
---
|
|
11
|
+
--- - Custom |vim.notify()| implementation. To adjust, use |MiniNotify.make_notify()|
|
|
12
|
+
--- or save-restore `vim.notify` manually after calling |MiniNotify.setup()|.
|
|
13
|
+
---
|
|
14
|
+
--- - Automated show of LSP progress report.
|
|
15
|
+
---
|
|
16
|
+
--- - Track history which can be accessed with |MiniNotify.get_all()|
|
|
17
|
+
--- and shown with |MiniNotify.show_history()|.
|
|
18
|
+
---
|
|
19
|
+
--- # Setup ~
|
|
20
|
+
---
|
|
21
|
+
--- This module needs a setup with `require('mini.notify').setup({})` (replace
|
|
22
|
+
--- `{}` with your `config` table). It will create global Lua table `MiniNotify`
|
|
23
|
+
--- which you can use for scripting or manually (with `:lua MiniNotify.*`).
|
|
24
|
+
---
|
|
25
|
+
--- See |MiniNotify.config| for `config` structure and default values.
|
|
26
|
+
---
|
|
27
|
+
--- You can override runtime config settings locally to buffer inside
|
|
28
|
+
--- `vim.b.mininotify_config` which should have same structure as
|
|
29
|
+
--- `MiniNotify.config`. See |mini.nvim-buffer-local-config| for more details.
|
|
30
|
+
---
|
|
31
|
+
--- # Comparisons ~
|
|
32
|
+
---
|
|
33
|
+
--- - [j-hui/fidget.nvim](https://github.com/j-hui/fidget.nvim):
|
|
34
|
+
--- - Basic goals of providing interface for notifications are similar.
|
|
35
|
+
--- - Has more configuration options and visual effects, while this module
|
|
36
|
+
--- does not (by design).
|
|
37
|
+
---
|
|
38
|
+
--- - [rcarriga/nvim-notify](https://github.com/rcarriga/nvim-notify):
|
|
39
|
+
--- - Similar to `j-hui/fidget.nvim`.
|
|
40
|
+
---
|
|
41
|
+
--- # Highlight groups ~
|
|
42
|
+
--- *MiniNotify-hl-groups*
|
|
43
|
+
---
|
|
44
|
+
--- - `MiniNotifyBorder` - window border.
|
|
45
|
+
--- - `MiniNotifyLspProgress` - notifications from built-in LSP progress report.
|
|
46
|
+
--- - `MiniNotifyNormal` - basic foreground/background highlighting.
|
|
47
|
+
--- - `MiniNotifyTitle` - window title.
|
|
48
|
+
---
|
|
49
|
+
--- To change any highlight group, set it directly with |nvim_set_hl()|.
|
|
50
|
+
---
|
|
51
|
+
--- NOTE: |vim.notify()| override after |MiniNotify.make_notify()| uses own
|
|
52
|
+
--- highlight groups per notification level.
|
|
53
|
+
---
|
|
54
|
+
--- # Disabling ~
|
|
55
|
+
---
|
|
56
|
+
--- To disable showing notifications, set `vim.g.mininotify_disable` (globally) or
|
|
57
|
+
--- `vim.b.mininotify_disable` (for a buffer) to `true`. Considering high number
|
|
58
|
+
--- of different scenarios and customization intentions, writing exact rules
|
|
59
|
+
--- for disabling module's functionality is left to user. See
|
|
60
|
+
--- |mini.nvim-disabling-recipes| for common recipes.
|
|
61
|
+
---@tag MiniNotify
|
|
62
|
+
|
|
63
|
+
--- # Notification specification ~
|
|
64
|
+
---
|
|
65
|
+
--- Notification is a table with the following keys:
|
|
66
|
+
---
|
|
67
|
+
--- - <msg> `(string)` - single string with notification message.
|
|
68
|
+
--- Use `\n` to delimit several lines.
|
|
69
|
+
--- - <level> `(string)` - notification level as key of |vim.log.levels|.
|
|
70
|
+
--- Like "ERROR", "WARN", "INFO", etc.
|
|
71
|
+
--- - <hl_group> `(string)` - highlight group with which notification is shown.
|
|
72
|
+
--- - <data> `(table)` - extra data to store in notification (like `source`, etc.).
|
|
73
|
+
--- - <ts_add> `(number)` - timestamp of when notification is added.
|
|
74
|
+
--- - <ts_update> `(number)` - timestamp of the latest notification update.
|
|
75
|
+
--- - <ts_remove> `(number|nil)` - timestamp of when notification is removed.
|
|
76
|
+
--- It is `nil` if notification was never removed and thus considered "active".
|
|
77
|
+
---
|
|
78
|
+
--- Notes:
|
|
79
|
+
--- - Timestamps are compatible with |strftime()| and have fractional part.
|
|
80
|
+
---@tag MiniNotify-specification
|
|
81
|
+
|
|
82
|
+
---@diagnostic disable:undefined-field
|
|
83
|
+
---@diagnostic disable:discard-returns
|
|
84
|
+
---@diagnostic disable:unused-local
|
|
85
|
+
---@diagnostic disable:cast-local-type
|
|
86
|
+
---@diagnostic disable:undefined-doc-name
|
|
87
|
+
---@diagnostic disable:luadoc-miss-type-name
|
|
88
|
+
|
|
89
|
+
-- Module definition ==========================================================
|
|
90
|
+
local MiniNotify = {}
|
|
91
|
+
local H = {}
|
|
92
|
+
|
|
93
|
+
--- Module setup
|
|
94
|
+
---
|
|
95
|
+
--- This will also:
|
|
96
|
+
--- - Set |vim.notify()| custom implementation (see |MiniNotify.make_notify()|).
|
|
97
|
+
--- - Clean the history. Use `MiniNotify.setup(MiniNotify.config)` to force
|
|
98
|
+
--- clean history while preserving the config.
|
|
99
|
+
---
|
|
100
|
+
---@param config table|nil Module config table. See |MiniNotify.config|.
|
|
101
|
+
---
|
|
102
|
+
---@usage >lua
|
|
103
|
+
--- require('mini.notify').setup() -- use default config
|
|
104
|
+
--- -- OR
|
|
105
|
+
--- require('mini.notify').setup({}) -- replace {} with your config table
|
|
106
|
+
--- <
|
|
107
|
+
MiniNotify.setup = function(config)
|
|
108
|
+
-- TODO: Remove after Neovim=0.9 support is dropped
|
|
109
|
+
if vim.fn.has('nvim-0.10') == 0 then
|
|
110
|
+
vim.notify(
|
|
111
|
+
'(mini.notify) Neovim<0.10 is soft deprecated (module works but is not supported).'
|
|
112
|
+
.. " It will be deprecated after the next 'mini.nvim' release (module might not work)."
|
|
113
|
+
.. ' Please update your Neovim version.'
|
|
114
|
+
)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
-- Export module
|
|
118
|
+
_G.MiniNotify = MiniNotify
|
|
119
|
+
|
|
120
|
+
-- Setup config
|
|
121
|
+
config = H.setup_config(config)
|
|
122
|
+
|
|
123
|
+
-- Apply config
|
|
124
|
+
H.apply_config(config)
|
|
125
|
+
|
|
126
|
+
-- Define behavior
|
|
127
|
+
H.create_autocommands()
|
|
128
|
+
|
|
129
|
+
-- Create default highlighting
|
|
130
|
+
H.create_default_hl()
|
|
131
|
+
|
|
132
|
+
-- Set custom implementation
|
|
133
|
+
vim.notify = MiniNotify.make_notify()
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
--- Defaults ~
|
|
137
|
+
---@eval return MiniDoc.afterlines_to_code(MiniDoc.current.eval_section)
|
|
138
|
+
---@text # Content ~
|
|
139
|
+
---
|
|
140
|
+
--- `config.content` defines how notifications are shown.
|
|
141
|
+
---
|
|
142
|
+
--- `content.format` is a function which takes single notification object
|
|
143
|
+
--- (see |MiniNotify-specification|) and returns a string to be used directly
|
|
144
|
+
--- when showing notification.
|
|
145
|
+
--- Default: `nil` for |MiniNotify.default_format()|.
|
|
146
|
+
---
|
|
147
|
+
--- `content.sort` is a function which takes array of notification objects
|
|
148
|
+
--- (see |MiniNotify-specification|) and returns an array of such objects.
|
|
149
|
+
--- It can be used to define custom order and/or filter for notifications which
|
|
150
|
+
--- are shown simultaneously.
|
|
151
|
+
--- Note: Input contains notifications before applying `content.format`.
|
|
152
|
+
--- Default: `nil` for |MiniNotify.default_sort()|.
|
|
153
|
+
---
|
|
154
|
+
--- Example: >lua
|
|
155
|
+
---
|
|
156
|
+
--- require('mini.notify').setup({
|
|
157
|
+
--- content = {
|
|
158
|
+
--- -- Use notification message as is for LSP progress
|
|
159
|
+
--- format = function(notif)
|
|
160
|
+
--- if notif.data.source == 'lsp_progress' then return notif.msg end
|
|
161
|
+
--- return MiniNotify.default_format(notif)
|
|
162
|
+
--- end,
|
|
163
|
+
---
|
|
164
|
+
--- -- Show more recent notifications first
|
|
165
|
+
--- sort = function(notif_arr)
|
|
166
|
+
--- table.sort(
|
|
167
|
+
--- notif_arr,
|
|
168
|
+
--- function(a, b) return a.ts_update > b.ts_update end
|
|
169
|
+
--- )
|
|
170
|
+
--- return notif_arr
|
|
171
|
+
--- end,
|
|
172
|
+
--- },
|
|
173
|
+
--- })
|
|
174
|
+
--- <
|
|
175
|
+
--- # LSP progress ~
|
|
176
|
+
---
|
|
177
|
+
--- `config.lsp_progress` defines automated notifications for LSP progress.
|
|
178
|
+
--- It is implemented as a single updating notification per progress with all
|
|
179
|
+
--- information about it.
|
|
180
|
+
--- Setting up is done inside |MiniNotify.setup()| via scheduled (|vim.schedule()|)
|
|
181
|
+
--- setting of |lsp-handler| for "$/progress" method.
|
|
182
|
+
---
|
|
183
|
+
--- `lsp_progress.enable` is a boolean indicating whether LSP progress should
|
|
184
|
+
--- be shown in notifications. Can be disabled in current session.
|
|
185
|
+
--- Default: `true`. Note: Should be `true` during |MiniNotify.setup()| call to be able
|
|
186
|
+
--- to enable it in current session.
|
|
187
|
+
---
|
|
188
|
+
--- `lsp_progress.level` is a level to be used in |MiniNotify.add()|.
|
|
189
|
+
--- Default: `'INFO'`.
|
|
190
|
+
---
|
|
191
|
+
--- `lsp_progress.duration_last` is a number of milliseconds for the last progress
|
|
192
|
+
--- report to be shown on screen before removing it.
|
|
193
|
+
--- Default: 1000.
|
|
194
|
+
---
|
|
195
|
+
--- Notes:
|
|
196
|
+
--- - This respects previously set handler by saving and calling it.
|
|
197
|
+
--- - Overriding "$/progress" method of `vim.lsp.handlers` disables notifications.
|
|
198
|
+
--- - All LSP progress notifications set the following fields in `data`:
|
|
199
|
+
--- - <source> is `"lsp_progress"`.
|
|
200
|
+
--- - <client_name> is set to client's name (provided by client or inferred).
|
|
201
|
+
--- - <context> is the latest LSP request context (`ctx` arg of |lsp-handler|).
|
|
202
|
+
--- - <response> is the latest LSP response (`result` arg of |lsp-handler|).
|
|
203
|
+
---
|
|
204
|
+
--- # Window ~
|
|
205
|
+
---
|
|
206
|
+
--- `config.window` defines behavior of notification window.
|
|
207
|
+
---
|
|
208
|
+
--- `window.config` is a table defining floating window characteristics
|
|
209
|
+
--- or a callable returning such table (will be called with identifier of
|
|
210
|
+
--- window's buffer already showing notifications). It should have the same
|
|
211
|
+
--- structure as in |nvim_open_win()|. It has the following default values
|
|
212
|
+
--- which show notifications in the upper right corner with upper limit on width:
|
|
213
|
+
--- - `width` is chosen to fit buffer content but at most `window.max_width_share`
|
|
214
|
+
--- share of |'columns'|.
|
|
215
|
+
--- To have higher maximum width, use function in `config.window` which computes
|
|
216
|
+
--- dimensions inside of it (based on buffer content).
|
|
217
|
+
--- - `height` is chosen to fit buffer content with enabled |'wrap'| (assuming
|
|
218
|
+
--- default value of `width`).
|
|
219
|
+
--- - `anchor`, `col`, and `row` are "NE", |'columns'|, and 0 or 1 (depending on tabline).
|
|
220
|
+
--- - `border` is "single".
|
|
221
|
+
--- - `zindex` is 999 to be as much on top as reasonably possible.
|
|
222
|
+
---
|
|
223
|
+
--- `window.max_width_share` defines maximum window width as a share of |'columns'|.
|
|
224
|
+
--- Should be a number between 0 (not included) and 1.
|
|
225
|
+
--- Default: 0.382.
|
|
226
|
+
---
|
|
227
|
+
--- Example for showing notifications in bottom right corner: >lua
|
|
228
|
+
---
|
|
229
|
+
--- local win_config = function()
|
|
230
|
+
--- local has_statusline = vim.o.laststatus > 0
|
|
231
|
+
--- local pad = vim.o.cmdheight + (has_statusline and 1 or 0)
|
|
232
|
+
--- return { anchor = 'SE', col = vim.o.columns, row = vim.o.lines - pad }
|
|
233
|
+
--- end
|
|
234
|
+
--- require('mini.notify').setup({ window = { config = win_config } })
|
|
235
|
+
--- <
|
|
236
|
+
--- `window.winblend` defines |'winblend'| value for notification window.
|
|
237
|
+
--- Default: 25.
|
|
238
|
+
MiniNotify.config = {
|
|
239
|
+
-- Content management
|
|
240
|
+
content = {
|
|
241
|
+
-- Function which formats the notification message
|
|
242
|
+
-- By default prepends message with notification time
|
|
243
|
+
format = nil,
|
|
244
|
+
|
|
245
|
+
-- Function which orders notification array from most to least important
|
|
246
|
+
-- By default orders first by level and then by update timestamp
|
|
247
|
+
sort = nil,
|
|
248
|
+
},
|
|
249
|
+
|
|
250
|
+
-- Notifications about LSP progress
|
|
251
|
+
lsp_progress = {
|
|
252
|
+
-- Whether to enable showing
|
|
253
|
+
enable = true,
|
|
254
|
+
|
|
255
|
+
-- Notification level
|
|
256
|
+
level = 'INFO',
|
|
257
|
+
|
|
258
|
+
-- Duration (in ms) of how long last message should be shown
|
|
259
|
+
duration_last = 1000,
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
-- Window options
|
|
263
|
+
window = {
|
|
264
|
+
-- Floating window config
|
|
265
|
+
config = {},
|
|
266
|
+
|
|
267
|
+
-- Maximum window width as share (between 0 and 1) of available columns
|
|
268
|
+
max_width_share = 0.382,
|
|
269
|
+
|
|
270
|
+
-- Value of 'winblend' option
|
|
271
|
+
winblend = 25,
|
|
272
|
+
},
|
|
273
|
+
}
|
|
274
|
+
--minidoc_afterlines_end
|
|
275
|
+
|
|
276
|
+
--- Make vim.notify wrapper
|
|
277
|
+
---
|
|
278
|
+
--- Calling this function creates an implementation of |vim.notify()| powered by
|
|
279
|
+
--- this module. General idea is to show notification as soon as safely possible
|
|
280
|
+
--- (see |vim.schedule_wrap()|) and remove it after a configurable amount of time.
|
|
281
|
+
---
|
|
282
|
+
--- All notifications set `source = "vim.notify"` in their `data` field.
|
|
283
|
+
---
|
|
284
|
+
--- This is used with default options inside |MiniNotify.setup()|. To adjust,
|
|
285
|
+
--- call manually after `setup()`. For example, to show errors longer: >lua
|
|
286
|
+
---
|
|
287
|
+
--- require('mini.notify').setup()
|
|
288
|
+
--- vim.notify = MiniNotify.make_notify({ ERROR = { duration = 10000 } })
|
|
289
|
+
--- <
|
|
290
|
+
--- To preserve original `vim.notify`: >lua
|
|
291
|
+
---
|
|
292
|
+
--- local notify_orig = vim.notify
|
|
293
|
+
--- require('mini.notify').setup()
|
|
294
|
+
--- vim.notify = notify_orig
|
|
295
|
+
--- <
|
|
296
|
+
---@param opts table|nil Options to configure behavior of notification `level`
|
|
297
|
+
--- (as in |MiniNotify.add()|). Fields are the same as names of `vim.log.levels`
|
|
298
|
+
--- with values being tables with possible fields:
|
|
299
|
+
--- - <duration> `(number)` - duration (in ms) of how much a notification
|
|
300
|
+
--- should be shown. If 0 or negative, notification is not shown at all.
|
|
301
|
+
--- - <hl_group> `(string)` - highlight group of notification.
|
|
302
|
+
--- Only data different to default can be supplied.
|
|
303
|
+
---
|
|
304
|
+
--- Default: >lua
|
|
305
|
+
---
|
|
306
|
+
--- {
|
|
307
|
+
--- ERROR = { duration = 5000, hl_group = 'DiagnosticError' },
|
|
308
|
+
--- WARN = { duration = 5000, hl_group = 'DiagnosticWarn' },
|
|
309
|
+
--- INFO = { duration = 5000, hl_group = 'DiagnosticInfo' },
|
|
310
|
+
--- DEBUG = { duration = 0, hl_group = 'DiagnosticHint' },
|
|
311
|
+
--- TRACE = { duration = 0, hl_group = 'DiagnosticOk' },
|
|
312
|
+
--- OFF = { duration = 0, hl_group = 'MiniNotifyNormal' },
|
|
313
|
+
--- }
|
|
314
|
+
--- <
|
|
315
|
+
MiniNotify.make_notify = function(opts)
|
|
316
|
+
local level_names = {}
|
|
317
|
+
for k, v in pairs(vim.log.levels) do
|
|
318
|
+
level_names[v] = k
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
--stylua: ignore
|
|
322
|
+
local default_opts = {
|
|
323
|
+
ERROR = { duration = 5000, hl_group = 'DiagnosticError' },
|
|
324
|
+
WARN = { duration = 5000, hl_group = 'DiagnosticWarn' },
|
|
325
|
+
INFO = { duration = 5000, hl_group = 'DiagnosticInfo' },
|
|
326
|
+
DEBUG = { duration = 0, hl_group = 'DiagnosticHint' },
|
|
327
|
+
TRACE = { duration = 0, hl_group = 'DiagnosticOk' },
|
|
328
|
+
OFF = { duration = 0, hl_group = 'MiniNotifyNormal' },
|
|
329
|
+
}
|
|
330
|
+
opts = vim.tbl_deep_extend('force', default_opts, opts or {})
|
|
331
|
+
|
|
332
|
+
for key, val in pairs(opts) do
|
|
333
|
+
if default_opts[key] == nil then H.error('Keys should be log level names.') end
|
|
334
|
+
if type(val) ~= 'table' then H.error('Level data should be table.') end
|
|
335
|
+
if type(val.duration) ~= 'number' then H.error('`duration` in level data should be number.') end
|
|
336
|
+
if type(val.hl_group) ~= 'string' then H.error('`hl_group` in level data should be string.') end
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
return vim.schedule_wrap(function(msg, level)
|
|
340
|
+
level = level or vim.log.levels.INFO
|
|
341
|
+
local level_name = level_names[level]
|
|
342
|
+
if level_name == nil then H.error('Only valid values of `vim.log.levels` are supported.') end
|
|
343
|
+
|
|
344
|
+
local level_data = opts[level_name]
|
|
345
|
+
if level_data.duration <= 0 then return end
|
|
346
|
+
|
|
347
|
+
local id = MiniNotify.add(msg, level_name, level_data.hl_group, { source = 'vim.notify' })
|
|
348
|
+
vim.defer_fn(function() MiniNotify.remove(id) end, level_data.duration)
|
|
349
|
+
end)
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
--- Add notification
|
|
353
|
+
---
|
|
354
|
+
--- Add notification to history. It is considered "active" and is shown.
|
|
355
|
+
--- To hide, call |MiniNotify.remove()| with identifier this function returns.
|
|
356
|
+
---
|
|
357
|
+
--- Example: >lua
|
|
358
|
+
---
|
|
359
|
+
--- local id = MiniNotify.add('Hello', 'WARN', 'Comment')
|
|
360
|
+
--- vim.defer_fn(function() MiniNotify.remove(id) end, 1000)
|
|
361
|
+
--- <
|
|
362
|
+
---@param msg string Notification message.
|
|
363
|
+
---@param level string|nil Notification level as key of |vim.log.levels|.
|
|
364
|
+
--- Default: `'INFO'`.
|
|
365
|
+
---@param hl_group string|nil Notification highlight group.
|
|
366
|
+
--- Default: `'MiniNotifyNormal'`.
|
|
367
|
+
---@param data table|nil Extra data to store in the notification.
|
|
368
|
+
--- Default: `{}`.
|
|
369
|
+
---
|
|
370
|
+
---@return number Notification identifier.
|
|
371
|
+
MiniNotify.add = function(msg, level, hl_group, data)
|
|
372
|
+
H.validate_msg(msg)
|
|
373
|
+
level = level or 'INFO'
|
|
374
|
+
H.validate_level(level)
|
|
375
|
+
hl_group = hl_group or 'MiniNotifyNormal'
|
|
376
|
+
H.validate_hl_group(hl_group)
|
|
377
|
+
data = data or {}
|
|
378
|
+
H.check_type('data', data, 'table')
|
|
379
|
+
|
|
380
|
+
local cur_ts = H.get_timestamp()
|
|
381
|
+
local new_notif = { msg = msg, level = level, hl_group = hl_group, ts_add = cur_ts, ts_update = cur_ts, data = data }
|
|
382
|
+
|
|
383
|
+
local new_id = #H.history + 1
|
|
384
|
+
-- NOTE: Crucial to use the same table here and later only update values
|
|
385
|
+
-- inside of it in place. This makes sure that history entries are in sync.
|
|
386
|
+
H.history[new_id], H.active[new_id] = new_notif, new_notif
|
|
387
|
+
|
|
388
|
+
-- Refresh active notifications
|
|
389
|
+
MiniNotify.refresh()
|
|
390
|
+
|
|
391
|
+
return new_id
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
--- Update active notification
|
|
395
|
+
---
|
|
396
|
+
--- Modify contents of active notification.
|
|
397
|
+
---
|
|
398
|
+
---@param id number Identifier of currently active notification as returned
|
|
399
|
+
--- by |MiniNotify.add()|.
|
|
400
|
+
---@param new table Table with contents to update. Keys should be as non-timestamp
|
|
401
|
+
--- fields of |MiniNotify-specification| and values - new content values.
|
|
402
|
+
--- If present, field `data` is updated as is. Use |MiniNotify.get()| together
|
|
403
|
+
--- with |vim.tbl_deep_extend()| to change only part of it.
|
|
404
|
+
MiniNotify.update = function(id, new)
|
|
405
|
+
local notif = H.active[id]
|
|
406
|
+
if notif == nil then H.error('`id` is not an identifier of active notification.') end
|
|
407
|
+
H.check_type('new', new, 'table')
|
|
408
|
+
|
|
409
|
+
if new.msg ~= nil then H.validate_msg(new.msg) end
|
|
410
|
+
if new.level ~= nil then H.validate_level(new.level) end
|
|
411
|
+
if new.hl_group ~= nil then H.validate_hl_group(new.hl_group) end
|
|
412
|
+
H.check_type('data', new.data, 'table', true)
|
|
413
|
+
|
|
414
|
+
notif.msg = new.msg or notif.msg
|
|
415
|
+
notif.level = new.level or notif.level
|
|
416
|
+
notif.hl_group = new.hl_group or notif.hl_group
|
|
417
|
+
notif.data = new.data or notif.data
|
|
418
|
+
notif.ts_update = H.get_timestamp()
|
|
419
|
+
|
|
420
|
+
MiniNotify.refresh()
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
--- Remove notification
|
|
424
|
+
---
|
|
425
|
+
--- If notification is active, make it not active (by setting `ts_remove` field).
|
|
426
|
+
--- If not active, do nothing.
|
|
427
|
+
---
|
|
428
|
+
---@param id number|nil Identifier of previously added notification.
|
|
429
|
+
--- If it is not, nothing is done (silently).
|
|
430
|
+
MiniNotify.remove = function(id)
|
|
431
|
+
local notif = H.active[id]
|
|
432
|
+
if notif == nil then return end
|
|
433
|
+
notif.ts_remove = H.get_timestamp()
|
|
434
|
+
H.active[id] = nil
|
|
435
|
+
|
|
436
|
+
MiniNotify.refresh()
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
--- Remove all active notifications
|
|
440
|
+
---
|
|
441
|
+
--- Hide all active notifications and stop showing window (if shown).
|
|
442
|
+
MiniNotify.clear = function()
|
|
443
|
+
local cur_ts = H.get_timestamp()
|
|
444
|
+
for id, _ in pairs(H.active) do
|
|
445
|
+
H.active[id].ts_remove = cur_ts
|
|
446
|
+
end
|
|
447
|
+
H.active = {}
|
|
448
|
+
|
|
449
|
+
MiniNotify.refresh()
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
--- Refresh notification window
|
|
453
|
+
---
|
|
454
|
+
--- Make notification window show relevant information:
|
|
455
|
+
--- - Create an array of active notifications (see |MiniNotify-specification|).
|
|
456
|
+
--- - Apply `config.content.sort` to an array. If output has zero notifications,
|
|
457
|
+
--- make notification window to not show.
|
|
458
|
+
--- - Apply `config.content.format` to each element of notification array and
|
|
459
|
+
--- update its message.
|
|
460
|
+
--- - Construct content from notifications and show them in a window.
|
|
461
|
+
---
|
|
462
|
+
--- Note: effects are delayed if inside fast event (|vim.in_fast_event()|).
|
|
463
|
+
MiniNotify.refresh = function()
|
|
464
|
+
if vim.in_fast_event() then return vim.schedule(MiniNotify.refresh) end
|
|
465
|
+
if H.is_textlock() and vim.fn.has('nvim-0.10') == 1 then
|
|
466
|
+
pcall(vim.api.nvim_del_autocmd, H.cache.safestate_au_id)
|
|
467
|
+
local au_opts = { once = true, nested = true, callback = vim.schedule_wrap(MiniNotify.refresh) }
|
|
468
|
+
H.cache.safestate_au_id = vim.api.nvim_create_autocmd('SafeState', au_opts)
|
|
469
|
+
return
|
|
470
|
+
end
|
|
471
|
+
if H.is_disabled() or type(vim.v.exiting) == 'number' then return H.window_close() end
|
|
472
|
+
|
|
473
|
+
-- Prepare array of active notifications
|
|
474
|
+
local notif_arr = vim.deepcopy(vim.tbl_values(H.active))
|
|
475
|
+
local config_content = H.get_config().content
|
|
476
|
+
|
|
477
|
+
local sort = vim.is_callable(config_content.sort) and config_content.sort or MiniNotify.default_sort
|
|
478
|
+
notif_arr = sort(notif_arr)
|
|
479
|
+
if not H.is_notification_array(notif_arr) then H.error('Output of `content.sort` should be notification array.') end
|
|
480
|
+
if #notif_arr == 0 then return H.window_close() end
|
|
481
|
+
|
|
482
|
+
local format = vim.is_callable(config_content.format) and config_content.format or MiniNotify.default_format
|
|
483
|
+
notif_arr = H.notif_apply_format(notif_arr, format)
|
|
484
|
+
|
|
485
|
+
-- Refresh buffer
|
|
486
|
+
local buf_id = H.cache.buf_id
|
|
487
|
+
if not H.is_loaded_buf(buf_id) then buf_id = H.buffer_create(buf_id) end
|
|
488
|
+
H.buffer_refresh(buf_id, notif_arr)
|
|
489
|
+
|
|
490
|
+
-- Refresh window
|
|
491
|
+
local win_id = H.cache.win_id
|
|
492
|
+
if not (H.is_valid_win(win_id) and H.is_win_in_tabpage(win_id)) then
|
|
493
|
+
H.window_close()
|
|
494
|
+
win_id = H.window_open(buf_id)
|
|
495
|
+
else
|
|
496
|
+
local new_config = H.window_compute_config(buf_id)
|
|
497
|
+
vim.api.nvim_win_set_config(win_id, new_config)
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
-- Redraw
|
|
501
|
+
vim.cmd('redraw')
|
|
502
|
+
|
|
503
|
+
-- Update cache
|
|
504
|
+
H.cache.buf_id, H.cache.win_id = buf_id, win_id
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
--- Get previously added notification by id
|
|
508
|
+
---
|
|
509
|
+
---@param id number Identifier of notification.
|
|
510
|
+
---
|
|
511
|
+
---@return table Notification object (see |MiniNotify-specification|).
|
|
512
|
+
MiniNotify.get = function(id) return vim.deepcopy(H.history[id]) end
|
|
513
|
+
|
|
514
|
+
--- Get all previously added notifications
|
|
515
|
+
---
|
|
516
|
+
--- Get map of used notifications with keys being notification identifiers.
|
|
517
|
+
---
|
|
518
|
+
--- Can be used to get only active notification objects. Example: >lua
|
|
519
|
+
---
|
|
520
|
+
--- -- Get active notifications
|
|
521
|
+
--- vim.tbl_filter(
|
|
522
|
+
--- function(notif) return notif.ts_remove == nil end,
|
|
523
|
+
--- MiniNotify.get_all()
|
|
524
|
+
--- )
|
|
525
|
+
--- <
|
|
526
|
+
---@return table Map with notification object values (see |MiniNotify-specification|).
|
|
527
|
+
--- Note: messages are taken from last valid update.
|
|
528
|
+
MiniNotify.get_all = function() return vim.deepcopy(H.history) end
|
|
529
|
+
|
|
530
|
+
--- Show history
|
|
531
|
+
---
|
|
532
|
+
--- Open or reuse a scratch buffer with all previously shown notifications.
|
|
533
|
+
---
|
|
534
|
+
--- Notes:
|
|
535
|
+
--- - Content is ordered from oldest to newest based on latest update time.
|
|
536
|
+
--- - Message is formatted with `config.content.format`.
|
|
537
|
+
MiniNotify.show_history = function()
|
|
538
|
+
-- Prepare content
|
|
539
|
+
local config_content = H.get_config().content
|
|
540
|
+
local notif_arr = MiniNotify.get_all()
|
|
541
|
+
table.sort(notif_arr, function(a, b) return a.ts_update < b.ts_update end)
|
|
542
|
+
local format = vim.is_callable(config_content.format) and config_content.format or MiniNotify.default_format
|
|
543
|
+
notif_arr = H.notif_apply_format(notif_arr, format)
|
|
544
|
+
|
|
545
|
+
-- Show content in a reusable buffer
|
|
546
|
+
local buf_id
|
|
547
|
+
for _, id in ipairs(vim.api.nvim_list_bufs()) do
|
|
548
|
+
if vim.bo[id].filetype == 'mininotify-history' then buf_id = id end
|
|
549
|
+
end
|
|
550
|
+
if buf_id == nil then
|
|
551
|
+
buf_id = vim.api.nvim_create_buf(true, true)
|
|
552
|
+
H.set_buf_name(buf_id, 'history')
|
|
553
|
+
vim.bo[buf_id].filetype = 'mininotify-history'
|
|
554
|
+
end
|
|
555
|
+
H.buffer_refresh(buf_id, notif_arr)
|
|
556
|
+
vim.api.nvim_win_set_buf(0, buf_id)
|
|
557
|
+
end
|
|
558
|
+
|
|
559
|
+
--- Default content format
|
|
560
|
+
---
|
|
561
|
+
--- Used by default as `config.content.format`. Prepends notification message
|
|
562
|
+
--- with the human readable update time and a separator.
|
|
563
|
+
---
|
|
564
|
+
---@param notif table Notification object (see |MiniNotify-specification|).
|
|
565
|
+
---
|
|
566
|
+
---@return string Formatted notification message.
|
|
567
|
+
MiniNotify.default_format = function(notif)
|
|
568
|
+
local time = vim.fn.strftime('%H:%M:%S', math.floor(notif.ts_update))
|
|
569
|
+
return string.format('%s │ %s', time, notif.msg)
|
|
570
|
+
end
|
|
571
|
+
|
|
572
|
+
--- Default content sort
|
|
573
|
+
---
|
|
574
|
+
--- Used by default as `config.content.sort`. First sorts by notification's `level`
|
|
575
|
+
--- ("ERROR" > "WARN" > "INFO" > "DEBUG" > "TRACE" > "OFF"; the bigger the more
|
|
576
|
+
--- important); if draw - by latest update time (the later the more important).
|
|
577
|
+
---
|
|
578
|
+
---@param notif_arr table Array of notifications (see |MiniNotify-specification|).
|
|
579
|
+
---
|
|
580
|
+
---@return table Sorted array of notifications.
|
|
581
|
+
MiniNotify.default_sort = function(notif_arr)
|
|
582
|
+
local res = vim.deepcopy(notif_arr)
|
|
583
|
+
table.sort(res, H.notif_compare)
|
|
584
|
+
return res
|
|
585
|
+
end
|
|
586
|
+
|
|
587
|
+
-- Helper data ================================================================
|
|
588
|
+
-- Module default config
|
|
589
|
+
H.default_config = MiniNotify.config
|
|
590
|
+
|
|
591
|
+
-- Map of currently active notifications with their id as key
|
|
592
|
+
H.active = {}
|
|
593
|
+
|
|
594
|
+
-- History of all notifications in order they are created
|
|
595
|
+
H.history = {}
|
|
596
|
+
|
|
597
|
+
-- Map of LSP progress process id to notification content
|
|
598
|
+
H.lsp_progress = {}
|
|
599
|
+
|
|
600
|
+
-- Priorities of levels
|
|
601
|
+
H.level_priority = { ERROR = 6, WARN = 5, INFO = 4, DEBUG = 3, TRACE = 2, OFF = 1 }
|
|
602
|
+
|
|
603
|
+
-- Namespaces
|
|
604
|
+
H.ns_id = {
|
|
605
|
+
highlight = vim.api.nvim_create_namespace('MiniNotifyHighlight'),
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
-- Various cache
|
|
609
|
+
H.cache = {
|
|
610
|
+
-- Notification buffer and window
|
|
611
|
+
buf_id = nil,
|
|
612
|
+
win_id = nil,
|
|
613
|
+
-- Scratch buffer to test if the editor is in textlock state
|
|
614
|
+
textlock_buf_id = nil,
|
|
615
|
+
-- Autocommand identifier when delaying until `SafeState`
|
|
616
|
+
safestate_au_id = nil,
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
-- Helper functionality =======================================================
|
|
620
|
+
-- Settings -------------------------------------------------------------------
|
|
621
|
+
H.setup_config = function(config)
|
|
622
|
+
H.check_type('config', config, 'table', true)
|
|
623
|
+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
|
|
624
|
+
|
|
625
|
+
H.check_type('content', config.content, 'table')
|
|
626
|
+
H.check_type('content.format', config.content.format, 'function', true)
|
|
627
|
+
H.check_type('content.sort', config.content.sort, 'function', true)
|
|
628
|
+
|
|
629
|
+
H.check_type('lsp_progress', config.lsp_progress, 'table')
|
|
630
|
+
H.check_type('lsp_progress.enable', config.lsp_progress.enable, 'boolean')
|
|
631
|
+
H.check_type('lsp_progress.duration_last', config.lsp_progress.duration_last, 'number')
|
|
632
|
+
|
|
633
|
+
H.check_type('window', config.window, 'table')
|
|
634
|
+
if not (type(config.window.config) == 'table' or vim.is_callable(config.window.config)) then
|
|
635
|
+
H.error('`window.config` should table or callable, not ' .. type(config.window.config))
|
|
636
|
+
end
|
|
637
|
+
H.check_type('window.max_width_share', config.window.max_width_share, 'number')
|
|
638
|
+
H.check_type('window.winblend', config.window.winblend, 'number')
|
|
639
|
+
|
|
640
|
+
return config
|
|
641
|
+
end
|
|
642
|
+
|
|
643
|
+
H.apply_config = function(config)
|
|
644
|
+
MiniNotify.config = config
|
|
645
|
+
|
|
646
|
+
if config.lsp_progress.enable then
|
|
647
|
+
-- Use `vim.schedule` to reduce startup time (sourcing `vim.lsp` is costly)
|
|
648
|
+
vim.schedule(function()
|
|
649
|
+
-- Cache original handler only once (to avoid infinite loop)
|
|
650
|
+
if vim.lsp.handlers['$/progress before mini.notify'] == nil then
|
|
651
|
+
vim.lsp.handlers['$/progress before mini.notify'] = vim.lsp.handlers['$/progress']
|
|
652
|
+
end
|
|
653
|
+
|
|
654
|
+
vim.lsp.handlers['$/progress'] = H.lsp_progress_handler
|
|
655
|
+
end)
|
|
656
|
+
end
|
|
657
|
+
|
|
658
|
+
-- Clean history
|
|
659
|
+
if #H.history > 0 then MiniNotify.clear() end
|
|
660
|
+
H.history = {}
|
|
661
|
+
end
|
|
662
|
+
|
|
663
|
+
H.create_autocommands = function()
|
|
664
|
+
local gr = vim.api.nvim_create_augroup('MiniNotify', {})
|
|
665
|
+
|
|
666
|
+
local au = function(event, pattern, callback, desc)
|
|
667
|
+
vim.api.nvim_create_autocmd(event, { group = gr, pattern = pattern, callback = callback, desc = desc })
|
|
668
|
+
end
|
|
669
|
+
|
|
670
|
+
au({ 'TabEnter', 'VimResized' }, '*', function() MiniNotify.refresh() end, 'Refresh notifications')
|
|
671
|
+
au('ColorScheme', '*', H.create_default_hl, 'Ensure colors')
|
|
672
|
+
end
|
|
673
|
+
|
|
674
|
+
--stylua: ignore
|
|
675
|
+
H.create_default_hl = function()
|
|
676
|
+
local hi = function(name, opts)
|
|
677
|
+
opts.default = true
|
|
678
|
+
vim.api.nvim_set_hl(0, name, opts)
|
|
679
|
+
end
|
|
680
|
+
|
|
681
|
+
hi('MiniNotifyBorder', { link = 'FloatBorder' })
|
|
682
|
+
hi('MiniNotifyLspProgress', { link = 'MiniNotifyNormal' })
|
|
683
|
+
hi('MiniNotifyNormal', { link = 'NormalFloat' })
|
|
684
|
+
hi('MiniNotifyTitle', { link = 'FloatTitle' })
|
|
685
|
+
end
|
|
686
|
+
|
|
687
|
+
H.is_disabled = function() return vim.g.mininotify_disable == true or vim.b.mininotify_disable == true end
|
|
688
|
+
|
|
689
|
+
H.get_config = function(config)
|
|
690
|
+
return vim.tbl_deep_extend('force', MiniNotify.config, vim.b.mininotify_config or {}, config or {})
|
|
691
|
+
end
|
|
692
|
+
|
|
693
|
+
-- LSP progress ---------------------------------------------------------------
|
|
694
|
+
H.lsp_progress_handler = function(err, result, ctx, config)
|
|
695
|
+
-- Make basic response processing. First call original LSP handler.
|
|
696
|
+
-- On Neovim>=0.10 this is crucial to not override `LspProgress` event.
|
|
697
|
+
if vim.is_callable(vim.lsp.handlers['$/progress before mini.notify']) then
|
|
698
|
+
vim.lsp.handlers['$/progress before mini.notify'](err, result, ctx, config)
|
|
699
|
+
end
|
|
700
|
+
|
|
701
|
+
local lsp_progress_config = H.get_config().lsp_progress
|
|
702
|
+
if not lsp_progress_config.enable then return end
|
|
703
|
+
|
|
704
|
+
if err ~= nil then return vim.notify(vim.inspect(err), vim.log.levels.ERROR) end
|
|
705
|
+
if not (type(result) == 'table' and type(result.value) == 'table') then return end
|
|
706
|
+
local value = result.value
|
|
707
|
+
|
|
708
|
+
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
|
709
|
+
if client == nil then return end
|
|
710
|
+
|
|
711
|
+
-- Construct LSP progress id
|
|
712
|
+
local buf_id = ctx.bufnr or 'nil'
|
|
713
|
+
local lsp_progress_id = buf_id .. client.name .. (result.token or '')
|
|
714
|
+
local progress_info = H.lsp_progress[lsp_progress_id] or {}
|
|
715
|
+
local data = { source = 'lsp_progress', client_name = client.name, response = result, context = ctx }
|
|
716
|
+
|
|
717
|
+
-- Store percentage to be used if no new one was sent
|
|
718
|
+
progress_info.percentage = (value.kind == 'end' and 100 or value.percentage) or progress_info.percentage or 0
|
|
719
|
+
|
|
720
|
+
-- Cache title because it is only supplied on 'begin'
|
|
721
|
+
if value.kind == 'begin' then progress_info.title = value.title end
|
|
722
|
+
|
|
723
|
+
-- Make message
|
|
724
|
+
local title, message = progress_info.title or '', value.message or ''
|
|
725
|
+
--stylua: ignore
|
|
726
|
+
local msg = string.format(
|
|
727
|
+
'%s: %s%s%s%s(%s%%)',
|
|
728
|
+
client.name, title, title == '' and '' or ' ', message, message == '' and '' or ' ', progress_info.percentage
|
|
729
|
+
)
|
|
730
|
+
|
|
731
|
+
-- Check for valid history entry as `setup()` might have removed the id
|
|
732
|
+
if H.history[progress_info.notif_id] == nil then
|
|
733
|
+
progress_info.notif_id = MiniNotify.add(msg, lsp_progress_config.level, 'MiniNotifyLspProgress', data)
|
|
734
|
+
else
|
|
735
|
+
MiniNotify.update(progress_info.notif_id, { msg = msg, data = data })
|
|
736
|
+
end
|
|
737
|
+
|
|
738
|
+
-- Cache progress info
|
|
739
|
+
H.lsp_progress[lsp_progress_id] = progress_info
|
|
740
|
+
|
|
741
|
+
-- Hide notification after last update to reduce flicker
|
|
742
|
+
if value.kind == 'end' then
|
|
743
|
+
H.lsp_progress[lsp_progress_id] = nil
|
|
744
|
+
local delay = math.max(lsp_progress_config.duration_last, 0)
|
|
745
|
+
vim.defer_fn(function() MiniNotify.remove(progress_info.notif_id) end, delay)
|
|
746
|
+
end
|
|
747
|
+
end
|
|
748
|
+
|
|
749
|
+
-- Buffer ---------------------------------------------------------------------
|
|
750
|
+
H.buffer_create = function(prev_buf_id)
|
|
751
|
+
pcall(vim.api.nvim_buf_delete, prev_buf_id, { force = true })
|
|
752
|
+
local buf_id = vim.api.nvim_create_buf(false, true)
|
|
753
|
+
H.set_buf_name(buf_id, 'content')
|
|
754
|
+
vim.bo[buf_id].filetype = 'mininotify'
|
|
755
|
+
return buf_id
|
|
756
|
+
end
|
|
757
|
+
|
|
758
|
+
H.buffer_refresh = function(buf_id, notif_arr)
|
|
759
|
+
local ns_id = H.ns_id.highlight
|
|
760
|
+
|
|
761
|
+
-- Ensure clear buffer
|
|
762
|
+
vim.api.nvim_buf_clear_namespace(buf_id, ns_id, 0, -1)
|
|
763
|
+
vim.api.nvim_buf_set_lines(buf_id, 0, -1, true, {})
|
|
764
|
+
|
|
765
|
+
-- Compute lines and highlight regions
|
|
766
|
+
local lines, highlights = {}, {}
|
|
767
|
+
for _, notif in ipairs(notif_arr) do
|
|
768
|
+
local notif_lines = vim.split(notif.msg, '\n')
|
|
769
|
+
for _, l in ipairs(notif_lines) do
|
|
770
|
+
table.insert(lines, l)
|
|
771
|
+
end
|
|
772
|
+
table.insert(highlights, { group = notif.hl_group, from_line = #lines - #notif_lines + 1, to_line = #lines })
|
|
773
|
+
end
|
|
774
|
+
|
|
775
|
+
-- Set lines and highlighting
|
|
776
|
+
vim.api.nvim_buf_set_lines(buf_id, 0, -1, true, lines)
|
|
777
|
+
local extmark_opts = { end_col = 0, hl_eol = true, hl_mode = 'combine' }
|
|
778
|
+
for _, hi_data in ipairs(highlights) do
|
|
779
|
+
extmark_opts.end_row, extmark_opts.hl_group = hi_data.to_line, hi_data.group
|
|
780
|
+
vim.api.nvim_buf_set_extmark(buf_id, ns_id, hi_data.from_line - 1, 0, extmark_opts)
|
|
781
|
+
end
|
|
782
|
+
end
|
|
783
|
+
|
|
784
|
+
H.buffer_default_dimensions = function(buf_id, max_width_share)
|
|
785
|
+
local line_widths = vim.tbl_map(vim.fn.strdisplaywidth, vim.api.nvim_buf_get_lines(buf_id, 0, -1, true))
|
|
786
|
+
|
|
787
|
+
-- Compute width so as to fit all lines
|
|
788
|
+
local width = 1
|
|
789
|
+
for _, l_w in ipairs(line_widths) do
|
|
790
|
+
width = math.max(width, l_w)
|
|
791
|
+
end
|
|
792
|
+
-- - Limit from above for better visuals
|
|
793
|
+
max_width_share = math.min(math.max(max_width_share, 0), 1)
|
|
794
|
+
local max_width = math.max(math.floor(max_width_share * vim.o.columns), 1)
|
|
795
|
+
width = math.min(width, max_width)
|
|
796
|
+
|
|
797
|
+
-- Compute height based on the width so as to fit all lines with 'wrap' on
|
|
798
|
+
local height = 0
|
|
799
|
+
for _, l_w in ipairs(line_widths) do
|
|
800
|
+
height = height + math.floor(math.max(l_w - 1, 0) / width) + 1
|
|
801
|
+
end
|
|
802
|
+
|
|
803
|
+
return width, height
|
|
804
|
+
end
|
|
805
|
+
|
|
806
|
+
-- Window ---------------------------------------------------------------------
|
|
807
|
+
H.window_open = function(buf_id)
|
|
808
|
+
local config = H.window_compute_config(buf_id, true)
|
|
809
|
+
local win_id = vim.api.nvim_open_win(buf_id, false, config)
|
|
810
|
+
|
|
811
|
+
vim.wo[win_id].foldenable = false
|
|
812
|
+
vim.wo[win_id].foldmethod = 'manual'
|
|
813
|
+
vim.wo[win_id].winblend = H.get_config().window.winblend
|
|
814
|
+
vim.wo[win_id].winhighlight = 'NormalFloat:MiniNotifyNormal,FloatBorder:MiniNotifyBorder,FloatTitle:MiniNotifyTitle'
|
|
815
|
+
vim.wo[win_id].wrap = true
|
|
816
|
+
|
|
817
|
+
return win_id
|
|
818
|
+
end
|
|
819
|
+
|
|
820
|
+
H.window_compute_config = function(buf_id, is_for_open)
|
|
821
|
+
local has_tabline = vim.o.showtabline == 2 or (vim.o.showtabline == 1 and #vim.api.nvim_list_tabpages() > 1)
|
|
822
|
+
local has_statusline = vim.o.laststatus > 0
|
|
823
|
+
local max_height = vim.o.lines - vim.o.cmdheight - (has_tabline and 1 or 0) - (has_statusline and 1 or 0)
|
|
824
|
+
local max_width = vim.o.columns
|
|
825
|
+
|
|
826
|
+
local config_win = H.get_config().window
|
|
827
|
+
local default_config = { relative = 'editor', style = 'minimal', noautocmd = is_for_open, zindex = 999 }
|
|
828
|
+
default_config.anchor, default_config.col, default_config.row = 'NE', vim.o.columns, has_tabline and 1 or 0
|
|
829
|
+
default_config.width, default_config.height = H.buffer_default_dimensions(buf_id, config_win.max_width_share)
|
|
830
|
+
default_config.border = (vim.fn.exists('+winborder') == 0 or vim.o.winborder == '') and 'single' or nil
|
|
831
|
+
default_config.title = ' Notifications '
|
|
832
|
+
-- Don't allow focus to not disrupt window navigation
|
|
833
|
+
default_config.focusable = false
|
|
834
|
+
|
|
835
|
+
local win_config = config_win.config
|
|
836
|
+
if vim.is_callable(win_config) then win_config = win_config(buf_id) end
|
|
837
|
+
local config = vim.tbl_deep_extend('force', default_config, win_config or {})
|
|
838
|
+
|
|
839
|
+
-- Tweak config values to ensure they are proper, accounting for border
|
|
840
|
+
local offset = config.border == 'none' and 0 or 2
|
|
841
|
+
config.height = math.min(config.height, max_height - offset)
|
|
842
|
+
config.width = math.min(config.width, max_width - offset)
|
|
843
|
+
if type(config.title) == 'string' then config.title = H.fit_to_width(config.title, config.width) end
|
|
844
|
+
|
|
845
|
+
return config
|
|
846
|
+
end
|
|
847
|
+
|
|
848
|
+
H.window_close = function()
|
|
849
|
+
if H.is_valid_win(H.cache.win_id) then vim.api.nvim_win_close(H.cache.win_id, true) end
|
|
850
|
+
H.cache.win_id = nil
|
|
851
|
+
end
|
|
852
|
+
|
|
853
|
+
-- Notifications --------------------------------------------------------------
|
|
854
|
+
H.validate_msg = function(x)
|
|
855
|
+
if type(x) ~= 'string' then H.error('`msg` should be string.') end
|
|
856
|
+
end
|
|
857
|
+
|
|
858
|
+
H.validate_level = function(x)
|
|
859
|
+
if vim.log.levels[x] == nil then H.error('`level` should be key of `vim.log.levels`.') end
|
|
860
|
+
end
|
|
861
|
+
|
|
862
|
+
H.validate_hl_group = function(x)
|
|
863
|
+
if type(x) ~= 'string' then H.error('`hl_group` should be string.') end
|
|
864
|
+
end
|
|
865
|
+
|
|
866
|
+
H.is_notification = function(x)
|
|
867
|
+
return type(x) == 'table'
|
|
868
|
+
and type(x.msg) == 'string'
|
|
869
|
+
and vim.log.levels[x.level] ~= nil
|
|
870
|
+
and type(x.hl_group) == 'string'
|
|
871
|
+
and type(x.ts_add) == 'number'
|
|
872
|
+
and type(x.ts_update) == 'number'
|
|
873
|
+
and (x.ts_remove == nil or type(x.ts_remove) == 'number')
|
|
874
|
+
end
|
|
875
|
+
|
|
876
|
+
H.is_notification_array = function(x)
|
|
877
|
+
if not H.islist(x) then return false end
|
|
878
|
+
for _, y in ipairs(x) do
|
|
879
|
+
if not H.is_notification(y) then return false end
|
|
880
|
+
end
|
|
881
|
+
return true
|
|
882
|
+
end
|
|
883
|
+
|
|
884
|
+
H.notif_apply_format = function(notif_arr, format)
|
|
885
|
+
for _, notif in ipairs(notif_arr) do
|
|
886
|
+
local res = format(notif)
|
|
887
|
+
if type(res) ~= 'string' then H.error('Output of `content.format` should be string.') end
|
|
888
|
+
notif.msg = res
|
|
889
|
+
end
|
|
890
|
+
return notif_arr
|
|
891
|
+
end
|
|
892
|
+
|
|
893
|
+
H.notif_compare = function(a, b)
|
|
894
|
+
local a_priority, b_priority = H.level_priority[a.level], H.level_priority[b.level]
|
|
895
|
+
return a_priority > b_priority or (a_priority == b_priority and a.ts_update > b.ts_update)
|
|
896
|
+
end
|
|
897
|
+
|
|
898
|
+
-- Utilities ------------------------------------------------------------------
|
|
899
|
+
H.error = function(msg) error('(mini.notify) ' .. msg, 0) end
|
|
900
|
+
|
|
901
|
+
H.check_type = function(name, val, ref, allow_nil)
|
|
902
|
+
if type(val) == ref or (ref == 'callable' and vim.is_callable(val)) or (allow_nil and val == nil) then return end
|
|
903
|
+
H.error(string.format('`%s` should be %s, not %s', name, ref, type(val)))
|
|
904
|
+
end
|
|
905
|
+
|
|
906
|
+
H.set_buf_name = function(buf_id, name) vim.api.nvim_buf_set_name(buf_id, 'mininotify://' .. buf_id .. '/' .. name) end
|
|
907
|
+
|
|
908
|
+
H.is_loaded_buf = function(buf_id) return type(buf_id) == 'number' and vim.api.nvim_buf_is_loaded(buf_id) end
|
|
909
|
+
|
|
910
|
+
H.is_valid_win = function(win_id) return type(win_id) == 'number' and vim.api.nvim_win_is_valid(win_id) end
|
|
911
|
+
|
|
912
|
+
H.is_win_in_tabpage = function(win_id) return vim.api.nvim_win_get_tabpage(win_id) == vim.api.nvim_get_current_tabpage() end
|
|
913
|
+
|
|
914
|
+
H.is_textlock = function()
|
|
915
|
+
if not H.is_loaded_buf(H.cache.textlock_buf_id) then
|
|
916
|
+
pcall(vim.api.nvim_buf_delete, H.cache.textlock_buf_id, { force = true })
|
|
917
|
+
H.cache.textlock_buf_id = vim.api.nvim_create_buf(false, true)
|
|
918
|
+
H.set_buf_name(H.cache.textlock_buf_id, 'textlock-check-scratch')
|
|
919
|
+
end
|
|
920
|
+
local ok = pcall(vim.api.nvim_buf_set_lines, H.cache.textlock_buf_id, 0, -1, false, {})
|
|
921
|
+
return not ok
|
|
922
|
+
end
|
|
923
|
+
|
|
924
|
+
H.fit_to_width = function(text, width)
|
|
925
|
+
local t_width = vim.fn.strchars(text)
|
|
926
|
+
return t_width <= width and text or ('…' .. vim.fn.strcharpart(text, t_width - width + 1, width - 1))
|
|
927
|
+
end
|
|
928
|
+
|
|
929
|
+
H.get_timestamp = function()
|
|
930
|
+
-- This is more acceptable for `vim.fn.strftime()` than `vim.loop.hrtime()`
|
|
931
|
+
local seconds, microseconds = vim.loop.gettimeofday()
|
|
932
|
+
return seconds + 0.000001 * microseconds
|
|
933
|
+
end
|
|
934
|
+
|
|
935
|
+
-- TODO: Remove after compatibility with Neovim=0.9 is dropped
|
|
936
|
+
H.islist = vim.fn.has('nvim-0.10') == 1 and vim.islist or vim.tbl_islist
|
|
937
|
+
|
|
938
|
+
return MiniNotify
|