Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The macro in the "Scripting" chapter doesn't apply to all lines #8

Open
lmintmate opened this issue Apr 3, 2018 · 0 comments
Open

Comments

@lmintmate
Copy link

I started reading the "Scripting" chapter of your nice book, and arrived at the Macro section. I tried out the macro proposed there across all lines and found out that it doesn't work in one of them. In particular, it doesn't work on the abul fazl is the historian line, because in step 4 of the macro when moving by one word, in most other lines the cursor would now be on the word is, but on this line it is on fazl instead, which means the macro for this particular line results in something like Abul was a the historian in Akbar's court., not at all what should have happened. And because this section is meant to showcase the power of macros, having the macro fail like that could confuse newcomers to Vim, leading them to think they did something wrong.
The most obvious solution for this would probably be to remove the abul fazl line altogether, since the other 3 lines are proof enough that the macro works well on a predictable context.
Thanks in advance for understanding.

P.S. Another step you could add to ensure the reproduction of the macro doesn't fail under different circumstances could be to add 0 at the beginning of the macro to ensure that the cursor is at the beginning of the line, because moving downwards lines by j often puts the cursor elsewhere than on the first character of the line, and when the macro is triggered from anywhere but the beginning of the line it obviously doesn't result in the desired outcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant