{"id":380,"date":"2018-03-27T07:13:56","date_gmt":"2018-03-27T07:13:56","guid":{"rendered":"http:\/\/info.juliusgoh.life\/?p=380"},"modified":"2019-03-07T03:41:14","modified_gmt":"2019-03-07T03:41:14","slug":"vim-folding-marker-method","status":"publish","type":"post","link":"https:\/\/info.juliusgoh.life\/?p=380","title":{"rendered":"Vim Folding ( Marker Method )"},"content":{"rendered":"<p>Hi, today i&#8217;ll be talking about folding for vim. Folding is to fold codes from line to line to have a better view on codes. today i will be demonstrating marker fold method for vim.<\/p>\n<p>Firstly , you will need to set your foldmethod to marker code and the default for open and close marker is {{{ and }}}, you can change it as the command i show below. To have a permanent change you can place the command below into your .vimrc<\/p>\n<pre>:set foldmethod=marker\r\n:set foldmarker=#StartFold,#EndFold\r\n<\/pre>\n<p>There are few command to take note of :-<\/p>\n<pre>za - To toggle fold\r\nzd - To delete fold\r\n<\/pre>\n<p>In order to create a fold there are few ways<\/p>\n<p><b>Range Folding<\/b><\/p>\n<pre>:1,10 fold\r\n<\/pre>\n<p><b>Block Folding<\/b><\/p>\n<pre>1.Position the cursor on the first brace, and type zfa} \r\nzfa} - to find the end } for the block .\r\n2.You can also go either way by Positioning the cursor on the end brace and type zfa{\r\nzfa{ - to find the start { for the block .\r\nzf%  - to find start \/ end for the block.\r\n<\/pre>\n<p><b>Manual Folding<\/b><\/p>\n<pre>By typing the marker manually.\r\nFor this example the marker start is #StartFold and marker end is #EndFold\r\n\r\n#StartFold\r\ncode goes here .......\r\n#EndFold\r\n<\/pre>\n<h1>SHORT CUTS!!!!!<\/h1>\n<pre>\r\nzf#j creates a fold from the cursor down # lines.\r\nzf\/string creates a fold from the cursor to string.\r\nzj moves the cursor to the next fold.\r\nzk moves the cursor to the previous fold.\r\nzo opens a fold at the cursor.\r\nzO opens all folds at the cursor.\r\nzm increases the foldlevel by one.\r\nzM closes all open folds.\r\nzr decreases the foldlevel by one.\r\nzR decreases the foldlevel to zero -- all folds will be open.\r\nzd deletes the fold at the cursor.\r\nzE deletes all folds.\r\n[z move to start of open fold.\r\n]z move to end of open fold.\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Hi, today i&#8217;ll be talking about folding for vim. Folding is to fold codes from line to line to have a better view on codes. today i will be demonstrating marker fold method for vim. Firstly , you will need to set your foldmethod to marker code and the default for open and close marker [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":381,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"image","meta":{"footnotes":""},"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=\/wp\/v2\/posts\/380"}],"collection":[{"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=380"}],"version-history":[{"count":7,"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=\/wp\/v2\/posts\/380\/revisions"}],"predecessor-version":[{"id":525,"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=\/wp\/v2\/posts\/380\/revisions\/525"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=\/wp\/v2\/media\/381"}],"wp:attachment":[{"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}