diff --git a/doc/substitute-nvim.txt b/doc/substitute-nvim.txt index d03c41d..cda5c8a 100644 --- a/doc/substitute-nvim.txt +++ b/doc/substitute-nvim.txt @@ -273,14 +273,24 @@ EXCHANGE OPERATOR *substitute-nvim-exchange-operator* This operator allows to quickly exchange text inside a buffer. Eg. To exchange two words, place your cursor on the first word and type `sxiw`. -Then move to the second word and type `sxiw` again. Note: the {motion} used in -the first and second use of `sx` don’t have to be the same. Note 2: this is -dot-repeatable, so you can use `.` instead of `sxiw` for the second word. +Then move to the second word and type `sxiw` again. + +Note: the {motion} used in the first and second use of `sx` don’t have to be +the same. Note 2: this is dot-repeatable, so you can use `.` instead of `sxiw` +for the second word. + +You can select a whole line using the `line` function (`sxx` in the example +below). + +Because this operator has to be invoked twice to change the document, if you +change your mind after invoking the operator once, you can cancel you selection +using the `cancel` function (mapped to `sxc` in the example below). > vim.api.nvim_set_keymap("n", "sx", "lua require('substitute.exchange').operator()", { noremap = true }) vim.api.nvim_set_keymap("n", "sxx", "lua require('substitute.exchange').line()", { noremap = true }) - vim.api.nvim_set_keymap("x", "X", "lua require('substitute.exchange').visual()") + vim.api.nvim_set_keymap("x", "X", "lua require('substitute.exchange').visual()", { noremap = true }) + vim.api.nvim_set_keymap("n", "sxc", "lua require('substitute.exchange').cancel()", { noremap = true }) < @@ -290,6 +300,7 @@ or nmap sx lua require('substitute.exchange').operator() nmap sxx lua require('substitute.exchange').line() xmap X lua require('substitute.exchange').visual() + nmap sxc lua require('substitute.exchange').cancel() <