feat: added retab command to change only leading space
This commit is contained in:
parent
1c0da94062
commit
ea5655bd0b
1 changed files with 20 additions and 0 deletions
20
init.lua
20
init.lua
|
@ -170,3 +170,23 @@ vim.api.nvim_create_user_command(
|
|||
end,
|
||||
{bang=true, nargs='?'}
|
||||
)
|
||||
|
||||
-- since builtin :retab! will expand also alignment spaces,
|
||||
-- I made this simple command to use 'unexpand'/'expand'
|
||||
vim.api.nvim_create_user_command(
|
||||
'Retab',
|
||||
function(args)
|
||||
local tablen = 4
|
||||
local cmd = "unexpand"
|
||||
local opt = "--first-only"
|
||||
if #args.args > 0 then
|
||||
tablen = args.args
|
||||
end
|
||||
if args.bang then
|
||||
cmd = "expand"
|
||||
opt = "--initial"
|
||||
end
|
||||
vim.cmd(string.format("%%!%s -t %d %s", cmd, tablen, opt))
|
||||
end,
|
||||
{bang=true, nargs='?'}
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue