Learning to edit text without using a mouse
14 entries
First: Apr 6, 2020
1 contributor
Cool that you write about why you starte...

My current reference sheet I have a bunch of commands on that I’m trying to memorize or reference frequently.

I started using vimwiki to keep track of things I learn while I'm coding. I can quickly open it, and jot something down or reference a previous note. This is super useful because it's in my terminal with vim, tmux, and friends.

Not sure how I'm going to use this log going forward now. I love how helpful it's been, but don't want to duplicate knowledge in two places.

I've used folds sparingly so far because I didn't really know how to use them. Earlier today, I had to edit a really large JSON file and it was a pain to navigate so I decided I should try out folding it.

All I had to do was add set foldmethod=syntax to my vimrc and I was off! I previously installed vim-polyglot so it was an extra bonus that it brings in syntax files on-demand to help with folding.

One of the side effects of how I use Vim is a lot of buffers are opened. I'll make some edits, then switch to a new file, keeping the buffer open, either in the background or foreground.

Once they start piling up, it's a paid to open the buffer list, navigate to each buffer, and close them all. I thought there had to be other people with this problem and found a plugin that takes care of it for me. close-buffers.vim give me the ability to interactively select buffers to close, close all hidden buffers, and several other options.

I just used my first Vim macro!

I knew they were super powerful, but I was avoiding them because the seemed like something hardcore Vim users used. I don't think I'm hardcore (yet). I've only used Vim for a month and a half!

Anyway, I was working in Patreon's code base and had to internationalize a bunch of strings so I recorded a macro to change 'some string' into __('some string'):


Now whenever I call @d, I save a few seconds.

My vimrc was getting disorganized after tinkering with it over the past month so I organized it into sections: Plug General, Appearance, Key Mappings, Leader Commands, Plugins, Coc, Autocommands, Commands, and Functions.

These sections are pretty self-explanatory, except I separated out "Coc" into it's own section out of "Plugins" because it has a bunch of extra configuration.

I also added a foldmethod comment (" vim:foldmethod=marker) so all the sections are collapsed when I open up my vimrc to change something.

Switched from vim-yoink to YankRing. Originally I discounted YankRing because the project was so old and didn't have any recent commits, but it appears to work okay (famous last words).

The thing I like about it that vim-yoink doesn't have is it allows you to view the entire clipboard with the YRShow command (I mapped to <Leader>y) and select one of the yanks to paste.

I use Alfred's built in clipboard history manager to cycle through different things I've copied, but it didn't work well with Vim. Formatting was messed up and my system clipboard picked up some Vim operators I didn't care about (mostly x).

I could have spent more time configuring, but for now I decided to go with vim-yoink, which "automatically maintain[s] a history of yanks that you can choose between when pasting." It even works with the system clipboard!

When I was writing a blog post in Vim, I wanted to turn on spellcheck and change a few other settings so I learned that I could use an autocommand to apply settings based on the open file type.

autocmd FileType markdown setlocal signcolumn=no spell textwidth=80 colorcolumn=+1

I found myself wanting a way to run things on the command line while using Vim so I decided to try out tmux. Like Vim, I had come across tmux before, but never found it that useful.

Now, I almost exclusively run Vim in tmux. With the vim-tmux-navigator plugin, you can quickly jump between Vim splits and tmux panes too.

Typically I will use two tmux panes. One on the left running Vim and one on the right for executing build scripts or tests. It's nice coding and seeing the results nearby.

Vim has a powerful ecosystem of plugins that do almost anything. I wanted to carefully approach installing plugins when I first started so I didn't end up with too many. My goal was to make Vim a little more like the IDEs I'd grown used to since I started programming.

With that in mind, I installed a plugin manager, vim-plug, and added a few to try out. By far the most useful plugin is coc.vim. I mentioned coc before in the output on snippets a couple days ago. It also powers my autocomplete, formatting, etc.

A close second to coc is fzf.vim, which allows me to open files and search code. I extended it to include a nice preview using bat and search really quickly with ripgrep.

Not all Vim plugins adds functionality. My color scheme is also a plugin! I'm using jellybeans. Vim is infinitely configurable and you can often find a plugin to help make a task easier or faster.

The first day I started using Vim, I configured a bunch of basic settings that are mostly unchanged today.

They are the foundation of my vimrc. Simple things like showing line numbers (set number) and the current mode (set showmode), and converting tabs to spaces (set tabstop=4).

I also disabled the arrow keys to force me to use hjkl for everything. Here's what my vimrc looked like back then.

In the last output, I said the next few would focus on documenting everything I learned before I signed up for Futureland. I lied. I'm learning too much, too quickly. Instead they will be a mix of previous learning and new stuff.

Now for some new stuff. Snippets. coc.vim, the ["Intellisense engine"] I'm using, includes an extension for code snippets. I’ve always wanted to use  snippets to speed up development (by reducing the amount of code I need to write) but never wanted to invest time in building up a repository of them.

With coc-snippets, I can take advantage of existing third-party snippet definitions. I already added a couple: vim-es2015-snippets and vim-react-snippets that are speeding things up.


I'm a month or so into learning Vim so thought I would start documenting the journey. It's a shame I didn't start recording from the beginning — since I learned a lot — but here we are now. Over the next few days, I'll catch Futureland up to speed, using my Git commit history. Today, I thought I would talk more about the motivation for learning Vim and how I got started.

Vim is a text editor for efficiently creating or changing text. It's popped up every so often since I started programming, but I always dismissed it. After feeling bored with VS Code and seeing a coworker use Vim. I decided I would explore making the switch. I could try it for a week and retreat to the comfort of VS Code if it wasn't for me.

I started on February 25, 2020 with an article on configuring Vim to play nicely with JavaScript. I wanted to make sure I could get an autocomplete, linting, etc. going before committing. Next, I did a few videos a day from Thoughtbot's Onramp to Vim course. After about a week of watching videos, reading blog posts, and using Vim for programming every day, I was hooked.

I wish I started learning Vim 10 years ago! There are not many things I can say that about.

tmm Vim