From a58e375ebfdccf610b61bd2eb14df081b0d69b99 Mon Sep 17 00:00:00 2001 From: Shantanu Raj Date: Tue, 9 May 2023 15:50:41 +0200 Subject: [PATCH] feat(nvim): Use native fzf for Telescope --- nvim/after/plugin/telescope.lua | 2 ++ nvim/lua/mimu/plugins.lua | 26 +++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/nvim/after/plugin/telescope.lua b/nvim/after/plugin/telescope.lua index 98a32a6..2caa29f 100644 --- a/nvim/after/plugin/telescope.lua +++ b/nvim/after/plugin/telescope.lua @@ -2,6 +2,8 @@ local builtin = require("telescope.builtin") local M = {} +require("telescope").load_extension("fzf") + M.project_files = function() local opts = require("telescope.themes").get_ivy({}) opts.find_command = { "rg", "--files", "--hidden", "--follow", "--glob", "!.git/*" } diff --git a/nvim/lua/mimu/plugins.lua b/nvim/lua/mimu/plugins.lua index 5420dde..fd39a10 100644 --- a/nvim/lua/mimu/plugins.lua +++ b/nvim/lua/mimu/plugins.lua @@ -1,3 +1,8 @@ +local fzf_make_cmd = "make" +if vim.loop.os_uname().machine == "arm64" then + fzf_make_cmd = " arch -arm64 make" +end + local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ @@ -20,7 +25,26 @@ return require("lazy").setup({ { "nvim-telescope/telescope.nvim", tag = "0.1.1", - dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + defaults = { + file_ignore_patterns = { + ".git/worktrees", + ".git/COMMIT_EDITMSG", + }, + }, + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + }, + }, + }, + dependencies = { + "nvim-lua/plenary.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", build = fzf_make_cmd }, -- Fzf native + }, }, -- theme