Ben Kadel explains how to use marks to bookmark locations and folds to collapse text sections in Vim.
Twitter: twitter.com/ben_kadel
Github: github.com/kardelio
P.S. I hope you enjoy the fun introduction as much as I enjoyed making it ;) ... Enjoy
The FIFTH instalment in the widely acclaimed and massively beloved vim show: VIM TIPS!
(youtube.com/playlist?list=PL3Y9MECuxct01Qol3kWK0fB5AXh3NFThZ)
This series, hopefully, provides small & easily consumed Tips & Tricks. That you can use in Vim to help you become a better Vim-er and is for Beginners & Intermediate Vim users alike. The aim is to hopefully expose/highlight some of Vim's massive (maybe even lesser known) functionality & features with clear explanations & examples.
In this episode I show you two incredibly useful features that exist already in Vim, that, when used, will enhance your speed & efficiency in the world's greatest Editor. These two features are called: Marks & Folds.
Use the timestamps below (YouTube chapters) to skip ahead to specific sections described below...
To start with I explain MARKS in Vim. The ability to essentially make a bookmark on any location within your Vim buffer. You can then quickly & easily jump to these marked locations. You can of-course list your marks & delete your marks. Not only that but you can jump to the specific column position within your mark too, not just the line that was marked!
In regards to Marks in Vim, I personally prefer to have a constant visual representation of where my marks are throughout my files, so I installed (& recommend) a brilliant plugin called Vim-Signature (github.com/kshenoy/vim-signature) that displays your marks with a small neat letter in the left side panel against the line number for the lines.
Next I explain Folds. The ability to create regions in the contents of your file that can be concatenated down (or minimised) so that if you are not interested in that part of the file or if it is simply a large text block that you want to skip around, then you can use folds to do just that. Like in other IDEs & Text Editors, folds in vim allow you to collapse the regions and see just a very brief summary of what is within the folded region. Folds in Vim give you a huge amount of control, you can set the fold method to be manual and create/delete all of your own specified regions or you can choose any of the following fold methods: marker, indent, syntax or diff and let Vim figure out how to allocate your fold regions for you.
All of these fold methods are explained in the video!
I hope you enjoy this video & hopefully learn a little something from it!
Timestamps ======================
- Intro
- Vim Tips Intro
- Marks & Folds Theory
- Marks
- Create a Mark
- Jump to a Mark
- See all marks
- Vim-Signature Plugin (See Marks)
- Multiple marks on 1 line
- Delete a Mark
- Columns in Marks
- Jump to column position in Mark
- Cycle through Marks
- Cycle through column positions in Marks
- Special Marks
Why it's here
1 person recommends this
What people say. Recommended as a clear tutorial on using Vim's built-in marks and folds to improve editing workflow.
Moments people linked to
b
u/bkthedeveloperin r/vim • Recommends
Vim Tips Ep. 5 - Two brilliant features in Vim to enhance your Workflow: Marks & Folds. Bookmark certain locations in your buffers to quickly jump to & collapse/expand sections of text within your file... Skip to 03:34 to dodge the silly intro: Timestamp already in link provided