Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-issue: readme.md: add lazy and retab keymaps #18

Open
recallmenot opened this issue Mar 22, 2024 · 0 comments
Open

non-issue: readme.md: add lazy and retab keymaps #18

recallmenot opened this issue Mar 22, 2024 · 0 comments

Comments

@recallmenot
Copy link

Hi,
thank you so much for making this plugin!!

Below is my lua for lazy, you could add that to the readme.

I've also added the following keybindings:

<Tab>g to guess the indetation
<Tab>t to convert to tabs (normal mode)
<Tab>t to convert to tabs (visual line mode)
<Tab>s to convert to spaces (normal mode)
<Tab>s to convert to spaces (visual line mode)

While the last two (four) bindings don't have anything to do with your plugin, you may still choose to add them to the readme as they provide a great workflow enhancement when converting styles.

return {
	'nmac427/guess-indent.nvim',
	lazy = false,
	config = function()
		require('guess-indent').setup {}
		vim.keymap.set('n', '<Tab>g', vim.cmd.GuessIndent, { desc = "GuessIndent (manual)" })
		-- to tabs
		vim.keymap.set('n', '<Tab>t', '<Cmd>set noexpandtab<CR><Cmd>%retab!<CR><Cmd>set tabstop=8<CR>', { noremap = true, desc = "retab to tabs" })
		vim.keymap.set('v', '<Tab>t', "<Cmd>set noexpandtab<CR><Cmd>'<,'>retab!<CR><Cmd>set tabstop=8<CR>", { noremap = true, desc = "retab to tabs" })
		-- to spaces (for the average emacs enjoyer)
		vim.keymap.set('n', '<Tab>s', '<Cmd>set expandtab<CR><Cmd>set tabstop=8<CR><Cmd>%retab!<CR>', { noremap = true, desc = "retab to spaces" })
		vim.keymap.set('v', '<Tab>s', "<Cmd>set expandtab<CR><Cmd>set tabstop=8<CR><Cmd>'<,'>retab!<CR>", { noremap = true, desc = "retab to spaces" })
	end,
}

For beginners like me, these would be quite helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant