Wednesday, April 27, 2011

Re: Few questions

shawn wilson, Wed 2011-04-27 @ 10:46:20-0400:
> 1. In visual mode how do I select to a line number? I know I can do iB
> or whatever but if I don't want to work with the whole function I just
> have to hold down j.

Use the G command. `nG` moves the cursor to line n. So if you want to
select from here to line 67, type `v67G`.


> 2. How do I insert something without entering insert mode? Ie I constantly
> find myself doing i blah <esc> just to add a space or something.

There are some suggestions for inserting single characters on this page:
http://vim.wikia.com/wiki/Insert_a_single_character. For inserting more
than one character, entering insert mode is really the only thing that
makes sense.


> 3. How can I get vi to close out my (..), '..', {..}, and so on (this
> might become annoying but I'd like to try something like this anyway).

You could use a simple key mapping in your .vimrc, such as:

inoremap ( ()<Left>

but that may not always do what you want. There's also
http://www.vim.org/scripts/script.php?script_id=1849, which is probably
a bit more robust.


> 4. Can I get the output of :shell or whatever to be inserted a(fter)
> my cursor?

Use `:r!` to read command output into your buffer. There's also
`:{range}!` which can pipe text from your buffer through a command, and
then replace the original text with the command output.

--
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

No comments: