From 1b15804feaa5cb2b0c2f6a880ec57529ae06ba59 Mon Sep 17 00:00:00 2001
From: Matei Adriel <rafaeladriel11@gmail.com>
Date: Mon, 7 Feb 2022 13:12:28 +0200
Subject: [PATCH] feat: migrated from vim-fzf to telescope

---
 dotfiles/neovim/lua/my/plugins/init.lua      |  3 +-
 dotfiles/neovim/lua/my/plugins/telescope.lua | 35 ++++++++++++++++++++
 modules/applications/neovim.nix              |  6 ++--
 3 files changed, 41 insertions(+), 3 deletions(-)
 create mode 100644 dotfiles/neovim/lua/my/plugins/telescope.lua

diff --git a/dotfiles/neovim/lua/my/plugins/init.lua b/dotfiles/neovim/lua/my/plugins/init.lua
index aeafd3b..7f6ead5 100644
--- a/dotfiles/neovim/lua/my/plugins/init.lua
+++ b/dotfiles/neovim/lua/my/plugins/init.lua
@@ -2,7 +2,8 @@ local M = {}
 
 function M.setup()
     require("my.plugins.lspconfig").setup()
-    require("my.plugins.fzf-lua").setup()
+    -- require("my.plugins.fzf-lua").setup()
+    require("my.plugins.telescope").setup()
     require("my.plugins.treesitter").setup()
     require("my.plugins.comment").setup()
 
diff --git a/dotfiles/neovim/lua/my/plugins/telescope.lua b/dotfiles/neovim/lua/my/plugins/telescope.lua
new file mode 100644
index 0000000..6ea6859
--- /dev/null
+++ b/dotfiles/neovim/lua/my/plugins/telescope.lua
@@ -0,0 +1,35 @@
+local mapSilent = require("my.keymaps").mapSilent
+
+local M = {}
+
+local bindings = {
+    -- Open files with control + P
+    find_files = "<c-P>",
+
+    -- Search through files with control + F
+    live_grep = "<c-F>",
+
+    -- See diagnostics with space + d
+    diagnotics = "<space>d",
+
+    -- Open a list with all the pickers
+    builtin = "<space>t",
+
+    -- List function, var names etc
+    treesitter = "<space>s",
+
+    -- Git stuff
+    git_commits = "<space>gj",
+    git_branches = "<space>gk"
+}
+
+function M.setup()
+    for action, keybind in pairs(bindings) do
+        -- Maps the keybind to the action
+        mapSilent('n', keybind, "<cmd>lua require('telescope.builtint')." .. action .. "()<CR>")
+    end
+
+    require("telescope").setup {defaults = {mappings = {i = {["<C-h>"] = "which-key"}}}}
+end
+
+return M
diff --git a/modules/applications/neovim.nix b/modules/applications/neovim.nix
index 3afbb72..d2a890c 100644
--- a/modules/applications/neovim.nix
+++ b/modules/applications/neovim.nix
@@ -28,7 +28,8 @@ in
       prettierd # prettier but faster
 
       # Others
-      fzf # Required by lua-fzf
+      fd # file finder
+      ripgrep # grep rewrite (I think?)
       nodePackages.typescript # typescript language
     ];
 
@@ -38,11 +39,12 @@ in
         github-nvim-theme # github theme for neovim
         nvim-lspconfig # configures lsps for me
         nvim-autopairs # close pairs for me
-        fzf-lua # fuzzy search for say opening files
+        telescope-nvim # fuzzy search for say opening files
         purescript-vim # purescript syntax highlighting
         nvim-comment # allows toggling line-comments
         nvim-treesitter # use treesitter for syntax highlighting
         startup-nvim # splash screen
+        vim-devicons # nice looking icons
       ];
   };
 }