Sunday, January 5, 2020

My Cousin Vimmy

Digraph List
 
Digraphs            SymbolKey   combination
 
Non-breaking space   Ctrl+K Space Space
Euro currency Ctrl+K Eu or Ctrl+K =e
En dash Ctrl+K -N
Em dash Ctrl+K -M
Quotation marks Guillemet « » Ctrl+K << and Ctrl+K >>
Paragraph sign § Ctrl+K SE
Number symbol Ctrl+K N0
Copyright © Ctrl+K Co
Registered trade mark ® Ctrl+K Rg
Grad Celsius Ctrl+K oC
Grad ° Ctrl+K ~o
Greek µ letter1 µ Ctrl+K My
Approximately equal Ctrl+K ?2 or Ctrl+K 2?
Not equal Ctrl+K !=
Left single line arrow Ctrl+K <- or Ctrl+K -<
Right single line arrow Ctrl+K >- or Ctrl+K ->
Double single line arrow Ctrl+K <>
Left dual line arrow Ctrl+K <=
Right dual line arrow Ctrl+K =>
Double dual line arrow Ctrl+K ==
Less or equal than Ctrl+K =<
More or equal than Ctrl+K >=
Is much less than Ctrl+K <*
More or equal than Ctrl+K >*
Plus minus±Ctrl+K +-

 

TO REMOVE ALL INDENTS ON A SELECTION :le

Cut and paste:

  1. Position the cursor where you want to begin cutting.
  2. Press v to select characters (or uppercase V to select whole lines).
  3. Move the cursor to the end of what you want to cut.
  4. Press d to cut (or y to copy).
  5. Move to where you would like to paste.
  6. Press P to paste before the cursor, or p to paste after.
Copy and paste is performed with the same steps except for step 4 where you would press y instead of d:
d = delete = cut
y = yank = copy

________________________________________________________________________________________

Another option which may be easier to remember would be to place marks on the two lines with ma and mb, then run :'a,'byank.

Many different ways to accomplish this task, just offering another.


........................................................................................

I had never found a satisfactory and re-callable way of doing copy-paste in vi, but this solution is really topnotch. Also, I added this to .vimrc "command! P :'a,'byank" to allow the "P" key to function as a shortcut
_______________________________________________________________________________________

just use V to select lines or v to select chars or Ctrlv to select a block.
When the selection spans the area you'd like to copy just hit y and use p to paste it anywhere you like...
_______________________________________________________________________________________


It sounds like you want to place marks in the file.
mx places a mark named x under the cursor
y'x yanks everything between the cursor's current position and the line containing mark x.
You can use 'x to simply move the cursor to the line with your mark.
You can use `x (a back-tick) to move to the exact location of the mark.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

One thing I do all the time is yank everything between the cursor and mark x into the clipboard.
You can do that like this:
"+y'x
NOTE: In some environments the clipboard buffer is represented by a * in stead of a +.

_______________________________________________________________________________________

You can copy/paste by using the + register (read more: Accessing the system clipboard)
"+gyywill yank a line, and put it into the + register. You can paste in your other window with "+p in normal mode, or Ctrl+r + while in insert mode.
If you don't wish to use split windows, there really is no other way to paste between windows apart from using the system clipboard.


  • 1
    You can use vim tabs as well as split windows. – ostler.c May 30 '12 at 21:26
  • 4
    It should also be noted that on Linux there are two clipboards - the regular clipboard - the one you access with CTRL+C and CTRL+V - is mapped to the + register. The other clipboard stores the last selected text and can be pasted with middle-click - and in Vim it's mapped to the * register. – Idan Arye May 31 '12 at 14:35
_______________________________________________________________________________________
_______________________________________________________________________________________

Since you already know how to cut/yank text, here are a few ideas for pasting it back into another file:
  • Edit the first file, yanking the text you want. Then open your second file from within vi (:e /path/to/other/file) and paste it
  • Open both files together in a split window and navigate between them using Ctrl + w, Up/Down either by:
    • vi -o /path/to/file1 /path/to/file2
    • From within the first file, Ctrl + w, s