Configuring leap

I really like the leap plugin but it fell into disuse for me because of conflicting keymaps and runtime errors I was getting. I didn’t want to commit time to investigating those issues, so I let it slide and did without. One day recently I decided to disable leap and try mini.jump2d.

And now I am torn.

I really like echasnovski’s careful plugin-craft and jump2d works effortlessly and has clear configurability.

But using it, I find I drastically prefer leap’s functional design. Problem is, when I look at the leap README I struggle to wade through it all and emerge with an understanding of how to configure it to my liking, especially keymaps.

Summary: in leap you jump to part of the window by typing the two characters that are there. In jump2d you have to type random characters, and you don’t know in advance how many you will have to type. ggandor lays out the perceived problems with this approach in the leap readme, and I agree with it.

Any experience reports would be appreciated. Whether they end up helping me or not, they will likely be interesting.

OK, I gave in to temptation and spent the time trying it again. No problem. Here is my configuration:

require('leap')
vim.keymap.set({'n','x'}, '<CR>', function ()
  local current_window = vim.fn.win_getid()
  require('leap').leap { target_windows = { current_window } }
end)

All I really want is simple jumping around the screen in normal and visual mode. No need for operators: I will do visual first to ensure I have the correct selection. Forward and backward leaping: I don’t want to dedicate different keymaps to these.

Life is better now.