Questions tagged [visual-mode]
Visual mode is a flexible and easy way to select a piece of text for an operator.
25
questions with no upvoted or accepted answers
6
votes
0
answers
191
views
How to copy text to X primary selection only when visual mode is started with the mouse?
At the moment, if I use Visual mode, whenever I select a block of text using the keyboard it ends up on my X primary selection (ie the clipboard that is filled using the mouse). Even if I just select ...
4
votes
0
answers
250
views
Pasting from vim to an ipython terminal
I have an open ipython terminal open, and I'd like to paste the visual selection to it, with prepending "%cpaste" and appending "--"
This is what I came up with
function! ...
4
votes
1
answer
2k
views
CTRL-A with visual mode not working
According to the Vim help, using g CTRL-A with visual mode should change several lines in A to that in B:
A:
1.
1.
1.
1.
B:
1.
2.
3.
4.
In my Vim, the CTRL-A is working in ...
3
votes
0
answers
156
views
Remove one level of all Vimwiki headers in a selection
In Vimwiki, a header level can be decreased, by pressing -.
Is there a native Vimwiki command to remove a level from all headers within a visual selection?
Keep in mind that Vimwiki supports a number ...
3
votes
0
answers
31
views
Keep function "keyword = arguments" together when reformatting across multiple lines using "gq"?
One thing I find myself doing often is using visual mode to select a block containing a long function definition containing one or more keyword arguments, and then using gq to reformat the code across ...
2
votes
1
answer
66
views
Replace only inside visual selection (\%V) by default
I would like to always use \%V bounds when replacing inside visual selection. How can I make that behaviour default?
I'm currently using this keymap to achieve that, but I was wondering if there is a ...
2
votes
0
answers
401
views
How to configure cursor shape in visual, visual block modes?
I configure cursor shape in normal, insert, and replace modes with the following in my vimrc
let &t_SI = "\<Esc>]50;CursorShape=2\x7"
let &t_SR = "\<Esc>]50;...
2
votes
0
answers
41
views
Do operator ranges/movements/textobjects always overwrite the last visual selection? workaround?
In vim, when I operate on a textobject from a plugin, say the 'inner indent' typed ii from kana/vim-textobj-indent, my last visual selection ('>, '<) is reset to where the operator worked on. ...
1
vote
1
answer
51
views
Make operator that doesn't change gv
I'm trying to redefine my inner and outer line text objects so that they don't change gv. First I had
onoremap <silent> il :<C-u>normal! $v^<CR>
I changed it based on Using visual ...
1
vote
0
answers
2k
views
How can I stop vim from automatically entering visual mode when I click into the PuTTY window with my mouse?
I suspect this is the same in vim as well, but fwiw I'm actually using nvim.
For a long time I've used set mouse=a so I can choose to navigate my file with the mouse, if I so wish.
What I've never ...
1
vote
0
answers
35
views
How can I repeat a custom function mapped using `vnoremap` using something similar to the dot (`.`) operator?
I have this custom function in my ~/.vimrc mapped to Visual mode using vnoremap.
After having executed the function using <leader><space>, how execute it again using something similar to ...
1
vote
0
answers
176
views
How to start insert-mode completion from select mode using Vimscript?
I have some text selected in select mode. I want to delete it and start insert-mode completion.
When I type these keystrokes into Vim it works perfectly:
gvc<C-X><C-U>
gv switches to ...
1
vote
1
answer
1k
views
Visual block mode insert/append not working in vim on RHEL/CentOS?
I was trying to append some text to multiple lines in vi on a RHEL 6 system, however I could not get it to work. I press Control + V to get into visual block mode, select the lines I need, but when I ...
1
vote
0
answers
262
views
How to use visual mode in python/dyn?
Vim documentation states how to run command and normal mode commands (source):
vim.command(str) python-command
Executes the vim (ex-mode) command str. ...
1
vote
0
answers
103
views
Select characters in Visual mode (works differently than Normal mode)
I'm trying to understand the difference in character counting between Normal and Visual modes.
Roses are red,
Violets are blue,
Sugar is sweet,
And so are you.
The task is to copy everything from ...
1
vote
0
answers
189
views
Why doesn't select mode appear in the status line?
Regardless of the mode I select, it appears on the status line.
But when I switch to select mode, it is not shown on the status line in Vim, whereas it is shown in gVim.
How do I make it work?
0
votes
1
answer
51
views
Vim visual block copy don't paste in KDE konsole
Selecting by visual line mode and copying (V and y) in vim in rxvt-unicode or in gnome-terminal and pasting in another tab of that terminal with Shift + Insert works well.
But trying to do the same ...
0
votes
1
answer
61
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',...
0
votes
1
answer
27
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
2
answers
92
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
0
answers
54
views
What's controlling Vim paste behaviour?
What's controlling Vim paste behaviour via Vim over ssh using putty with right-click paste set to Linux host?
To start we have:
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Mar 27 2023 00:00:00)
...
0
votes
0
answers
57
views
Detect new visual selection with vimscript
I asked a related but different question
here.
I'm writing the
vim-visual-history
plugin that keeps a traversable history of previous visual selections. To
detect the selections, I'm using:
autocmd ...
0
votes
0
answers
182
views
Is there a modification to make the dot command work intuitively in visual mode?
This is a repeat of a question that I asked on the Vim subreddit but didn't receive a helpful answer for. I think that this should be do-able, but I'm not good enough at Vimscript or Lua yet to ...
0
votes
0
answers
95
views
How can I highlight in visual block mode all text between two delimiters over multiple lines?
I have a tab-separated spreadsheet and I'd like to highlight in visual block mode by selecting a character, expanding the visual highlight region to the whole entry between the two tab characters, ...
0
votes
0
answers
36
views
Chronologically store visual selections in a buffer
My goal is to enhance the usage of gv with counts, in order to access older selections quickly. Such that 2gv would reselect the selection made before the last.
Vim doesn't have events for entering ...