On May 18, 7:53 pm, Run Paint Run Run <[email protected]> wrote:
> Hi,
>
> I'm writing a "cookbook" for Vim athttp://vim.runpaint.org/. It's
> released under a Creative Commons license in PDF and HTML.
>
> If anybody has suggestions or comments, I'd love to hear them. :-)
>

Is that an invitation to share some tips? :-) I hope so, there's a few
I've been wanting to get off my chest.  There's a good chance some of
them are on the wiki. Anyway, I briefly checked what you've done so
far, and it seems like an excellent piece of work.

Anyway, here are some of my personal pro tips:

" 1) better motion
nnoremap <c-k> <c-y><c-y><c-y>
nnoremap <c-j> <c-e><c-e><c-e>

For some reason I don't care for the full screen or half screen
scrolling commands, I find them disorientating, and the one line
scrolling is just too slow.  But setting up the above suits me just
perfectly, maybe because it moves the same amount as the turn of the
mousewheel. The idea behind writing out the motion 3 times instead of
using a repeat was that it would actually be a more gradual scroll
instead of a jerky motion. I have know idea if thats just nonsense
though.

" 2) search for last deleted/changed/yanked word
nnoremap gs /<c-r>"<cr>

I don't really tend to think ahead, and quite often I'll change or
delete a word, or part of a word in my code, and then realise I need
to change it for the other occurrences as well. This combo will
automatically search for the next occurrence of the text you changed,
and you can just press . to repeat the change, and then n to move onto
the next.

" More controversial: make vim more consistent
nnoremap Y y$
nnoremap vv V
nnoremap V v$

The yank and visual commands now act more like the change and delete
commands, but some might not like it, as it changes the traditional
behaviour of the editor.

" One for linux console enthusiasts
if &term == "linux" || &term == "screen.linux"
  set t_ve=^[[?25h^[[?17;16;64c
endif

If you like to work within the linux console/framebuffer, depending on
your system you might be stuck with an blinky underline or something.
This changes it to a solid green block. You can change the colour, and
other parameters by messing around with the numbers (I can't remember
what corresponds to what)

" something a bit more radical
imap jk <esc>
imap kh <esc>

One of the principles of vim is keeping your fingers on the home
keys.  Another principle of vim is pressing escape a whole lot. These
two don't always work well together. Above is my current preferred
solution.  I've seen many others. ctrl-[ works by default, as does
ctrl-l I think (though I've remapped mine).  You could also remap
something like ctrl-space, or even remap your caps lock key to escape
(I have mine remapped to ctrl). But I've decided I don't like pressing
ctrl more than I have to, so prefer to escape with the above two
rarely occurring key combinations.  One of the downsides though is
that when you do enter either a j or a k, the screen will appear to
hang as it waits for another key, you don't actually have to wait or
anything (another keypress will cancel the wait) but it can be a
little distracting.  To fix this I also use the following:

autocmd InsertEnter * set timeoutlen=160
autocmd InsertLeave * set timeoutlen=3000

The important one is the first as it determines how much time you have
to enter the keypress combination to exit insert mode.  You may want
to make it faster or slower according to your own preference.


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to