1

Neovim: Disable Telescope preview word wrap

It does not work for previews that don't correspond to files, e.g.
notifications.
This commit is contained in:
2024-10-14 20:13:28 +02:00
parent f7b97521f1
commit dec7d084a8

View File

@ -182,22 +182,24 @@ in {
'';
}
{
# TODO: This breaks if the preview buffer does not refer to a file,
# e.g. when showing previous notifications
desc = "Enable line wrapping in telescope preview";
event = ["User"];
pattern = ["TelescopePreviewerLoaded"];
callback.__raw = ''
function(args)
if args.data.bufname:match("*.csv") then
vim.wo.wrap = false
else
vim.wo.wrap = true
end
end
'';
}
# This breaks if the preview buffer does not refer to a file, e.g. when showing previous notifications
# {
# desc = "Enable line wrapping in telescope preview";
# event = ["User"];
# pattern = ["TelescopePreviewerLoaded"];
# callback.__raw = ''
# -- The callback arg is of this format:
# -- {
# -- title: string, # preview window title
# -- filetype: string,
# -- bufname: string,
# -- }
# function(args)
# vim.wo.wrap = true
# end
# '';
# }
];
keymaps = import ./mappings.nix {inherit lib mylib;};