It happens to me many times that I want to repeat a command in Vim until a certain condition is met, and not just several times. For example, let's say I want to make this code more accurate:
Ogre::String GetConfigPath() const { return m_configPath; }
Ogre::String GetConfigName() const { return m_configName; }
Ogre::String GetConfigFileName() const { return m_configPath + m_configName + ".txt"; }
Ogre::String GetConfigStateFileName() const { return m_configPath + m_configName + "-state.txt"; }
Ogre::String GetConfigStatisticsFileName() const { return m_configPath + m_configName + "-statistics.txt"; }
Ogre::String GetConfigDetailedStatisticsFileName() const { return m_configPath + m_configName + "-detailed_statistics.txt"; }
What I usually do is go to the function with the longest name, press “Tab”, and then align the rest of the curly braces of the other functions to fit that. Obviously, the challenge now is to add spaces in front of the curly braces of other functions until the cursor is at, say, 80 (which is the position of the longest function).
Do I need to repeat the command until the cursor is at position x?
This is just an example, and I often need to repeat the command until a certain condition is met.
Any idea?
Rafid source
share