mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-23 01:08:53 +02:00
fix: support neovim v0.10
This commit is contained in:
parent
f00aeb3add
commit
5179bb1047
13 changed files with 515 additions and 513 deletions
|
@ -1,33 +1,33 @@
|
|||
local M = {}
|
||||
|
||||
function M.smart_quit()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local buf_windows = vim.call("win_findbuf", bufnr)
|
||||
local modified = vim.api.nvim_buf_get_option(bufnr, "modified")
|
||||
if modified and #buf_windows == 1 then
|
||||
vim.ui.input({
|
||||
prompt = "You have unsaved changes. Quit anyway? (y/n) ",
|
||||
}, function(input)
|
||||
if input == "y" then
|
||||
vim.cmd("q!")
|
||||
end
|
||||
end)
|
||||
else
|
||||
vim.cmd("q!")
|
||||
end
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local buf_windows = vim.call("win_findbuf", bufnr)
|
||||
local modified = vim.api.nvim_buf_get_var(bufnr, "modified")
|
||||
if modified and #buf_windows == 1 then
|
||||
vim.ui.input({
|
||||
prompt = "You have unsaved changes. Quit anyway? (y/n) ",
|
||||
}, function(input)
|
||||
if input == "y" then
|
||||
vim.cmd "q!"
|
||||
end
|
||||
end)
|
||||
else
|
||||
vim.cmd "q!"
|
||||
end
|
||||
end
|
||||
|
||||
function M.isempty(s)
|
||||
return s == nil or s == ""
|
||||
return s == nil or s == ""
|
||||
end
|
||||
|
||||
function M.get_buf_option(opt)
|
||||
local status_ok, buf_option = pcall(vim.api.nvim_buf_get_option, 0, opt)
|
||||
if not status_ok then
|
||||
return nil
|
||||
else
|
||||
return buf_option
|
||||
end
|
||||
local status_ok, buf_option = pcall(vim.api.nvim_buf_get_var, 0, opt)
|
||||
if not status_ok then
|
||||
return nil
|
||||
else
|
||||
return buf_option
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue