Are you a Vim user? Do you like to use the hjkl keys to move the cursor in Normal mode, like me? If you do, perhaps you’ve experienced the annoyance of forgetting that you are in Insert mode, only to find something like ffffff or kkkkk appearing on the screen instead of the expected cursor movement. I have to admit that this still happens to me, even after many years. How can it be avoided?
Vim experts advise that you should stay in Normal mode most of the time; it should be the default. I agree, and I do try to remember to do this. Another idea, which I’ve tried in the past, is to make key mappings such as Alt+h and Alt+l in Insert mode to move the cursor.. Of course, you still have to remember which mode you are in unless you make the same mappings for Normal mode. But then you’ve lost the simplicity of the default one-key hjkl, which was the main roeason to go down this route in the first place.
The solution I’ve adopted is based on <https://stackoverflow.com/questions/7614546/vim-cursorline-color-change-in-insert-mode>. Here is the code I’m using in .gvimrc with a dark colour scheme (Murphy).
autocmd InsertEnter * highlight CursorLine guifg=white guibg=grey25
autocmd InsertLeave * highlight CursorLine guifg=white guibg=red
This gives a light grey cursor line in Insert mode which stand out on the dark background but not too starkly. In Normal mode the cursor line becomes red. I use the default cursor, which is block in Normal mode and 25% in Insert mode. Both are white; I’ve set the Normal mode cursor not to blink.
I find that this set-up acts as an effective reminder of which mode I’m in.
Revised 21 June 2019
Sorry if you’ve come here because of the title; I’ve had to delete most of what I’d written because it’s no longer correct. It was based on using a site (Online Sitemap Generator) where you can make a large sitemap.xml for free (though you are encouraged to make a small donation). I’d used it for about a year on and off and was reasonably happy with it, although I did need to edit the files quite extensively, which was the point of the post.
Things have now changed at this site; I get a lot of errors when I try to make a sitemap. The resulting file is unreliable so I’m no longer using the site.
I haven’t been able to find another site which offers free sitemaps for more than 500 entries. My book reviews page has almost 600 reviews so that’s no good to me. I’d be willing to pay a reasonable amount occasionally but the charges I’ve found on-line are more than I’m willing to pay on a recurring basis considering I don’t get any income from my reviews.
For the moment my solution for the book reviews page is to keep the last good sitemap I obtained and add new entries by hand. This isn’t a problem as I don’t often write more than one review a week at most.
For WordPress I’ve installed a plugin which provides a sophisticated sitemap.xml system which seems to be working well (google-sitemap-generator.4.1.0).
Starting with Vim 7.0 this brilliant editor introduced a more powerful set of commands for Undo and Redo, using an undo tree. Being lazy, I didn’t fully get to grips with this and as a result didn’t really understand what I was doing. At times I accidentally deleted text I’d just writtenjjjk and then couldn’t recover it.
I knew the previous version of my work had to be there but I didn’t know how to get it back. After a time I realised that when things seemed to go wrong the solution was usually to use ‘g-‘ and ‘g+’ to go hack and forth in the undo tree. But this was a bit hit & miss.
If you have had a similar experience here are a couple of useful site where things are explained clearly; Undo and Redo and Using Undo Branches.
Finally, thanks to a third page I now know why I occasionally deleted work I’d just done and couldn’t recover it. See Recover from accidental Ctrl-U. This explains why it happens and provides a way to recover the deleted text. Better still, it tells you how to prevent it happening in future. Short cut for the impatient: put these lines in .vimrc:
inoremap <c-u> <c-g>u<c-u>
inoremap <c-w> <c-g>u<c-w>