git_buf_edit, set bufhidden:wipe

main
bhagwan 3 years ago
parent 0b97ac673b
commit e6c4f31c06

@ -237,11 +237,12 @@ M.git_buf_edit = function(selected)
local file = path.relative(vim.fn.expand("%"), vim.loop.cwd())
local commit_hash = selected[1]:match("[^ ]+")
local git_file_contents = vim.fn.systemlist("git show " .. commit_hash .. ":" .. file)
local buf = vim.api.nvim_create_buf(true, false)
local buf = vim.api.nvim_create_buf(true, false)
local file_name = string.gsub(file,"%.","[" .. commit_hash .. "]%.")
vim.api.nvim_buf_set_lines(buf,0,0,true,git_file_contents)
vim.api.nvim_buf_set_name(buf,file_name)
vim.api.nvim_buf_set_option(buf, 'buftype', 'nofile')
vim.api.nvim_buf_set_option(buf, 'bufhidden', 'wipe')
vim.api.nvim_buf_set_option(buf, 'filetype',buffer_filetype)
vim.api.nvim_win_set_buf(win, buf)
end

Loading…
Cancel
Save