refactor(colorscheme): clean up vim.cmd colorscheme calls (#2830)
This commit is contained in:
@@ -959,7 +959,7 @@ end
|
|||||||
|
|
||||||
internal.colorscheme = function(opts)
|
internal.colorscheme = function(opts)
|
||||||
local before_background = vim.o.background
|
local before_background = vim.o.background
|
||||||
local before_color = vim.api.nvim_exec("colorscheme", true)
|
local before_color = vim.cmd.colorscheme()
|
||||||
local need_restore = true
|
local need_restore = true
|
||||||
|
|
||||||
local colors = opts.colors or { before_color }
|
local colors = opts.colors or { before_color }
|
||||||
@@ -999,7 +999,7 @@ internal.colorscheme = function(opts)
|
|||||||
del_win(status.layout.preview.border.winid)
|
del_win(status.layout.preview.border.winid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
vim.cmd("colorscheme " .. entry.value)
|
vim.cmd.colorscheme(entry.value)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1015,7 +1015,7 @@ internal.colorscheme = function(opts)
|
|||||||
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||||
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines)
|
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines)
|
||||||
end
|
end
|
||||||
vim.cmd("colorscheme " .. entry.value)
|
vim.cmd.colorscheme(entry.value)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -1038,7 +1038,7 @@ internal.colorscheme = function(opts)
|
|||||||
|
|
||||||
actions.close(prompt_bufnr)
|
actions.close(prompt_bufnr)
|
||||||
need_restore = false
|
need_restore = false
|
||||||
vim.cmd("colorscheme " .. selection.value)
|
vim.cmd.colorscheme(selection.value)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@@ -1052,7 +1052,7 @@ internal.colorscheme = function(opts)
|
|||||||
close_windows(status)
|
close_windows(status)
|
||||||
if need_restore then
|
if need_restore then
|
||||||
vim.o.background = before_background
|
vim.o.background = before_background
|
||||||
vim.cmd("colorscheme " .. before_color)
|
vim.cmd.colorscheme(before_color)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user