Commit Graph

27 Commits

Author SHA1 Message Date
Liam Jarvis
37c5268578 fix(previewer): Cast filepath to string before matching for filetype (#2565) 2023-06-11 08:31:19 +02:00
Simon Hauser
89ca726572 refactor(previewer): remove with_preview_window (#2563) 2023-06-10 21:01:23 +02:00
Simon Hauser
69e8715786 fix(previewer): only run ftdetect for files (#2559) 2023-06-09 18:51:17 +02:00
Simon Hauser
66b03e7740 feat!(previewer): replace plenary.filetype with vim.filetype.match (#2529) 2023-06-09 11:24:52 +02:00
Christian Clason
d8c5ed4e40 feat(ts)!: use upstream treesitter implementation (#2499)
bumps minimum required neovim version to 0.9, see `help telescope.changelog-2499`
2023-05-24 10:43:04 +02:00
Kalka
65287605c3 fix: wrap nvim_buf_set_option in a protected call (#2346) 2023-01-30 22:06:47 +01:00
Simon Hauser
3a29c1e89d fix: preview = true (#2168) 2022-10-08 07:46:08 +02:00
Simon Hauser
19047b6b3c fix: previewer if custom_captures are set (#2156) 2022-09-04 21:06:34 +02:00
Simon Hauser
f838695459 chore: reformat with stylua 0.14.0 2022-07-07 08:27:46 +02:00
marcel
5dd4b52910 break: cleanup preview.treesitter language setting (#1612)
this follows nvim-treesitter more closely but enable can also be a table
of enabled languages

The config now looks like this:
```lua
defaults = {
  preview = {
    treesitter = {
      enable = false,
      -- or
      enable = { "c" },
      -- disable can be set if enable isn't set
      disable = { "perl", "javascript" },
    },
  },
},
```
2022-07-01 22:58:05 +02:00
Simon Hauser
234066f875 fix: man_pages previewer, respecting MANPATH and apropos output parsing (#1764)
- introducing putils writer and use it rather than using PAGER env var
- introducing env for lua/telescope/_.lua job interface
  - to respect MANPATH (and PATH just in case)
- fix for apropos output parsing might return e.g. `alacritty, Alacritty`
  We need to split on first `,`
2022-03-10 13:48:40 +01:00
Patrick Ziegler
ce8c8d4a45 fix(highlight): Use TS built-in is_enabled function (#1513)
The function just replicated the logic from is_enabled and assumed the
`disable` setting is always a table. This is no longer the case
(https://github.com/nvim-treesitter/nvim-treesitter/pull/2009), it can
now also be a function.
2021-11-30 21:18:08 +01:00
fdschmidt93
a6c7498bdc feat: filetype_hook & improved docs; fix preview partial override (#1273) 2021-09-27 15:24:35 +02:00
fdschmidt93
5a020a8859 fix: fallback to syntax hl if treesitter fails (#1249) 2021-09-17 00:07:54 +02:00
fdschmidt93
7c5b846f6f feat: skip/timeout preview if file cannot be easily previewed (#1231)
* For full configuration, see `:h telescope.defaults.preview`
* Unblocks previewer on binaries, too large files, and files that take too long to read
* Allows toggling treesitter highlighting for buffer_previewer
* Allows to globally opt out of previewer
2021-09-16 23:01:40 +02:00
Simon Hauser
79644ab677 chore: use stylua for formatting (#1040)
* chore: stylua job and config

* reformat with stylua
2021-07-23 11:42:37 -04:00
Simon Hauser
664690029f fix: unknown filetype error message (#1034) 2021-07-20 19:20:22 +02:00
Simon Hauser
aefc831735 fix: no longer leaking one buffer previewer in some occasions (#664)
* fix: stop leaking last preview buffer
* fix: formatting for docs
* fix: async check if file is dir or not and
  - fix for in_fast_event when overriding file_maker
* fix: filtering for space in keymaps and fzy
* fix: show correct result numbers when using file_ignore_patterns
* Handle early close. Caused because we actually cleaning up buffers now
* cleanup
* [docgen] Update doc/telescope.txt
2021-03-30 12:32:18 +02:00
Simon Hauser
3a7fa41857 fix: all git builtin respect cwd now (#517) 2021-02-09 18:25:57 +01:00
elianiva
b1fb172b7f fix: no TS highlight if it gets loaded after Telescope (#479) 2021-01-30 23:34:05 +07:00
Simon Hauser
5592d709c6 refactor file_maker signature and fix scrolling (#412) 2021-01-11 21:10:42 +01:00
Alvaro Muñoz
f15af583eb fix: make sure preview buffer is valid before writing to it (#376) 2021-01-01 20:42:36 +01:00
Simon Hauser
686d560fa5 fix: has ts (#374) 2020-12-31 11:50:39 +01:00
fffed
d72f73feeb fix: add ts_parsers.ft_to_lang to detect lang (#373)
Add detection of a proper buffer language by `ts_parsers.ft_to_lang` as `ts_parsers.has_parser` works with `language` but not with `filetype`
https://github.com/nvim-treesitter/nvim-treesitter/issues/796
2020-12-30 22:24:45 +01:00
Alvaro Muñoz
e0705b5d4a feat: append mode for previewers.utils.job_maker (#372) 2020-12-30 00:56:12 +01:00
Simon Hauser
1d40ab5ccd feat: All buffer previewers are now async and more config options (#354)
Configure preview window with:
autocmd User TelescopePreviewerLoaded setlocal wrap
autocmd User TelescopePreviewerLoaded setlocal number

file_maker example: Use regex highlighting for certain filetype like `*min.js` because they slow
down things with treesitter highlighter. Just a snippet for tests. We will do an extension :)

local previewers = require('telescope.previewers')
local putils = require('telescope.previewers.utils')
local pfiletype = require('plenary.filetype')

local _bad = { '.*%.min%.js' }
local bad_files = function(filepath)
  for _, v in ipairs(_bad) do
    if filepath:match(v) then
      return true
    end
  end

  return false
end

local new_maker = function(filepath, bufnr, bufname, use_ft_detect, callback)
  if use_ft_detect == nil then use_ft_detect = true end

  if bad_files(filepath) then
    previewers.buffer_previewer_maker(filepath, bufnr, bufname, false, callback)
    local ft = pfiletype.detect(filepath)
    putils.regex_highlighter(bufnr, ft)
  else
    previewers.buffer_previewer_maker(filepath, bufnr, bufname, use_ft_detect, callback)
  end
end

require('telescope').setup {
  defaults = {
    buffer_previewer_maker = new_maker,
  }
}
2020-12-29 21:05:59 +01:00
Simon Hauser
8c90d4855c Refactor previewers (#345) 2020-12-19 16:45:02 +01:00