more stuff too lazy to seperate

This commit is contained in:
2023-11-24 21:38:31 -05:00
parent ed205a9545
commit 550cac1035
33 changed files with 488 additions and 246 deletions

View File

@ -9,16 +9,28 @@ local function telescopew()
if vim.o.columns <= 80 then
return vim.o.columns
else
return 80
return 0.8
end
end
telescope.setup {
defaults = {
borderchars = {
prompt = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
results = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
preview = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
prompt = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
results = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
preview = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
},
winblend = 0,
layout_strategy = 'horizontal',
sorting_strategy = 'descending',
scroll_strategy = 'limit',
layout_config = {
horizontal = {
width = telescopew(),
height = 20,
prompt_position = 'bottom',
anchor = 'N',
}
},
preview = {
-- add image previews via chafa
@ -30,7 +42,7 @@ telescope.setup {
'jpe',
'jpeg',
'webp',
'gif',
'gif'
}
local split_path = vim.split(filepath:lower(), '.', { plain=true })
local extension = split_path[#split_path]
@ -38,39 +50,22 @@ telescope.setup {
end
if is_image(filepath) then
local term = vim.api.nvim_open_term(bufnr, {})
local function send_output(_, data, _ )
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({
'chafa',
'-C',
'on',
'--animate',
'off',
'-s',
(telescopew() - 10)..'x25',
'--clear',
filepath
'chafa', '-C', 'on', '--animate', 'off', '-s',
(telescopew() - 10)..'x20', '--clear', filepath
}, { on_stdout = send_output, stdout_buffered = true, pty = true })
a.nvim_set_option_value("number", false, {buf = bufnr})
a.nvim_set_option_value("number", false, { buf = bufnr })
else
require("telescope.previewers.utils").set_preview_message(bufnr, opts.winid, "File cannot be previewed")
require("telescope.previewers.utils").set_preview_message(bufnr,
opts.winid, "File cannot be previewed")
end
end
},
winblend = 0,
-- 'horizontal', 'vertical', 'bottom_pane', or 'cursor'
layout_strategy = 'vertical',
sorting_strategy = 'ascending',
layout_config = {
vertical = {
width = telescopew(),
prompt_position = "top",
}
},
mappings = {
i = {
["<esc>"] = actions.close,
@ -90,8 +85,8 @@ telescope.setup {
}
}
telescope.load_extension('file_browser')
telescope.load_extension('ui-select')
telescope.load_extension('projects')
telescope.load_extension('fzf')
a.nvim_create_autocmd('User', {
pattern = 'TelescopePreviewerLoaded',