folding

Folding JSON at specific points

时光总嘲笑我的痴心妄想 提交于 2019-12-08 01:06:25
问题 I have a JSON file and would like to fold it with a toggle ( z a ) at every line with a key called subsection. I thought about using a global command like: :g/subsection/za but it doesn't work since a global command expects an editing function as the second argument, and z a is not editing. Any thoughts? 回答1: How about: :g/subsection/norm za From :h :g To repeat a non-Ex command, you can use the ":normal" command: > :g/pat/normal {commands} 回答2: For opening / closing folds (at a line / range)

How can I automatically fold a long C code in Vim?

空扰寡人 提交于 2019-12-07 14:28:05
问题 I regularly run into C-codes without folding. It is irritating to read them if there is no folding, particularly with long files. How can I fold them? 回答1: To fold according to syntax :set foldmethod=syntax If you want to do it manually on the bits you want to fold away :set foldmethod=manual then create new folds by selecting / moving and pressing zf e.g. shift-v j j zf (ignoring the spaces) Edit: Also see the comments of this answer for indent and marker foldmethods. 回答2: I think you may

Code Folding for CSS in VSCode

丶灬走出姿态 提交于 2019-12-07 12:24:41
问题 I can't get code folding to work in the editor in Css. In both html and js I can fold code according to comments, which enables me to create neat groups. But in Css you can't fold comments. Does anyone know of a way to enable this or another nice tip for creating groups of code in a Css file? Here are some pictures. Here you can see there is not minus button next to the Own Classes comment: But here you can see the comments fold nicely in js, this enables me to create nice groups of code: 回答1

Exporting Vim folds?

▼魔方 西西 提交于 2019-12-07 05:47:44
问题 How can I export vim folds from a file, so that I can transfer it to a different machine? For example say I create the folds in a file and save it on a local machine - where does the "folding" metadata go? Can I just copy it to another machine, or must I manually recreate the folds again? EDIT: Hm, I've noticed this might be a duplicate question, but still there is not answer as to how to save the fold information WITHOUT modifying the source file. Thanks 回答1: Save your session with the

Folding JSON at specific points

久未见 提交于 2019-12-06 11:26:15
I have a JSON file and would like to fold it with a toggle ( z a ) at every line with a key called subsection. I thought about using a global command like: :g/subsection/za but it doesn't work since a global command expects an editing function as the second argument, and z a is not editing. Any thoughts? How about: :g/subsection/norm za From :h :g To repeat a non-Ex command, you can use the ":normal" command: > :g/pat/normal {commands} For opening / closing folds (at a line / range), there are dedicated Ex commands : :foldopen and :foldclose . Those can be directly used with :global/subsection

How can I automatically fold a long C code in Vim?

ぃ、小莉子 提交于 2019-12-06 00:16:52
I regularly run into C-codes without folding. It is irritating to read them if there is no folding, particularly with long files. How can I fold them? To fold according to syntax :set foldmethod=syntax If you want to do it manually on the bits you want to fold away :set foldmethod=manual then create new folds by selecting / moving and pressing zf e.g. shift-v j j zf (ignoring the spaces) Edit: Also see the comments of this answer for indent and marker foldmethods. I think you may have mixed the terminology. Do you need "wrapping" or "folding". Wrapping is the one where lines that wouldn't

Code Folding for CSS in VSCode

拈花ヽ惹草 提交于 2019-12-05 22:25:35
I can't get code folding to work in the editor in Css. In both html and js I can fold code according to comments, which enables me to create neat groups. But in Css you can't fold comments. Does anyone know of a way to enable this or another nice tip for creating groups of code in a Css file? Here are some pictures. Here you can see there is not minus button next to the Own Classes comment: But here you can see the comments fold nicely in js, this enables me to create nice groups of code: See the docs to read about code folding in VS Code: Since the 1.22 release, folding ranges can also be

How to collapse concealed text?

倾然丶 夕夏残阳落幕 提交于 2019-12-05 22:03:08
The problem is as follows: This is about a plain .txt file I have enabled the conceal feature and created this syntax file: set conceallevel=3 syn region cTest conceal start='€£' end='£€' hi cTest ctermfg=DarkYellow I write first a summary/skeleton of what I want to say, and put it in between €£ and £€. Then, in the same line, I write a lengthier text following the guidelines of the summary. The whole file contains many (>100) lines. The conceal feature works very nicely, except for one point: if the ensuing lines are each, e.g., 600 characters long (summary 120, text 480), and if the screen

Exporting Vim folds?

我的未来我决定 提交于 2019-12-05 10:46:32
How can I export vim folds from a file, so that I can transfer it to a different machine? For example say I create the folds in a file and save it on a local machine - where does the "folding" metadata go? Can I just copy it to another machine, or must I manually recreate the folds again? EDIT: Hm, I've noticed this might be a duplicate question, but still there is not answer as to how to save the fold information WITHOUT modifying the source file. Thanks Save your session with the :mksession command, and restore it with vim -S Session.vim . The session file will restore almost everything,

Android code folding the Switch block

谁说我不能喝 提交于 2019-12-05 04:13:38
Under Android Studio 1.0.2 is there a way to fold the block of code for a Switch conditional statement? I could not find how to do it online or in File > Settings. Select the code block and right click to choose fold code block (it "says" Ctrl-Shift-Period but Ctrl-Shift-Period doesnt really do it....) Vitaly Zinchenko To fold an arbitrary selected block Select contiguous fragment of code in the editor. On the main menu, choose Code|Folding|Fold Selection/Remove Region, or press Ctrl + Period Source: https://www.jetbrains.com/help/idea/2017.1/code-folding.html 来源: https://stackoverflow.com