Scala: how to merge a collection of Maps

Well, you could do: mapList reduce (_ ++ _) except for the special requirement for collision. Since you do have that special requirement, perhaps the best would be doing something like this (2.8): def combine(m1: Map, m2: Map): Map = { val k1 = Set(m1.keysIterator.toList: _*) val k2 = Set(m2.keysIterator.toList: _*) val intersection = k1 … Read more

Python code-folding in emacs?

Hideshow works out of the box and folds python code. It is built-in my version of emacs (24.3.1) I have never needed more than these commands: M-x hs-minor-mode M-x hs-hide-all M-x hs-show-all To toggle use C-c @ C-c which probably needs rebinding. You might also want to setup a hook in your .emacs file for … Read more

How can I fold content in Github markdown?

Check if this follows dear-github issue 166, which mentions: collapsible sections are supported: <details> <summary>Click to expand</summary> whatever </details> See more in this example. The key is to wrap the whole contents inside the <p>: <details><summary>stuff with *mark* **down**</summary><p> ## _formatted_ **heading** with [a](link) — {{standard 3-backtick code block omitted from here due to escaping … Read more

How to fold/unfold HTML tags with Vim

I have found zfat (or, equally, zfit) works well for folding with HTML documents. za will toggle (open or close) an existing fold. zR opens all the folds in the current document, zM effectively re-enables all existing folds marked in the document. If you find yourself using folds extensively, you could make some handy keybindings … Read more

Fold function in vim

Vim folding commands ——————————— zf#j creates a fold from the cursor down # lines. zf/ string creates a fold from the cursor to string . zj moves the cursor to the next fold. zk moves the cursor to the previous fold. za toggle a fold at the cursor. zo opens a fold at the cursor. … Read more

notepad++ user defined regions with folding

For version 6.5.5 and above: Under the menu “Language” there is a menuitem called “Define your language…“ In the tab “Folder & Default” is a group called “Folding in code” where you can enter an “Open”- and a “Close”-Keyword. For versions older than 6.5.5: Under the menu “View” there is a menuitem called “User-Defined Dialog…“ … Read more

How do I enable automatic folds in Vim?

To allow folds based on syntax add something like the following to your .vimrc: set foldmethod=syntax set foldlevelstart=1 let javaScript_fold=1 ” JavaScript let perl_fold=1 ” Perl let php_folding=1 ” PHP let r_syntax_folding=1 ” R let ruby_fold=1 ” Ruby let sh_fold_enabled=1 ” sh let vimsyn_folding=’af’ ” Vim script let xml_syntax_folding=1 ” XML Syntax based folding is … Read more