Skip to content

Neovim plugin for quick navigation in and out of surrounding characters like quotes, parentheses, curly braces, and square brackets.

License

Notifications You must be signed in to change notification settings

ysmb-wtsg/in-and-out.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Neovim plugin for quick navigation in and out of surrounding characters like quotes, parentheses, curly braces, and square brackets.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages