-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
188 lines (157 loc) · 5.88 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
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
set nocompatible
source $VIMRUNTIME/mswin.vim
behave mswin
" On Windows, also use '.vim' instead of 'vimfiles'; this makes synchronization
" across (heterogeneous) systems easier.
if has('win32') || has('win64')
set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
"For Win32 GUI remove 't' flag from 'guioptions': no tearoff menu entries
let &guioptions = substitute(&guioptions, "t", "", "g")
au GUIEnter * simalt ~x
endif
" Use bundles config
if filereadable(expand("~/.vim/.vimrc.bundles"))
source ~/.vim/.vimrc.bundles
endif
" ================ General Config ====================
set backspace=indent,eol,start "Allow backspace in insert mode
set showcmd "Show incomplete commands at the bottom
set cmdheight=2
set showmode "Show current mode
set autoread "Reload files changed outside vim
set hidden "http://items.sjbach.com/319/configuring-vim-right
set history=1000 "Store :cmdline history
set visualbell "No sounds
set noerrorbells
set number "Line numbers
set ruler
set mouse=a
set fileformats=unix,dos,mac
set showmatch
set foldenable
set foldmethod=indent
set foldlevel=100
"Turn on syntax highlighting
syntax on
filetype on
filetype plugin on
filetype indent on
" ================ Indentation ======================
set tabstop=4
set shiftwidth=4
set softtabstop=4
set autoindent
set smartindent
set smarttab
set expandtab
set nowrap
set linebreak
" ================ Turn Off Swap Files ==============
set nobackup
set nowritebackup
set noswapfile
" ================ Search settings ====================
set incsearch
set hlsearch
set ignorecase
set smartcase
" ================ Completion =======================
set wildmenu
set wildmode=list:longest
" ================ Scrolling ========================
set scrolloff=5 "Start scrolling when we're n lines away from margins
set sidescrolloff=5
set sidescroll=1
set guioptions+=b "Show horizontal scrollbar
set guioptions-=T
let mapleader = ','
let g:molokai_original = 1
colorscheme molokai
if has('win32') || has('win64')
set guifont=Consolas:h10:cANSI
elseif has('gui_gtk2')
set guifont=Ubuntu\ Mono\ 11
endif
if has('gui_macvim')
autocmd VimLeave * macaction terminate:
endif
" Plugins {
" javascript {
let g:html_indent_inctags = "html,body,head,tbody"
let g:html_indent_script1 = "inc"
let g:html_indent_style1 = "inc"
" }
" NeoComplCache {
let g:acp_enableAtStartup = 0
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_enable_smart_case = 1
let g:neocomplcache_enable_camel_case_completion = 1
let g:neocomplcache_enable_underbar_completion = 1
let g:neocomplcache_enable_auto_delimiter = 1
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_max_list = 15
" Define file-type dependent dictionaries.
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ }
" Define keyword, for minor languages
if !exists('g:neocomplcache_keyword_patterns')
let g:neocomplcache_keyword_patterns = {}
endif
let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
" Plugin key-mappings.
inoremap <expr><C-g> neocomplcache#undo_completion()
inoremap <expr><C-l> neocomplcache#complete_common_string()
" <CR>: close popup and save indent.
inoremap <expr><CR> neocomplcache#smart_close_popup() . "\<CR>"
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>: close popup and delete backword char.
inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><C-e> neocomplcache#cancel_popup()
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" Enable heavy omni completion.
if !exists('g:neocomplcache_omni_patterns')
let g:neocomplcache_omni_patterns = {}
endif
let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'
let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
let g:neocomplcache_omni_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
let g:neocomplcache_omni_patterns.c = '\%(\.\|->\)\h\w*'
let g:neocomplcache_omni_patterns.cpp = '\h\w*\%(\.\|->\)\h\w*\|\h\w*::'
" }
" NerdTree {
map <C-d> :NERDTreeToggle<CR>
nmap <leader>d :NERDTreeToggle<CR>
nmap <leader>f :NERDTreeFind<CR>
let NERDTreeChDirMode=0
let NERDTreeQuitOnOpen=1
let NERDTreeMouseMode=2
let NERDTreeShowHidden=1
let NERDTreeKeepTreeInNewTab=1
let g:NERDSpaceDelims=1
let g:nerdtree_tabs_open_on_gui_startup=0
" }
" ctrlp {
nmap <leader>p :CtrlP<CR>
nmap <leader>b :CtrlPBuffer<CR>
nmap <leader>P :CtrlPClearCache<CR>:CtrlP<CR>
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_switch_buffer = 'et'
" }
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher {
if executable('ag')
let g:ackprg = 'ag --nogroup --column'
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
endif
" }
" }