-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathvimrc
More file actions
269 lines (206 loc) · 5.61 KB
/
vimrc
File metadata and controls
269 lines (206 loc) · 5.61 KB
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
" vim: set fdm=marker:
" Variables {{{
let s:is_windows = has('win32') || has('win64')
"}}}
" Setting up vim-plug as the package manager {{{
if !filereadable(expand("~/.vim/autoload/plug.vim"))
echo "Installing vim-plug and plugins. Restart vim after finishing the process."
silent call mkdir(expand("~/.vim/autoload", 1), 'p')
execute "!curl -fLo ".expand("~/.vim/autoload/plug.vim", 1)." https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
autocmd VimEnter * PlugInstall
endif
set rtp+=~/.vim
call plug#begin('~/.vim/plugged')
" Sensible defaults {{{
Plug 'tpope/vim-sensible'
" }}}
" #Colour schemes {{{
Plug 'tomasr/molokai'
Plug 'sjl/badwolf'
Plug 'Lokaltog/vim-distinguished'
Plug 'goatslacker/mango.vim'
Plug 'whatyouhide/vim-gotham'
" }}}
" #Visual improvements {{{
" Status bar
Plug 'bling/vim-airline'
" Highlight current paragraph
Plug 'junegunn/limelight.vim'
" }}}
" #Language specific - syntax and helpers {{{
" #Coffeescript {{{
" General syntax
Plug 'kchmck/vim-coffee-script'
" Coffeescript with JSX (CJSX)
Plug 'mtscout6/vim-cjsx'
" }}}
" #Javascript {{{
Plug 'jelera/vim-javascript-syntax'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
let g:jsx_ext_required=0
Plug 'slava/vim-spacebars'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'Raimondi/delimitMate'
Plug 'marijnh/tern_for_vim', { 'do': 'npm install && curl https://raw.githubusercontent.com/Slava/tern-meteor/master/meteor.js > node_modules/tern/plugin/meteor.js' }
let g:tern_map_keys=1
let g:tern_show_argument_hints='on_hold'
" }}}
" #Clojure {{{
Plug 'guns/vim-clojure-static'
" }}}
" #Python {{{
" Linting, code completion, refactoring
Plug 'klen/python-mode'
let g:pymode_rope = 0
" Better code completion - replaces rope in python-mode
Plug 'davidhalter/jedi-vim'
"}}}
" #HTML / CSS {{{
" Zen coding for vim
Plug 'mattn/emmet-vim'
" Add colors to CSS color codes
Plug 'ap/vim-css-color'
" }}}
" Markdown {{{
Plug 'tpope/vim-markdown'
" }}}
" }}}
" #Git integration {{{
" Git commands in vim
Plug 'tpope/vim-fugitive'
" Git diff icons in gutter
Plug 'airblade/vim-gitgutter'
" }}}
" Syntax highlighting {{{
Plug 'scrooloose/syntastic'
let g:syntastic_check_on_open = 1
let g:syntastic_javascript_checkers = ['eslint']
" }}}
" Auto-completion {{{
if s:is_windows
Plug 'ajh17/VimCompletesMe'
else
Plug 'Valloric/YouCompleteMe', { 'do': './install.sh' }
endif
" }}}
" Seamless navigation between tmux and vim {{{
Plug 'christoomey/vim-tmux-navigator'
" }}}
" Vim motions on speed {{{
Plug 'Lokaltog/vim-easymotion'
" }}}
" File browser {{{
Plug 'scrooloose/nerdtree'
let g:NERDTreeDirArrows=0
" Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'kien/ctrlp.vim'
" }}}
" Toggle comments with gc {{{
Plug 'tpope/vim-commentary'
" }}}
" Easily manipulate surroundings {{{
Plug 'tpope/vim-surround'
" }}}
" Start screen {{{
Plug 'mhinz/vim-startify'
" }}}
" #Random plugins {{{
" Touch typing tutor
Plug 'thanthese/Tortoise-Typing'
" Sublime text style minimap
Plug 'severin-lemaignan/vim-minimap'
" Distraction free writing
Plug 'junegunn/goyo.vim'
" }}}
" Check for uninstalled plugins {{{
" and prompt to install if found
" }}}
call plug#end()
" }}}
" #Essentials {{{
" Set leader
let mapleader = "\\"
" Set colorscheme
let $TERM = "xterm-256color"
set t_Co=256
if s:is_windows " trick to support 256 colors in conemu for Windows
let &t_AF="\e[38;5;%dm"
let &t_AB="\e[48;5;%dm"
endif
set background=dark
colorscheme molokai
" Set modelines on
set modeline
" Shortcut to edit .vimrc
nnoremap <leader>ev :e $MYVIMRC<CR>
" Shortcut to reload .vimrc
nnoremap <leader>sv :source $MYVIMRC<CR>
" Allow multiple buffers to be open
set hidden
" Turn off line wrapping
set nowrap
" Make backspace be sensible
set backspace=indent,eol,start
" Automatically indent
set autoindent
" Copy indentation if auto is confused
set copyindent
" Turn on syntax highlighting
syntax on
" Set tabs
set tabstop=2
set shiftwidth=2
set expandtab
autocmd Filetype python setlocal ts=4 sw=4 expandtab
" Highlight matching braces/tags
set showmatch
" Vim can set title of window
set title
" Use a visual indicator rather than a beep
set visualbell
" Set search options
set hlsearch " Highlight search
set incsearch " Immediately highlight
set ignorecase " Ignore case
set smartcase " Case sensitive if caps used
nnoremap <leader><space> :nohlsearch<CR>
" Folding
set foldenable " enable folding
set foldlevelstart=10
set foldnestmax=10
set foldmethod=indent " fold based on indent
nnoremap <space> za " space opens fold
" swap and backup
set nobackup
set nowritebackup
set noswapfile
" Turn line numbers on
set number
set cursorline " highlight current line
" Easier split navigation
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-H> <C-W><C-H>
nnoremap <C-L> <C-W><C-L>
set splitright
set splitbelow
" Easier escaping
:imap jk <Esc>
" Easier saving
nnoremap w :w<cr>
set wildmenu " visual autocomplete for command menu
set wildignore+=*/node_modules/* " Ignore certain dirs
" }}}
" #Extra Functions {{{
" Remap <Enter> to split the line and insert a new line in between if BreakLine return True
fun! BreakLine()
if (mode() == 'i')
return ((getline(".")[col(".")-2] == '{' && getline(".")[col(".")-1] == '}') ||
\(getline(".")[col(".")-2] == '(' && getline(".")[col(".")-1] == ')'))
else
return 0
endif
endfun
inoremap <expr> <CR> BreakLine() ? "<CR><ESC>O" : "<CR>"
" }}}