~havi/nvim.d

a1c16118d586969dabe6fe1afa15e46d28804c93 — havi 5 months ago c5f3d92
feat(after/plugin/user_commands): collection of utility commands
1 files changed, 33 insertions(+), 0 deletions(-)

A after/plugin/user_commands.lua
A after/plugin/user_commands.lua => after/plugin/user_commands.lua +33 -0
@@ 0,0 1,33 @@
-- NeatFoldText
vim.api.nvim_create_user_command(
	'SpacesToTabs',
	function(tbl)
		vim.opt.expandtab = false
		local previous_tabstop = vim.bo.tabstop
		vim.opt.tabstop = tonumber(tbl.args)
		vim.api.nvim_command 'retab!'
		vim.opt.tabstop = previous_tabstop
	end,
	{force = true, nargs = 1}
)

vim.api.nvim_create_user_command(
	'TabsToSpaces',
	function(tbl)
		vim.opt.expandtab = true
		local previous_tabstop = vim.bo.tabstop
		vim.opt.tabstop = tonumber(tbl.args)
		vim.api.nvim_command 'retab'
		vim.opt.tabstop = previous_tabstop
	end,
	{force = true, nargs = 1}
)

-- Vim LSP stuff
vim.api.nvim_create_user_command(
	'LspOrganizeImports',
	'lua vim.lsp.buf.code_action{source = {organizeImports = true}}',
	{force = true}
)