diff --git a/.config/vis/visrc.lua b/.config/vis/visrc.lua index e8701fa..9dd3bfa 100644 --- a/.config/vis/visrc.lua +++ b/.config/vis/visrc.lua @@ -9,12 +9,19 @@ plugins = { ["cursors"] = require 'plugins/cursors', } +local disable_formating = false vis.events.subscribe(vis.events.INIT, function() require 'themes/minimal-light' require 'plugins/commentary' vis:map(vis.modes.NORMAL, ',f', ':fzf') vis:map(vis.modes.NORMAL, ',b', ':fzfmru') + vis:command_register('W', function(argv) + disable_formating = true + vis:command('w') + disable_formating = false + return true + end, "Write file without formatting") end) vis.events.subscribe(vis.events.WIN_OPEN, function(win) @@ -24,11 +31,16 @@ end) local function format(file, path) local win = vis.win local fmt = nil - if win.syntax == "javascript" or win.syntax == "typescript" or win.syntax == "json" or win.syntax == "css" then + if + win.syntax == "javascript" + or win.syntax == "typescript" + or win.syntax == "json" + or win.syntax == "css" + then fmt = "prettier --stdin-filepath "..file.path end - if fmt == nil then + if fmt == nil or disable_formating then return true end