mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-22 08:53:31 +02:00
update
This commit is contained in:
parent
e52b14c920
commit
90d02a0f5b
5 changed files with 28 additions and 26 deletions
|
@ -2,7 +2,7 @@
|
|||
require("user.options")
|
||||
require("user.keymaps")
|
||||
require("user.autocommands")
|
||||
require("user.format_onsave")
|
||||
require("user.format")
|
||||
-- require("user.colorscheme")
|
||||
-- require("user.snip")
|
||||
-- require("user.bufferline")
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
local M = {
|
||||
disable = 0, -- 0 ( format jalan) 1 (fromat off)
|
||||
}
|
||||
|
||||
return M
|
5
lua/custom/format_onsave_20230219.lua
Normal file
5
lua/custom/format_onsave_20230219.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
local M = {
|
||||
disable = 1, -- 0 ( format jalan) 1 (fromat off)
|
||||
}
|
||||
|
||||
return M
|
7
lua/user/format.lua
Normal file
7
lua/user/format.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
local data_exists, frmt = pcall(require, "custom.format_onsave")
|
||||
if not data_exists then
|
||||
require("user.format_onsave")
|
||||
end
|
||||
if frmt.disable == 0 then
|
||||
require("user.format_onsave")
|
||||
end
|
|
@ -1,7 +1,4 @@
|
|||
local data_exists, frmt = pcall(require, "custom.format_onsave")
|
||||
if data_exists then
|
||||
if frmt.disable == 0 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")
|
||||
|
@ -15,13 +12,11 @@ if data_exists then
|
|||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
vim.cmd([[
|
||||
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=1000 ,filter=format_filter}
|
||||
augroup end
|
||||
]])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue