~havi/nvim.d

ref: a1c16118d586969dabe6fe1afa15e46d28804c93 nvim.d/after/plugin/user_commands.lua -rw-r--r-- 735 bytes
a1c16118havi feat(after/plugin/user_commands): collection of utility commands 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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}
)