Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [selection]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
32 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 ...
pic810's user avatar
  • 1
0 votes
1 answer
37 views

When text is selected in Neovim on macOS, that selection isn't added to the primary clipboard. Can it be?

When using neovim on macOS (at least macOS), text that is selected isn't automatically added to the primary selection for the operating system. One must use the terminal's selection utilities, or yank ...
theherk's user avatar
  • 133
1 vote
2 answers
41 views

Switch modes without losing the selection

I use VsCode with Neovim extension. Sometimes I have to add different quotations or underscores or edit parentheses around a word but the words or marks around them aren't always straightforward or ...
mpower's user avatar
  • 111
1 vote
1 answer
37 views

select until repeatedly

Is there a way to repeat the "select until" operation? For example: f(a, g(b)) If I want to select f(a, g(b)). I would like to: go to f then do vf) which will select f(a, g(b) and then do ...
lo tolmencre's user avatar
1 vote
2 answers
1k views

Select entire function call or extend selection

I have the following situation a lot, where I always end up having to yank two things in a row: For example, I want to yank a function call: func(a, b) Okay, here I can go to f and press vf). But ...
lo tolmencre's user avatar
2 votes
1 answer
45 views

How do the * and + registrers behave in the virtual console?

My Vim is installed with +clipboard support, and all works just fine. I know that the clipboard comes with X, so there isn't such a thing in a virtual console (or, at least, this is what I've ...
Enlico's user avatar
  • 2,214
4 votes
0 answers
218 views

Select everything between quotes over multiple lines

Is there a way to select everything between quotes " ' and <backtick> where the text contained between these quotes span multiple lines? vi<quote> will select everything in between ...
Riptide's user avatar
  • 141
0 votes
1 answer
309 views

keyboard shortcut to insert text at the end of several lines of same length instead of 10,12s/$/pattern_to_be_inserted/gc

to insert the same text inside several lines in one particular line <ctrl> + <v> to select the line and then <shift> + <i> to insert a texte BEFORE the particular column. Is ...
ecjb's user avatar
  • 149
0 votes
1 answer
287 views

How to replace selected text T with some function(T), using a keyboard shortcut?

I want to annotate words /sentences for a "named entity recognition" purpose; inside a text file, I want to annotating words or sentences with this format [pattern](label): [a word where the ...
Giorgio Robino's user avatar
0 votes
1 answer
491 views

Vim editor entities tagging/annotation tool

I'm looking for a word/sentence annotation tool/plugin to be used INSIDE vim editor. Specifically I'm looking for a cli tool NER (named entity) tagging. Any idea/suggestion/tip? By example, I would ...
Giorgio Robino's user avatar
0 votes
1 answer
77 views

How to select non-uniform length strings from within multiple lines

Suppose I have this data: import { york1400 } from "./data/york1400"; import { york1430 } from "./data/york1430"; import { york1500 } from "./data/york1500"; import { ...
Ben Frain's user avatar
  • 217
0 votes
1 answer
1k views

How to diff a selected part of two files?

I have two files with some similar program functions in. But these functions are not ordered File 1: | File 2: function a | function c | function b | function e ...
Andy A.'s user avatar
  • 233
6 votes
1 answer
314 views

How do registers + and * interact with suspending Vim via Ctrl-Z?

As show in the following screencast, I see that using Ctrl-Z makes most recent written register of + and * overwrite the other one. You can see me doing the following: opening a file via vi -u NONE ...
Enlico's user avatar
  • 2,214
1 vote
1 answer
812 views

How to get current line string without visual selection?

I'm usually working with a file list for sorting/deleting/etc files, and I like to sometimes run arbitrary command on those files (which have either a full path or already present in current directory)...
Nordine Lotfi's user avatar
2 votes
1 answer
286 views

Caret `^` and `\%V` compatibility in Vim regex

Can the caret ^ and the sequence \%V be used to match the beginning of a line in a visual selection? And if not, what is the rationale? The following example seems to indicate that ^ and \%V are not ...
mgarort's user avatar
  • 275
0 votes
1 answer
1k views

How to multi select for the purpose of copy operation?

I can do a search to highlight multiple unrelated words that exist with: /word1\|word2\|word3 But this is only search, it is not "select" (for copy and paste operation) How to highlight ...
user15344508's user avatar
3 votes
2 answers
5k views

How to move selected lines up and down? [duplicate]

Is it possible to move selected lines up and down? c = 3 a = 1 b = 2 I would like to select second and third lines and move them one line up, so that result be: a = 1 b = 2 c = 3 I know that > ...
niekas's user avatar
  • 1,585
2 votes
1 answer
174 views

Can you do a jagged visual selection or jagged yank?

given some text like sadf_blahbalh_sdf sadf_abc_zzz asdf_yx_sdf and I want to block select from the 'b' of blah down to the 'y' of yx and then, for every line extend the select to the _ using ...
Keith Nicholas's user avatar
0 votes
2 answers
193 views

How to grow/shrink a selection per tab?

How to have a selection grow/shrink as we tabulate, regardless of cursor position ? The selection can span more than one line. Kind of like this: For the tabbing I've got this part so far: xnoremap &...
8c6b5df0d16ade6c's user avatar
0 votes
0 answers
22 views

Key combination to delete without copying to clipboard/register ? (General) [duplicate]

What's the command/option/keys/function that performs a delete on a selection (in visual mode) without copying the selection to clipboard/register? I.e I don't want to use d or x as they will delete ...
8c6b5df0d16ade6c's user avatar
17 votes
4 answers
29k views

Select multiple words, one at a time, then replace them all

Goal: Select multiple words, one at a time, then replace them all. I'm new to Vim; I come from Visual Studio. I would like to achieve one important feature that helped me a lot in my productivity: ...
Sam's user avatar
  • 301
2 votes
1 answer
1k views

How to perform an action on search matches?

How can I visually select all text highlighted by a search in order to run a command on it? And if it's possible, how can I capitalize the selection?
Cycl0n's user avatar
  • 23
3 votes
3 answers
1k views

How can I indent selected lines in Visual mode by space granularity instead of TABs?

How can I indent lines selected in Visual mode using space granularity instead of than TABs (i.e. < or >)? Sometimes when coding Python, I need to indent lines to a level that is not a TAB ...
Shuzheng's user avatar
  • 1,255
1 vote
1 answer
259 views

gvim swaping between underline and normal visual text selection in visual mode

I'm having a weird issue running gvim 8.2.1081 on fedora 32 using kde. When selecting text in visual mode gvim keeps swapping between an underline and the expected visual text selection while moving ...
Pedro Peixoto's user avatar
2 votes
3 answers
758 views

Visually select consecutive lines with the same starting string

This is mainly for working on multiple files in vifm (log1.txt, log2.txt, etc.) so lines can be assumed to be sorted, though this should work in normal vim/nvim. Let's say we have this: test 1 test 2 ...
ChocolateOverflow's user avatar
2 votes
1 answer
158 views

Put cursor at arbitrary line and column

Normal, insert, and visual modes restrict cursor movements to locations occupied by some characters. They don't allow moving to the right from the end of line and down beyond end of file. For example:...
Anton Tarasenko's user avatar
1 vote
1 answer
44 views

Is it possible to ignore J if only one line is selected?

Today I made a macro that involved selecting a few lines to join. The problem was that sometimes I only selected parts of one line and in this case two lines was still joined with J. Is it possible to ...
Moberg's user avatar
  • 113
2 votes
1 answer
2k views

Select text in block-wise visual mode on each line asynchronously

If I have text like this: cat = "john" leopard = "frank" tiger = "josh" and I want to select the first word of each line in block-wise visual mode, I want to be able to do something like this: put ...
WalksB's user avatar
  • 507
3 votes
1 answer
29 views

How to line-select a block within a back-ticked string

I've got the following code 1 const unrelated = 3; 2 3 const XYZ = styled.div` 4 display: inline-block; 5 position: absolute; 6 7 margin: auto; 8 `; 9 10 const unrelated2 = 6; With my ...
kadrian's user avatar
  • 133
1 vote
3 answers
399 views

Selector for line of text?

To grab a full word from anywhere in the word I can do: viw And to grab an entire line from start to finish I can do: V However, is there a section that grabs all text from the first char to the ...
David542's user avatar
  • 2,455
2 votes
3 answers
154 views

How to do multiline non-rectangular deletion?

Here is a problem I am able to solve in Sublime in seconds but has me stumped in Vim: Given text like this: [email protected] Bob Potato [email protected] Peter Carrot thomas.cucumber@thomasstore....
Ben Frain's user avatar
  • 217
4 votes
1 answer
228 views

How to re-select a previously selected region in visual mode?

I often select a region in visual mode for properly indenting it. However, after pressing for example 3>, visual mode exits and the selection disappears. How can I re-select the previously selected ...
Shuzheng's user avatar
  • 1,255
1 vote
0 answers
106 views

Expanding region/selection for javascript

is there a way to configure https://github.com/terryma/vim-expand-region (or any other plugin) to work with js,jsx,ts,tsx files? I'm new to vim, I'm not sure what to do. The mentioned plugin is not ...
Stav Alfi's user avatar
  • 121
1 vote
1 answer
281 views

Gradient color background for visual selections

In this video from Bisqwit, the selected line is colored by a gradient according to column number. Image is below. He implemented the gradient in a custom terminal emulator. Is there any way to ...
japreiss's user avatar
  • 151
1 vote
4 answers
87 views

How to end selection at an occurrence of a word?

Let's say I have this text with | as my cursor: <<<<<<< HEAD hi ======= hello ====== >>>>>> XXXX GGg| Now, I'd like to select from >>>> to say second=== or ...
SurenNihalani's user avatar
2 votes
1 answer
291 views

vim - how do I cut some lines of file-1 to file-2 in 1 step?

When I need to cut some lines from one file to another file, I always do the following steps: Select the lines in file-1 :w >> file-2 Re-select the lines d This is super annoying if you need ...
Teddy C's user avatar
  • 155
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
3 votes
2 answers
1k views

How to vertically-block-select words of different length?

With other editors we can select vertical-blocks where each line has the same start column but not the same end-column. For example: print("", s.field1); print("", s.field_long); print("", s.f); ...
Patrick B.'s user avatar