Enhance neovim's visual line mode with fully highlighted lines
neovim-plugin
1local M = {}
2
3local internal = require 'full_visual_line.internal'
4
5-- Just in case
6function M.setup(opts)
7 M.enable()
8end
9
10function M.toggle()
11 if M.is_enabled() then
12 M.disable()
13 else
14 M.enable()
15 end
16end
17
18function M.is_enabled()
19 return internal.is_autocmd_setup()
20end
21
22function M.enable()
23 internal.cleanup()
24 internal.setup_autocmd()
25
26 -- the plugin got enabled while already in visual line mode
27 if vim.api.nvim_get_mode().mode == 'V' then
28 internal.clear_lines()
29
30 local state = internal.update_visual_line_state()
31 internal.draw_lines_in_range(state.start, state._end)
32 end
33end
34
35function M.disable()
36 internal.cleanup()
37end
38
39return M