Add :RStrip command to strip trailing white space

This commit is contained in:
Kenneth Benzie 2024-04-02 21:17:05 +01:00
parent f95a8fb8e5
commit d9f6bea1dc

View File

@ -1,3 +1,11 @@
-- :RString Strip white psace from right of all lines
vim.api.nvim_create_user_command('RStrip', function(_)
local cursor_pos = vim.fn.getcurpos(vim.api.nvim_get_current_win())
vim.cmd [[ execute '%s/\s\+$//e' ]]
vim.cmd [[ nohlsearch ]]
vim.fn.setpos('.', cursor_pos)
end, {})
-- :TabWidth <N> set the tab width for the current buffer
vim.api.nvim_create_user_command('TabWidth', function(opts)
-- Set the tab width for the current filetype