summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index cbb2907..689c875 100644
--- a/init.lua
+++ b/init.lua
@@ -109,6 +109,15 @@ vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
-- UndoTree
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle, {})
+-- 'a' on empty line: enter insert mode with correct indentation
+vim.keymap.set('n', 'a', function()
+ local line = vim.api.nvim_get_current_line()
+ if line:match("^%s*$") then
+ return '"_cc'
+ end
+ return 'a'
+end, { noremap = true, expr = true })
+
--------------------------------------------------------
-- 🪶 GUI and Colour Configuration
--------------------------------------------------------