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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
return {
"fzf-lua",
enabled = false,
cmd = "FzfLua",
after = function ()
require("fzf-lua").setup {
"default-title",
files = {
cwd_prompt = false,
},
}
require("fzf-lua").register_ui_select()
local multiline_string_to_table = function (input_str)
local lines = {}
for line in input_str:gmatch("[^\r\n]+") do
table.insert(lines, line)
end
return lines
end
Custom_pickers = {}
Custom_pickers.fzf_dir_cd = function()
local dirs = {}
for i, name in ipairs(multiline_string_to_table(vim.fn.system("fd -t d"))) do
table.insert(dirs, name)
end
require("fzf-lua").fzf_exec( dirs, {
winopts = {
title = " Directories ",
},
prompt = "❯ ",
actions = {
["enter"] = function(selected)
vim.cmd.cd(selected)
end
}
})
end
Custom_pickers.fzf_dir_tcd = function()
local dirs = {}
for i, name in ipairs(multiline_string_to_table(vim.fn.system("fd -t d"))) do
table.insert(dirs, name)
end
require("fzf-lua").fzf_exec( dirs, {
winopts = {
title = " Directories ",
},
prompt = "❯ ",
actions = {
["enter"] = function(selected)
vim.cmd.tcd(selected)
end
}
})
end
end
}
|