Chris's Digital Picnic

I've Finally Made It to Vim!

12 September 2025
by Chris Were

Unlike Kier Starmer my father was not a toolmaker, today I’d like to talk about a tool, made by a toolmaker.

I can’t believe I’ve been on Linux full-time for over 10 years without learning how Vim works. It’s the preferred text editor of almost everyone I know, and it’s a crime I didn’t give it a try sooner.

When it comes to learning Vim, I was very fortunate to have Drew walk me through the basics, as well as some advanced Vim techniques. Since then, I’ve hardly used anything else.

In fact, I’ve started using Vim for tasks I hadn’t previously used a text editor for. I’ve adopted calendar.txt as my calendar and todo.txt to organise my tasks. My go-to approach for new tasks is now to see how they can be handled in plain text.

But it doesn’t stop there. Keeping information in plain text has made me more familiar with other command-line tools, such as grep, which allows me to filter and view specific parts of a text file. I also use the terminal file browser nnn alongside Vim to rename and sort files. It’s incredibly satisfying to have all these tools work together in simple, yet highly effective ways. I’ve always been a fan of “the UNIX way,” but I’ve never truly lived it until now—and it all started with Vim.

For those who don’t know, Vim is a text editor, similar to Windows Notepad, where you can create and edit text files. But unlike Notepad, Vim comes with powerful tools for coding and all other forms of writing.

Lately, I’ve changed my workflow significantly: I’ve moved from Xfce to i3, from Nano to Vim, and from GUI applications to plain text and their CLI counterparts. I’ll be journaling more about this journey, but returning to a command-line-focused workflow is proving to be incredibly rewarding.

In the interest of completeness here is my .vimrc file, so you call all see how I’ve customised it.

unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim
set nocompatible
set nobackup
set nowritebackup
set noswapfile
set ruler
set showcmd
set incsearch
set hlsearch
set noautoindent
set nocursorline
set laststatus=2
set wrap
set wrapscan
set linebreak
set showbreak=↪
set nolist
set number
set mouse=a
set clipboard=unnamedplus
set noexpandtab
set tabstop=4
set softtabstop=0
set noexpandtab
set shiftwidth=4
set hidden
set ignorecase
set smartcase
set formatoptions-=cro
set spell spelllang=en_gb
set spellsuggest=best,10
set nospell


" Change the highlight for misspelled words
highlight SpellBad ctermfg=red ctermbg=NONE cterm=underline
highlight SpellCap ctermfg=yellow ctermbg=NONE cterm=underline
highlight SpellRare ctermfg=magenta ctermbg=NONE cterm=underline
highlight SpellLocal ctermfg=cyan ctermbg=NONE cterm=underline

" Cursor shapes
let &t_SI = "\<Esc>[6 q"
let &t_SR = "\<Esc>[4 q"
let &t_EI = "\<Esc>[2 q"

" Save as root
cmap w!! w !sudo tee > /dev/null %

" Remember buffers
set viminfo^=%

" Tweaks for browsing
set autochdir
let g:netrw_banner=0        " disable annoying banner
let g:netrw_browse_split=4  " open in prior window
let g:netrw_altv=1          " open splits to the right
let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+'  " hide dotfiles on load.
let g:netrw_keepdir = 0     " keep the current directory and the browsing directory synced. 
let g:netrw_winsize=30

map <silent> <C-E> :Lexplore<CR>
function! NetrwMapping()
endfunction

augroup netrw_mapping
    autocmd!
    autocmd filetype netrw call NetrwMapping()
augroup END

function! NetrwMapping()
    nmap <buffer> H u
    nmap <buffer> h -^
    nmap <buffer> l <CR>
    nmap <buffer> . gh
    nmap <buffer> P <C-w>z
    nmap <buffer> L <CR>:Lexplore<CR>
    nmap <buffer> <C-E> :Lexplore<CR>
endfunction

" set leader to space
map <SPACE> <leader>

" Bindings
nnoremap <leader>s :setlocal spell! spell?<CR>
nnoremap <leader>v :set relativenumber! relativenumber?<CR>
nnoremap <Tab> :bNext<CR>
nnoremap <S-Tab> :bprevious<CR>
nnoremap <leader><space> :nohlsearch<CR>
nnoremap <Up> gk
nnoremap <Down> gj
nnoremap j gj
nnoremap k gk
inoremap <Up> <C-o>gk
inoremap <Down> <C-o>gj
vnoremap <leader>y :w !xclip -selection clipboard<CR>

" Shorter tabs for HTML files
autocmd FileType html setlocal tabstop=2
autocmd FileType html setlocal softtabstop=2
autocmd FileType html setlocal shiftwidth=2
autocmd FileType html setlocal noexpandtab