summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/nvim/init.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index a11639f..d2c45e5 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -82,6 +82,16 @@ vim.keymap.set('n', '<leader>T', function() vim.cmd.normal('"zX"zp') end,
{ desc = '[T]ranspose the current and previous characters' })
vim.keymap.set('n', '-', ':Ex<CR>',
{ desc = 'Open Netrw' })
+vim.keymap.set('n', 'gJ', function()
+ vim.cmd [[
+ let save = winsaveview()
+ normal! gJ
+ if matchstr(getline('.'), '\%' . col('.') . 'c.') =~ '\s'
+ normal! "_dw
+ endif
+ call winrestview(save)
+ ]]
+end, { desc = '[J]oin lines without whitespace' })
vim.keymap.set('n', '<leader>k', function()
vim.cmd 'vsplit'