Sponsored Content
Top Forums Shell Programming and Scripting Vim : Match all bracket { and fold them (zf%) Post 302972977 by Purgator on Thursday 12th of May 2016 10:24:10 AM
Old 05-12-2016
Vim : Match all bracket { and fold them (zf%)

Hello !

I'm using a lot the command zf% with the cursor on the first bracket of a function for example, to fold it.

Ex : I put my cursor on the first bracket

Code:
myfunction(){
# body
}

I type zf%

It become :

Code:
+--  9 lines : myfunction() {------------------------------------------------------------

I would like to fold all matching bracket in the file with 1 command.
Now i have to manually place my cursor on every bracket to manualy create the fold.

How to procced please ?

Thank you in advance.

Last edited by RudiC; 05-12-2016 at 01:50 PM.. Reason: Added code tags
 

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
FOLD(1) 							   User Commands							   FOLD(1)

NAME
fold - wrap each input line to fit in specified width SYNOPSIS
fold [OPTION]... [FILE]... DESCRIPTION
Wrap input lines in each FILE (standard input by default), writing to standard output. Mandatory arguments to long options are mandatory for short options too. -b, --bytes count bytes rather than columns -s, --spaces break at spaces -w, --width=WIDTH use WIDTH columns instead of 80 --help display this help and exit --version output version information and exit AUTHOR
Written by David MacKenzie. REPORTING BUGS
Report fold bugs to bug-coreutils@gnu.org GNU coreutils home page: <http://www.gnu.org/software/coreutils/> General help using GNU software: <http://www.gnu.org/gethelp/> Report fold translation bugs to <http://translationproject.org/team/> COPYRIGHT
Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
The full documentation for fold is maintained as a Texinfo manual. If the info and fold programs are properly installed at your site, the command info coreutils 'fold invocation' should give you access to the complete manual. GNU coreutils 8.12.197-032bb September 2011 FOLD(1)
All times are GMT -4. The time now is 08:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy