Closed madhat2r closed 1 month ago
Sure, it's just a text find-and-replace
vim.keymap.set("n", "<leader>+x", function()
local cursor = vim.api.nvim_win_get_cursor(0)
local lnum = cursor[1]
local line = vim.api.nvim_buf_get_lines(0, lnum - 1, lnum, true)[1]
line = line:gsub(" ([r%-][w%-]).([r%-][w%-]).([r%-][w%-]). ", function(u, g, p)
return " " .. u .. "x" .. g .. "x" .. p .. "x "
end)
vim.api.nvim_buf_set_lines(0, lnum - 1, lnum, true, { line })
end)
That is perfect Steven, thank you!
Is there a way to create a keybinding that would chmod +x on current entry?