dotfiles/home/config/nvim/plugins/telescope.fnl
Daniel Kempkens 40be012ceb
All checks were successful
Build / build-amd64-linux (push) Successful in 34s
Build / build-arm64-linux (push) Successful in 1m38s
nvim: use telescope-zf-native
2024-01-21 00:14:00 +01:00

51 lines
2.8 KiB
Fennel

(let [telescope (require :telescope)
actions (require :telescope.actions)
themes (require :telescope.themes)]
(telescope.setup {:defaults {; Display
:prompt_prefix " "
:selection_caret " "
:set_env {:COLORTERM :truecolor}
:path_display [:truncate :absolute]
; Layout
:layout_strategy :horizontal
:layout_config {:horizontal {:preview_width 0.5}}
; Mappings
:mappings {:i {:<esc> actions.close}}
; Arguments
:vimgrep_arguments [:rg
:--hidden
:--ignore-vcs
:-g
:!.git/*
:--color=never
:--no-heading
:--with-filename
:--line-number
:--column
:--smart-case
:--trim]}
:extensions {:ui-select [(themes.get_dropdown {})]
:zf-native {:file {:enable true
:highlight_results true
:match_filename true}
:generic {:enable true
:highlight_results true
:match_filename false}}}})
(telescope.load_extension :zf-native)
(telescope.load_extension :ui-select)
(telescope.load_extension :yank_history)
(telescope.load_extension :undo)
(let [augroup (vim.api.nvim_create_augroup :NifocTelescope {:clear true})
aucmd vim.api.nvim_create_autocmd]
(aucmd :FileType {:pattern :TelescopePrompt
:callback #(set vim.opt_local.cursorline false)
:group augroup})
(aucmd :User {:pattern :TelescopePreviewerLoaded
:command "let w:is_telescope=v:true"
:group augroup})
(aucmd :BufWinEnter {:callback #(when vim.w.is_telescope
(set vim.opt_local.number true)
(set vim.opt_local.relativenumber false)
(set vim.opt_local.wrap true))
:group augroup})))