• Coolcoder360@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    2 hours ago

    Just switch to visual mode and select the text and yank it.

    Press v where you want to start the selection from (switches to visual mode), hjkl (or arrow keys) to move the cursor to the end, then you can yank it from there. It’ll highlight what you’re selecting just like you’re using your mouse, but you’re using the keyboard.

    If you want to get really fancy there are 3 different kinds of visual mode, but lower case is the most often one that I use because it’s char by char, V is line by line, Ctrl+v is “block” (you can select chunks across several lines omitting things at the beginning or end of lines).

    Ctrl+V to do the block mode is nice if you need to edit the same part of several lines that all line up vertically, you just Ctrl+v, jk to select the lines, then I (shift+i) to insert on all those lines (if you’re in vim you can delete things in insert mode also, if you’re in vi you’ll need to delete first then insert)