From 67e501963ce3b886092f7a3a052b19c9b9e828a5 Mon Sep 17 00:00:00 2001 From: "RingOfStorms (Joshua Bell)" Date: Mon, 2 Oct 2023 14:13:39 -0500 Subject: [PATCH] better rg settings in telescope --- lua/plugins/lsp.lua | 9 +++ lua/plugins/telescope.lua | 147 +++++++++++++++++++++++--------------- 2 files changed, 97 insertions(+), 59 deletions(-) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 997632f..0157006 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -129,6 +129,15 @@ return { { "lvimuser/lsp-inlayhints.nvim", }, + { + "L3MON4D3/LuaSnip", + build = "make install_jsregexp", + opts = { + history = true, + region_check_events = "InsertEnter", + delete_check_events = "TextChanged,InsertLeave", + } + }, { -- Autocompletion "hrsh7th/nvim-cmp", diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 38b399f..f6b6fce 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -1,66 +1,95 @@ +local function prereqs() + local output = vim.fn.system({ + "which", + "rg", + }) + if output == nil or output == "" or string.find(output, "not installed for the toolchain") then + print("Installing ripgrep globally with rtx") + vim.fn.system({ + "rtx", + "global", + "ripgrep@latest", + }) + end +end + return { - "nvim-telescope/telescope.nvim", - tag = "0.1.1", - dependencies = { - { "nvim-lua/plenary.nvim" }, - { "nvim-telescope/telescope-fzf-native.nvim", enabled = vim.fn.executable("make") == 1, build = "make" }, - }, - cmd = "Telescope", - keys = { - { "f", "", desc = "Find ..." }, - { - "ff", - function() - require("telescope.builtin").find_files({ + "nvim-telescope/telescope.nvim", + tag = "0.1.1", + dependencies = { + { "nvim-lua/plenary.nvim" }, + { "nvim-telescope/telescope-fzf-native.nvim", enabled = vim.fn.executable("make") == 1, build = "make" }, + }, + build = prereqs, + cmd = "Telescope", + keys = { + { "f", "", desc = "Find ..." }, + { + "fr", + function() + require("telescope.builtin").resume() + end, + desc = "Resume last telescope", + }, + { + "ff", + function() + require("telescope.builtin").find_files({ hidden = true }) - end, - desc = "Find Files", - }, - { - "fg", - function() - require("telescope.builtin").git_files() - end, - desc = "Find Git only Files", - }, - { - "fw", - function() - require("telescope.builtin").live_grep() - end, - desc = "Find Words", - }, - { - "fc", - function() - require("telescope.builtin").commands() - end, - desc = "Find Commands", - }, - { - "fk", - function() - require("telescope.builtin").keymaps() - end, - desc = "Find Commands", - }, - { - "fb", - function() - require("telescope.builtin").buffers() - end, - desc = "Find Commands", - }, - }, - opts = { - pickers = { - buffers = { - sort_lastused = true, - }, + end, + desc = "Find Files", + }, + { + "fg", + function() + require("telescope.builtin").git_files() + end, + desc = "Find Git only Files", + }, + { + "fw", + function() + require("telescope.builtin").live_grep({ + grep_open_files = true, + }) + end, + desc = "Find Words", + }, + { + "fc", + function() + require("telescope.builtin").commands() + end, + desc = "Find Commands", + }, + { + "fk", + function() + require("telescope.builtin").keymaps() + end, + desc = "Find Commands", + }, + { + "fb", + function() + require("telescope.builtin").buffers() + end, + desc = "Find Commands", + }, + }, + opts = { + pickers = { + buffers = { + sort_lastused = true, + }, find_files = { + hidden = true, sort_lastused = true, } - }, - }, + }, + defaults = { + file_ignore_patterns = { 'node_modules', 'package-lock.json', 'target' }, + }, + }, }