Skip to content

Instantly share code, notes, and snippets.

@BillyHilly
Created November 14, 2018 15:47
Show Gist options
  • Save BillyHilly/10b879e9bd0df30b9aeb8592098d5a22 to your computer and use it in GitHub Desktop.
Save BillyHilly/10b879e9bd0df30b9aeb8592098d5a22 to your computer and use it in GitHub Desktop.
VIM .vimrc settings
" Enable pathogen
execute pathogen#infect()
" Custom VIM Config
" " SRC: https://github.com/mcgheee/MyDotFiles/blob/master/.vimrc
" Enable syntax highlighting
syntax on
" Enable filetype plugins
filetype plugin indent on
" Sets how many lines of history VIM has to remember
set history=500
" Set to auto read when a file is changed from the outside
set autoread
" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
let mapleader = ","
let g:mapleader = ","
" Fast saving
nmap <leader>w :w!<cr>
" :W sudo saves the file
" (useful for handling the permission-denied error)
command W w !sudo tee % > /dev/null
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" For regular expressions turn magic on
set magic
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=2
set tabstop=2
" Linebreak on 500 characters
" set lbr
" set tw=500
" set ai "Auto indent
" set si "Smart indent
" set wrap "Wrap lines
" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Remember info about open buffers on close
set viminfo^=%
" Always show the status line
set laststatus=2
" Pressing ,ss will toggle and untoggle spell checking
map <leader>ss :setlocal spell!<cr>
set statusline=%F%h%m%r%w%=\Column:\ %3c\ -\ \Line:\ %l/%-5L
" Enable ruler
set ruler
" Enable Line Numbers
set number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment