feat(nvim): big Changes

- Null-ls changed to none-ls
- Added keymap to see none-ls buffer info
- Lualine style changed to slanted
- Neo-tree handlers
- Spectre new keymaps
- Telescope fzf options and some keybindings
- Which-key adapted to new spectre bind changes

BREAKING CHANGE: - Null-ls changed to none-ls
This commit is contained in:
Sergio Laín 2023-10-01 21:35:33 +02:00
parent c5fb4e51b6
commit fd1a4f6702
No known key found for this signature in database
GPG key ID: 14C9B8080681777B
9 changed files with 74 additions and 11 deletions

View file

@ -1,8 +1,6 @@
-- Keymaps are automatically loaded on the VeryLazy event -- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua -- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here -- Add any additional keymaps here
local Util = require("lazyvim.util")
local function map(mode, lhs, rhs, opts) local function map(mode, lhs, rhs, opts)
local keys = require("lazy.core.handler").handlers.keys local keys = require("lazy.core.handler").handlers.keys
---@cast keys LazyKeysHandler ---@cast keys LazyKeysHandler
@ -76,6 +74,8 @@ map("n", "<leader>sp", ":Telescope lazy<CR>", { desc = "Plugins (Lazy)" })
map("n", "<leader>si", ":Telescope import<CR>", { desc = "Imports" }) map("n", "<leader>si", ":Telescope import<CR>", { desc = "Imports" })
map("n", "<leader>cn", ":NullLsInfo<CR>", { desc = "NullLs Info" })
map( map(
"n", "n",
"<leader>ft", "<leader>ft",
@ -312,11 +312,6 @@ vim.keymap.set({ "n", "x" }, "l", "<Cmd>lua Scroll('l', 0, 1)<CR>")
vim.keymap.set({ "n", "x" }, "<Left>", "<Cmd>lua Scroll('h', 0, 1)<CR>") vim.keymap.set({ "n", "x" }, "<Left>", "<Cmd>lua Scroll('h', 0, 1)<CR>")
vim.keymap.set({ "n", "x" }, "<Right>", "<Cmd>lua Scroll('l', 0, 1)<CR>") vim.keymap.set({ "n", "x" }, "<Right>", "<Cmd>lua Scroll('l', 0, 1)<CR>")
-- SCROLL_WHEEL_KEYMAPS:
vim.keymap.set({ "n", "x" }, "<ScrollWheelUp>", "<Cmd>lua Scroll('<ScrollWheelUp>')<CR>")
vim.keymap.set({ "n", "x" }, "<ScrollWheelDown>", "<Cmd>lua Scroll('<ScrollWheelDown>')<CR>")
vim.keymap.set("n", "<M-BS>", "<Cmd>noh<CR>", { noremap = true, silent = true, desc = "Clear Search" }) vim.keymap.set("n", "<M-BS>", "<Cmd>noh<CR>", { noremap = true, silent = true, desc = "Clear Search" })
vim.keymap.set("n", "]b", require("goto-breakpoints").next, { desc = "Next Breakpoint" }) vim.keymap.set("n", "]b", require("goto-breakpoints").next, { desc = "Next Breakpoint" })

View file

@ -11,6 +11,8 @@ return {
theme = "catppuccin", theme = "catppuccin",
globalstatus = true, globalstatus = true,
disabled_filetypes = { statusline = { "dashboard", "alpha" } }, disabled_filetypes = { statusline = { "dashboard", "alpha" } },
component_separators = "",
section_separators = { left = "", right = "" },
}, },
sections = { sections = {
lualine_a = { "mode" }, lualine_a = { "mode" },

View file

@ -76,6 +76,32 @@ return {
}, },
}, },
config = function(_, opts) config = function(_, opts)
opts.event_handlers = opts.event_handlers or {}
local function on_move(data)
local clients = vim.lsp.get_active_clients()
for _, client in ipairs(clients) do
if client:supports_method("workspace/willRenameFiles") then
local resp = client.request_sync("workspace/willRenameFiles", {
files = {
{
oldUri = vim.uri_from_fname(data.source),
newUri = vim.uri_from_fname(data.destination),
},
},
}, 1000)
if resp and resp.result ~= nil then
vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding)
end
end
end
end
local events = require("neo-tree.events")
vim.list_extend(opts.event_handlers, {
{ event = events.FILE_MOVED, handler = on_move },
{ event = events.FILE_RENAMED, handler = on_move },
})
require("neo-tree").setup(opts) require("neo-tree").setup(opts)
vim.api.nvim_create_autocmd("TermClose", { vim.api.nvim_create_autocmd("TermClose", {
pattern = "*lazygit", pattern = "*lazygit",

View file

@ -1,6 +1,6 @@
return { return {
{ {
"jose-elias-alvarez/null-ls.nvim", "nvimtools/none-ls.nvim",
opts = function(_, opts) opts = function(_, opts)
local nls = require("null-ls") local nls = require("null-ls")

View file

@ -0,0 +1,14 @@
return {
{
"nvim-pack/nvim-spectre",
cmd = "Spectre",
opts = { open_cmd = "noswapfile vnew" },
-- stylua: ignore
keys = {
{ "<leader>srf", function() require("spectre").toggle() end, desc = "Replace globally" },
{ "<leader>srw", mode = {"n"},function() require("spectre").open_visual({select_word=true}) end, desc = "Current Word" },
{ "<leader>srw", mode = {"v"},function() require("spectre").open_visual() end, desc = "Current Word" },
{ "<leader>src", mode = {"n"},function() require("spectre").open_file_search({select_word=true}) end, desc = "Word on Current File" },
},
},
}

View file

@ -16,6 +16,9 @@ return {
["yanky.nvim#yank_history"] = { ["yanky.nvim#yank_history"] = {
disable = true, disable = true,
}, },
["zoxide.nvim#zoxide"] = {
disable = true,
},
}, },
}) })
end, end,

View file

@ -0,0 +1,9 @@
return {
{
"nvim-telescope/telescope-dap.nvim",
requires = { "nvim-telescope/telescope.nvim" },
config = function()
require("telescope").load_extension("dap")
end,
},
}

View file

@ -1,5 +1,4 @@
local Util = require("lazyvim.util") local Util = require("lazyvim.util")
local macchiato = require("catppuccin.palettes").get_palette("macchiato")
return { return {
{ {
@ -404,10 +403,15 @@ return {
Util.telescope("find_files", { hidden = true, default_text = line })() Util.telescope("find_files", { hidden = true, default_text = line })()
end end
local TelescopeColor = {}
return { return {
defaults = { defaults = {
-- layout_strategy = "horizontal",
-- layout_config = {
-- horizontal = {
-- prompt_position = "top",
-- },
-- },
-- sorting_strategy = "ascending",
prompt_prefix = "", prompt_prefix = "",
selection_caret = "", selection_caret = "",
mappings = { mappings = {
@ -423,6 +427,9 @@ return {
["<C-k>"] = actions.move_selection_previous, ["<C-k>"] = actions.move_selection_previous,
["<C-j>"] = actions.move_selection_next, ["<C-j>"] = actions.move_selection_next,
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist, ["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["<esc>"] = actions.close,
["<C-u>"] = false,
["<c-d>"] = actions.delete_buffer + actions.move_to_top,
}, },
n = { n = {
["q"] = actions.close, ["q"] = actions.close,
@ -455,6 +462,12 @@ return {
-- Add imports to the top of the file keeping the cursor in place -- Add imports to the top of the file keeping the cursor in place
insert_at_top = true, insert_at_top = true,
}, },
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case",
},
}, },
}, },
require("telescope").load_extension("refactoring"), require("telescope").load_extension("refactoring"),

View file

@ -31,6 +31,7 @@ return {
["<leader>sS"] = { name = "+Goto Symbols (Workspace)" }, ["<leader>sS"] = { name = "+Goto Symbols (Workspace)" },
["<leader>ss"] = { name = "+Goto Symbols" }, ["<leader>ss"] = { name = "+Goto Symbols" },
["<leader>db"] = { name = "+Breakpoints" }, ["<leader>db"] = { name = "+Breakpoints" },
["<leader>sr"] = { name = "+replace" },
}, },
}, },
config = function(_, opts) config = function(_, opts)