FAQ

Search Discussions

  • Gerhard Haering at Apr 24, 2003 at 1:51 pm
  • Hans Nowak at Apr 25, 2003 at 3:43 am
  • Nicodemus at Apr 26, 2003 at 4:44 pm
  • Will Stuyvesant at Apr 25, 2003 at 4:32 pm
    [Hans Nowak]
    I have been trying to edit Python source code with vim on Mac OS X. Most of
    the settings in my .vimrc file (copied from Windows) work just fine, except for
    one. I use Tab to indent and Shift-Tab to dedent (a line, not a block). Tab
    behaves as usual, but Shift-Tab doesn't seem to work; it just behaves like I
    pressed Tab.
    In gvim on windows and linux (untested on Mac, since I have no access
    to a Mac anywhere):

    Start block selection with the v key, or with <SHIFT>v. And then of
    course the j key for line down and the l key for going right etc.

    To indent a line, or a selected block, use <SHIFT>>>. To dedent it do
    <SHIFT><<.

    --
    This life is a test. It is only a test. Had this been an
    actual life, you would have received further instructions as
    to what to do and where to go.
  • Hans Nowak at Apr 25, 2003 at 5:06 pm

    Will Stuyvesant wrote:
    [Hans Nowak]
    I have been trying to edit Python source code with vim on Mac OS X. Most of
    the settings in my .vimrc file (copied from Windows) work just fine, except for
    one. I use Tab to indent and Shift-Tab to dedent (a line, not a block). Tab
    behaves as usual, but Shift-Tab doesn't seem to work; it just behaves like I
    pressed Tab.

    In gvim on windows and linux (untested on Mac, since I have no access
    to a Mac anywhere):

    Start block selection with the v key, or with <SHIFT>v. And then of
    course the j key for line down and the l key for going right etc.

    To indent a line, or a selected block, use <SHIFT>>>. To dedent it do
    <SHIFT><<.
    Thanks for your reply; however, I know how to do indents and dedents in vim,
    the problem is more how to map Shift-Tab to do the dedent. The reason is
    simply that I have been using it for years and don't want to unlearn it and get
    used to a different key combination. :(

    I'll see if I can do something with the key combinations you mentioned.

    Cheers,
  • Hans Nowak at Apr 25, 2003 at 5:06 pm

    Will Stuyvesant wrote:
    [Hans Nowak]
    I have been trying to edit Python source code with vim on Mac OS X. Most of
    the settings in my .vimrc file (copied from Windows) work just fine, except for
    one. I use Tab to indent and Shift-Tab to dedent (a line, not a block). Tab
    behaves as usual, but Shift-Tab doesn't seem to work; it just behaves like I
    pressed Tab.

    In gvim on windows and linux (untested on Mac, since I have no access
    to a Mac anywhere):

    Start block selection with the v key, or with <SHIFT>v. And then of
    course the j key for line down and the l key for going right etc.

    To indent a line, or a selected block, use <SHIFT>>>. To dedent it do
    <SHIFT><<.
    Thanks for your reply; however, I know how to do indents and dedents in vim,
    the problem is more how to map Shift-Tab to do the dedent. The reason is
    simply that I have been using it for years and don't want to unlearn it and get
    used to a different key combination. :(

    I'll see if I can do something with the key combinations you mentioned.

    Cheers,
  • Asun Friere at Apr 28, 2003 at 3:54 am
    Hans Nowak <zephyr01 at alltel.net> wrote in message news:<mailman.1051243975.12570.python-list at python.org>...
    Gerhard Haering wrote:
    I use Tab to indent and Shift-Tab to dedent (a line, not a block).
    IMHO it is much preferable to use ^T (insert mode) to indent and ^D
    (insert mode) to dedent. To control the size of the indent set the
    shiftwidth property (eg set sw=4). The reason I prefer this way of
    indenting is that it does not introduce Tabs into the source, which is
    an especial advantage in Python code. The underlying ex commands
    corresponding to '^T' and '^D' are '>' and '<'. (eg ':237,348 >>'
    will indent lines 237 to 384 by 2 (>>) shifts, ':5,12 <' will dedent
    lines 5 to 12 by one).

    Note that ^T/^D work more nicely under vim than they do under trad vi,
    as it makes no difference (in vim) where in the line your cursor is,
    vim will automagically (in|de)dent the entire line, and not split the
    line like vi does.

    You personally (assuming you are already working with tab studded
    python code) should probably stick to using tabs (for fear of invoking
    precisely the sort of indent-hell that not using tabs is supposed to
    avoid), but any other vi(m)? newbie, or vi using python newbie, really
    ought to use vi's built-in indentation mechanism and not stuff up your
    source with tabs.
  • Screwtape at Apr 24, 2003 at 3:19 pm

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedApr 24, '03 at 1:32p
activeApr 28, '03 at 3:54a
posts9
users7
websitepython.org

People

Translate

site design / logo © 2022 Grokbase