diff options
| author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-11 20:42:43 +0200 | 
|---|---|---|
| committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-11 20:42:43 +0200 | 
| commit | 64d9d82afbe9fcdabc9e4b9c5f02bf12c093645c (patch) | |
| tree | d9c2218c51716e77ea62cfe5c662274f49a2f3a2 /config/essentials/vis | |
| parent | d7d9eb0f21770d4467a31d16e2adf7e9c8a21edf (diff) | |
checkpoint
Diffstat (limited to 'config/essentials/vis')
| -rw-r--r-- | config/essentials/vis/backup.lua | 6 | ||||
| -rw-r--r-- | config/essentials/vis/format.lua | 18 | ||||
| -rw-r--r-- | config/essentials/vis/fzf-mru.lua | 2 | ||||
| -rw-r--r-- | config/essentials/vis/visrc.lua | 8 | 
4 files changed, 19 insertions, 15 deletions
diff --git a/config/essentials/vis/backup.lua b/config/essentials/vis/backup.lua index 7c44c60..2c8f0b8 100644 --- a/config/essentials/vis/backup.lua +++ b/config/essentials/vis/backup.lua @@ -20,6 +20,10 @@ end  -- Before saving the file, copy the current contents of the file to a backup file  vis.events.subscribe(vis.events.FILE_SAVE_PRE, function(file, path) +	if file == nil then +		return +	end +  	if file.size > backup.byte_limit then  		return  	end @@ -46,7 +50,7 @@ vis.events.subscribe(vis.events.FILE_SAVE_PRE, function(file, path)  end)  -- Set defaults -backup.directory = os.getenv("XDG_DATA_HOME") .. "/Trash/vis-backups" +backup.directory = (os.getenv("XDG_DATA_HOME") or (os.getenv("HOME") .. "/.local/share")) .. "/Trash/vis-backups"  backup.get_fname = backup.entire_path_with_double_percentage_signs diff --git a/config/essentials/vis/format.lua b/config/essentials/vis/format.lua index 67613a6..eefdc77 100644 --- a/config/essentials/vis/format.lua +++ b/config/essentials/vis/format.lua @@ -63,15 +63,15 @@ M.formatters = {  		end,  	},  	luaformatter = M.stdio_formatter("lua-format"), -	markdown = M.stdio_formatter(function(win) -		if win.options and M.wrapwidth ~= 0 then -			return "prettier --parser markdown --prose-wrap always " -				.. ("--print-width " .. (M.wrapwidth - 1) .. " ") -				.. M.with_filename(win, "--stdin-filepath ") -		else -			return "prettier --parser markdown " .. M.with_filename(win, "--stdin-filepath ") -		end -	end, { ranged = false }), +	-- markdown = M.stdio_formatter(function(win) +		-- if win.options and M.wrapwidth ~= 0 then +			-- return "prettier --parser markdown --prose-wrap always " +				-- .. ("--print-width " .. (M.wrapwidth - 1) .. " ") +				-- .. M.with_filename(win, "--stdin-filepath ") +		-- else +			-- return "prettier --parser markdown " .. M.with_filename(win, "--stdin-filepath ") +		-- end +	-- end, { ranged = false }),  	powershell = M.stdio_formatter([[      "$( (command -v powershell.exe || command -v pwsh) 2>/dev/null )" -c '          Invoke-Formatter  -ScriptDefinition ` diff --git a/config/essentials/vis/fzf-mru.lua b/config/essentials/vis/fzf-mru.lua index 455d083..8408dd7 100644 --- a/config/essentials/vis/fzf-mru.lua +++ b/config/essentials/vis/fzf-mru.lua @@ -10,7 +10,7 @@ Changes made:  --]]  local M = {} -M.fzf_filepath = os.getenv("XDG_CACHE_HOME") .. "/vis-fzf-mru" +M.fzf_filepath = (os.getenv("XDG_CACHE_HOME") or (os.getenv("HOME") .. "/.local/share")).. "/vis-fzf-mru"  M.fzf_path = "fzf"  M.fzf_args = "--height=40%"  M.fzf_history = 20 diff --git a/config/essentials/vis/visrc.lua b/config/essentials/vis/visrc.lua index 577712a..b56b6af 100644 --- a/config/essentials/vis/visrc.lua +++ b/config/essentials/vis/visrc.lua @@ -25,7 +25,7 @@ local format = require("format")  -- set height to 40%  local fzfmru = require("fzf-mru") -fzfmru.fzfmru_path = 'grep "^' .. os.getenv("PWD") .. '" | fzf' +fzfmru.fzfmru_path = 'grep "^' .. io.popen("pwd"):read("*a"):gsub("\n$", "") .. '" | fzf'  -- todo:  -- c-scope @@ -120,9 +120,9 @@ end)  vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused args  	-- automatically cd in parent dir of file  	vis:command_register("cdp", function() -		if win.file and win.file.path then -			local dir = win.file.path:match(".*/") -			vis:command("cd " .. dir) +		if win and win.file and win.file.path then +			-- local dir = win.file.path:match(".*/") +			-- vis:info("cd " .. tostring(dir))  		end  	end, "Cd to parent dir of file")  | 
