How I stay organised using Vim

I spend all day in VIM. Either editing configuration, writing plans or using it as a full blown IDE.

I use nvim-metals to get IDE features like showing variable types when editing Scala code.

Whilst every morning I give a standup update, through out the day I keep all my notes in a text file. Its just a text file and looks roughly like this

Where ever I am in Vim or whatever I’m doing, I can immediately open the file with `G I’m using the feature called “marks”. In short m will mark the current cursor position so ma will remember the cursor position and associate it with the letter a. Typing` awill take you to the line your mark was on. (The quote character is under escape on a UK keyboard).

It’s an amazingly useful feature. I use it the most when I’m half-way through writing some code and I need to jump to the top of the file to add an import. I mark the cursor position, jump to the top and then return once I’m done. Lowercase letters are local to your file so you can store 26 unique positions per file. Using an uppercase letters operate at the global level opening my notes file regardless of where I am, or if the notes file isn’t opened yet. It just opens it and puts me in.

If I need to write an essay on a particular topic or the notes get long and ugly, the second trick I use is to create a specific text file for that thing and keep the filename in my notes file. Using gf in vim opens the file path under the cursor, so it takes me hardly anytime to navigate through my collection of notes, drilling in and out when necessary.

Vim’s Ctrl+o feature helps me move back to where I was when I’m finished with the notes, speeding up navigation. I also have this bind in my vim rc:

noremap <silent><leader>bd :MBEbd<CR>

When I type \bd the file I’m looking at is close and vanishes. This is my trick to keep my workspace clean and tab list short and focused. It’s not uncommon for me to spend a minute every now and again closing all the unused files like this, just as you might also do when you periodically close those browser tabs you weren’t using.

Finally, the benefit of just using a text file instead of some plugin solution is the flexibility. It’s in my sync’d cloud files so it’s backed up and can be opened in other programs. Sometimes i open it in Kate if i’m not in vim at that particular moment.