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
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/YF9fexRFHtyzYvfI%40trackstand.
No comments:
Post a Comment