summaryrefslogtreecommitdiff
path: root/pkgs/custom-neovim/config/lua/plugins/fzf.lua
blob: 1c1b9aa1ea268aebce06e33c2a058885cb3231cd (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
return {
  "fzf-lua",
  cmd = "FzfLua",
  after = function ()
    require("fzf-lua").setup {
      "default-title",
      files = {
        cwd_prompt = false,
      },
    }

    require("fzf-lua").register_ui_select()

    Custom_pickers = {}

    Custom_pickers.fzf_dir_cd = function()
      local dirs = {}
      for name, type in vim.fs.dir("./", {depth = 100}) do
        if type == "directory" then
          table.insert(dirs, name)
        end
      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 name, type in vim.fs.dir("./", {depth = 100}) do
        if type == "directory" then
          table.insert(dirs, name)
        end
      end

      require("fzf-lua").fzf_exec( dirs, {
        winopts = {
          title = " Directories ",
        },
        prompt = "❯ ",
        actions = {
          ["enter"] = function(selected)
            vim.cmd.tcd(selected)
          end
        }
      })
    end
  end,
}