diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index ba0d9dc..c52e64a 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -8,9 +8,9 @@ "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "conform.nvim": { "branch": "master", "commit": "6239d9986f51ca93ded99ecdb1af0e287eabb651" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "dressing.nvim": { "branch": "master", "commit": "43b8f74e0b1e3f41e51f640f8efa3bcd401cea0d" }, "emmet-vim": { "branch": "master", "commit": "6c511a8d7d2863066f32e25543e2bb99d505172c" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "fzf-lua": { "branch": "main", "commit": "34d5e4053a3825ef16a04aa3664dc856c6a13e64" }, "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, "hererocks": { "branch": "master", "commit": "c9c5444dea1e07e005484014a8231aa667be30b6" }, "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, @@ -29,9 +29,6 @@ "persisted.nvim": { "branch": "main", "commit": "e9a179271b1c7888e0a87448b3cf81652a6606c1" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "rest.nvim": { "branch": "main", "commit": "e82dc524894b1b55bcc3296d3644f15c9e06d5ad" }, - "telescope-file-browser.nvim": { "branch": "master", "commit": "626998e5c1b71c130d8bc6cf7abb6709b98287bb" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, - "telescope.nvim": { "branch": "master", "commit": "2eca9ba22002184ac05eddbe47a7fe2d5a384dfc" }, "typescript-tools.nvim": { "branch": "master", "commit": "f8c2e0b36b651c85f52ad5c5373ff8b07adc15a7" }, "vim-dadbod": { "branch": "master", "commit": "f740950d0703099e0f172016f10e0e39f50fd0ba" }, "vim-dadbod-completion": { "branch": "master", "commit": "04485bfb53a629423233a4178d71cd4f8abf7406" }, diff --git a/.config/nvim/lua/plugins/catppuccin.lua b/.config/nvim/lua/plugins/catppuccin.lua index 23b3870..8a321cb 100644 --- a/.config/nvim/lua/plugins/catppuccin.lua +++ b/.config/nvim/lua/plugins/catppuccin.lua @@ -11,7 +11,7 @@ return { treesitter = true, cmp = true, gitsigns = true, - telescope = true, + telescope = false, dashboard = false, neotree = true, which_key = true, diff --git a/.config/nvim/lua/plugins/fzf.lua b/.config/nvim/lua/plugins/fzf.lua new file mode 100644 index 0000000..31fb94d --- /dev/null +++ b/.config/nvim/lua/plugins/fzf.lua @@ -0,0 +1,109 @@ +return { + "ibhagwan/fzf-lua", + config = function() + local actions = require("fzf-lua.actions") + + require("fzf-lua").setup({ + "fzf-vim", + fzf_colors = true, + fzf_opts = { + ["--no-scrollbar"] = true, + }, + keymap = { + fzf = { + ["ctrl-a"] = "toggle-all", + }, + }, + defaults = { + actions = { + ["ctrl-q"] = actions.file_sel_to_qf, + ["ctrl-y"] = function(selected) + local path = require("fzf-lua.path") + local entry = path.entry_to_file(selected[1]) + + if entry.path == "" then + return + end + + vim.fn.setreg("+", entry.path) + + print("Copied to clipboard: " .. entry.path) + end, + }, + }, + files = { + fd_opts = [[--type f --hidden --follow --no-ignore-vcs]], + no_header_i = true, + }, + grep = { + rg_opts = [[--line-number --column --no-heading --color=always --with-filename --smart-case --trim --no-ignore-vcs --hidden]], + }, + winopts = { + row = 0.2, + height = 0.8, + width = 0.7, + treesitter = { + enabled = true, + }, + preview = { + layout = "vertical", + vertical = "down:60%", + hidden = "nohidden", + }, + }, + }) + + require("fzf-lua").register_ui_select(function(_, items) + return { + winopts = { + height = math.floor(math.min(vim.o.lines * 0.4, #items + 2) + 0.5), + width = 0.5, + relative = "cursor", + row = 1, + backdrop = 100, + preview = { hidden = "hidden" }, + }, + } + end) + end, + dependencies = { "nvim-tree/nvim-web-devicons" }, + cmd = { "FzfLua" }, + keys = { + { + "", + function() + require("fzf-lua").files() + end, + + desc = "Find files", + }, + { + "b", + function() + require("fzf-lua").buffers() + end, + desc = "Find buffers", + }, + { + "lg", + function() + require("fzf-lua").live_grep() + end, + desc = "Live grep", + }, + { + "g", + function() + require("fzf-lua").git_status() + end, + desc = "Show changed files (git)", + }, + { + "cr", + function() + require("fzf-lua").lsp_references() + end, + desc = "LSP References", + }, + }, +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua deleted file mode 100644 index 9ed4a34..0000000 --- a/.config/nvim/lua/plugins/telescope.lua +++ /dev/null @@ -1,173 +0,0 @@ -local M = { - "nvim-telescope/telescope.nvim", - dependencies = { - { "nvim-telescope/telescope-file-browser.nvim" }, - { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, - { - "stevearc/dressing.nvim", - version = "*", - opts = { - select = { - telescope = require("telescope.themes").get_cursor(), - }, - }, - }, - }, - cmd = { "Telescope" }, - keys = { - { - "", - function() - require("telescope.builtin").find_files() - end, - desc = "Find files", - }, - { - "b", - function() - require("telescope.builtin").buffers() - end, - desc = "Find buffers", - }, - { - "lg", - function() - require("telescope.builtin").live_grep() - end, - desc = "Live grep", - }, - { - "g", - function() - require("telescope.builtin").git_status() - end, - desc = "Show changed files (git)", - }, - { - "tl", - function() - require("telescope.builtin").builtin() - end, - desc = "Show all telescope pickers", - }, - { - "tb", - function() - require("telescope").extensions.file_browser.file_browser() - end, - desc = "Open file browser", - }, - { - "tn", - function() - require("telescope").extensions.file_browser.file_browser({ - path = "%:p:h", - select_buffer = true, - }) - end, - desc = "Open file browser current file", - }, - { - "tp", - function() - require("telescope").extensions.persisted.persisted() - end, - desc = "Show sessions from persisted", - }, - }, -} - -function M.config() - local actions = require("telescope.actions") - - local layout_config = { - mirror = true, - prompt_position = "top", - } - - require("telescope").setup({ - defaults = { - vimgrep_arguments = { - "rg", - "--line-number", - "--column", - "--with-filename", - "--smart-case", - "--trim", - "--no-ignore-vcs", - "--hidden", - }, - initial_mode = "insert", - mappings = { - i = { - [""] = actions.move_selection_previous, - [""] = actions.move_selection_next, - [""] = actions.select_all, - [""] = function(_) - local entry = require("telescope.actions.state").get_selected_entry() - if entry ~= nil then - local content = entry.path - local relative_path = vim.fn.fnamemodify(content, ":~:.") - - vim.fn.setreg("+", relative_path) - - print("Copied to clipboard: " .. relative_path) - end - end, - }, - }, - layout_strategy = "vertical", - }, - pickers = { - find_files = { - layout_config = layout_config, - find_command = { "fd", "--hidden", "--no-ignore-vcs", "--follow", "--type", "f" }, - }, - live_grep = { - layout_config = layout_config, - }, - lsp_references = { - layout_config = layout_config, - show_line = false, - }, - buffers = { - layout_config = layout_config, - sort_mru = true, - ignore_current_buffer = true, - cwd_only = true, - mappings = { - i = { - [""] = actions.delete_buffer, - }, - }, - }, - }, - - 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" - -- the default case_mode is "smart_case" - }, - file_browser = { - theme = "ivy", - layout_config = { - prompt_position = "bottom", - }, - hijack_netrw = true, - no_ignore = true, - hidden = true, - auto_depth = true, - respect_gitignore = false, - }, - }, - }) - -- To get fzf loaded and working with telescope, you need to call - require("telescope").load_extension("fzf") - require("telescope").load_extension("file_browser") - require("telescope").load_extension("persisted") -end - -return M