Refresh generated neovim config
This commit is contained in:
@ -2,7 +2,7 @@ local actions = require("telescope.actions")
|
||||
local actions_state = require("telescope.actions.state")
|
||||
|
||||
local function _get_default_register()
|
||||
local clipboardFlags = vim.split(vim.api.nvim_get_option("clipboard"), ",")
|
||||
local clipboardFlags = vim.split(vim.api.nvim_get_option_value("clipboard", {}), ",")
|
||||
if vim.tbl_contains(clipboardFlags, "unnamedplus") then
|
||||
return "+"
|
||||
end
|
||||
|
||||
@ -2,9 +2,9 @@ local finders = require("telescope.finders")
|
||||
local pickers = require("telescope.pickers")
|
||||
local conf = require("telescope.config").values
|
||||
|
||||
require("telescope-undo.previewer")
|
||||
require("telescope-undo.actions")
|
||||
require("telescope-undo.lua-timeago")
|
||||
local get_previewer = require("telescope-undo.previewer").get_previewer
|
||||
local timeago = require("telescope-undo.lua-timeago").timeago
|
||||
|
||||
local function _traverse_undotree(opts, entries, level)
|
||||
local undolist = {}
|
||||
@ -28,10 +28,7 @@ local function _traverse_undotree(opts, entries, level)
|
||||
local header = filename .. "\n--- " .. filename .. "\n+++ " .. filename .. "\n"
|
||||
|
||||
-- do the diff using our internal diff function
|
||||
local diff = vim.diff(buffer_before, buffer_after, {
|
||||
algorithm = "patience",
|
||||
ctxlen = opts.diff_context_lines or 0,
|
||||
})
|
||||
local diff = vim.diff(buffer_before, buffer_after, opts.vim_diff_opts)
|
||||
|
||||
-- extract data for yanking and searching
|
||||
local ordinal = ""
|
||||
@ -96,7 +93,7 @@ end
|
||||
local M = {}
|
||||
|
||||
M.undo = function(opts)
|
||||
if not vim.api.nvim_buf_get_option(0, "modifiable") then
|
||||
if not vim.api.nvim_get_option_value("modifiable", { buf = 0 }) then
|
||||
print("telescope-undo.nvim: Current buffer is not modifiable.")
|
||||
return
|
||||
end
|
||||
|
||||
@ -17,7 +17,7 @@ local function round(num)
|
||||
return math.floor(num + 0.5)
|
||||
end
|
||||
|
||||
function timeago(time)
|
||||
local function timeago(time)
|
||||
local now = os.time()
|
||||
local diff_seconds = os.difftime(now, time)
|
||||
if diff_seconds < 45 then
|
||||
@ -70,3 +70,5 @@ function timeago(time)
|
||||
end
|
||||
return round(diff_years) .. " " .. language.year.plural
|
||||
end
|
||||
|
||||
return { timeago = timeago }
|
||||
|
||||
@ -3,10 +3,10 @@ local is_wsl = (function()
|
||||
local output = vim.fn.systemlist("uname -r")
|
||||
return not not string.find(output[1] or "", "WSL")
|
||||
end)()
|
||||
function get_previewer(opts)
|
||||
local function get_previewer(opts)
|
||||
if opts.use_custom_command ~= nil then
|
||||
return previewers.new_termopen_previewer({
|
||||
get_command = function(entry, status)
|
||||
get_command = function(entry, _)
|
||||
local difftext = entry.value.diff:gsub("'", [['"'"']])
|
||||
local shlexed = {}
|
||||
for i, part in ipairs(opts.use_custom_command) do
|
||||
@ -20,7 +20,7 @@ function get_previewer(opts)
|
||||
local has_bash = vim.fn.executable("bash") == 1
|
||||
if opts.use_delta and not is_wsl and (has_powershell or has_bash) and vim.fn.executable("delta") == 1 then
|
||||
return previewers.new_termopen_previewer({
|
||||
get_command = function(entry, status)
|
||||
get_command = function(entry, _)
|
||||
local append = ""
|
||||
if opts.side_by_side == true then
|
||||
append = append .. " -s"
|
||||
@ -44,7 +44,7 @@ function get_previewer(opts)
|
||||
else
|
||||
return previewers.new_buffer_previewer({
|
||||
-- this is not the prettiest preview...
|
||||
define_preview = function(self, entry, status)
|
||||
define_preview = function(self, entry, _)
|
||||
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, true, vim.split(entry.value.diff, "\n"))
|
||||
require("telescope.previewers.utils").highlighter(
|
||||
self.state.bufnr,
|
||||
@ -55,3 +55,4 @@ function get_previewer(opts)
|
||||
})
|
||||
end
|
||||
end
|
||||
return { get_previewer = get_previewer }
|
||||
|
||||
Reference in New Issue
Block a user