Skip to content

Instantly share code, notes, and snippets.

@mattijsbliek
Created July 6, 2017 12:29
Show Gist options
  • Save mattijsbliek/0ddff48ac09a118da292b78d834979e4 to your computer and use it in GitHub Desktop.
Save mattijsbliek/0ddff48ac09a118da292b78d834979e4 to your computer and use it in GitHub Desktop.
" Map leader key to ,
let mapleader = ","
" Map : to ;
nnoremap ; :
" Map ; to :
nnoremap : ;
" Move in visual lines instead of actual lines, handy when using wrapping
noremap j gj
noremap k gk
noremap gj j
noremap gk k
" Split lines in half at the cursor
nnoremap S i<cr><esc>^mwgk:silent! s/\v +$//<cr>:noh<cr>`w
" Turn off default regex characters and make searches use normal regexes
nnoremap / /\v
vnoremap / /\v
" Move to beginning and end of line with H and L
onoremap H ^
noremap H ^
noremap L $
" Get rid of search highlights with , space
noremap <silent> <leader><space> :noh<CR>
" The stuff below are some overrides I use and you can safely ignore. Feel free to change if you want though.
" Turn on syntax highlighting
syntax on
" Do not wrap lines
set nowrap
" Disable backups
set nobackup
" Disable swap files
set noswapfile
" Make Vim autoread changed files
set autoread
" Share clipboard with the OS
set clipboard=unnamed
" Set encoding to UTF-8
set encoding=utf-8
" Indentation settings
set linebreak
set tabstop=2
set noexpandtab
set shiftwidth=2
set smartindent
" Prevent zero leading numbers to be interpreted as octal
set nrformats=hex
" Ignore case for searches
set ignorecase
" When you do type an uppercase character, switch to case sensitive search
set smartcase
" Applies substitutions globally on lines
set gdefault
" The lines below work together to highlight search results (as you type)
set hlsearch
set incsearch
set showmatch
" Use many muchos levels of undo
set undolevels=1000
" Don't beep
set noerrorbells
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment