Vim: Study on constructing Regular Expressions to delete or reduce blank lines with Global Command
Preface On the topic of this article you may find interesting the following one: “Vim and Regular Expressions for removing redundant whitespace” . Unlike the previous article, here the presence of whitespace causes different solutions than blank lines regardless of the number of their occurrences. The study in this article is focused on both the analysis of “ regular expressions ” and Vim’s global command. Vim and the Global Command The Global Command in Vim is the g key. It’s useful for a lot of purposes. In Normal Mode it can be used to compose multi-letter commands, such as the following ones: guw : lower case next word gUw : upper case next word gU2w : upper case next two word gUe : upper case until the end of the word gu$ : lower case until the end of the line ge : move to the end of the previous word (simple e moves to the end of the next word) … and so on. The g Command can also be a motion operator , as described in this article of mine . The same global ...