Skip to content

Commit

Permalink
feat(lazy): add telescope
Browse files Browse the repository at this point in the history
  • Loading branch information
alexiszamanidis committed May 31, 2024
1 parent 9243a09 commit 9fffd8b
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nvim/.config/nvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require('keymaps')
require('plugins.lazy')
require('options')
require('keymaps')
require('lazy_init')
require('misc')
5 changes: 5 additions & 0 deletions nvim/.config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lazy.nvim": { "branch": "main", "commit": "eab487c2520f0fe9e54eb5e3ea0606e20512492e" },
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
})
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
spec = "plugins",
change_detection = { notify = false }
})
1 change: 1 addition & 0 deletions nvim/.config/nvim/lua/plugins.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
return {}
56 changes: 56 additions & 0 deletions nvim/.config/nvim/lua/plugins/telescope.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
return {
{
"nvim-telescope/telescope.nvim",
tag = "0.1.5",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("telescope").setup({
defaults = {
prompt_prefix = " > ",
file_ignore_patterns = {
".git/",
"node_modules/",
},
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = { prompt_position = "top", preview_width = 0.55, results_width = 0.8 },
vertical = { mirror = false },
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
},
pickers = {
find_files = {
show_untracked = true,
hidden = true,
},
git_files = {
show_untracked = true,
hidden = true,
},
live_grep = {
additional_args = function()
return { "--hidden" }
end,
},
},
})

local builtin = require("telescope.builtin")
vim.keymap.set("n", "<C-p>", builtin.find_files)
vim.keymap.set("n", "<leader>fg", builtin.live_grep)
vim.keymap.set("n", "<leader>fw", function()
local word = vim.fn.expand("<cword>")
builtin.grep_string({ search = word })
end)
vim.keymap.set("n", "<leader>fW", function()
local word = vim.fn.expand("<cWORD>")
builtin.grep_string({ search = word })
end)
end,
},
}

0 comments on commit 9fffd8b

Please sign in to comment.