folding

A text editor that auto-folds parentheses?

巧了我就是萌 提交于 2019-12-04 18:45:16
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 optionally collapse/fold each parentheses set to ease reading, e.g. SELECT * FROM ... AS X1 SELECT * FROM (SELECT F1,F2 FROM TABLE1 AS X LEFT JOIN ... AS B ON X.F1=B.F9) AS X1 I can do this in Visual Studio by repeatedly hitting ctrl-shift-] to select a set, and then

Autofold #ifdef..#endif in vim via .vimrc

允我心安 提交于 2019-12-04 10:54:21
问题 I have seen partial solutions over the internet but none that really satisfied me: what do I have to put into my .vimrc (ideally I don't want to chance any syntax/*.vim file) such that in all .c/cpp/h files that I open, I get automatic folding of #ifdef ... #endif sections? 回答1: If the only type of folding that you want is the #ifdef sections, the easiest way is to create a file ~/.vim/after/ftplugin/c.vim (you may also need to do this in cpp.vim , I'm not sure) with the following content:

Emacs persistent folding mode

拟墨画扇 提交于 2019-12-04 00:13:46
There are plenty of ways to fold code in Emacs and I've settled in on using the outline minor mode... it works great! However, I really want my folding to be persisted when I close and re-open files. It is quite frustrating to have folding set up in a file the way I like it, only to have that lost when I restart Emacs. Has anyone found a way to keep the folding state of a file persistent? Edit: Now that I understand the question... How about something like the following nippet of code. It seems to work for me, though I haven't figured out how to avoid being prompted for the file local variable

Page feed symbol display in Vim

做~自己de王妃 提交于 2019-12-03 17:13:04
问题 One of the nice things about Vim is that one can insert a page feed symbol ( Ctrl - L in Insert mode), which delegates the printer to start printing the following on a new page. It shows as ^L in text. Is it possible to make this symbol show as something else, for example as ----------------- new page here ----------------- so it is somewhat more visible while scrolling through pages of text? That is, without rebuilding Vim from source. 回答1: If you do not use folding extensively when editing

Syntax-highlight Python in a vim fold line

a 夏天 提交于 2019-12-03 17:11:47
问题 I have found that code-folding helps me organize my files better. Thus, at the bottom of my ~/.vimrc , I enable vim code folding by default: ""Folding set foldmethod=indent set foldnestmax=2 nnoremap <space> za vnoremap <space> zf "set nofoldenable "set this to disable folding on file open This has the advantages of using SPACE to toggle folds at the cursor, or if they start to annoy me I can use z R to unfold everything. However, I'm also addicted to syntax highlighting. I use Dmitry

How do I fold code for comment blocks inside method blocks?

天涯浪子 提交于 2019-12-03 09:00:56
问题 How can I fold comment blocks inside method blocks to be folded (outlined), just like methods and regions, etc.? 回答1: Select the block that you want to hide Ctrl + M + H This needs to be done only once. The block will become collapsible afterwards. 回答2: Edit + Outlining + Start Automatic Outlining. 回答3: I think it might be right... 도구 > 옵션 > 텍스트 편집기 > C/C++ > 서식 > 개요 > 문 블록에 개요 사용 : True --> 모든 블록에 folding/unfolding 사용 가능. Tool > Option > Text Editor > C/C++ > Form > Outline > Use statement

Syntax-highlight Python in a vim fold line

二次信任 提交于 2019-12-03 06:21:15
I have found that code-folding helps me organize my files better. Thus, at the bottom of my ~/.vimrc , I enable vim code folding by default: ""Folding set foldmethod=indent set foldnestmax=2 nnoremap <space> za vnoremap <space> zf "set nofoldenable "set this to disable folding on file open This has the advantages of using SPACE to toggle folds at the cursor, or if they start to annoy me I can use z R to unfold everything. However, I'm also addicted to syntax highlighting. I use Dmitry Vasiliev's python.vim , but it doesn't highlight syntax in a fold line: The lack of syntax highlighting for

Vim: Fold top level folds only

泪湿孤枕 提交于 2019-12-03 03:06:42
问题 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

Python code-folding in emacs?

僤鯓⒐⒋嵵緔 提交于 2019-12-03 02:12:50
问题 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? 回答1: 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

Fold function in vim

╄→гoц情女王★ 提交于 2019-12-03 01:34:15
问题 Is there any way or tools to fold function in vim, like Visual Studio or Eclipse? 回答1: 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