Sponsored Content
Top Forums Shell Programming and Scripting Vim : Match all bracket { and fold them (zf%) Post 302974264 by Purgator on Friday 27th of May 2016 05:07:38 AM
Old 05-27-2016
Hello,

i found a way to do that easy by using a macro.

Type 'q' to begin recording the macro, then select a register between a-z. Now type the macro '/{' + 'zf%'. Press q at the end to finish recording.
Now you can do something like '10@q' to play 10 times this macro. I still need to improve it to make it begin at the top of the file and end at the bottom, but it's already a quick easy way to deserve the purpose.

Summary :
Create macro
Code:
qa/{<Enter>zf%q

Execute macro
Code:
10@a

Just be careful to not doing zf multiple times on the same {

Enjoy

EDIT : I'm here again, just call :set nowrapscan to configure search not going back to the beggining of the file. Then you can simply do 1000@a end all functions gonna be collapse 1 time.

Last edited by Purgator; 05-27-2016 at 06:20 AM.. Reason: improving answer
This User Gave Thanks to Purgator For This Post:
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Best practice for bracket comparisons?

So, I have no formal higher education in programming at all and am self taught. I am now wondering what would be considered best practices? Like should I hard code a variable, then compare it to what I want to know or achieve, or should I just put the commands with in the brackets? Example, a... (5 Replies)
Discussion started by: tlarkin
5 Replies

2. Solaris

Very Importan - Vim Settings - Error while opening a File using vim

I downloaded vim.7.2 and compiled the vim source . Added the vim binary path to PATH (Because iam not the root of the box) when i load the file using vim it throws me an error Error detected while processing /home2/e3003091/.vimrc: line 2: E185: Cannot find color scheme darkblue line... (0 Replies)
Discussion started by: girija
0 Replies

3. Shell Programming and Scripting

Split a string with bracket

Hi, Am trying to split a string with bracket in ksh but it is not splitting it correctly. split("Hello, Name(1), Name(2)", main,","); How do i split correctly? (3 Replies)
Discussion started by: nightrider
3 Replies

4. Shell Programming and Scripting

Double bracket giving error

here is a small script I wrote: #! /bin/bash if ] then echo "argument is null" fi It is giving error: test.sh: any idea, why is it so? (2 Replies)
Discussion started by: vina201unx2011
2 Replies

5. Shell Programming and Scripting

ksh, difference between double bracket and single bracket

Can somebody tell me the difference between double brackets and single brackets, when doing a test. I have always been acustomed to using single brackets and have not encountered any issues to date. Why would somebody use double brackets. Ie if ] vs if Thanks to... (2 Replies)
Discussion started by: BeefStu
2 Replies

6. UNIX for Dummies Questions & Answers

Vim Match problem

Goodmorning, I've some problem in using regular expression in a VIM syntax configuration file. I've need to match a string as <<< some to match >>> so that it matches only some to match . With standard regular expression i know that for this goal works fine the regex: (?<=<{3}).*(?=>{3}) ... (4 Replies)
Discussion started by: keltron
4 Replies

7. Shell Programming and Scripting

Remove bracket part

Hi I have to remove in a file in first column whatever is written in brackets with brackets so one file hgfd 123 gfhdj 483 jdgfdg 34738 the output shuld be hgfd 123 gfhdj 483 jdgfdg 34738 (9 Replies)
Discussion started by: manigrover
9 Replies

8. Shell Programming and Scripting

variable inside if bracket

Is this possible? The below code not working for me. dir=mydir if ; then echo "found /home/$mydir " else echo "Not found /home/$mydir" fi ---------- Post updated at 05:28 AM ---------- Previous update was at 05:25 AM ---------- Its working for me now (1 Reply)
Discussion started by: anil510
1 Replies
assert.h(3HEAD) 						      Headers							   assert.h(3HEAD)

NAME
assert.h, assert - verify program assertion SYNOPSIS
#include <assert.h> DESCRIPTION
The <assert.h> header defines the assert() macro. It refers to the macro NDEBUG which is not defined in the header. If NDEBUG is defined as a macro name before the inclusion of this header, the assert() macro is defined simply as: #define assert(ignore)((void) 0) Otherwise, the macro behaves as described in assert(3C). The assert() macro is redefined according to the current state of NDEBUG each time <assert.h> is included. The assert() macro is implemented as a macro, not as a function. If the macro definition is suppressed in order to access an actual func- tion, the behavior is undefined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
assert(3C), attributes(5), standards(5) SunOS 5.11 10 Sep 2004 assert.h(3HEAD)
All times are GMT -4. The time now is 05:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy