blob: 04096b266976d2ef9ea5df5bfe56d683b2f6f354 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
(local pickers (require :telescope.pickers))
(local finders (require :telescope.finders))
(local conf (. (require :telescope.config) :values))
(local themes (require :telescope.themes))
(local actions (require :telescope.actions))
(local action_state (require :telescope.actions.state))
(fn colors [opts]
(local opts (if opts opts {}))
(local finder
(pickers.new opts
{:prompt_title :colors
:finder (finders.new_oneshot_job [:fd
:-d1
"."
(os.getenv :HOME)
(.. (os.getenv :HOME)
:/projects)]
{})
:attach_mappings (fn [prompt_buf map]
(actions.select_default:replace (fn []
(actions.close prompt_buf)
(local selection
(action_state.get_selected_entry))
(P selection)
(vim.cmd (.. :tabnew
(. selection
1)))
(vim.cmd (.. :tc
(. selection
1)))
(vim.schedule (fn []
(vim.cmd (.. :Telescope
" "
:find_files)))))))
:sorter (conf.generic_sorter opts)}))
(finder:find))
(vim.api.nvim_create_user_command :NewTab (fn [] (colors (themes.get_ivy))) {})
(vim.api.nvim_create_user_command :Colors colors {})
|