Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing whole alphabet in Vim

Tags:

vim

alphabet

I sometimes need to write the whole alphabet abcd…z and I hate typing it letter by letter in Vim's insert mode. Does there exist any method to do this more efficiently?

I know about the ga command which gives me the ascii code of the character where the cursor is … but don't know anything about how to mix it with my standard solution to type numbers from 1 to (for example) 5000: a1ESCqqyyp^Aq4998@q

like image 636
Maria Matejka Avatar asked Aug 07 '13 17:08

Maria Matejka


People also ask

What does capital I do in Vim?

This is the same thing as pressing caret "I". So the lowercase "i" command lets you insert text before your current cursor position and capital "I" lets you insert text before the first non blank character on the line you're on.

What is B in Vim?

b - jump backwards to the start of a word. B - jump backwards to the start of a word (words can contain punctuation) 0 - jump to the start of the line. ^ - jump to the first non-blank character of the line. $ - jump to the end of the line.


1 Answers

Using set nrformats+=alpha:

ia<Esc>qqylp<C-a>q24@q

Step by step:

ia<Esc>      " Start with 'a'
qqylp<C-a>q  " @q will duplicate the last character and increment it
24@q         " Append c..z
like image 54
Nikita Kouevda Avatar answered Oct 12 '22 11:10

Nikita Kouevda