Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #101457
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Tim Chase <python.list@tim.thechases.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Which Python editor has this feature? |
| Date | Sun, 10 Jan 2016 20:37:48 -0600 |
| Lines | 33 |
| Message-ID | <mailman.2.1452482175.13488.python-list@python.org> (permalink) |
| References | <830f6f97-22dd-488c-9dd6-e9cd92844307@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de +C7EZvVjqc+VoK9g5gYcdw7phDStoyGkUQgDlnBWoAew== |
| Return-Path | <python.list@tim.thechases.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; "'',": 0.07; 'block;': 0.07; 'subject:editor': 0.07; 'block.': 0.09; 'cursor': 0.09; 'editor.': 0.09; 'url:github': 0.09; 'python': 0.10; '-tkc': 0.16; 'bracket': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'mark,': 0.16; 'pep8': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'work,': 0.21; 'object.': 0.22; 'matching': 0.23; "haven't": 0.24; 'header:In-Reply-To:1': 0.24; 'helpful': 0.27; 'start,': 0.27; "skip:' 10": 0.28; 'for,': 0.29; 'indentation': 0.29; 'spaces': 0.29; 'allows': 0.30; 'code': 0.30; '[1]': 0.32; 'jump': 0.33; 'lets': 0.33; "skip:' 20": 0.34; 'previous': 0.34; 'add': 0.34; 'skip:( 30': 0.35; 'text': 0.35; 'mapping': 0.35; 'quite': 0.35; 'something': 0.35; 'level': 0.35; 'asking': 0.35; 'should': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'there,': 0.37; 'charset :us-ascii': 0.37; 'delete': 0.38; 'rather': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'your': 0.60; 'different': 0.63; 'between': 0.65; 'received:50': 0.66; 'upper': 0.76; 'subject:this': 0.85; 'skip:4 20': 0.91 |
| X-Sender-Id | wwwh|x-authuser|tim@thechases.com |
| X-Sender-Id | wwwh|x-authuser|tim@thechases.com |
| X-MC-Relay | Neutral |
| X-MailChannels-SenderId | wwwh|x-authuser|tim@thechases.com |
| X-MailChannels-Auth-Id | wwwh |
| X-MC-Loop-Signature | 1452480004394:1902211515 |
| X-MC-Ingress-Time | 1452480004394 |
| In-Reply-To | <830f6f97-22dd-488c-9dd6-e9cd92844307@googlegroups.com> |
| X-Mailer | Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) |
| X-AuthUser | tim@thechases.com |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:101457 |
Show key headers only | View raw
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.
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>"
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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