Skip to content

Commit

Permalink
Add Lua version of oo map
Browse files Browse the repository at this point in the history
  • Loading branch information
yochem committed Sep 30, 2023
1 parent f2b10db commit c2e7e85
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions content/vim/add-empty-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,13 @@ And here are the snippets for the people that use Lua in Neovim:
vim.keymap.set("n", "oo", "m`o<Esc>``")
vim.keymap.set("n", "OO", "m`O<Esc>``")
```

Or for the Lua-in-nvim purists:
```lua
vim.keymap.set("n", "oo", function ()
local cur = vim.api.nvim_win_get_cursor(0)
vim.api.nvim_buf_set_mark(0, "`", cur[1], cur[2], {})
vim.cmd.norm('o')
vim.api.nvim_win_set_cursor(0, vim.api.nvim_buf_get_mark(0, "`"))
end)
```

0 comments on commit c2e7e85

Please sign in to comment.