Questions tagged [visual-mode]

Visual mode is a flexible and easy way to select a piece of text for an operator.

24 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
0 answers
177 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 ...
Muzer's user avatar
  • 161
4 votes
0 answers
229 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! ...
Uri Goren's user avatar
  • 141
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 ...
Chromium's user avatar
  • 277
3 votes
0 answers
146 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 ...
Alexander Pozdneev's user avatar
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 ...
Keith Hughitt's user avatar
2 votes
0 answers
327 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;...
Aaron Parisi's user avatar
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. ...
simlei's user avatar
  • 113
1 vote
1 answer
39 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 ...
Rizhiy's user avatar
  • 143
1 vote
1 answer
47 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 ...
minseong's user avatar
  • 2,323
1 vote
0 answers
1k 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 ...
Codemonkey's user avatar
1 vote
0 answers
34 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 ...
Shuzheng's user avatar
  • 1,235
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 ...
Andy Stewart's user avatar
  • 1,359
1 vote
1 answer
969 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 ...
user avatar
1 vote
0 answers
249 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. ...
niekas's user avatar
  • 1,575
1 vote
0 answers
186 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?
SibiCoder's user avatar
  • 3,372
0 votes
1 answer
23 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 ))
chapel's user avatar
  • 11
0 votes
2 answers
72 views
+50

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 ...
Sasgorilla's user avatar
0 votes
0 answers
124 views

Search forward / backward (`*` / `#`) in visual select mode

This seems to be a mismatch in behavior between Vim and Neovim. In Vim, when in visual selection mode, * and # work as expected: they jump forward / backward to the next occurrence of the word under ...
phg's user avatar
  • 197
0 votes
0 answers
46 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) ...
chipfall's user avatar
  • 103
0 votes
0 answers
54 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 ...
mattb's user avatar
  • 1,131
0 votes
0 answers
162 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 ...
Jordan Mandel's user avatar
0 votes
0 answers
89 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, ...
Julius Hamilton's user avatar
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 ...
M.V.'s user avatar
  • 1
0 votes
0 answers
97 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 ...
john c. j.'s user avatar