meine
unread,Mar 27, 2021, 12:38:30 PM3/27/21Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vim...@googlegroups.com
Hi,
I read about the 'unimpaired.vim' plugin and its nifty feature to add a
blank line below or above the line you're on. Quite often needed when
editing the final layout of your document.
But why with a plugin? As I want to learn Vim the 'less comfortable'
way, I tried some things and made just two lines in my .vimrc that do
just the same. The challenge was to return the cursor to the original
position (line and column) after the new line was made.
" add a line below or above without moving
noremap <Leader>o mpo<Esc>`p
noremap <Leader>O mpO<Esc>`p
'mp' marks the position (just chose p because I don't use that edge of
my keyboard often)
'o' or 'O' adds an empty line below or above
<Esc> gets back to Normal mode
`p gets back to the previous position (mind the backtick!)
Probably no higer Vim skills or rocket science, but I am happy to have
solved this instead of just downloading a plugin. Also learned the
difference between an apostrophe and backtick when going to a mark :-)
//meine