소스 검색

chore: format on save off by default

chore: check if table
Christian Chiarulli 2 년 전
부모
커밋
08d3c056ff
4개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 0
      lua/lvim/config/defaults.lua
  2. 3 1
      lua/lvim/core/autocmds.lua
  3. 1 1
      utils/installer/config.example.lua
  4. 1 1
      utils/installer/config_win.example.lua

+ 2 - 0
lua/lvim/config/defaults.lua

@@ -4,6 +4,8 @@ return {
   colorscheme = "lunar",
   transparent_window = false,
   format_on_save = {
+    ---@usage boolean: format on save (Default: false)
+    enabled = false,
     ---@usage pattern string pattern used for the autocommand (Default: '*')
     pattern = "*",
     ---@usage timeout number timeout in ms for the format request (Default: 1000)

+ 3 - 1
lua/lvim/core/autocmds.lua

@@ -158,7 +158,9 @@ function M.disable_format_on_save()
 end
 
 function M.configure_format_on_save()
-  if lvim.format_on_save then
+  if type(lvim.format_on_save) == "table" and lvim.format_on_save.enabled then
+    M.enable_format_on_save()
+  elseif lvim.format_on_save == true then
     M.enable_format_on_save()
   else
     M.disable_format_on_save()

+ 1 - 1
utils/installer/config.example.lua

@@ -10,7 +10,7 @@ an executable
 
 -- general
 lvim.log.level = "warn"
-lvim.format_on_save = false
+lvim.format_on_save.enabled = false
 lvim.colorscheme = "lunar"
 -- to disable icons and use a minimalist setup, uncomment the following
 -- lvim.use_icons = false

+ 1 - 1
utils/installer/config_win.example.lua

@@ -27,7 +27,7 @@ vim.g.clipboard = {
 
 -- general
 lvim.log.level = "warn"
-lvim.format_on_save = true
+lvim.format_on_save.enabled = false
 lvim.colorscheme = "lunar"
 -- to disable icons and use a minimalist setup, uncomment the following
 -- lvim.use_icons = false