1
0
Fork 0

nvim: Update telescope configuration

This commit is contained in:
Daniel Kempkens 2022-06-12 23:06:29 +02:00
parent 3fb46b6bac
commit 196acb23a8
3 changed files with 20 additions and 8 deletions

View file

@ -19,8 +19,7 @@
(set vim.g.mapleader " ")
(set vim.opt.timeoutlen 400)
;; Leader Mappings
(keymap.set :n :<leader>o telescope-nifoc.project-files
{:desc "Find Files"})
(keymap.set :n :<leader>o telescope-nifoc.find-files {:desc "Find Files"})
(keymap.set :n :<leader>s #(telescope-builtin.live_grep telescope-ivy)
{:desc "Live Grep"})
(keymap.set :n :<leader>fn :<cmd>enew<CR> {:desc "New File"})

View file

@ -1,19 +1,23 @@
(let [mod {}
builtin (require :telescope.builtin)
themes (require :telescope.themes)]
(fn mod.project-files []
(let [git-opts (themes.get_ivy)
find-opts (themes.get_ivy {:find_command [:rg
(fn mod.find-files []
(let [find-opts (themes.get_ivy {:find_command [:rg
:--files
:--hidden
:--ignore-vcs
:-L
:-g
:!.git/*
:-g
:!node_modules/*]})
:!node_modules/*]})]
(builtin.find_files find-opts)))
(fn mod.project-files []
(let [git-opts (themes.get_ivy)
ok? (pcall builtin.git_files git-opts)]
(when (not ok?)
(builtin.find_files find-opts))))
(mod.find-files))))
mod)

View file

@ -10,7 +10,16 @@
:layout_strategy :horizontal
:layout_config {:horizontal {:preview_width 0.5}}
; Mappings
:mappings {:i {:<esc> actions.close}}}
:mappings {:i {:<esc> actions.close}}
; Arguments
:vimgrep_arguments [:rg
:--color=never
:--no-heading
:--with-filename
:--line-number
:--column
:--smart-case
:--trim]}
:extensions {:ui-select [(themes.get_dropdown {})]}})
(telescope.load_extension :ui-select)
(telescope.load_extension :toggleterm)