fix: failed to rename buffer (#731)
This commit is contained in:
parent
a0d3845bf3
commit
26bf8d67e8
@ -1,3 +1,5 @@
|
|||||||
|
local Path = require("plenary.path")
|
||||||
|
|
||||||
local api = vim.api
|
local api = vim.api
|
||||||
local fn = vim.fn
|
local fn = vim.fn
|
||||||
local lsp = vim.lsp
|
local lsp = vim.lsp
|
||||||
@ -662,8 +664,9 @@ function M.get_mentions()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function get_opened_buffer_by_filepath(filepath)
|
local function get_opened_buffer_by_filepath(filepath)
|
||||||
|
local absolute_path = Path:new(filepath):absolute()
|
||||||
for _, buf in ipairs(api.nvim_list_bufs()) do
|
for _, buf in ipairs(api.nvim_list_bufs()) do
|
||||||
if fn.bufname(buf) == filepath then return buf end
|
if Path:new(fn.bufname(buf)):absolute() == absolute_path then return buf end
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user