This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vim.keymap.set('n', '<leader>f', function() | |
local ext = vim.fn.expand '%:e' | |
local confirm = | |
vim.fn.input('proceed with formatting ' .. ext .. ' files? [y/n] ') | |
if confirm:lower() ~= 'y' then | |
print 'operation cancelled' | |
return | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with builtins; | |
let | |
printChild = prefix: x: | |
let | |
names = attrNames x; | |
in | |
if isAttrs x && length names == 1 | |
then "." + head names + printChild prefix x.${head names} | |
else " = " + print prefix x | |
; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Calls GPT-4 to fill holes in the current file, | |
" omitting collapsed folds to save prompt space | |
local M = {} | |
local function save_visible_lines(dest) | |
local visible_lines = {} | |
local lnum = 1 | |
while lnum <= vim.fn.line('$') do | |
if vim.fn.foldclosed(lnum) == -1 then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- autosave.lua script | |
-- Fork from: https://gist.github.com/CyberShadow/2f71a97fb85ed42146f6d9f522bc34ef | |
local options = require 'mp.options' | |
local o = { | |
save_period = 60 | |
} | |
options.read_options(o) |