Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Code Folding - code folding wherever I want (Notepad++)

I am majoring in financial studies and write my R code primarily in Notepad++.

I also use Notepad++ to write my thoughts and plans before moving the final version to Latex.

What I wanted to do is to use Notepad++ to be able to fold wherever I want, on whatever language I write, whether it is Python, R, etc., even plain txt too.

vim/emacs may or may not have that feature already, but I don't think I have the willingness to study one of them since the learning curve is steep

I hope that there's a specific way to do the custom folding so as not to interfere with the native code-folding feature of Notepad++ (ex: like how # trigger comment in R, or like in Python).

like image 244
Firhat Nawfan H. Avatar asked Nov 01 '22 12:11

Firhat Nawfan H.


1 Answers

I would definitely go with User-Defined styles for the text files.

For Ruby, since it is an already defined language, you can either

  • Try to redefine the language as a user-one + add your additional folding items (but it is very painful)
  • Use a work-around as explained in https://stackoverflow.com/a/16472818/1603480

But, that would be for a specific language so you would have to select the style for each language (so doesn't meet your requirement "for any language").

Probably a solution would be a macro or a Python script modifying your text (for example by using the hide function of Notepad++).

like image 120
Jean-Francois T. Avatar answered Nov 22 '22 18:11

Jean-Francois T.