From 2097f11305598bd88f799a76f5549da57f852a58 Mon Sep 17 00:00:00 2001 From: fdschmidt93 <39233597+fdschmidt93@users.noreply.github.com> Date: Thu, 4 Nov 2021 07:32:02 +0100 Subject: [PATCH] fix: deactivate binary ft detection for Win32 (#1413) * Make `file` mime type detection for Windows users opt-in, as it caused issues when they had it --- doc/telescope.txt | 2 +- lua/telescope/config.lua | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/telescope.txt b/doc/telescope.txt index 3e1c0c4..980168a 100644 --- a/doc/telescope.txt +++ b/doc/telescope.txt @@ -310,7 +310,7 @@ telescope.setup({opts}) *telescope.setup()* Windows users get `file` from: https://github.com/julian-r/file-windows Set to false to attempt to preview any mime type. - Default: true + Default: true for all OS excl. Windows - filesize_limit: The maximum file size in MB attempted to be previewed. Set to false to attempt to preview any file size. Default: 25 diff --git a/lua/telescope/config.lua b/lua/telescope/config.lua index dc01d3b..8c90bbb 100644 --- a/lua/telescope/config.lua +++ b/lua/telescope/config.lua @@ -3,6 +3,7 @@ local deprecated = require "telescope.deprecated" local sorters = require "telescope.sorters" local if_nil = vim.F.if_nil local os_sep = require("plenary.path").path.sep +local has_win = vim.fn.has "win32" == 1 -- Keep the values around between reloads _TelescopeConfigurationValues = _TelescopeConfigurationValues or {} @@ -411,7 +412,7 @@ append( append( "preview", { - check_mime_type = true, + check_mime_type = not has_win, filesize_limit = 25, timeout = 250, treesitter = true, @@ -432,7 +433,7 @@ append( Windows users get `file` from: https://github.com/julian-r/file-windows Set to false to attempt to preview any mime type. - Default: true + Default: true for all OS excl. Windows - filesize_limit: The maximum file size in MB attempted to be previewed. Set to false to attempt to preview any file size. Default: 25