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:
o<esc>
or
O<esc>
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 o<Esc>
nnoremap zk O<Esc>

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 =""
        o<Esc>
        :normal o

open empty line before: any one of the three below
        :.-1put =""
        O<Esc>
        :normal O

To do it with a single keystroke: use all four below:
        :map <F3> o<Esc>
        :map <F2> O<Esc>
        :imap <F3> <End><CR>
        :imap <F2> <Home><CR>

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

Reply via email to