From 663c16177b174d81f585797c89c4c3be807e8ebd Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Thu, 18 Jan 2018 17:02:04 -0600 Subject: [PATCH] Add Fold A Visual Selection And Expand It Back as a vim til --- README.md | 3 ++- ...ld-a-visual-selection-and-expand-it-back.md | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 vim/fold-a-visual-selection-and-expand-it-back.md diff --git a/README.md b/README.md index 57e6726..8128271 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_597 TILs and counting..._ +_598 TILs and counting..._ --- @@ -615,6 +615,7 @@ _597 TILs and counting..._ - [End Of The Word](vim/end-of-the-word.md) - [Filter Lines Through An External Program](vim/filter-lines-through-an-external-program.md) - [Fix The Spelling Of A Word](vim/fix-the-spelling-of-a-word.md) +- [Fold A Visual Selection And Expand It Back](vim/fold-a-visual-selection-and-expand-it-back.md) - [Format Long Lines To Text Width](vim/format-long-lines-to-text-width.md) - [From Ruby Variables To JavaScript Variables](vim/from-ruby-variables-to-javascript-variables.md) - [Generate and Edit Rails Migration](vim/generate-and-edit-rails-migration.md) diff --git a/vim/fold-a-visual-selection-and-expand-it-back.md b/vim/fold-a-visual-selection-and-expand-it-back.md new file mode 100644 index 0000000..d8d43a1 --- /dev/null +++ b/vim/fold-a-visual-selection-and-expand-it-back.md @@ -0,0 +1,18 @@ +# Fold A Visual Selection And Expand It Back + +If I visually select a series of lines -- say the open and close tags of a +large `div` in an HTML file I am reading through -- and then hit `zf`, it +will be _folded_ into a single line. That line will list how many lines are +included in the fold as well as the content of the first line of the fold. + +If I later come back to that fold and want to expand it again, I can hit +`zd` to delete (or undo) the fold. + +To do this, you'll want to make sure your `foldmethod` is set to `manual`. +This can be done by running the following command: + +``` +:set foldmethod=manual +``` + +See the vim helpfiles (`:h fold`) for more details.