folding

Python code-folding in emacs?

可紊 提交于 2019-12-02 17:16:05
I have many classes and defs ... I want to have + and - keys before class and def to collapse the class or open it ( toggle it ). How i can do this? 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 hs-minor-mode to automatically be enabled when opening .py files. I use it in combination the following to jump around. M-x imenu <my_func

Vim: Fold top level folds only

时间秒杀一切 提交于 2019-12-02 16:37:54
I have a long code file with syntax folding in Vim. I know how to open all folds (zR) or close all folds (zM), and I know how to increase or decrease the foldlevel (zm, zr). However when I increase the foldlevel the inner most folds are closed; instead I want the outer most folds closed while the inner most are unfolded. It is possible to do this manually by opening all folds and the closing each top level fold by hand it's incredible tedious specially with long files that I open quickly to get an overview of the code. Is there any key shortcut to do this? Or do I need to make some sort of Vim

What is the recommended way to use Vim folding for Python code

南楼画角 提交于 2019-12-02 13:56:06
I am interested in enabling code folding in Vim for Python code. I have noticed multiple ways to do so. Does anyone have a preferred way to do Python code folding in Vim? I.e, Do you have a particular Vim plugin that you use and like? Do you use manual folding or do you place markers in comments? Any other recommended ways to do code folding for Python in Vim? Personally I can't convince myself to litter my code with the markers. I've become pretty used to (and efficient) at using indent-folding. Together with my mapping of space bar (see below) to open/close folds and the zR and zM commands,

Fold function in vim

╄→гoц情女王★ 提交于 2019-12-02 13:52:13
Is there any way or tools to fold function in vim, like Visual Studio or Eclipse? codaddict 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. zO opens all folds at the cursor. zc closes a fold under cursor. zm increases the foldlevel by one. zM closes all open folds. zr decreases the foldlevel by one. zR decreases the foldlevel to zero -- all

How to fold verbatim text (not code) in R bookdown?

人盡茶涼 提交于 2019-12-01 08:20:36
问题 In my document, I want to show some info, using ``` block, such as: ``` bruin@c7 ~ $ cat /etc/centos-release CentOS Linux release 7.4.1708 (Core) bruin@c7 ~ $ ``` For large output chunks, I want to fold them. How to do that? Searching the web it seems all related topics are about code folding, but what I want to fold is not any type of code, just simple text... Thanks! 回答1: Here is a very easy way to implement the following yourself: You can find all the code you need in the following

How can I fold .cs files inside .xaml files in Visual Studio 2010?

非 Y 不嫁゛ 提交于 2019-12-01 02:51:21
How can I put my ViewModel file (a .cs file) folded inside its corresponded View file (a .xaml file) file like in the image? I don't know of a way to do it in visual studio, but you can edit your .csproj file in a text editor. You should find something like this: <Page Include="MainWindow.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Compile Include="MainWindow.xaml.cs"> <DependentUpon>MainWindow.xaml</DependentUpon> <SubType>Code</SubType> </Compile> The two tags might not be right next to each other in your file. The important part is the <DependantUpon>

syntax highlighting in a VIM fold header

社会主义新天地 提交于 2019-12-01 00:04:33
问题 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 there any way to disable this, so I continue to see the syntax highlighting? [for a simple example this is not so important, but I also use folding extensively in viewing

Netbeans IDE : How do I fold large chunks of Javascript code in Netbeans?

青春壹個敷衍的年華 提交于 2019-11-30 18:15:38
问题 I have taken the leap from my comfortable dreamweaver IDE to Netbeans and am missing my code folding options :( I see with Netbeans you can fold normal functions but I can't seem to work out how to fold large chunks (entire modules). I have found fixes for other languages in Netbeans but they don't seem to work in Javascript. This is very frustrating when working on my large 4000+ line files... Surely there is a way?! If not can anyone recommend an IDE that is good for JS, CSS, HTML and PHP?

Vim syntax based folding with php

廉价感情. 提交于 2019-11-30 14:59:22
问题 I have downloaded php.vim file, which contains PHP-based syntax information. It should be able to provide syntax based folding, but I can't make it work for some reason. I have set :let g:php_folding 2 and :set foldmethod=syntax but for no avail. I'm pretty sure the file is in right place and is read by vim, since I can do :let g:php_sql_query=1 which works. The php.vim file is located in ~/.vim/syntax/php.vim 回答1: :syntax enable (or :syntax on) work because both those options also turn on

Explaining foldexpr syntax

时光毁灭记忆、已成空白 提交于 2019-11-30 14:40:12
问题 Could you please explain me the syntax in the following example or post me a link where is more general careful explanation of individual symbols? The help in vim is incomplete :set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1 what is unclear? Strings are between single quotes instead of double quotes? Or I can choose? What means the explanation mark (?) ? in =~'\\S'?'<1':1 What means the expression 'string1'string2'string3 ? What means :1 ? Thank you 回答1: The foldexpr