2023-09-06 00:26:45 +02:00
|
|
|
return {
|
|
|
|
{
|
|
|
|
'itchyny/vim-cursorword',
|
|
|
|
event = 'FileType',
|
|
|
|
init = function()
|
|
|
|
vim.g.cursorword = 0
|
|
|
|
end,
|
|
|
|
config = function()
|
2023-09-06 10:19:56 +02:00
|
|
|
local augroup = vim.api.nvim_create_augroup('plex_cursorword', {})
|
2023-09-06 00:26:45 +02:00
|
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
|
|
group = augroup,
|
|
|
|
pattern = {
|
|
|
|
'conf',
|
|
|
|
'dosini',
|
|
|
|
'json',
|
|
|
|
'markdown',
|
|
|
|
'nginx',
|
|
|
|
'text',
|
|
|
|
'yaml',
|
|
|
|
},
|
|
|
|
callback = function()
|
|
|
|
if vim.wo.diff or vim.wo.previewwindow then
|
|
|
|
vim.b.cursorword = 0
|
|
|
|
else
|
|
|
|
vim.b.cursorword = 1
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd('InsertEnter', {
|
|
|
|
group = augroup,
|
|
|
|
callback = function()
|
|
|
|
if vim.b['cursorword'] == 1 then
|
|
|
|
vim.b['cursorword'] = 0
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd('InsertLeave', {
|
|
|
|
group = augroup,
|
|
|
|
callback = function()
|
|
|
|
if vim.b['cursorword'] == 0 then
|
|
|
|
vim.b['cursorword'] = 1
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
}
|