Update .config/nvim/lazy-lock.json

Update .config/nvim/lua/config/20_keymaps.lua
Update .config/nvim/lua/plugin/03_treesitter.lua
Update .config/nvim/lua/plugin/05_fzf.lua
Update .config/nvim/lua/plugin/10_hop.lua
Update .config/nvim/lua/plugin/35_yanky.lua
This commit is contained in:
Lewis Wynne 2025-11-12 19:58:07 +00:00
parent 4d2c3675d9
commit 98f4fd1cbc
6 changed files with 50 additions and 44 deletions

View file

@ -2,18 +2,37 @@
---@diagnostic disable: unused-local, unused-function
-- stylua: ignore start
local nmap = function(lhs, rhs, desc)
vim.keymap.set("n", lhs, rhs, { desc = desc })
local map = function(mode, lhs, rhs, desc)
vim.keymap.set(mode, lhs, rhs, { noremap = true, desc = desc })
end
local nmap_leader = function(lhs, rhs, desc)
vim.keymap.set("n", "<Leader>" .. lhs, rhs, { desc = desc })
end
local nop = function(lhs) map({ "n", "v" }, lhs, "<nop>", "") end
local nmap = function(lhs, rhs, desc) map("n", lhs, rhs, desc) end
local xmap = function(lhs, rhs, desc) map("x", lhs, rhs, desc) end
local nmap_leader = function(lhs, rhs, desc) nmap("<Leader>" .. lhs, rhs, desc) end
nop('<C-w>s')
nop('<C-w>v')
nmap_leader(';', '<Cmd>vsplit<CR>', 'vsplit')
nmap_leader('-', '<Cmd>split<CR>', 'hsplit')
nmap_leader('ca', '<Cmd>lua vim.lsp.buf.code_action()<CR>', 'lsp code action')
nmap_leader('ci', '<Cmd>lua vim.lsp.buf.implementation()<CR>', 'lsp find implementation')
nmap_leader('cr', '<Cmd>lua vim.lsp.buf.references()<CR>', 'lsp find references')
nmap_leader('cR', '<Cmd>lua vim.lsp.buf.rename()<CR>', 'lsp rename')
nmap_leader(';', '<Cmd>vsplit<CR>', 'vsplit')
nmap_leader('-', '<Cmd>split<CR>', 'hsplit')
local c = function(rhs)
return function()
local count = vim.v.count1
for _ = 1, count do
vim.cmd(rhs)
end
end
end
nmap(">", c("normal! >>"), "indent")
nmap("<", c("normal! <<"), "dedent")
xmap(">", ">gv", "indent and reselect")
xmap("<", "<gv", "dedent and reselect")

View file

@ -1,15 +1,15 @@
return {
{
'nvim-treesitter/nvim-treesitter',
branch = 'master',
"nvim-treesitter/nvim-treesitter",
branch = "master",
lazy = false,
build = ":TSUpdate"
build = ":TSUpdate",
},
{
'nvim-treesitter/nvim-treesitter-context',
dependencies = { 'nvim-treesitter/nvim-treesitter' },
"nvim-treesitter/nvim-treesitter-context",
dependencies = { "nvim-treesitter/nvim-treesitter" },
config = function()
require("treesitter-context").setup()
end,
}
},
}

View file

@ -2,7 +2,7 @@ return {
{
"ibhagwan/fzf-lua",
dependencies = { { "nvim-mini/mini.icons" } },
epts = {
opts = {
winopts = {
preview = {
vertical = "down:65%",
@ -20,11 +20,8 @@ return {
{ "<leader>ff", "<cmd>FzfLua files<CR>", mode = { "n" }, desc = "fzf files" },
{ "<leader>fg", "<cmd>FzfLua live_grep<CR>", mode = { "n" }, desc = "fzf grep" },
{ "<leader>fh", "<cmd>FzfLua command_history<CR>", mode = { "n" }, desc = "fzf cmd history" },
-- <leader>fi --> lsp find implementation
{ "<leader>fk", "<cmd>FzfLua keymaps<CR>", mode = { "n" }, desc = "fzf keymaps" },
{ "<leader>fl", "<cmd>FzfLua blines<CR>", mode = { "n" }, desc = "fzf bufferlines" },
{ "<leader>fo", "<cmd>FzfLua oldfiles<CR>", mode = { "n" }, desc = "fzf oldfiles" },
-- <leader>fr --> lsp find references
{ "<leader>fr", "<cmd>FzfLua oldfiles<CR>", mode = { "n" }, desc = "fzf oldfiles" },
{ "<leader>fs", "<cmd>FzfLua<CR>", mode = { "n" }, desc = "fzf something else" },
},
},

View file

@ -4,13 +4,11 @@ return {
version = "*",
config = function()
local hop = require("hop")
hop.setup({
keys = "etovxqpdygfblzhckisuran",
jump_on_sole_occurrence = true,
})
-- Runs vim cmds ... if in visual mode
local function run_if_visual(...)
local function if_visual(...)
local mode = vim.fn.mode()
if mode == "v" then
for _, cmd in ipairs({ ... }) do
@ -19,26 +17,22 @@ return {
end
end
-- HopWordMW, and include whole word if in visual mode.
local function hop_word_smart()
---@diagnostic disable-next-line: missing-fields
hop.hint_words({ multi_windows = true })
run_if_visual("normal! iw")
if_visual("normal! iw")
end
-- HopPatternMW, and include whole word if in visual mode.
local function hop_pattern_smart()
---@diagnostic disable-next-line: missing-fields
hop.hint_patterns({ multi_windows = true })
run_if_visual("normal! iw")
if_visual("normal! iw")
end
-- stylua: ignore start
vim.keymap.set({ "n", "x", "o" }, "gw", hop_word_smart, { desc = "hop to word" })
vim.keymap.set({ "n", "x", "o" }, "gl", "<cmd>HopChar1MW<CR>", { desc = "hop to char" })
vim.keymap.set({ "n", "x", "o" }, "g:", "<cmd>HopLineStartMW<CR>", { desc = "hop to line" })
vim.keymap.set({ "n", "x", "o" }, "gt", "<cmd>HopNodes<CR>", { desc = "hop to ts" })
vim.keymap.set({ "n", "x", "o" }, "gp", hop_pattern_smart, { desc = "hop to pattern" })
vim.keymap.set({ "n", "x", "o" }, "gt", "<cmd>HopNodes<CR>", { desc = "hop to ts" })
vim.keymap.set({ "n", "x", "o" }, "s", hop_pattern_smart, { desc = "hop to pattern" })
-- stylua: ignore end
end,
},

View file

@ -1,19 +1,16 @@
return {
{
"gbprod/yanky.nvim",
-- stylua: ignore
keys = {
{ "y", "<Plug>(YankyYank)" },
{ "p", "<Plug>(YankyPutAfter)", mode = { "n", "x" } },
{ "P", "<Plug>(YankyPutBefore)", mode = { "n", "x" } },
{ "[p", "<Plug>(YankyPutIndentBeforeLinewise)", mode = { "n", "x" } },
{ "]p", "<Plug>(YankyPutIndentAfterLinewise)", mode = { "n", "x" } },
{ ">p", "<Plug>(YankyPutIndentAfterShiftRight)", mode = { "n", "x" } },
{ ">P", "<Plug>(YankyPutIndentBeforeShiftRight)", mode = { "n", "x" } },
{ "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", mode = { "n", "x" } },
{ "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", mode = { "n", "x" } },
{ "<c-p>", "<Plug>(YankyPreviousEntry)", mode = "n" },
{ "<c-n>", "<Plug>(YankyNextEntry)", mode = "n" },
{ "<leader>fy", "<Cmd>YankyRingHistory<CR>", mode = { "n", "x" } },
{ "y", "<Plug>(YankyYank)", desc = "yank" },
{ "p", "<Plug>(YankyPutAfter)", mode = { "n", "x" }, desc = "put after" },
{ "P", "<Plug>(YankyPutBefore)", mode = { "n", "x" }, desc = "put before" },
{ "[p", "<Plug>(YankyPutIndentBeforeLinewise)", mode = { "n", "x" }, desc = "put after line" },
{ "]p", "<Plug>(YankyPutIndentAfterLinewise)", mode = { "n", "x" }, desc = "put before line" },
{ "<c-p>", "<Plug>(YankyPreviousEntry)", mode = "n", desc = "previous yank" },
{ "<c-n>", "<Plug>(YankyNextEntry)", mode = "n", desc = "next yank" },
{ "<leader>fy", "<Cmd>YankyRingHistory<CR>", mode = { "n", "x" }, desc = "yank history" },
},
opts = {
preserve_cursor_position = { enabled = true },