Closed shadyalfred closed 1 year ago
In the example code for line jumps label = { after = { 0, 0 } },
the tuple is the offset from the match to show the label, can you try changing the first 0
based on vim.api.nvim_win_get_cursor
to get it to render at the same column as the cursor?
Good idea, @IndianBoy42!
local col = vim.api.nvim_win_get_cursor(0)[2]
flash.jump({
...
label = {
before = { 0, col },
},
})
The label is shown in the correct position, but jumping to it moves the cursor to the beginning of that line which is a bit disorienting.
This works great!
local col = vim.api.nvim_win_get_cursor(0)[2]
flash.jump({
...
label = {
before = { 0, col },
},
})
vim.api.nvim_input(col .. 'l')
You can also use opts.jump.offset
Yes, I've found out about it after closing the issue. Also disabling the search highlight because it was confusing.
-- Move to lines beneath the cursor
local col = vim.api.nvim_win_get_cursor(0)[2]
flash.jump({
jump = {
offset = col,
},
search = {
mode = 'search',
max_length = 0,
forward = true,
wrap = false,
multi_window = false,
},
pattern = '^',
label = {
before = { 0, col },
},
highlight = {
matches = false,
},
})
-- move to lines above the cursor
local col = vim.api.nvim_win_get_cursor(0)[2]
flash.jump({
jump = {
offset = col,
},
search = {
mode = 'search',
max_length = 0,
forward = false,
wrap = false,
multi_window = false,
},
pattern = '^',
label = {
before = { 0, col },
},
highlight = {
matches = false,
},
})
Did you check the docs?
Is your feature request related to a problem? Please describe.
Showing the labels at the beginning of the line can be hard to follow specially when the lines are indentated and there is a big gap of space between the label hint and the start of the text in the line.
Describe the solution you'd like
Something like this