美文网首页
8.textObject_macro

8.textObject_macro

作者: 泠泉 | 来源:发表于2019-06-07 08:49 被阅读0次
" text Object  
    {operator}{a}{object}  
    {operator}{i}{object}  
      
daw = delete a word  
      ==a==n object: include tail space  
  
ciw = change inner word  
      ==i==nner object: just content self  
      exclude tail word space  
  
" word/sentence/paragraph  
    textObject      specification  
    w               word  
    s               sentence  
    p               paragraph  
      
" chunk object  
    ]/[             []block  
    )/( b           block  
    >/< >/<         <>block  
    }/{ B           Block  
    t               tag block: <> </>   
  
" visual mode  
    viw             select word  
    vis             select sentence  
    vip             select paragraph  
    vi(             select content in (  
    vi[             select content in [  
    vit             select content in tab   
  
    v2i{            select content in 2{  
    v3aw            select 3 word  
    v3iw            select 3 word, exclude tail space  
      
v operator can substitute to c x d y etc. operator effect on text Object  
  
====================================  
  
" macro  
    if you write a thing once,it is okay. However if you're writing  
t twice or more times, then you should find a better way to do it.   
  
qa                  start record macro and reg to a  
q                   stop record macro  
n@a                 execute n times macro a  
@@                  redo last operation  
:n,mnormal @a       n to m row execute reg a  
:let @a= '          edit macro reg a  
  
  
" best operation  
    normalize cursor pos: 0  
    execute edit and operator  
    move cursor to easy back pos: j  
  
  
" macro save  
    viminfo/vimrc file  
    save history and not null reg   
    vim launch read  
    easy to cover  

相关文章

网友评论

      本文标题:8.textObject_macro

      本文链接:https://www.haomeiwen.com/subject/vofmxctx.html