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 [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/YF9fexRFHtyzYvfI%40trackstand. |
Regarding the difference between the apostrophe and back tick, I couldn't figure out when I would need the apostrophe version, so I also mapped the apostrophe to the back tick: map ' ` -- Salman On Sat, Mar 27, 2021, 12:38 meine <[hidden email]> wrote: Hi, -- 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 [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANuxnEcfcrdvQUOLPB7yC_MCDUmaPDtZ371DPmSVHE%3Df9HmGAw%40mail.gmail.com. |
Free forum by Nabble | Edit this page |