Evert Provoost

Editors

Yes, you read that right, I use both Neovim and Emacs, let me explain.

If you want to know more about these two and don’t really care for my use case, start reading from About vi and Emacs.

Why?

Well, Emacs is in general a better environment, vi is a better editor. If I need to edit some configuration file quickly I’ll grab Neovim, once I start coding I’ll go ahead and use Emacs.

Two different editor types?!

Oh, I seem to have forgotten to mention, I use Emacs with Evil-mode, the best of vi and Emacs in one.

About vi and Emacs

Why use these ancient pieces of software?

You say ‘ancient’ as if it’s a bad thing… The fact that they are ancient is probably the major reason to use them! Emacs and vi have huge user bases, for every question there is probably an answer on-line. Plug-ins for most programming languages, great spell-checkers, etc.

Okay, okay you’ve got my interest, where do I get started?

Here my personal bias towards modal editing will come into play, but there is a correlation between Emacs default key bindings and RSI, so my preference is somewhat justified.

I’d personally suggest to start slow, others will say to dive right in and to not use anything else but vi and especially Emacs need some configuring to get it to your liking so it’s usually best to start using it for smaller projects and files first so you get a feel for everything.

It’s also because of this I’d suggest starting with vi, it has modal editing out of the box.

So vi, the search engine gives me Vim, Neovim, Vile…

All of those will work, however the Vim and Neovim communities are by far the largest, as you might have seen on my about page I use Neovim, it has some saner defaults and for the remainder of the text I assume you are using Neovim too. However Vim is fine too, Neovim is a fork of Vim anyway so they aren’t too different.

Getting started with (Neo)vim

At this point I’d say search the internet, there are some amazing resources on-line, however I can give you some configuration tips to get you started.

You can add these to your .config/nvim/init.vim (.vimrc with Vim):

You will learn Neovim configuration as you go but these six can kick start your editing speed.

Faster mode switching

The main reason I see people quit using vi is because they get into the habit of only working in insert mode, this is because on modern keyboards the escape key is rather uncomfortable to press. Die-hard vi users will probably configure their OS to swap the escape and caps-lock key, others might use Ctrl-C (which is bound by default) however the main comfort of vi is staying on the home row of the keyboard for most operations.

Therefore I prefer to use a bind jj to exit insert mode.

" Add jj in insert mode to exit said mode
inoremap jj <Esc>

For those who worry about accidentally typing “jj”, the only words containing this string of characters I found are “hajjes”, “hajjis”, “hajji” and “hajj”. If this is a problem for you “jk” has only one conflict: “pirojki”.

More configuration snippets

Move by visual line

" Move vertically by visual line
noremap j gj
noremap k gk
" You are using vi keys right? ;-)
noremap <Down> gj
noremap <Up> gk

Hide search highlights with Ctrl-L

" Make C-L not only refresh screen but also
" remove search highlights
nnoremap <C-L> :nohlsearch<CR><C-L>

Line numbering

" Linenumbers
set number
set relativenumber

Use the system clipboard

" Use system clipboard
set clipboard^=unnamed,unnamedplus

Be able to use the mouse for some things

" Add mouse support
set mouse=a

80 characters long lines

" Automatically wrap at 80 characters
set textwidth=80
" Show a line where the 80 character limit ends
set colorcolumn=81

Make tabs more like other editors

" Make tabs 4 spaces wide
set tabstop=4
set shiftwidth=4

Hightlight whitespace at the end of lines

" Hightlight whitespace at the end of lines
set list