chore(fmt): Finally let's use stylua

Hoping it's as good as go-fmt
This commit is contained in:
hedy
2023-11-17 09:28:33 +08:00
parent d400d4f025
commit dc55a8b942
22 changed files with 247 additions and 307 deletions

View File

@@ -1,26 +1,19 @@
local M = {}
M.hovered_hl_ns = vim.api.nvim_create_namespace 'hovered_item'
M.hovered_hl_ns = vim.api.nvim_create_namespace('hovered_item')
function M.clear_hover_highlight(bufnr)
vim.api.nvim_buf_clear_namespace(bufnr, M.hovered_hl_ns, 0, -1)
end
function M.add_hover_highlight(bufnr, line, col_start)
vim.api.nvim_buf_add_highlight(
bufnr,
M.hovered_hl_ns,
'OutlineCurrent',
line,
col_start,
-1
)
vim.api.nvim_buf_add_highlight(bufnr, M.hovered_hl_ns, 'OutlineCurrent', line, col_start, -1)
end
function M.setup_highlights()
-- Setup the OutlineCurrent highlight group if it hasn't been done already by
-- a theme or manually set
if vim.fn.hlexists 'OutlineCurrent' == 0 then
if vim.fn.hlexists('OutlineCurrent') == 0 then
-- TODO: Use nvim_get_hl
local cline_hl = vim.api.nvim_get_hl_by_name('CursorLine', true)
local string_hl = vim.api.nvim_get_hl_by_name('String', true)
@@ -36,16 +29,10 @@ function M.setup_highlights()
-- notably making them italic, which messes up the outline connector. Fix
-- this by copying the foreground color from the comment hl into a new
-- highlight.
local comment_fg_gui = vim.fn.synIDattr(
vim.fn.synIDtrans(vim.fn.hlID 'Comment'),
'fg',
'gui'
)
local comment_fg_gui = vim.fn.synIDattr(vim.fn.synIDtrans(vim.fn.hlID('Comment')), 'fg', 'gui')
if vim.fn.hlexists 'OutlineGuides' == 0 then
vim.cmd(
string.format('hi OutlineGuides guifg=%s', comment_fg_gui)
)
if vim.fn.hlexists('OutlineGuides') == 0 then
vim.cmd(string.format('hi OutlineGuides guifg=%s', comment_fg_gui))
end
end