Neovim plugin to quickly navigate in and out of surrounding characters.
Go to file
Bryan d554979867 Fix command line function 2024-10-21 23:01:25 -06:00
doc cloned from https://github.com/ysmb-wtsg/in-and-out.nvim, fixed vim.validate() being called incorrectly in config function 2024-10-09 22:23:36 -06:00
lua/in-and-out Fix command line function 2024-10-21 23:01:25 -06:00
.gitignore cloned from https://github.com/ysmb-wtsg/in-and-out.nvim, fixed vim.validate() being called incorrectly in config function 2024-10-09 22:23:36 -06:00
LICENSE cloned from https://github.com/ysmb-wtsg/in-and-out.nvim, fixed vim.validate() being called incorrectly in config function 2024-10-09 22:23:36 -06:00
README.md cloned from https://github.com/ysmb-wtsg/in-and-out.nvim, fixed vim.validate() being called incorrectly in config function 2024-10-09 22:23:36 -06:00
stylua.toml cloned from https://github.com/ysmb-wtsg/in-and-out.nvim, fixed vim.validate() being called incorrectly in config function 2024-10-09 22:23:36 -06:00

README.md

in-and-out.nvim

in-and-out is a Neovim plugin designed to quickly navigate in and out of surrounding characters like quotes (", '), parentheses ((, )), curly braces ({, }), square brackets ([, ]), and backticks (`).

demo

Installation

Use your favorite package manager. For example, using lazy:

{
	"ysmb-wtsg/in-and-out.nvim",
	keys = {
		{
			"<C-CR>",
			function()
				require("in-and-out").in_and_out()
			end,
			mode = "i"
                },
	},
}

Configuration

By default, this plugin will jump into and out of the following surrounding characters:

{ '"', "'", "(", ")", "{", "}", "[", "]", "`" }

If you are happy with this list of targets, you don't need to do any configuration, and you don't need to call setup.

On the other hand, if you want to add to the list of targets or replace it altogether, use the plugin's setup method. To add targets, pass setup an options table containing a sublist named additional_targets. To replace the original targets list entirely, pass setup an options table with a sublist called targets.

Note: you cannot use both the targets and the additional_targets sublists at the same time. If you try, the plugin will apply targets and ignore additional_targets.

See the examples below.

Using lazy to add smart quotes as a target:

{
	"ysmb-wtsg/in-and-out.nvim",
	keys = {
		{
			"<C-CR>",
			function()
				require("in-and-out").in_and_out()
			end,
			mode = "i"
                },
	},
	opts = { additional_targets = { "“", "”" } },
}

Manual require to reset the targets altogether:

require("in-and-out.nvim").setup({
	targets = { "(", ")", "[", "]" }
})

Mapping

By default, the plugin does not set any mapping. You can set one through your plugin manager (if it supports setting mappings) or manually.

Using lazy:

{
	"ysmb-wtsg/in-and-out.nvim",
        keys = {
                {
                        "<C-CR>",
                        function()
                                require("in-and-out").in_and_out()
                        end,
                        mode = "i"
                },
        },
	opts = { additional_targets = { "“", "”" } },
}

Manually:

vim.keymap.set("i", "<C-CR>", function() require("in-and-out").in_and_out()
end)