K
K
krll-k2015-09-20 13:46:25
vim
krll-k, 2015-09-20 13:46:25

How to highlight text in vim text editor?

You need to be able to select text so that later you can cut it into a separate file. In sublime text, this is done by holding down the shift and ctrl buttons, but how in vim?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
nonlux, 2015-09-20
@krll-k

I'll try to summarize, I remember my panic when I opened vim for the first time
Option 1:
- Press v (vim switches to visual mode, selects everything from the current cursor position)
- move the cursor (you can use arrows, you can hjkl , you can use web%$ as you like)
- press y
Option 2:
If we are talking about strings, we need to solve this problem
- type :set relativenumber
- determine how many lines to copy by line numbering on the left ( let 's say 43 )
- press y43y There are many options and each d%#@, as he wants.

S
SilentFl, 2015-09-21
@SilentFl

1) selection of a block of text occurs in selection mode, by pressing either v (character-by-character selection), or V (line-by-line), or Ctrl + v (block, a rectangular block is selected)
2) copy - either y (just copy to vim buffer), or "*y (copy to system clipboard) or "+y (also copy to system clipboard)
3) cut - d. Moreover, you can cut without prior selection, for example, dd will delete the current line, diw - the current word.
4) insert - p, or P
I recommend reading a book on vim

A
Alexander Chernykh, 2015-09-20
@sashkets

You need to stupidly read man, at least on the Internet

D
Daniil Kolesnichenko, 2015-09-20
@KolesnichenkoDS

Google -> Vim visual mode

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question