Questions tagged [visual-mode]
Visual mode is a flexible and easy way to select a piece of text for an operator.
309
questions
1
vote
1
answer
29
views
v_g_ctrl-g in neovim does not work
I am trying to find out the word count in selected text in neovim. For some reason, g_ctrl-g works perfectly fine in normal mode, but when I try it in visual mode after selecting some text, nothing ...
0
votes
1
answer
21
views
Why do text objects move the cursor to the end in Visual mode, but in the beginning in Operator-pending mode?
As far as I can tell, selection in Visual mode using most text objects results in the cursor being placed at the end of the text object region, whether that's linewise or characterwise.
However, using ...
0
votes
1
answer
57
views
Vim to drag current selected multi lines up
How do we have neovim to drag up current selected multi lines as
vim.api.nvim_set_keymap('x', 'I', ":m '<-2<CR>", { noremap = true, silent = true })
or:
vim.api.nvim_set_keymap('x',...
1
vote
1
answer
55
views
Paste in front or after in visual-block mode?
I can enter visual-block mode using <C-v>, move down a couple of rows by pressing j several times, then paste some content from the registry via pressing p or P. However, the pasting will ...
0
votes
2
answers
40
views
Select current Line from normal mode without changing cursor position AND without selecting the new line character at the end
What I am asking about can be done using multiple ways but none of them fully achieves what I want. For an instance :
0vg_ selects the current line without the new line character at the end but ...
0
votes
2
answers
28
views
How to use register expression with visual selection?
I have this key map in my Vim configuration:
nmap <leader>rn :%s/\<<C-r><C-w>\>/
But for this code from php I have a problem.
$text=$home_intro['text'];
Because, if cursor is ...
1
vote
1
answer
63
views
How can I accept a range in a Lua user command?
I want to optionally accept a range in a user-defined function:
vim.api.nvim_create_user_command('Pizzafy',
function(args)
if args.range > 0 then
-- visual mode, I think
...
0
votes
1
answer
26
views
Can the dot operator expand to the outer brackets if an inner pair was mistakenly highlighted during 'vib' (visualize inner brackets)?
( 2. can dot highlight this too?
( 1. 'vib' HERE selects this inner text ))
0
votes
0
answers
31
views
How to undo expanding selection in Vim? [duplicate]
I have this code snippet:
await sendtemplateemail({
recipient: invite.recipient_primary_email,
templateid: 'd-******',
templatedata: {
inviteurl: `${process.env....
0
votes
2
answers
88
views
How do I switch modes inside a user-defined lua function?
I want to write a command to do the following:
Make a visual selection.
Call a command on the visual selection.
By way of example, I'd like to call vat to visually select around the current tag, and ...
0
votes
1
answer
51
views
How can expand and contract visual selection from a tag block?
Say I have hierarchical markup like this:
<div id="level_1">
<div id="level_2">
<div id="level_3">
watermelon
</div>
</div>...
0
votes
1
answer
36
views
Keybinding to quickly update (aka prettify) React indentation
This is an example of the original code
<Text fontWeight="bold" size="lg" color="turquoise.500">Use Search V2 Beta</Text>
and I want a keyboard shortcut (say ...
0
votes
1
answer
48
views
keybindings that change mode: cannot use keybindings on the new mode
I have defined the following keybindings:
local opts = { noremap = true }
local ll = "<leader>i"
opts["desc"] = "Send visual lines"
vim.keymap.set("v", ...
2
votes
3
answers
158
views
Best way to keybind subsequent substitutions in visual mode
I need a keybinding that, given some text selected in visual mode (line visual mode, block visual mode, or whatever):
Add > _ before the text
Add _ after the text
In case of empty lines, > ...
4
votes
1
answer
409
views
Why does `yW` yank until the end of the WORD, but `W` move to the next one?
My confusion started with realizing, that yW yanks a different region, then what vW selects, but I found this that explains about selection. But then I realized, that while yW will yank until the end ...