vim hit “enter” on a specific letter

喜夏-厌秋 提交于 2019-12-20 04:13:42

问题


I want to hit enter on the arrow symbol in a file. Basically after hitting enter the arrow key collapses to show more text. I have so many such arrow keys.

▾ $wp_filter = (array [365])
  \
   ▸ $wp_filter['pre_term_name'] = (array [2])

After completely collapse

▾ $wp_filter = (array [365])
  \
   ▾ $wp_filter['pre_term_name'] = (array [2])
    \
     ▾ $wp_filter['pre_term_name'][10] = (array [2])
      \
       ▾ $wp_filter['pre_term_name'][10]['sanitize_text_field'] = (array [2])
        \
         ⬦ $wp_filter['pre_term_name'][10]['sanitize_text_field']['function'] = (string [19]) `sanitize_text_field`

I am trying

:%s/▸/\r/g

It does not collapse the text and the text after arrow breaks to next line.

▾ $wp_filter = (array [365])
  \

 $wp_filter['pre_term_name'] = (array [2])

I also tries

:%s/▸/▸\r/g

It breaks the line after the arrow mark.

▾ $wp_filter = (array [365])
  \
   ▸
 $wp_filter['pre_term_name'] = (array [2])

回答1:


see http://vim.wikia.com/wiki/Folding or http://vimdoc.sourceforge.net/htmldoc/fold.html

particularly: za toggles one level of folding, zA toggles all levels. You need to be on the node for this to work.

To open all folds in the file: zR (and zM will close all of them) (of course here, no need to be on a node, as it acts on all of them)



来源:https://stackoverflow.com/questions/25853291/vim-hit-enter-on-a-specific-letter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!