Skip to content

Instantly share code, notes, and snippets.

@jonduarte
Created August 16, 2017 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonduarte/1c3cadf39acb6aa3a27251260428b214 to your computer and use it in GitHub Desktop.
Save jonduarte/1c3cadf39acb6aa3a27251260428b214 to your computer and use it in GitHub Desktop.
" Pathogen
execute pathogen#infect()
syntax on
" load ctrlp
set runtimepath^=~/.vim/bundle/ctrlp.vim
" set <Leader> key as "," originally was \
let mapleader=","
set encoding=utf-8
set history=100
set t_Co=256
set background=dark
filetype indent on
"set line numbers
set number
set scrolloff=3
set splitbelow
set splitright
" show matching brackets
set showmatch
set backspace=2
colorscheme railscasts
"-------------------------Search-------------------------
" refine search at every stroke
set incsearch
" highlight search results
set hlsearch
" clear search highlights
nnoremap <silent> <C-L> :nohls<CR><C-L>
" case non-sensitive
set ignorecase
"-------------------------Tabs and Spaces-----------------------
" make tabs work as spaces with width of 2 spaces by default
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set autoindent
set smartindent
"-------------------------Visual--------------------------------
" draw a vertical line at the 81st column
set colorcolumn=81
" substitute special characters with symbols
set list listchars=eol:$,trail:·,tab:>·
" customize statuslbar
set statusline=%f\ %h%m%r%w%=%(%l,%c%V%)\ %P
" Always show status bar
set laststatus=2
"-------------------------Mappings------------------------------
" make k, j, 0, $ work regardless of line wrap
map k gk
map j gj
map 0 g0
map $ g$
" Yank from the cursor to the end of the line
nmap Y y
" edit ~/.vimrc
nmap <Leader>ev :e $MYVIMRC<enter>
nmap <Leader>, <c-^>
nmap <Leader>tf :A<enter>
nmap <Leader>cp :set paste<enter>
nmap <Leader>ecp :set nopaste<enter>
"nmap <C-R> :CtrlPMRUFiles<enter>
"-------------------------Auto-Commands-------------------------
" wrap autcmd in groups so vim doesn't duplicated them
" ensure all the commands start from scratch
augroup autosourcing
autocmd!
" Remove extra white spaces after saving file
autocmd BufWritePre * :%s/\s\+$//e
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment