/
vimrc
154 lines (122 loc) · 3.36 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
" Adapted from sample .vimrc file by Martin Brochhaus
" Presented at PyCon APAC 2012
"" Remove vi compatibility
set nocompatible
set ruler
set showcmd
set smartindent
" Breaks pasting
""" set autoindent
xnoremap p pgvy
set visualbell "No sounds
set autoread "Reload files changed outside vim
" Mouse and backspace
set mouse=a " on OSX press ALT and click
set bs=2 " make backspace behave like normal again
set laststatus=2
" Automatic reloading of .vimrc
autocmd! bufwritepost .vimrc source %
" Look for tags recursively
set tags=tags;/
" Showing line numbers and length
set number " show line numbers
set tw=79 " width of document (used by gd)
set nowrap " don't automatically wrap on load
set fo-=t " don't automatically wrap text when typing
set colorcolumn=80
" Real programmers don't use TABs but spaces
set tabstop=4
set softtabstop=4
set shiftwidth=4
set shiftround
set expandtab
" Make search case insensitive
set hlsearch
set incsearch
set ignorecase
set smartcase
" Disable stupid backup and swap files - they trigger too many events
" for file system watchers
set nobackup
set nowritebackup
set noswapfile
" Function to conditionally disable plugins used below
function! Cond(cond, ...)
let opts = get(a:000, 0, {})
return a:cond ? opts : extend(opts, { 'on': [], 'for': [] })
endfunction
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin()
Plug 'fatih/vim-go'
Plug 'b4winckler/vim-objc'
Plug 'christoomey/vim-tmux-navigator'
Plug 'duff/vim-scratch'
Plug 'eraserhd/vim-ios', Cond(has('gui_macvim'))
Plug 'flazz/vim-colorschemes'
Plug 'junegunn/goyo.vim'
Plug 'kien/ctrlp.vim'
Plug 'kien/rainbow_parentheses.vim'
Plug 'plasticboy/vim-markdown'
Plug 'rhysd/vim-clang-format'
Plug 'mileszs/ack.vim'
Plug 'sjl/gundo.vim'
Plug 'tomtom/tcomment_vim'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-speeddating'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'vim-scripts/camelcasemotion'
Plug 'vim-scripts/matchit.zip'
call plug#end()
" Enable 256 colors
set t_Co=256
syntax on
filetype off
set background=dark
let g:molokai_original = 1
colorscheme molokai
"""au FileType javascript call JavaScriptFold()
" map control-backspace to delete the previous word
:imap <C-BS> <C-W>
if has('gui_running') || has('gui_macvim')
source $HOME/.vim/gui_settings.vim
endif
" Smart Status Line
set statusline=%F%m%r%h%w
set cursorline
"Spell checker options
set spellsuggest=5
" ================ Persistent Undo ==================
" " Keep undo history across sessions, by storing in file.
" " Only works all the time.
"
silent !mkdir ~/.vim/backups > /dev/null 2>&1
set undodir=~/.vim/backups
set undofile
" Add abbreviations
source $HOME/.vim/abbreviations.vim
" Add omnicomplete for filetypes
source $HOME/.vim/languages_omni.vim
set completeopt-=preview
let mapleader = ","
" Replace Ex-Mode with ,
noremap Q ,
" Gvim settings
so $HOME/.vim/settings.vim
if has("unix")
let s:uname = system("uname")
if system("uname") == "Darwin\n"
so $HOME/.vim/settings_mac.vim
endif
endif
if filereadable(expand('~/.vimrc_local'))
" Local vimrc
source ~/.vimrc_local
endif
filetype plugin indent on