mirror of
https://github.com/ksyasuda/dotfiles.git
synced 2025-12-05 02:53:38 -08:00
update nvim
This commit is contained in:
@@ -221,6 +221,55 @@ return {
|
||||
diff = {
|
||||
enabled = true,
|
||||
provider = "mini_diff",
|
||||
provider_opts = {
|
||||
-- Options for inline diff provider
|
||||
inline = {
|
||||
layout = "buffer", -- float|buffer - Where to display the diff
|
||||
|
||||
diff_signs = {
|
||||
signs = {
|
||||
text = "▌", -- Sign text for normal changes
|
||||
reject = "✗", -- Sign text for rejected changes in super_diff
|
||||
highlight_groups = {
|
||||
addition = "DiagnosticOk",
|
||||
deletion = "DiagnosticError",
|
||||
modification = "DiagnosticWarn",
|
||||
},
|
||||
},
|
||||
-- Super Diff options
|
||||
icons = {
|
||||
accepted = " ",
|
||||
rejected = " ",
|
||||
},
|
||||
colors = {
|
||||
accepted = "DiagnosticOk",
|
||||
rejected = "DiagnosticError",
|
||||
},
|
||||
},
|
||||
|
||||
opts = {
|
||||
context_lines = 3, -- Number of context lines in hunks
|
||||
dim = 25, -- Background dim level for floating diff (0-100, [100 full transparent], only applies when layout = "float")
|
||||
full_width_removed = true, -- Make removed lines span full width
|
||||
show_keymap_hints = true, -- Show "gda: accept | gdr: reject" hints above diff
|
||||
show_removed = true, -- Show removed lines as virtual text
|
||||
},
|
||||
},
|
||||
-- Options for the split provider
|
||||
split = {
|
||||
close_chat_at = 240, -- Close an open chat buffer if the total columns of your display are less than...
|
||||
layout = "vertical", -- vertical|horizontal split
|
||||
opts = {
|
||||
"internal",
|
||||
"filler",
|
||||
"closeoff",
|
||||
"algorithm:histogram", -- https://adamj.eu/tech/2024/01/18/git-improve-diff-histogram/
|
||||
"indent-heuristic", -- https://blog.k-nut.eu/better-git-diffs
|
||||
"followwrap",
|
||||
"linematch:120",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
---Customize how tokens are displayed
|
||||
---@param tokens number
|
||||
|
||||
@@ -36,15 +36,14 @@ return {
|
||||
dynamic_preview_title = true,
|
||||
treesitter = true,
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
-- map actions.which_key to <C-h> (default: <C-/>)
|
||||
-- actions.which_key shows the mappings for your picker,
|
||||
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
|
||||
["<C-h>"] = "which_key",
|
||||
["<C-u"] = false,
|
||||
},
|
||||
},
|
||||
-- mappings = {
|
||||
-- i = {
|
||||
-- -- map actions.which_key to <C-h> (default: <C-/>)
|
||||
-- -- actions.which_key shows the mappings for your picker,
|
||||
-- -- e.g. git_{create, delete, ...}_branch for the git_branches picker
|
||||
-- ["<C-/>"] = "which_key",
|
||||
-- },
|
||||
-- },
|
||||
file_ignore_patterns = { "^node_modules/", "^env/", "^__pycache__/" },
|
||||
},
|
||||
pickers = {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
local telescope = require("telescope")
|
||||
local telescopeConfig = require("telescope.config")
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -36,56 +37,13 @@ function M.setup()
|
||||
-- I don't want to search in the `.git` directory.
|
||||
table.insert(vimgrep_arguments, "--glob")
|
||||
table.insert(vimgrep_arguments, "!**/.git/*")
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
-- `hidden = true` is not supported in text grep commands.
|
||||
vimgrep_arguments = vimgrep_arguments,
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
-- `hidden = true` will still show the inside of `.git/` as it's not `.gitignore`d.
|
||||
find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" },
|
||||
mappings = {
|
||||
n = {
|
||||
["cd"] = function(prompt_bufnr)
|
||||
local selection = require("telescope.actions.state").get_selected_entry()
|
||||
local dir = vim.fn.fnamemodify(selection.path, ":p:h")
|
||||
require("telescope.actions").close(prompt_bufnr)
|
||||
-- Depending on what you want put `cd`, `lcd`, `tcd`
|
||||
vim.cmd(string.format("silent lcd %s", dir))
|
||||
end,
|
||||
},
|
||||
},
|
||||
vim.tbl_deep_extend("force", telescopeConfig.values, {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-h>"] = actions.results_scrolling_left,
|
||||
["<C-l>"] = actions.results_scrolling_right,
|
||||
},
|
||||
},
|
||||
preview = {
|
||||
-- show images in telescope using kitty
|
||||
mime_hook = function(filepath, bufnr, opts)
|
||||
local is_image = function(filepath)
|
||||
local image_extensions = { "png", "jpg" } -- Supported image formats
|
||||
local split_path = vim.split(filepath:lower(), ".", { plain = true })
|
||||
local extension = split_path[#split_path]
|
||||
return vim.tbl_contains(image_extensions, extension)
|
||||
end
|
||||
if is_image(filepath) then
|
||||
local term = vim.api.nvim_open_term(bufnr, {})
|
||||
local function send_output(_, data, _)
|
||||
for _, d in ipairs(data) do
|
||||
vim.api.nvim_chan_send(term, d .. "\r\n")
|
||||
end
|
||||
end
|
||||
vim.fn.jobstart({
|
||||
"kitty +icat " .. filepath, -- Terminal image viewer command
|
||||
}, { on_stdout = send_output, stdout_buffered = true, pty = true })
|
||||
else
|
||||
require("telescope.previewers.utils").set_preview_message(
|
||||
bufnr,
|
||||
opts.winid,
|
||||
"Binary cannot be previewed"
|
||||
)
|
||||
end
|
||||
end,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user