Thursday, April 28, 2011

Re: Few questions

Taylor, Ben, thanks.

On Wed, Apr 27, 2011 at 9:02 PM, Taylor Hedberg <tmhedberg@gmail.com> wrote:
> 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`.
>

that's what i'm looking for... i'm just so used to :n that i never think of nG.

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

yeah, i am going to have to play with :nmap a bit... something like:
:nmap <Space> i_<Esc>l_r
(which doesn't do it exactly, maybe a_ ...

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

i'll pass on the fancy scripts for this one :)
i like the inoremap command and will read on the link ben posted (and
either be good or end up having my own macros irritating me more than
laziness)

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

yeah :read !<stuff> was what i was looking for. however, redir looks
pretty cool. i'll have to read up on it more as i don't quite get it
yet.

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

Post a Comment