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 01:26:46 +02:00
|
|
|
local augroup = vim.api.nvim_create_augroup('rafi_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,
|
|
|
|
},
|
|
|
|
}
|