Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

vim - how to indent/un-indent a block of code

21 views
Skip to first unread message

john

unread,
Sep 25, 2002, 1:33:49 PM9/25/02
to
I am running gvim 6.0 on solaris and I cannot seem to find a way to
indent or un-indent
a selected block of code. Can this be done and if so how.
If you would rather just refer me to a help txt file that would be fine.

thank you for your help


john


Benjamin Esham

unread,
Sep 25, 2002, 4:08:11 PM9/25/02
to
* john <jr...@optech.com>:

> I am running gvim 6.0 on solaris and I cannot seem to find a way to indent
> or un-indent a selected block of code. Can this be done and if so how.

Try selecting the code Visually, and then typing

=

Note that this assumes that you don't have the 'equalprg' option set.

> If you would rather just refer me to a help txt file that would be fine.

You might take a look at

:h =
:h indent.txt

--
Benjamin D. Esham { http://bdesham.net
bde...@iname.com } AIM: s c e s a r 1
http://tuxedo.org/~esr/faqs/smart-questions.html

Charles E. Campbell

unread,
Sep 25, 2002, 4:34:34 PM9/25/02
to
In article <3D91F37D...@optech.com>, john <jr...@optech.com>
wrote:

>I am running gvim 6.0 on solaris and I cannot seem to find a way to
>indent or un-indent a selected block of code. Can this be done and if
>so how?
---------------------------------------------------------------------

Visually select block (use V and motion)
< to un-indent
> to add one indent

Regards,
Chip Campbell
--
Charles E Campbell, Jr, PhD _ __ __
Goddard Space Flight Center / /_/\_\_/ /
c...@NgrOyphSon.gPsfAc.nMasa.gov /_/ \/_//_/
PGP public key: http://www.erols.com/astronaut/pgp.html

john

unread,
Sep 25, 2002, 4:53:06 PM9/25/02
to
Well, I was just about to write you to say I had already tried that and it
didn't work.
But I decided to give it another try. My problem is that I run in insert
mode and
I wasn't getting out of insert mode properly.
Thanks for your help I'm going left, I'm going right I'm an indenting fool
:)

john

john

unread,
Sep 25, 2002, 4:59:05 PM9/25/02
to
Benjamin,

Well you misunderstood my question, BUT I found the information very useful!
Thanks! I didn't know I could do filtering that way.
thanks

Bob Harris

unread,
Sep 25, 2002, 6:37:41 PM9/25/02
to
In article <3D91F37D...@optech.com>, john <jr...@optech.com>
wrote:

X I am running gvim 6.0 on solaris and I cannot seem to find a way to
X indent or un-indent
X a selected block of code. Can this be done and if so how.
X If you would rather just refer me to a help txt file that would be fine.
X
X thank you for your help
X
X
X john

You may like

<iB
>iB

which will indent/unindent the inner block of a {} nesting, without
moving the lines containing the {} values. Much better than

>%
<%

which move the {} lines as well as the inner body.

Bob Harris

Loïc Minier

unread,
Sep 26, 2002, 5:37:06 AM9/26/02
to
* john <jr...@optech.com>,
Wed, 25 Sep 2002 16:53:06 -0400:

> I wasn't getting out of insert mode properly.

You may also indent in insert-mode, I use quite often ^D and ^T for
this purpose.


--
Loïc Minier <lo...@via.ecp.fr>

0 new messages