From 7c3289fded1f75f6e060f56bd06edc2a327744d9 Mon Sep 17 00:00:00 2001 From: Squibid Date: Tue, 6 May 2025 16:51:24 -0500 Subject: kitchen sink again :( --- lua/conf/binds.lua | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'lua/conf/binds.lua') diff --git a/lua/conf/binds.lua b/lua/conf/binds.lua index 8f3c05e..9a9a7d6 100644 --- a/lua/conf/binds.lua +++ b/lua/conf/binds.lua @@ -1,23 +1,25 @@ -local misc = require('core.misc') +local misc = require("core.misc") local map = misc.map -- vim binds -vim.g.mapleader = ' ' -- set leader key +vim.g.mapleader = " " -- set leader key -map('x', 'p', [["_dP]], { desc = 'Greatest remap of all time.' }) -map('n', '', ':nohlsearch:echo', { desc = 'Clear search.' }) +map("x", "p", [["_dP]], { desc = "Greatest remap of all time." }) +map("n", "", ":nohlsearch:echo", { desc = "Clear search." }) -- move selected text up/down -map('v', '', ":m '<-2gv=gv", { desc = 'Move selected text up.' }) -map('v', '', ":m '>+1gv=gv", { desc = 'Move selected text down.' }) +map("v", "", ":m '<-2gv=gv", { desc = "Move selected text up." }) +map("v", "", ":m '>+1gv=gv", { desc = "Move selected text down." }) -- the cursor STAYS IN THE MIDDLE -map('n', '', 'mzJ`zdelm z') -- when combining lines -map('n', 'n', 'nzzzv') -- when searching -map('n', 'N', 'Nzzzv') -map('n', '', 'zzzv') -- half page jumping -map('n', '', 'zzzv') +map("n", "", "mzJ`zdelm z") -- when combining lines +map("n", "n", "nzzzv") -- when searching +map("n", "N", "Nzzzv") +map("n", "", "zzzv") -- half page jumping +map("n", "", "zzzv") -map('n', 'x', function() -- execute order 111 +map({ "n", "i" }, "", "") + +map("n", "x", function() -- execute order 111 local fn = vim.fn.expand("%:p") if vim.fn.getftype(fn) == "file" then local perm = vim.fn.getfperm(fn) @@ -31,14 +33,14 @@ map('n', 'x', function() -- execute order 111 else vim.notify("File doesn't exist", vim.log.levels.INFO, { title = misc.appid }) end -end, { desc = 'toggle executable flag of the file' }) +end, { desc = "toggle executable flag of the file" }) -- good spell suggestion ui -- (stolen from https://github.com/neovim/neovim/pull/25833) -vim.keymap.set('n', 'z=', function() +vim.keymap.set("n", "z=", function() local spell_on_choice = vim.schedule_wrap(function(_, idx) - if type(idx) == 'number' then - vim.cmd('normal! '..idx..'z=') + if type(idx) == "number" then + vim.cmd("normal! "..idx.."z=") end end) @@ -46,15 +48,15 @@ vim.keymap.set('n', 'z=', function() spell_on_choice(nil, vim.v.count) return end - local cword = vim.fn.expand('') - local prompt = 'Change '..vim.inspect(cword)..' to:' + local cword = vim.fn.expand("") + local prompt = "Change "..vim.inspect(cword).." to:" vim.ui.select(vim.fn.spellsuggest(cword, vim.o.lines), { prompt = prompt }, spell_on_choice) -end, { desc = 'Shows spelling suggestions' }) +end, { desc = "Shows spelling suggestions" }) -- quickfix -map('n', '', 'cnext') -map('n', '', 'cprev') -map('n', '', 'cclose') +map("n", "", "cnext") +map("n", "", "cprev") +map("n", "", "cclose") -- man pages -map('n', '', 'Man') +map("n", "", "Man") -- cgit v1.2.1