From 2098949e9c1f326c8be56ed9df0204e3eec846c9 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Mon, 8 Apr 2024 20:52:47 +0100 Subject: [PATCH] Add :Chmod command to change mode bits --- lua/commands.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/commands.lua b/lua/commands.lua index e367a28..0686519 100644 --- a/lua/commands.lua +++ b/lua/commands.lua @@ -99,7 +99,13 @@ end, { end }) --- TODO: :Chmod +-- :Chmod change file mode bits +if vim.fn.executable('chmod') == 1 then + vim.api.nvim_create_user_command('Chmod', function(opts) + local file = vim.fn.expand('%:p') + vim.fn.system('chmod ' .. opts.args .. ' ' .. file) + end, { nargs = '+' }) +end -- :Mkdir create a directory, bang to create intermediate directories vim.api.nvim_create_user_command('Mkdir', function(opts)