mirror of
https://codeberg.org/JasterV/dotfiles.git
synced 2026-04-26 18:40:04 +00:00
feat: customize telescope & add telescope file browser
This commit is contained in:
parent
e7c99bcf24
commit
519c098183
4 changed files with 165 additions and 12 deletions
|
|
@ -1,14 +1,14 @@
|
||||||
{
|
{
|
||||||
"LazyVim": { "branch": "main", "commit": "879e29504d43e9f178d967ecc34d482f902e5a91" },
|
"LazyVim": { "branch": "main", "commit": "879e29504d43e9f178d967ecc34d482f902e5a91" },
|
||||||
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
|
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
|
||||||
"SchemaStore.nvim": { "branch": "main", "commit": "9cc6e7d6dc69408de20fee6bad42a93cdb11dbc6" },
|
"SchemaStore.nvim": { "branch": "main", "commit": "90149d11708d38037e340bf7a668e1a79217680d" },
|
||||||
"bufferline.nvim": { "branch": "main", "commit": "e48ce1805697e4bb97bc171c081e849a65859244" },
|
"bufferline.nvim": { "branch": "main", "commit": "e48ce1805697e4bb97bc171c081e849a65859244" },
|
||||||
"catppuccin": { "branch": "main", "commit": "5e36ca599f4aa41bdd87fbf2c5aae4397ac55074" },
|
"catppuccin": { "branch": "main", "commit": "5e36ca599f4aa41bdd87fbf2c5aae4397ac55074" },
|
||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "ad2b5ecd907128ed1b66b1cf4bed57902ef836ee" },
|
"conform.nvim": { "branch": "master", "commit": "c4b2efb8aee4af0ef179a9b49ba401de3c4ef5d2" },
|
||||||
"crates.nvim": { "branch": "main", "commit": "81c6325b7f8875857ec09e5d24f3b6d7986f29e2" },
|
"crates.nvim": { "branch": "main", "commit": "81c6325b7f8875857ec09e5d24f3b6d7986f29e2" },
|
||||||
"dashboard-nvim": { "branch": "master", "commit": "63df28409d940f9cac0a925df09d3dc369db9841" },
|
"dashboard-nvim": { "branch": "master", "commit": "63df28409d940f9cac0a925df09d3dc369db9841" },
|
||||||
"dressing.nvim": { "branch": "master", "commit": "94b0d24483d56f3777ee0c8dc51675f21709318c" },
|
"dressing.nvim": { "branch": "master", "commit": "94b0d24483d56f3777ee0c8dc51675f21709318c" },
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "ce0e625df61be77abe1340fbc9afe9ad39b31dd8" },
|
"nvim-lspconfig": { "branch": "master", "commit": "ce0e625df61be77abe1340fbc9afe9ad39b31dd8" },
|
||||||
"nvim-notify": { "branch": "master", "commit": "ebcdd8219e2a2cbc0a4bef68002f6867f1fde269" },
|
"nvim-notify": { "branch": "master", "commit": "ebcdd8219e2a2cbc0a4bef68002f6867f1fde269" },
|
||||||
"nvim-spectre": { "branch": "master", "commit": "d8906855f1949ac97b1e77aaf8d3fe12ed158ddc" },
|
"nvim-spectre": { "branch": "master", "commit": "d8906855f1949ac97b1e77aaf8d3fe12ed158ddc" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "65ef62092ef997d2ecf68ede01a0afbda17808c3" },
|
"nvim-treesitter": { "branch": "master", "commit": "3ef514b10b9557e3905b9817ca632e7506dd384a" },
|
||||||
"nvim-treesitter-context": { "branch": "master", "commit": "652ec514d6ba8bc4a3c2de76c855fe668e2c7196" },
|
"nvim-treesitter-context": { "branch": "master", "commit": "652ec514d6ba8bc4a3c2de76c855fe668e2c7196" },
|
||||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "85b9d0cbd4ff901abcda862b50dbb34e0901848b" },
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "85b9d0cbd4ff901abcda862b50dbb34e0901848b" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" },
|
||||||
|
|
@ -46,8 +46,9 @@
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "cff25ce621e6d15fae0b0bfe38c00be50ce38468" },
|
"nvim-web-devicons": { "branch": "master", "commit": "cff25ce621e6d15fae0b0bfe38c00be50ce38468" },
|
||||||
"persistence.nvim": { "branch": "main", "commit": "ad538bfd5336f1335cdb6fd4e0b0eebfa6e12f32" },
|
"persistence.nvim": { "branch": "main", "commit": "ad538bfd5336f1335cdb6fd4e0b0eebfa6e12f32" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
|
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
|
||||||
"rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" },
|
"rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },
|
||||||
"solarized-osaka.nvim": { "branch": "main", "commit": "d3272bc510deecd423833771e443ab0eaf8cd802" },
|
"solarized-osaka.nvim": { "branch": "main", "commit": "d3272bc510deecd423833771e443ab0eaf8cd802" },
|
||||||
|
"telescope-file-browser.nvim": { "branch": "master", "commit": "4bd5657b14b58e069287f5ac591a647bb860b2ed" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "3466159b0fcc1876483f6f53587562628664d850" },
|
"telescope.nvim": { "branch": "master", "commit": "3466159b0fcc1876483f6f53587562628664d850" },
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" },
|
"todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" },
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,6 @@ discipline.cowboy()
|
||||||
local keymap = vim.keymap
|
local keymap = vim.keymap
|
||||||
local opts = { noremap = true, silent = true }
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
keymap.set("n", "<leader>sx", require("telescope.builtin").resume, opts)
|
|
||||||
|
|
||||||
keymap.set("n", "x", '"_x')
|
|
||||||
|
|
||||||
-- Increment/decrement
|
-- Increment/decrement
|
||||||
keymap.set("n", "+", "<C-a>")
|
keymap.set("n", "+", "<C-a>")
|
||||||
keymap.set("n", "-", "<C-x>")
|
keymap.set("n", "-", "<C-x>")
|
||||||
|
|
@ -39,7 +35,3 @@ keymap.set("n", "<C-w><down>", "<C-w>-")
|
||||||
keymap.set("n", "<C-j>", function()
|
keymap.set("n", "<C-j>", function()
|
||||||
vim.diagnostic.goto_next()
|
vim.diagnostic.goto_next()
|
||||||
end, opts)
|
end, opts)
|
||||||
|
|
||||||
keymap.set("n", "<leader>r", function()
|
|
||||||
require("craftzdog.utils").replaceHexWithHSL()
|
|
||||||
end)
|
|
||||||
|
|
|
||||||
160
.config/nvim/lua/plugins/telescope.lua
Normal file
160
.config/nvim/lua/plugins/telescope.lua
Normal file
|
|
@ -0,0 +1,160 @@
|
||||||
|
return {
|
||||||
|
"telescope.nvim",
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
|
build = "make",
|
||||||
|
},
|
||||||
|
"nvim-telescope/telescope-file-browser.nvim",
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>fP",
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").find_files({
|
||||||
|
cwd = require("lazy.core.config").options.root,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
desc = "Find Plugin File",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
";f",
|
||||||
|
function()
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
builtin.find_files({
|
||||||
|
no_ignore = false,
|
||||||
|
hidden = true,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
desc = "Lists files in your current working directory, respects .gitignore",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
";r",
|
||||||
|
function()
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
builtin.live_grep()
|
||||||
|
end,
|
||||||
|
desc = "Search for a string in your current working directory and get results live as you type, respects .gitignore",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"\\\\",
|
||||||
|
function()
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
builtin.buffers()
|
||||||
|
end,
|
||||||
|
desc = "Lists open buffers",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
";t",
|
||||||
|
function()
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
builtin.help_tags()
|
||||||
|
end,
|
||||||
|
desc = "Lists available help tags and opens a new window with the relevant help info on <cr>",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
";;",
|
||||||
|
function()
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
builtin.resume()
|
||||||
|
end,
|
||||||
|
desc = "Resume the previous telescope picker",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
";e",
|
||||||
|
function()
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
builtin.diagnostics()
|
||||||
|
end,
|
||||||
|
desc = "Lists Diagnostics for all open buffers or a specific buffer",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
";s",
|
||||||
|
function()
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
builtin.treesitter()
|
||||||
|
end,
|
||||||
|
desc = "Lists Function names, variables, from Treesitter",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sf",
|
||||||
|
function()
|
||||||
|
local telescope = require("telescope")
|
||||||
|
|
||||||
|
local function telescope_buffer_dir()
|
||||||
|
return vim.fn.expand("%:p:h")
|
||||||
|
end
|
||||||
|
|
||||||
|
telescope.extensions.file_browser.file_browser({
|
||||||
|
path = "%:p:h",
|
||||||
|
cwd = telescope_buffer_dir(),
|
||||||
|
respect_gitignore = false,
|
||||||
|
hidden = true,
|
||||||
|
grouped = true,
|
||||||
|
previewer = false,
|
||||||
|
initial_mode = "normal",
|
||||||
|
layout_config = { height = 40 },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
desc = "Open File Browser with the path of the current buffer",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
local telescope = require("telescope")
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
local fb_actions = require("telescope").extensions.file_browser.actions
|
||||||
|
|
||||||
|
opts.defaults = vim.tbl_deep_extend("force", opts.defaults, {
|
||||||
|
wrap_results = true,
|
||||||
|
layout_strategy = "horizontal",
|
||||||
|
layout_config = { prompt_position = "top" },
|
||||||
|
sorting_strategy = "ascending",
|
||||||
|
winblend = 0,
|
||||||
|
mappings = {
|
||||||
|
n = {},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
opts.pickers = {
|
||||||
|
diagnostics = {
|
||||||
|
theme = "ivy",
|
||||||
|
initial_mode = "normal",
|
||||||
|
layout_config = {
|
||||||
|
preview_cutoff = 9999,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
opts.extensions = {
|
||||||
|
file_browser = {
|
||||||
|
theme = "dropdown",
|
||||||
|
-- disables netrw and use telescope-file-browser in its place
|
||||||
|
hijack_netrw = true,
|
||||||
|
mappings = {
|
||||||
|
-- your custom insert mode mappings
|
||||||
|
["n"] = {
|
||||||
|
-- your custom normal mode mappings
|
||||||
|
["N"] = fb_actions.create,
|
||||||
|
["h"] = fb_actions.goto_parent_dir,
|
||||||
|
["/"] = function()
|
||||||
|
vim.cmd("startinsert")
|
||||||
|
end,
|
||||||
|
["<C-u>"] = function(prompt_bufnr)
|
||||||
|
for _ = 1, 10 do
|
||||||
|
actions.move_selection_previous(prompt_bufnr)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
["<C-d>"] = function(prompt_bufnr)
|
||||||
|
for _ = 1, 10 do
|
||||||
|
actions.move_selection_next(prompt_bufnr)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
["<PageUp>"] = actions.preview_scrolling_up,
|
||||||
|
["<PageDown>"] = actions.preview_scrolling_down,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
telescope.setup(opts)
|
||||||
|
require("telescope").load_extension("fzf")
|
||||||
|
require("telescope").load_extension("file_browser")
|
||||||
|
end,
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue