feat: set specs ft

This commit is contained in:
raf 2024-05-19 02:31:49 +03:00
parent 2743e412bb
commit 30a4c18276
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29

View file

@ -66,8 +66,11 @@ function M.show_specs(popup)
height = 1,
col = cursor_col,
row = cursor_row,
style = 'minimal'
style = 'minimal',
noautocmd = true
})
vim.api.nvim_set_option_value('filetype', 'specs.nvim', { buf = bufh })
vim.api.nvim_win_set_option(win_id, 'winhl', 'Normal:' .. _opts.popup.winhl)
vim.api.nvim_win_set_option(win_id, "winblend", _opts.popup.blend)
@ -109,76 +112,92 @@ function M.show_specs(popup)
cnt = cnt + 1
end
end))
end
--[[ ▁▁▂▂▃▃▄▄▅▅▆▆▇▇██ ]]--
--[[ ▁▁▂▂▃▃▄▄▅▅▆▆▇▇██ ]]
--
function M.linear_fader(blend, cnt)
if blend + cnt <= 100 then
return cnt
else return nil end
else
return nil
end
end
--[[ ⌣/⌢\⌣/⌢\⌣/⌢\⌣/⌢\ ]]--
--[[ ⌣/⌢\⌣/⌢\⌣/⌢\⌣/⌢\ ]]
--
function M.sinus_fader(blend, cnt)
if cnt <= 100 then
return math.ceil((math.sin(cnt * (1 / blend)) * 0.5 + 0.5) * 100)
else return nil end
else
return nil
end
end
--[[ ▁▁▁▁▂▂▂▃▃▃▄▄▅▆▇ ]]--
--[[ ▁▁▁▁▂▂▂▃▃▃▄▄▅▆▇ ]]
--
function M.exp_fader(blend, cnt)
if blend + math.floor(math.exp(cnt / 10)) <= 100 then
return blend + math.floor(math.exp(cnt / 10))
else return nil end
else
return nil
end
end
--[[ ▁▂▃▄▅▆▇█▇▆▅▄▃▂▁ ]]--
--[[ ▁▂▃▄▅▆▇█▇▆▅▄▃▂▁ ]]
--
function M.pulse_fader(blend, cnt)
if cnt < (100 - blend) / 2 then
return cnt
elseif cnt < 100 - blend then
return 100 - cnt
else return nil end
else
return nil
end
end
--[[ ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ]]--
--[[ ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ]]
--
function M.empty_fader(_, _)
return nil
end
--[[ ░░▒▒▓█████▓▒▒░░ ]]--
--[[ ░░▒▒▓█████▓▒▒░░ ]]
--
function M.shrink_resizer(width, ccol, cnt)
if width - cnt > 0 then
return { width - cnt, ccol - (width - cnt) / 2 + 1 }
else return nil end
else
return nil
end
end
--[[ ████▓▓▓▒▒▒▒░░░░ ]]--
--[[ ████▓▓▓▒▒▒▒░░░░ ]]
--
function M.slide_resizer(width, ccol, cnt)
if width - cnt > 0 then
return { width - cnt, ccol }
else return nil end
else
return nil
end
end
--[[ ███████████████ ]]--
--[[ ███████████████ ]]
--
function M.empty_resizer(width, ccol, cnt)
if cnt < 100 then
return { width, ccol - width / 2 }
else return nil end
else
return nil
end
end
local DEFAULT_OPTS = {
@ -213,7 +232,8 @@ function M.toggle()
end
function M.create_autocmds()
vim.cmd("augroup Specs") vim.cmd("autocmd!")
vim.cmd("augroup Specs")
vim.cmd("autocmd!")
if opts.show_jumps then
vim.cmd("silent autocmd CursorMoved * :lua require('specs').on_cursor_moved()")
end
@ -222,7 +242,8 @@ function M.create_autocmds()
end
function M.clear_autocmds()
vim.cmd("augroup Specs") vim.cmd("autocmd!")
vim.cmd("augroup Specs")
vim.cmd("autocmd!")
vim.cmd("augroup END")
au_toggle = false
end