folding

Correcting Wrong Marker Folding in VIM

I mistakenly did marker folding to my .vimrc: {{{8 #CS something.. }}}8 {{{9 #Math ... }}}9 ... many more! I need to switch the format to "#SOMETHING {{{NUMBER" like: #CS {{{8 something.. }}}8 #Math {{{9 ... }}}9 ... many more! What is wrong in the following code: :%s$/({{{\d/) /(#[:alpha:]/)$\2 \1$g [Solution] %s$\(...

Why does this Haskell code work successfully with infinite lists?

I have some Haskell code that does work correctly on an infinite list, but I do not understand why it can do so successfully. (I modified my original code -- that did not handle infinite lists -- to incorporate something from some other code online, and suddenly I see that it works but don't know why). myAny :: (a -> Bool) -> [a] -> Bo...

Why does this first Haskell function FAIL to handle infinite lists, while this second snippet SUCCEEDS with infinite lists?

I have two Haskell functions, both of which seem very similar to me. But the first one FAILS against infinite lists, and the second one SUCCEEDS against infinite lists. I have been trying for hours to nail down exactly why that is, but to no avail. Both snippets are a re-implementation of the "words" function in Prelude. Both work fine...

Compact C Folding in Vim

Hi, I'm trying to make a simple Vim script that would create very compact top-level folds for c files. Ideally, if it was run on this code: static void funca(...) { ... } /* Example comment */ static void funcb(...) { ... } Then it would create folds which would look like this when closed: +-- x Lines: static void funca(......

How to implement a list fold in Java

I have a List and want to reduce it to a single value (functional programming term "fold", Ruby term inject), like Arrays.asList("a", "b", "c") ... fold ... "a,b,c" As I am infected with functional programming ideas (Scala), I am looking for an easier/shorter way to code it than sb = new StringBuilder for ... { append ... } sb.toS...

Eclipse RCP - Internals of projection (folding) service

I need to make custom text folding as described here: http://stackoverflow.com/questions/1017375/can-i-merge-syntax-coloring-and-folding-or-projection-colored-from-master-docume I'm digging through code, but its very perplexed... and I cant get access to some classes. I still haven't found what class decides what to show when ProjectionA...

little folding triangles?

Based on the style of the 'turning' triangle that opens up a sub menu. Say I had a form that had lender name address city.... how would I add extra section to that form for a second lender name address.... ? Not many people are going to need this on my site but the one's that do, must have the extra fields. I would like to conceal the e...

Scala: how to merge a collection of Maps

I have a List of Map[String, Double], and I'd like to merge their contents into a single Map[String, Double]. How should I do this in an idiomatic way? I imagine that I should be able to do this with a fold. Something like: val newMap = Map[String, Double]() /: listOfMaps { (accumulator, m) => ... } Furthermore, I'd like to handle ...

Preventing vim to auto-expand folds

I'm using foldmethod=marker and #{{{ #}}} markers in Python code. After typing #{{{ vim automatically expands all folds below the cursor. Is it possible to turn this off? ...

How do you know when to use fold-left and when to use fold-right?

I'm aware that fold-left produces left-leaning trees and fold-right produces right-leaning trees, but when I reach for a fold, I sometimes find myself getting bogged down in headache-inducing thought trying to determine which kind of fold is appropriate. I usually end up unwinding the entire problem and stepping through the implementati...

A text editor that auto-folds parentheses?

I have some big messy SQL procedures that I'm debugging, and they tend to have a lot of heavily nested parentheses: SELECT * FROM (SELECT F1,F2 FROM TABLE1 AS X LEFT JOIN (SELECT F9,F8 FROM (SELECT F13,F14 FROM TABLE4) AS J INNER JOIN TABLE3 ON...) AS B ON X.F1=B.F9) AS X1 I'm looking for an editor that can automatically mark and op...

Collapse comments and all functions in vim/gvim

I'm a novice user to vim and I haven't been able to find in the internet how to collapse functions and I've figured out how to collapse the argument list in C with zfa} and zfa). but I can't figure out how to collapse the comments sections. How do I do that? Second question but related, is there a way to collapse all functions/argument...

Code folding on consecutive collect/select/reject/each

I play around with arrays and hashes quite a lot in ruby and end up with some code that looks like this: sum = two_dimensional_array.select{|i| i.collect{|j| j.to_i }.sum > 5 }.collect{|i| i.collect{|j| j ** 2 }.average }.sum (Let's all pretend that the above code sample makes sense now...) The problem is that even th...

Vim folding for php.

Vim privedes nice syntax folding for ruby and c(well, that is what I've tried) out of the box, but what about php? It doesnt have this feature! Am I missing something? ...

syntax highlighting in a VIM fold header

Is there any way to have VIM continue to apply formatting to the line used as the header for a fold? E.g., I have the following code: int foo(int a, int b) { int c; .... } When folded, I see: +-- 4 lines: int foo(int a, int b) {---------------------------- However, the whole line is highlighted as per the "Folded" class. Is th...

Stopping VIM from opening all subsequent closed folds when creating a new one

I noticed that when I create a new fold (I'm using foldmethod=marker) all the folds below the one I'm creating are automatically opened, is there a way to prevent this and leave them closed? I can't use zf to manually create a fold because I'm editing PHP/HTML and there is no 'commentstring' format good for both. ...

I want to duplicate Folding (use extra cpu-cycles)

I want to use extra-cpu cycles to do some of my own processing, and I was wondering if someone could point me in the right direction as to how to get started on this? ...

Can I have Vim ignore a license block at the top of a file?

Is there a way to use folds or some other Vim-script black magic to hide license blocks at the top of files? I don't like that they take up such a large section of my editing pane; I like to get a sense for what a file is doing when I first open it, rather than a face-full of boilerplate. ...

Semantic #region usage

What's your opinion about using #region folding using application semantic, instead of folding for "syntax". For example: #region Application Loop #region User Management #region This Kinf of stuffs instead of #region Private Routines #region Public Properties #region ThisRoutine // (Yes, I've seen this also!) In this logic, I'm s...

Is there a way to set custom collapsable code regions in Xcode

Is there a way to create custom collapsable code regions in Xcode similar to how Visual Studio can fold around #region/#endregion blocks? It would be nice to throw all autogenerated content into a region that I can fold away until I need to look at it. #pragma mark doesn't seem to do the trick. ...