summaryrefslogtreecommitdiff
path: root/.config/nvim/init.lua
diff options
context:
space:
mode:
authorThomas Voss <thomas.voss@humanwave.nl> 2024-06-12 16:43:54 +0200
committerThomas Voss <thomas.voss@humanwave.nl> 2024-06-12 18:49:56 +0200
commit6918b5cffe1e4707501b63f69f8458c8eccbeed4 (patch)
tree226e3c365e73546633ee3b1b111380cd53735fcb /.config/nvim/init.lua
parentcc7d8f1f21db59a096e3246c78f6fd6c74634318 (diff)
nvim: Only remap visual-line and -block modes on Linux
Diffstat (limited to '.config/nvim/init.lua')
-rw-r--r--.config/nvim/init.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index ec708f0..1c2d070 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -62,16 +62,12 @@ vim.keymap.set('n', '<C-k>', '<C-w><C-k>',
{ desc = 'Move focus to the upper window' })
vim.keymap.set('n', '<C-l>', '<C-w><C-l>',
{ desc = 'Move focus to the right window' })
-vim.keymap.set('n', '<C-v>', 'V',
- { desc = 'Enter visual-line mode' })
vim.keymap.set('n', '<leader>h', function() vim.cmd 'split' end,
{ desc = 'Open a [H]orizontal split' })
vim.keymap.set('n', '<leader>v', function() vim.cmd 'vsplit' end,
{ desc = 'Open a [V]ertical split' })
vim.keymap.set('n', 'M', ':w! | make<CR>',
{ desc = 'Run the configured compiler' })
-vim.keymap.set('n', 'V', '<C-v>',
- { desc = 'Enter visual-block mode' })
vim.keymap.set('x', '<C-j>', ":m '>+1<CR>gv=gv",
{ desc = 'Move a selection down a line' })
vim.keymap.set('x', '<C-k>', ":m '<-2<CR>gv=gv",
@@ -106,6 +102,13 @@ vim.keymap.set('n', '<leader>K', function()
mk_scratch_buffer()
end, { desc = 'Open the scratch buffer in a horizontal split' })
+if vim.loop.os_uname().sysname ~= 'Darwin' then
+ vim.keymap.set('n', '<C-v>', 'V',
+ { desc = 'Enter visual-line mode' })
+ vim.keymap.set('n', 'V', '<C-v>',
+ { desc = 'Enter visual-block mode' })
+end
+
-- Don’t move the cursor with various commands
vim.keymap.set('n', 'J', 'mzJ`z')
vim.keymap.set('n', '<C-d>', '<C-d>zz')