Re: inserting newlines
On 3/19/07, fREW [EMAIL PROTECTED] wrote: Hi all, I was recently discussing some features of vim that I use a lot with a friend and asking if he knew of ways to do certain things better, and one issue that both of us have is that we create newlines with o or O and then go back to normal mode immediately afterwards. So I often end up doing: oesc or Oesc where it would be nice to have a single key that would do this. Is there already such a feature, or should I just do something like nnoremap zj oEsc nnoremap zk OEsc I realize that zk and zj are still two keystrokes, but they are easier to type as it is. I have this mapping noremap Enter icresc in my vimrc, so I *do* do it with one keystroke (the Enter in normal mode). Yakov one man's bug is another man's feature Lerner
Re: inserting newlines
On Tue, 20 Mar 2007, Yakov Lerner wrote: On 3/19/07, fREW [EMAIL PROTECTED] wrote: one issue that both of us have is that we create newlines with o or O and then go back to normal mode immediately afterwards. I have this mapping noremap Enter icresc in my vimrc, so I *do* do it with one keystroke (the Enter in normal mode). That's an idea! I use CR a lot in normal mode to move down a line, but I could map the other key which does the same thing, '+'. It is also easy to remember, as meaning, add a line. -- Greg MathesonIf you have no teeth, use your gums. --Korean army saying. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Re: inserting newlines
Greg Matheson wrote: On Tue, 20 Mar 2007, Yakov Lerner wrote: On 3/19/07, fREW [EMAIL PROTECTED] wrote: one issue that both of us have is that we create newlines with o or O and then go back to normal mode immediately afterwards. I have this mapping noremap Enter icresc in my vimrc, so I *do* do it with one keystroke (the Enter in normal mode). That's an idea! I use CR a lot in normal mode to move down a line, but I could map the other key which does the same thing, '+'. It is also easy to remember, as meaning, add a line. I also use Enter to move down a line. How about? :map C-CR oesc :map C-S-CR Oesc -- Just my 0.0002 million dollars worth, Shawn For the things we have to learn before we can do them, we learn by doing them. Aristotle
Re: inserting newlines
one issue that both of us have is that we create newlines with o or O and then go back to normal mode immediately afterwards. I have this mapping noremap Enter icresc in my vimrc, so I *do* do it with one keystroke (the Enter in normal mode). That's an idea! I use CR a lot in normal mode to move down a line, but I could map the other key which does the same thing, '+'. It is also easy to remember, as meaning, add a line. I think you may be the first person I've met who uses the enter key for that purpose on a regular basis :) [ed: as I typed this, a second email came in from another person who uses enter ] But yes, enter, + and - are keys that mostly duplicate the behavior of j/k keys, so I find them good candidates for remapping. I have + and - remapped to O and o respectively followed by esc for adding lines above/below the current line. But any mix of those keys would be usable for such purposes. -tim
Re: inserting newlines
On Tue, 20 Mar 2007, Tim Chase wrote: one issue that both of us have is that we create newlines with o or O and then go back to normal mode immediately afterwards. I have this mapping noremap Enter icresc in my vimrc, so I *do* do it with one keystroke (the Enter in normal mode). That's an idea! I use CR a lot in normal mode to move down a line, but I could map the other key which does the same thing, '+'. It is also easy to remember, as meaning, add a line. I think you may be the first person I've met who uses the enter key for that purpose on a regular basis :) [ed: as I typed this, a second email came in from another person who uses enter ] But yes, enter, + and - are keys that mostly duplicate the behavior of j/k keys, so I find them good candidates for remapping. I use j and k a lot, of course. I like to use - and CR because they go to the first non-blank character on the line. There's also underscore, which I have never used. _ underscore [count] - 1 lines downward, on the first non-blank character |linewise|. Perhaps I should try mapping that one. I have + and - remapped to O and o respectively followed by esc for adding lines above/below the current line. That's intuitive too. -- Greg MathesonManagement is doing things right; Leadership is doing the right things. --Peter Drucker -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
inserting newlines
Hi all, I was recently discussing some features of vim that I use a lot with a friend and asking if he knew of ways to do certain things better, and one issue that both of us have is that we create newlines with o or O and then go back to normal mode immediately afterwards. So I often end up doing: oesc or Oesc where it would be nice to have a single key that would do this. Is there already such a feature, or should I just do something like nnoremap zj oEsc nnoremap zk OEsc I realize that zk and zj are still two keystrokes, but they are easier to type as it is. Thanks! -- -fREW
Re: inserting newlines
fREW wrote: Hi all, I was recently discussing some features of vim that I use a lot with a friend and asking if he knew of ways to do certain things better, and one issue that both of us have is that we create newlines with o or O and then go back to normal mode immediately afterwards. So I often end up doing: oesc or Oesc where it would be nice to have a single key that would do this. Is there already such a feature, or should I just do something like nnoremap zj oEsc nnoremap zk OEsc I realize that zk and zj are still two keystrokes, but they are easier to type as it is. Thanks! open empty line after: any one of the three below :put = oEsc :normal o open empty line before: any one of the three below :.-1put = OEsc :normal O To do it with a single keystroke: use all four below: :map F3 oEsc :map F2 OEsc :imap F3 EndCR :imap F2 HomeCR Replace F2 and/or F3 by any other keystroke that you would prefer to use instead. Best regards, Tony. -- Enzymes are things invented by biologists that explain things which otherwise require harder thinking. -- Jerome Lettvin