use nvim_get_option_value instead of nvim{,_buf,_win}_get_option
This commit is contained in:
@@ -108,7 +108,7 @@ config.get = function()
|
|||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
local bufnr = vim.api.nvim_get_current_buf()
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
local filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype')
|
local filetype = vim.api.nvim_get_option_value('filetype', { buf = bufnr })
|
||||||
local buffer_config = config.buffers[bufnr] or { revision = 1 }
|
local buffer_config = config.buffers[bufnr] or { revision = 1 }
|
||||||
local filetype_config = config.filetypes[filetype] or { revision = 1 }
|
local filetype_config = config.filetypes[filetype] or { revision = 1 }
|
||||||
return config.cache:ensure({
|
return config.cache:ensure({
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ return function()
|
|||||||
local config = {
|
local config = {
|
||||||
enabled = function()
|
enabled = function()
|
||||||
local disabled = false
|
local disabled = false
|
||||||
disabled = disabled or (vim.api.nvim_buf_get_option(0, 'buftype') == 'prompt')
|
disabled = disabled or (vim.api.nvim_get_option_value('buftype', { buf = 0 }) == 'prompt')
|
||||||
disabled = disabled or (vim.fn.reg_recording() ~= '')
|
disabled = disabled or (vim.fn.reg_recording() ~= '')
|
||||||
disabled = disabled or (vim.fn.reg_executing() ~= '')
|
disabled = disabled or (vim.fn.reg_executing() ~= '')
|
||||||
return not disabled
|
return not disabled
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ context.new = function(prev_context, option)
|
|||||||
self.cache = cache.new()
|
self.cache = cache.new()
|
||||||
self.prev_context = prev_context or context.empty()
|
self.prev_context = prev_context or context.empty()
|
||||||
self.option = option or { reason = types.cmp.ContextReason.None }
|
self.option = option or { reason = types.cmp.ContextReason.None }
|
||||||
self.filetype = vim.api.nvim_buf_get_option(0, 'filetype')
|
self.filetype = vim.api.nvim_get_option_value('filetype', { buf = 0 })
|
||||||
self.time = vim.loop.now()
|
self.time = vim.loop.now()
|
||||||
self.bufnr = vim.api.nvim_get_current_buf()
|
self.bufnr = vim.api.nvim_get_current_buf()
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ end
|
|||||||
---@return { [1]: integer, [2]: integer }
|
---@return { [1]: integer, [2]: integer }
|
||||||
api.get_cursor = function()
|
api.get_cursor = function()
|
||||||
if api.is_cmdline_mode() then
|
if api.is_cmdline_mode() then
|
||||||
return { math.min(vim.o.lines, vim.o.lines - (vim.api.nvim_get_option('cmdheight') - 1)), vim.fn.getcmdpos() - 1 }
|
return { math.min(vim.o.lines, vim.o.lines - (vim.api.nvim_get_option_value('cmdheight', {}) - 1)), vim.fn.getcmdpos() - 1 }
|
||||||
end
|
end
|
||||||
return vim.api.nvim_win_get_cursor(0)
|
return vim.api.nvim_win_get_cursor(0)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ custom_entries_view.open = function(self, offset, entries)
|
|||||||
width = width + self.column_width.kind + (self.column_width.menu > 0 and 1 or 0)
|
width = width + self.column_width.kind + (self.column_width.menu > 0 and 1 or 0)
|
||||||
width = width + self.column_width.menu + 1
|
width = width + self.column_width.menu + 1
|
||||||
|
|
||||||
local height = vim.api.nvim_get_option('pumheight')
|
local height = vim.api.nvim_get_option_value('pumheight', {})
|
||||||
height = height ~= 0 and height or #self.entries
|
height = height ~= 0 and height or #self.entries
|
||||||
height = math.min(height, #self.entries)
|
height = math.min(height, #self.entries)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user