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

View file

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

View file

@ -10,7 +10,16 @@
:layout_strategy :horizontal :layout_strategy :horizontal
:layout_config {:horizontal {:preview_width 0.5}} :layout_config {:horizontal {:preview_width 0.5}}
; Mappings ; 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 {})]}}) :extensions {:ui-select [(themes.get_dropdown {})]}})
(telescope.load_extension :ui-select) (telescope.load_extension :ui-select)
(telescope.load_extension :toggleterm) (telescope.load_extension :toggleterm)