From 9e86ac84257c02cd23d944d1deb646e5c57bc49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20L=C3=BCdecke?= Date: Tue, 1 Oct 2024 20:59:15 +0200 Subject: [PATCH] Keybinding q to wrap current paragraph --- lua/keybindings.lua | 53 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 59380b8..f0d3ed1 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -24,44 +24,45 @@ vim.keymap.set('n', 'c', ":Calendar -split=horizontal -position=below -h -- -- configure workspaces -- also add a custom picker to fzf --- +-- local workspaces = require('workspaces') -workspaces_fzf_picker = function(opts) - local fzf_lua = require('fzf-lua') - opts = opts or {} - opts.prompt = "Workspaces> " - opts.actions = { - ['default'] = function(selected) - workspaces.open(selected[1]) - end - } - fzf_lua.fzf_exec(function(fzf_cb) - -- NOP - local ws = workspaces.get() - ws = ws or {} - for i = 1, #ws do - fzf_cb(ws[i].name) - end - fzf_cb() -- EOF - end, opts) +local workspaces_fzf_picker = function(opts) + local fzf_lua = require('fzf-lua') + opts = opts or {} + opts.prompt = "Workspaces> " + opts.actions = { + ['default'] = function(selected) + workspaces.open(selected[1]) + end + } + fzf_lua.fzf_exec(function(fzf_cb) + -- NOP + local ws = workspaces.get() + ws = ws or {} + for i = 1, #ws do + fzf_cb(ws[i].name) + end + fzf_cb() -- EOF + end, opts) end -vim.keymap.set('n', 'w', workspaces_fzf_picker, { desc = "Workspaces" } ) +vim.keymap.set('n', 'w', workspaces_fzf_picker, { desc = "Workspaces" }) ------------------------------------------- --- +------------------------------------------ +-- -- Word higlighting -- ------------------------------------------- +------------------------------------------ local mywords = require('mywords') vim.keymap.set('n', 'mm', mywords.hl_toggle, { desc = "Highlight current word" }) vim.keymap.set('n', 'mr', mywords.hl_toggle_regex, { desc = "Highlight regexp" }) vim.keymap.set('n', 'mc', mywords.uhl_all, { desc = "Clear all highlights" }) ------------------------------------------- --- +------------------------------------------ +-- -- Shortcuts which are known from Emacs -- ------------------------------------------- +------------------------------------------ vim.keymap.set('n', '1', ":wincmd o", { desc = "Win: close others" }) vim.keymap.set('n', '0', ":only", { desc = "Win: close current" }) +vim.keymap.set('n', 'q', "gwap", { desc = "Wrap paragraph" })