VIM: Python type indented-block command equivalent to % for C?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paddy3118

    #1

    VIM: Python type indented-block command equivalent to % for C?


    Not python:
    but python type
    indented text

    Notice the blank line above.
    It could have several
    spaces or tabs, and still
    be a part of the block
    beginning 'Not python:':
    The block ends at the
    first non-blank line
    with less indent.

    Assuming that only space characters are allowed
    for indenting, is their a way to yank a Python
    block like y% works for C , or a way to move to
    the end of a block defined by indentation?

    I have tried help indent but could not find
    anything.

    Thanks, Paddy.

  • Roel Schroeven

    #2
    Re: VIM: Python type indented-block command equivalent to % for C?

    Paddy3118 schreef:
    Assuming that only space characters are allowed
    for indenting, is their a way to yank a Python
    block like y% works for C , or a way to move to
    the end of a block defined by indentation?
    >
    I have tried help indent but could not find
    anything.
    I don't know either, but if you find anything, please post it to this
    list: I'm looking for such functionality too.

    --
    If I have been able to see further, it was only because I stood
    on the shoulders of giants. -- Isaac Newton

    Roel Schroeven

    Comment

    • Antony Scriven

      #3
      Re: VIM: Python type indented-block command equivalent to % for C?

      [F-ups set to comp.editors]

      Paddy3118 wrote:
      Not python:
      but python type
      indented text
      >
      Notice the blank line above.
      It could have several
      spaces or tabs, and still
      be a part of the block
      beginning 'Not python:':
      The block ends at the
      first non-blank line
      with less indent.
      >
      Assuming that only space characters are allowed
      for indenting, is their a way to yank a Python
      block like y% works for C , or a way to move to
      the end of a block defined by indentation?
      I expect there are scripts for Python. Try googling and
      www.vim.org. Anyway I'm not sure that I understand your
      description 100%, but try something like this.

      :ono = /\n.*\%<<C-R>=indent('.')< CR>c\S\\|\%$/+0<CR>

      Now try d= y= etc. Also note that I've made it work
      linewise. And take look at :help /\%v if you want it to
      work with tabs. --Antony

      Comment

      • Paddy3118

        #4
        Re: VIM: Python type indented-block command equivalent to % for C?

        On Mar 8, 5:02 am, "Paddy3118" <paddy3...@goog lemail.comwrote :
        Not python:
        but python type
        indented text
        >
        Notice the blank line above.
        It could have several
        spaces or tabs, and still
        be a part of the block
        beginning 'Not python:':
        The block ends at the
        first non-blank line
        with less indent.
        >
        Assuming that only space characters are allowed
        for indenting, is their a way to yank a Python
        block like y% works for C , or a way to move to
        the end of a block defined by indentation?
        >
        I have tried help indent but could not find
        anything.
        >
        Thanks, Paddy.
        I have installed the following plugins for my Python work:
        taglist

        python.vim
        Download Vim for free. Vim - the ubiquitous text editor. Vim is a highly configurable, keyboard-driven text editor designed to make creating and editing text extremely efficient. It is based on the classic vi editor and comes preinstalled as “vi” on most UNIX systems and macOS.

        and Bicycle Repair Man


        - Paddy

        Comment

        Working...