Simply Vim
In search of a calm editor with few distractions, I made a configuration for the Vim text editor. While some don’t consider Vim to be an editor with low cognitive load, I humbly disagree with this. Yes it has a learning curve, but it’s well documented, and you can learn basic functionality very quickly. Also, the basic use of Vim does not change much, so everything you learn is knowledge you’ll be able to use for decades.
Note: there’s also nvi which is even lighter than vim.
Unfortunately that doesn’t provide UTF-8 support, which makes it unsuitable for some of my writing.
You can get the configuration (.vimrc) at #code
Features
- No syntax highlighting by default
- No package management, so no automatic updates and breakage. Just download the plugins you use and put them in `~/.vim`
- Most settings from vim-sensible by Tim Pope, but without the plugin
- Toggle light / dark background
- Clear the search highlight
- For a nice writing environment, I use the *Goyo* and *Limelight* plugins
- Insert a timestamp easily
- All the power the Vim editor offers!
Keyboard shortcuts
Use these in 'normal' mode. Press SPACE before each key.
| Key | Action |
|---|---|
| c | Clear search highlight |
| d | Toggle dark / light background |
| s | Toggle syntax highlighting |
| t | Insert timestamp |
| G | Toggle the Goyo plugin (center your text) |
| L | Toggle the Limelight plugin (highlight current paragraph, darken others) |
A few tips on using Vim
Vim offers a lot of shortcuts for functionality to help you edit conveniently and fast. But you don’t need to remember them all. I don’t. Here are a few I do use regularly and which seem to stick in my mind.
| Key | Action |
|---|---|
| { | Move cursor to before current paragraph |
| } | Move cursor to after current paragraph |
| /Fore | Move cursor to next occurrence of 'Fore' |
| ?Back | Move cursor to previous occurrence of 'Back' |
| n | Move cursor to next match of previous search term |
| gg | Move cursor to beginning of file |
| G | Move cursor to end of file |
| :42 | Move cursor to line 42 |
| y4l | Yank (copy) the next 4 characters starting from the cursor |
| y4y | Yank (copy) 4 lines starting from the cursor |
| p | Paste yanked contents after current line |
| P | Paste yanked contents before current line |
| :pu | Paste yanked contents before current line |
| ciw | Replace word (think Change In Word) |
| ci( | Change next text between () |
| ci< | Change next text between < and > (think HTML tags) |
| . | Repeat last modification action |
Screenshots
Below are some screenshots of how this configuration of Vim looks. Click on them to see a larger version. I mostly have Limelight and syntax disabled, and use Vim full screen. So my screen usually looks like something resembling the first screenshot.
Code
Save this file as $HOME/.vimrc and customize it to your heart’s desire :-)
1" vi compatibility
2set nocompatible
3
4" locale
5language en_US.UTF-8
6
7" Encoding
8set encoding=utf-8
9
10" true color support
11set termguicolors
12
13" Color scheme (terminal)
14set t_Co=256
15
16" Syntax highlighting
17syntax off
18
19" Blink cursor on error instead of beeping (grr)
20set visualbell
21
22" How many lines of command history to remember?
23set history=1000
24
25" Show status line
26set laststatus=2
27
28" Show menu for completion
29set wildmenu
30
31" Show cursor position
32set ruler
33
34" Reread file changed outside vim
35set autoread
36
37" Delete comment character when joining commented lines
38set formatoptions+=j
39
40" Wrapping
41set wrap
42" Wrap at word boundary
43set lbr
44
45" Whitespace
46set textwidth=0
47set formatoptions=tcqrn1
48set tabstop=8
49set shiftwidth=8
50set softtabstop=8
51set noexpandtab
52set noshiftround
53set smarttab
54
55" How to indicate whitespace
56set listchars=tab:⟶\ ,trail:▸,extends:⟶,precedes:⟵,nbsp:+
57
58" Incremental search
59set incsearch
60
61" Highlight search
62set hlsearch
63
64" For plugins to load correctly
65filetype plugin indent on
66
67" limelight
68let g:limelight_conceal_ctermfg = 'gray'
69let g:limelight_conceal_ctermfg = 240
70
71" Use space for keyboard shortcuts
72nnoremap <SPACE> <Nop>
73let mapleader=" "
74
75" toggle syntax on/off
76nnoremap <expr> <Leader>s exists("syntax_on") ? ':syntax off<CR>' : ':syntax on<CR>'
77
78" toggle background light/dark
79nnoremap <expr> <Leader>d &background == 'light' ? ':set background=dark<CR>' : ':set background=light<CR>'
80
81" toggle listing of whitespace
82nnoremap <expr> <Leader>w ':set list!<CR>'
83
84" clear search highlight
85nnoremap <expr> <Leader>c ':noh<CR>'
86
87" insert timestamp
88map <Leader>t :put =strftime('%Y-%m-%d %a, %H:%M')<CR>
89
90" toggle Goyo
91nnoremap <expr> <Leader>G ':Goyo<CR>'
92
93" toggle Limelight
94nnoremap <expr> <Leader>L ':Limelight!!<CR>'


