Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #101473

Re: Which Python editor has this feature?

Newsgroups comp.lang.python
Date 2016-01-11 03:08 -0800
References <830f6f97-22dd-488c-9dd6-e9cd92844307@googlegroups.com> <mailman.2.1452482175.13488.python-list@python.org>
Message-ID <a6bcf94b-fa85-4e23-8d11-67a0c32c3342@googlegroups.com> (permalink)
Subject Re: Which Python editor has this feature?
From jfong@ms4.hinet.net

Show all headers | View raw


Tim Chase at 2016/1/11 UTC+8 11:16:27AM wrote:
> On 2016-01-10 17:59, jfong@ms4.hinet.net wrote:
> > It lets you jump between the current cursor position and the line
> > the upper level indentation start, something like the bracket
> > matching in C editor. Because of Python use indentation as its code
> > block mark, It might be helpful if we can jump between different
> > level of it:-)
> 
> While not quite what you're asking for, vim offers an "indent text
> object" plugin[1] that allows you to use a block of indentation
> around the cursor as an object.  So you can use vim's grammar to issue
> commands like "dai" to delete the current indentation-defined block;
> or you can use ">ii" to add a level of indentation to the
> indentation-defined block.

Thanks, Tim.
I always admire people who can remember all those detail commands/parameters/options which a DOS-style editor as vim has. It's almost like a mission impossible to me:-(

> If you want to make a vim mapping that will jump up to the top of the
> previous level of indentation, the following should do the trick
> 
>   :nnoremap <expr> Q '?^'.repeat(' ', (strlen(substitute(getline('.'), '\S.*', '', ''))-&sw)).'\S?e'."\<cr>"

But, but... this line??? won't it goes too far for a human being to read?

--Jach

> There might be some edge-cases that I haven't caught there, but, as
> long as you edit with spaces rather than tabs, it should work,
> including the accommodation of your 'shiftwidth', even if it's not
> PEP8 4-spaces-per-indent.
> 
> -tkc
> 
> [1]
> https://github.com/michaeljsmith/vim-indent-object

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Which Python editor has this feature? jfong@ms4.hinet.net - 2016-01-10 17:59 -0800
  Re: Which Python editor has this feature? Chris Angelico <rosuav@gmail.com> - 2016-01-11 13:58 +1100
    Re: Which Python editor has this feature? jfong@ms4.hinet.net - 2016-01-11 03:04 -0800
      Re: Which Python editor has this feature? Terry Reedy <tjreedy@udel.edu> - 2016-01-11 16:21 -0500
        Re: Which Python editor has this feature? jfong@ms4.hinet.net - 2016-01-11 17:51 -0800
          Re: Which Python editor has this feature? Terry Reedy <tjreedy@udel.edu> - 2016-01-12 02:55 -0500
            Re: Which Python editor has this feature? wxjmfauth@gmail.com - 2016-01-12 00:28 -0800
              Re: Which Python editor has this feature? jfong@ms4.hinet.net - 2016-01-12 17:27 -0800
                Re: Which Python editor has this feature? Chris Angelico <rosuav@gmail.com> - 2016-01-13 12:51 +1100
                Re: Which Python editor has this feature? Steven D'Aprano <steve@pearwood.info> - 2016-01-13 13:04 +1100
                Re: Which Python editor has this feature? wxjmfauth@gmail.com - 2016-01-13 00:04 -0800
                Re: Which Python editor has this feature? wxjmfauth@gmail.com - 2016-01-13 07:24 -0800
            Re: Which Python editor has this feature? jfong@ms4.hinet.net - 2016-01-12 17:20 -0800
              Re: Which Python editor has this feature? Terry Reedy <tjreedy@udel.edu> - 2016-01-13 04:10 -0500
                Re: Which Python editor has this feature? jfong@ms4.hinet.net - 2016-01-13 16:48 -0800
      Re: Which Python editor has this feature? Chris Angelico <rosuav@gmail.com> - 2016-01-12 11:14 +1100
      Re: Which Python editor has this feature? Bernardo Sulzbach <mafagafogigante@gmail.com> - 2016-01-11 22:55 -0200
        Re: Which Python editor has this feature? Grant Edwards <invalid@invalid.invalid> - 2016-01-12 18:31 +0000
      Re: Which Python editor has this feature? Chris Angelico <rosuav@gmail.com> - 2016-01-12 12:09 +1100
      Re: Which Python editor has this feature? Terry Reedy <tjreedy@udel.edu> - 2016-01-12 03:27 -0500
      Re: Which Python editor has this feature? Chris Angelico <rosuav@gmail.com> - 2016-01-12 21:18 +1100
      Re: Which Python editor has this feature? Terry Reedy <tjreedy@udel.edu> - 2016-01-13 04:05 -0500
      Re: Which Python editor has this feature? Chris Angelico <rosuav@gmail.com> - 2016-01-13 21:09 +1100
  Re: Which Python editor has this feature? Tim Chase <python.list@tim.thechases.com> - 2016-01-10 20:37 -0600
    Re: Which Python editor has this feature? jfong@ms4.hinet.net - 2016-01-11 03:08 -0800
      Re: Which Python editor has this feature? Tim Chase <python.list@tim.thechases.com> - 2016-01-11 05:59 -0600
  Re: Which Python editor has this feature? Rustom Mody <rustompmody@gmail.com> - 2016-01-10 19:49 -0800
    Re: Which Python editor has this feature? Frank Haun <fh@fhaun.de> - 2016-01-11 11:54 +0000
  Re: Which Python editor has this feature? Gordon Levi <gordon@address.invalid> - 2016-01-11 19:40 +1100
    Re: Which Python editor has this feature? jfong@ms4.hinet.net - 2016-01-11 03:16 -0800
    Re: Which Python editor has this feature? Fabio Zadrozny <fabiofz@gmail.com> - 2016-01-26 16:10 -0200
  Re: Which Python editor has this feature? Fabio Zadrozny <fabiofz@gmail.com> - 2016-01-26 16:09 -0200

csiph-web