Skip to content
This repository was archived by the owner on Feb 20, 2025. It is now read-only.

Commit 25e3c69

Browse files
committed
feat(nvim-plug): check hlexists
1 parent 1e2b5af commit 25e3c69

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

bundle/nvim-plug/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
- [Commands](#commands)
1515
- [Default UI](#default-ui)
1616
- [Custom Plugin UI](#custom-plugin-ui)
17-
- [Plugin priority](#plugin-priority)
17+
- [Plugin priority](#plugin-priority)
1818
- [Feedback](#feedback)
1919

2020
<!-- vim-markdown-toc -->
2121

2222
## Intro
2323

24-
nvim-plug is an asynchronous Neovim plugin manager written in Lua. There is also a [Chinese introduction](https://wsdjeg.net/neovim-plugin-manager-nvim-plug/) about nvim-plug.
24+
nvim-plug is an asynchronous Neovim plugin manager written in Lua.
25+
There is also a [Chinese introduction](https://wsdjeg.net/neovim-plugin-manager-nvim-plug/) about this plugin.
2526

2627
## Features
2728

@@ -184,7 +185,7 @@ require('plug').setup({
184185
})
185186
```
186187

187-
### Plugin priority
188+
## Plugin priority
188189

189190
By default this feature is disabled, plugins will be loaded when run `add({plugins})` function.
190191
To enable plugin priority feature, you need to call `plug.load()` after `plug.add()` function.

bundle/nvim-plug/lua/plug/ui.lua

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,21 @@ M.open = function()
101101
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, build_context())
102102
end
103103
--- setup highlight
104-
vim.cmd('hi def link PlugTitle TODO')
105-
vim.cmd('hi def link PlugProcess Repeat')
106-
vim.cmd('hi def link PlugDone Type')
107-
vim.cmd('hi def link PlugFailed WarningMsg')
108-
vim.cmd('hi def link PlugDoing Number')
104+
if vim.fn.hlexists('PlugTitle') == 0 then
105+
vim.cmd('hi def link PlugTitle TODO')
106+
end
107+
if vim.fn.hlexists('PlugProcess') == 0 then
108+
vim.cmd('hi def link PlugProcess Repeat')
109+
end
110+
if vim.fn.hlexists('PlugDone') == 0 then
111+
vim.cmd('hi def link PlugDone Type')
112+
end
113+
if vim.fn.hlexists('PlugFailed') == 0 then
114+
vim.cmd('hi def link PlugFailed WarningMsg')
115+
end
116+
if vim.fn.hlexists('PlugDoing') == 0 then
117+
vim.cmd('hi def link PlugDoing Number')
118+
end
109119
vim.fn.matchadd('PlugTitle', '^Plugins.*', 2, -1, { window = winid })
110120
vim.fn.matchadd('PlugProcess', '^\\[\\zs=*', 2, -1, { window = winid })
111121
vim.fn.matchadd('PlugDone', '^√.*', 2, -1, { window = winid })

0 commit comments

Comments
 (0)