Giter VIP home page Giter VIP logo

zfvimindentmove's Introduction

ZFVimIndentMove

vim script to move cursor quickly accorrding indent

if you like my work, check here for a list of my vim plugins, or buy me a coffee

how to use

  1. use Vundle or any other plugin manager you like to install

    Plugin 'ZSaberLv0/ZFVimIndentMove'
    
  2. use keymap to move cursor, default keymap:

    nnoremap E <nop>
    nnoremap EE ``
    nnoremap <silent> EH :call ZF_IndentMoveParent('n')<cr>
    xnoremap <silent> EH :<c-u>call ZF_IndentMoveParent('v')<cr>
    nnoremap <silent> EL :call ZF_IndentMoveParentEnd('n')<cr>
    xnoremap <silent> EL :<c-u>call ZF_IndentMoveParentEnd('v')<cr>
    nnoremap <silent> EK :call ZF_IndentMovePrev('n')<cr>
    xnoremap <silent> EK :<c-u>call ZF_IndentMovePrev('v')<cr>
    nnoremap <silent> EJ :call ZF_IndentMoveNext('n')<cr>
    xnoremap <silent> EJ :<c-u>call ZF_IndentMoveNext('v')<cr>
    nnoremap <silent> EI :call ZF_IndentMoveChild('n')<cr>
    xnoremap <silent> EI :<c-u>call ZF_IndentMoveChild('v')<cr>
    

    you may disable the default keymap by

    let g:ZFIndentMove_autoKeymap=0
    

functions

  • ZF_IndentGetIndentLevel(line)

    get indent level of line, accorrding to your min(tabstop, softtabstop)

  • ZF_IndentIsEmpty(line)

    true if line is empty or contains spaces or tabs only

  • ZF_IndentMoveParent(mode)

    move up to nearest parent indent (whose indent is less than current line)

    move >> foo
                foo
    
     cur >>     foo
    
  • ZF_IndentMoveParentEnd(mode)

    move down to nearest parent indent (whose indent is less than current line)

     cur >>     foo
    
                foo
    move >> foo
    
  • ZF_IndentMoveChild(mode)

    move down to nearest child indent (whose indent is larger than current line)

     cur >> foo
            foo
    
    move >>     foo
    
  • ZF_IndentMovePrev(mode)

    move up to nearest sibling or parent indent (whose indent is equal to or less than current line, skip first empty or same indent line)

    move >> foo
    
            foo
     cur >> foo
    

    or

    move >> foo
                foo
     cur >>     foo
    
  • ZF_IndentMoveNext(mode)

    move down to nearest sibling or parent indent (whose indent is equal to or less than current line, skip first empty or same indent line)

     cur >> foo
            foo
    
    move >> foo
    

    or

     cur >>     foo
                foo
    move >> foo
    

zfvimindentmove's People

Contributors

zsaberlv0 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.