mirror of
https://github.com/hyzendust/KickestEnd.nvim.git
synced 2026-07-01 01:32:17 +02:00
Compare commits
3 Commits
25f8a5cd15
...
7df4ce3c03
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7df4ce3c03 | ||
|
|
602735a0f4 | ||
|
|
0e08afd339 |
10
init.lua
10
init.lua
@@ -39,14 +39,14 @@ vim.opt.rtp:prepend(lazypath)
|
||||
-- You can also configure plugins after the setup call,
|
||||
-- as they will be available in your neovim runtime.
|
||||
|
||||
-- Disables which-key healthcheck notifications
|
||||
-- Disables which-key healthcheck notification
|
||||
do
|
||||
local orig_notify = vim.notify
|
||||
vim.notify = function(msg, ...)
|
||||
if type(msg) == 'string' and msg:match 'which%-key' then
|
||||
return -- ignore WhichKey health messages
|
||||
vim.notify = function(msg, level, ...)
|
||||
if type(msg) == 'string' and msg:match 'issues reported with your' and msg:match 'which%-key' then
|
||||
return
|
||||
end
|
||||
return orig_notify(msg, ...)
|
||||
return orig_notify(msg, level, ...)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -76,4 +76,8 @@ local function replace_snippets()
|
||||
::continue::
|
||||
end
|
||||
end
|
||||
replace_snippets()
|
||||
-- Wait until lazy.nvim has finished loading plugins
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'LazyDone',
|
||||
callback = replace_snippets,
|
||||
})
|
||||
|
||||
@@ -27,15 +27,21 @@ vim.api.nvim_create_user_command('UpdateKickestEnd', function()
|
||||
local origin_master = vim.fn.systemlist({ 'git', '-C', config_path, 'rev-parse', 'origin/master' })[1]
|
||||
local is_uptodate = (head == origin_master)
|
||||
|
||||
-- Check for local commits not yet pushed to origin/master -- a
|
||||
local ahead_count = tonumber(vim.fn.systemlist({ 'git', '-C', config_path, 'rev-list', '--count', 'origin/master..HEAD' })[1]) or 0
|
||||
local has_unpushed_commits = ahead_count > 0
|
||||
|
||||
-- Skip update if nothing to do
|
||||
if not dirty and is_uptodate then
|
||||
vim.notify('KickestEnd.nvim is already up-to-date with origin/master.', vim.log.levels.INFO)
|
||||
return
|
||||
end
|
||||
|
||||
-- If there are local changes or untracked files, confirm overwrite
|
||||
if dirty then
|
||||
local answer = vim.fn.input 'Local changes or new files detected! Overwrite and delete them? (y/N): '
|
||||
-- If there are local changes, untracked files, or unpushed commits, confirm overwrite
|
||||
if dirty or has_unpushed_commits then
|
||||
local prompt = dirty and 'Local changes or new files detected! Overwrite and delete them? (y/N): '
|
||||
or string.format('%d local commit(s) not on origin/master will be lost! Continue? (y/N): ', ahead_count)
|
||||
local answer = vim.fn.input(prompt)
|
||||
if answer:lower() ~= 'y' then
|
||||
vim.notify('Update cancelled to preserve your modifications.', vim.log.levels.WARN)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user