Skip to content

Instantly share code, notes, and snippets.

@0xBEEB
Created May 20, 2016 16:50
Show Gist options
  • Save 0xBEEB/c8f38db39b4af0f3b14ec63d7eaf7c11 to your computer and use it in GitHub Desktop.
Save 0xBEEB/c8f38db39b4af0f3b14ec63d7eaf7c11 to your computer and use it in GitHub Desktop.
" Make Vim more useful
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
call vundle#end()
filetype plugin indent on
set background=dark
colorscheme jellybeans
set t_Co=256
if $COLORTERM == 'gnome-terminal'
set t_Co=256
endif
" Allow cursor keys in insert mode
set esckeys
" Allow backspace in insert mode
set backspace=indent,eol,start
" Optimize for fast terminal connections
set ttyfast
" Add the g flag to search/replace by default
set gdefault
" Use UTF-8 without BOM
set encoding=utf-8 nobomb
set termencoding=utf-8
" Don’t add empty newlines at the end of files
set binary
set noeol
" Centralize backups, swapfiles and undo history
set history=1000
set hidden
set backupdir=~/.vim/backups
set directory=~/.vim/swaps
if exists("&undodir")
set undodir=~/.vim/undo
endif
" Uses language syntax to indent
set smartindent
" min space between lines
set linespace=0
" Don’t create backups when editing files in certain directories
set backupskip=/tmp/*,/private/tmp/*
" Respect modeline in files
set modeline
set modelines=4
" Enable per-directory .vimrc files and disable unsafe commands in them
set exrc
set secure
" Enable line numbers
set number
" Enable syntax highlighting
syntax on
" Highlight current line
set cursorline
set cursorcolumn
hi ColorColumn ctermbg=black guibg=black
" Make tabs as wide as two spaces
set tabstop=4
set shiftwidth=4
set expandtab
set softtabstop=4
" Show “invisible” characters
set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
set list
" Highlight searches
set hlsearch
" Ignore case of searches
set ignorecase
" Highlight dynamically as pattern is typed
set incsearch
" Always show status line
set laststatus=2
" Enable mouse in all modes
set mousehide
set mouse=a
" Disable error bells
set noerrorbells
" Don’t reset cursor to start of line when moving around.
set nostartofline
" Show the cursor position
set ruler
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%)
" Don’t show the intro message when starting Vim
set shortmess=atI
" Show the current mode
set showmode
" Show the filename in the window titlebar
set title
" Show the (partial) command as it’s being typed
set showcmd
" Start scrolling three lines before the horizontal window border
set scrolloff=8
" Show matching braces
set showmatch
set matchtime=5
" Splits
set fillchars=""
" Searches
set mat=2
set incsearch
set ignorecase
set smartcase
set hlsearch
set wrapscan
set sm
set magic
set wildmenu
set wildignore=*.dll,*.o,*.obj,*.bak,*.exe,*,pyc,*.jpg,*.gif,*.png
set virtualedit=all
" Visual bell
set vb
set novisualbell
set noerrorbells
" Strip trailing whitespace (,ss)
function! StripWhitespace()
let save_cursor = getpos(".")
let old_query = getreg('/')
:%s/\s\+$//e
call setpos('.', save_cursor)
call setreg('/', old_query)
endfunction
noremap <leader>ss :call StripWhitespace()<CR>
" Save a file as root (,W)
noremap <leader>W :w !sudo tee % > /dev/null<CR>
" Remaps
nnoremap ; :
nnoremap j gj
nnoremap k gk
nnoremap Y y$
vmap <C-c> "+y
vmap <C-x> "+d
vmap <C-p> "+gp
let mapleader=","
let g:mapleader=","
imap jk <ESC>
" Plugin configs
let g:ctrlp_working_path_mode='ra'
let g:ctrlp_user_command='find %s -type f'
let g:vim_markdown_folding_disabled=1
let g:vim_markdown_math=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment