Skip to content

Instantly share code, notes, and snippets.

@vehrka
Created July 31, 2019 07:12
Show Gist options
  • Save vehrka/71b289bfe79854da0d92e8480bd42f15 to your computer and use it in GitHub Desktop.
Save vehrka/71b289bfe79854da0d92e8480bd42f15 to your computer and use it in GitHub Desktop.
Minimal vimrc
set number
set numberwidth=5
set nocompatible " be iMproved, required
set backspace=indent,eol,start " Backspace for dummies
set linespace=0 " No extra spaces between rows
set showmatch " Show matching brackets/parenthesis
set incsearch " Find as you type search
set hlsearch " Highlight search terms
set winminheight=0 " Windows can be 0 line high
set ignorecase " Case insensitive search
set smartcase " Case sensitive when uc present
set wildmenu " Show list instead of just completing
set wildmode=list:longest,full " Command <Tab> completion, list matches, then longest common part, then all.
set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap too
" Put backup and temporary files where they don't bother
" "
set backupdir=~/.vim/vim-tmp,~/.tmp,~/tmp,~/var/tmp,/tmp
set directory=~/.vim/vim-tmp,~/.tmp,~/tmp,~/var/tmp,/tmp
" Improved block moves
"
vnoremap < <gv
vnoremap > >gv
" Automatically jump to end of text you pasted
"
vnoremap <silent> y y`]
vnoremap <silent> p p`]
nnoremap <silent> p p`]
" In visual mode C-r gets the selected text and ofers replace
"
vnoremap <C-r> "hy:%s/<C-r>h//gc<left><left><left>
" I never want regular Visual mode
"
nnoremap v <C-V>
nnoremap <C-V> v
vnoremap v <C-V>
vnoremap <C-V> v
" Square up visual selections...
set virtualedit=block
" " Make BS/DEL work as expected in visual modes (i.e. delete the selected text)...
vmap <BS> x
" Make vaa select the entire file...
vmap aa VGo1G
" How many times
"
nmap <leader>s :%s///g<LEFT><LEFT><LEFT>
vmap <leader>s :s///g<LEFT><LEFT><LEFT>
nmap <leader>t :%s/ *$//g<cr>
vmap <leader>t :s/ *$//g<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment