fix: disable format if lsp undefined

This commit is contained in:
asep komarudin 2024-02-23 19:49:22 +07:00
parent 8dee08aca6
commit 9fd84a85f3
6 changed files with 30 additions and 5 deletions

View file

@ -26,7 +26,7 @@ vim.g.pcode_colorscheme = "tokyonight"
-- dracula
-- nightfox
-- 0 =off 1= on
vim.g.pcode_transparent_mode = 0
vim.g.pcode_transparent_mode = 1
-- 0 disable progress
-- 1 lualine lsp progress

View file

@ -225,8 +225,18 @@ return {
-- purple = "#FCC76A",
menu = "#282A36",
},
italic_comment = true,
overrides = {
NvimTreeFolderIcon = { fg = "#FCC76A" },
CmpItemAbbr = { fg = "#ABB2BF" },
CmpItemKind = { fg = "#ABB2BF" },
CmpItemAbbrDeprecated = { fg = "#ABB2BF" },
CmpItemAbbrMatch = { fg = "#8BE9FD" },
htmlLink = { fg = "#BD93F9" },
Underlined = { fg = "#8BE9FD" },
NvimTreeSpecialFile = { fg = "#FF79C6" },
MatchParen = { fg = "#F8F8F2" },
SpellBad = { fg = "#FF6E6E" },
},
transparent_bg = transparent,
})

View file

@ -7,8 +7,13 @@ if frmt.format_on_save == 1 then
run = 1
end
local buf_clients = vim.lsp.buf_get_clients()
if next(buf_clients) == nil then
run = 0
end
if run == 1 then
function format_filter(client)
function FORMAT_FILTER(client)
local filetype = vim.bo.filetype
local n = require("null-ls")
local s = require("null-ls.sources")
@ -23,11 +28,12 @@ if run == 1 then
return false
end
end
vim.cmd([[
augroup _lsp
autocmd!
" autocmd BufWritePre * lua vim.lsp.buf.format{timeout_ms =200, filter=format_filter}
autocmd BufWritePre * lua vim.lsp.buf.format{timeout_ms=2000 ,filter=format_filter}
autocmd BufWritePre * lua vim.lsp.buf.format{timeout_ms=2000 ,filter=FORMAT_FILTER}
augroup end
]])
end

View file

@ -51,5 +51,8 @@ tokyonight.setup({
bg = colors.none,
fg = "#e0af68",
}
highlights.Underlined = {
underline = false,
}
end,
})

View file

@ -113,6 +113,12 @@ material_icon.setup({
web_devicons.setup({
override = material_icon.get_icons(),
override_by_filename = {
[".htaccess"] = {
icon = "󰛓",
color = "#C63C17",
cterm_color = "240",
name = "htaccess",
},
[".huskyrc"] = {
icon = "󰩃",
color = "#ffffff",