vim and :g
Tue 2006-10-17 19:06
So many things, like vim, are a land of constant discovery. Just now I have devised:
:g/$/exec "s/$/!".line(".")."|"
What it does is append to every line the string !<line-number>| - which will look absurd to most people, but it is incredibly useful for me. There are probably a billion other ways to do the same thing...
Munged from an example on vim.org that inserts line numbers at the start of the line:
:g/^/exec "s/^/".strpart(line(".")." ",0,4)
Recent Entries
Jul 14 BrewDog Beer Bash
Jul 12 Photos for Kat
May 29 Namur in May
May 14 Namur en Mai
May 05 No More Facebook
Mar 04 Pigeon and Potato Salad
Jan 09 Snow!
Categories
- Entries - 260
- Beer - 1
- Cycling - 2
- Food - 53
- Cooking - 26
- Hare - 5
- Soup - 1
- Eating - 5
- England - 5
- London - 4
- Rickmansworth - 1
- Produce - 14
- Ristretto - 8
- Health - 3
- Money - 2
- Random - 74
- Technology - 93
- Code - 22
- General - 46
- Security - 23
- Work - 2
- Wanderings - 32
- Australia - 2
- Barcelona - 2
- Belgium - 2
- England - 15
- Cambridge_Easter - 3
- Lakes - 9
- Finland - 4
- France - 1
- Germany - 1
- Ramble - 3
- Wales - 1




No Responses