1 min read

tiny-vim.rc

My tiny vim configuration for whenever I need to hop on a server

  • vim

I started using vim for the usual reasons, at a point in time when I couldn’t even touch type it seemed like dark magic when I saw a colleague using it. But nowadays it’s just so ingrained in me that it’s physically painful editing text without it.

The advent of AI enabled editors was maybe the first and only threat to my usage of vim, I did tip my toes in that pond, but thankfully agentic development through claude code turned out to be the best way to interface with AI, and vim does very well there.

Anyway, these days I occasionally need to jump on a server to debug something and when that time comes it’s very useful to have all my vim utilities at hand. I purposefully keep my own config very vanilla so that it’s never shocking going back to an older version of vim.

The following is the config I pull into the server to setup vim to my liking.

" Oneliner to import from the shell
" vim -c ':so https://gist.github.com/bhugoVilela/33d3dc7e317adcabab32e19053d1a520/raw/6f7e12330cfa1243d862c35c89e8635075d78485/tiny.vim'
inoremap jk <esc>
set nu
set relativenumber
set nowrap
set nohlsearch
set incsearch
set scrolloff=8
let mapleader = " "
set ignorecase
set smartcase
set smartindent
set noswapfile
set completeopt=menuone,noselect
set splitright
set splitbelow

nnoremap <leader>ex :Ex<CR>
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
nnoremap J mzJ`z
nnoremap <leader>y "*y
vnoremap <leader>y "*y
nnoremap <leader>Y "*Y
nnoremap <C-h> ^
nnoremap <C-l> $
inoremap <C-h> ^
inoremap <C-l> $
vnoremap <C-h> ^
vnoremap <C-l> $
tnoremap <esc> <C-\><C-n>
tnoremap jk <C-\><C-n>
inoremap jk <esc>
nnoremap <C-p> <C-^>
xnoremap . :norm .<CR>
augroup netrw_mapping
    autocmd!
    autocmd FileType netrw execute 'nmap <buffer> l <Enter>' |
        \ execute 'nmap <buffer> h -' |
        \ execute 'nmap <buffer> <C-l> <Enter>' |
        \ execute 'nmap <buffer> <C-h> -'
augroup end