forked from julienw/config-files
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
180 lines (142 loc) · 4.3 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
set nocompatible
" change the leader for some commands
let mapleader = ","
filetype off " required!
" Vundle configuration
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" My Bundles
Bundle 'Raimondi/delimitMate'
Bundle 'mattn/emmet-vim'
Bundle 'scrooloose/syntastic.git'
Bundle 'jelera/vim-javascript-syntax'
Bundle 'pangloss/vim-javascript'
Bundle 'ervandew/supertab'
Bundle 'Lokaltog/vim-distinguished'
Bundle 'nathanaelkane/vim-indent-guides'
Bundle 'tpope/vim-fugitive'
Bundle 'airblade/vim-gitgutter'
Bundle 'sickill/vim-pasta.git'
Bundle 'kien/ctrlp.vim'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'wincent/Command-T'
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle 'garbas/vim-snipmate'
Bundle 'honza/vim-snippets'
Bundle 'elzr/vim-json'
Bundle 'sjl/gundo.vim'
"Bundle 'Rip-Rip/clang_complete'
set t_Co=256
syntax on
"colorscheme desert
colorscheme distinguished
filetype indent plugin on
autocmd BufNewFile,BufRead *.jsm set filetype=javascript
set hidden
" set xterm title
set title
" text formatting
"set completeopt=menu,menuone,longest
set completeopt=
set pumheight=15
set expandtab
set ignorecase
"set infercase
set nowrap
"set smartcase
set shiftround
set shiftwidth=2
set softtabstop=2
set tabstop=2
set smarttab
" UI
set cursorcolumn
set cursorline
set laststatus=2
set incsearch
set hlsearch
set lazyredraw
"set list
"set listchars=tab:>-,trail:-
set ruler
set scrolloff=5
set showcmd
" show the matching bracket/parenthesis/etc
set showmatch
set sidescrolloff=5
set statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v]
set number
set numberwidth=5
" use the mouse in all mode
set mouse=a
" toggle between paste mode and nopaste mode
set pastetoggle=<F12>
" the normal vim copy/paste operations use the system clipboard
set clipboard=unnamedplus
" general
set backspace=indent,eol,start
set autoindent
"set smartindent
noremap <expr> <Home> (col('.') == matchend(getline('.'), '^\s*')+1 ? '0' : '^')
"noremap <expr> <End> (col('.') == match(getline('.'), '\s*$') ? '$' : 'g_')
"vnoremap <expr> <End> (col('.') == match(getline('.'), '\s*$') ? '$h' : 'g_')
imap <Home> <C-o><Home>
"imap <End> <C-o><End>
" write with sudo
command! W w !sudo tee % > /dev/null
" highlight bad whitespaces
" see http://vim.wikia.com/wiki/Highlight_unwanted_spaces
highlight ExtraWhitespace ctermbg=darkgreen guibg=darkgreen
"match ExtraWhitespace /\s\+$/
"autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
"autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
"autocmd InsertLeave * match ExtraWhitespace /\s\+$/
"autocmd BufWinLeave * call clearmatches()
" Show trailing whitepace and spaces before a tab:
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL
" "
" auto clear trailing space
" see http://vim.wikia.com/wiki/Remove_unwanted_spaces
"autocmd BufWritePre *.pl,*.js,*.jsm,*.css :%s/\s\+$//e
" show long lines
set textwidth=80
set colorcolumn=+1
set updatetime=750
" remember where we were last time (note: viminfo is good by default)
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
" keep the selection
vmap > >gv
vmap < <gv
" define Y like D
nmap Y y$
" display a warning when the file exernally changed (not really good)
au FileChangedShell * echo "Warning: File changed on disk"
" search for the symbol under the cursor
au CursorMoved * exe printf('match CursorColumn /\V\<%s\>/', escape(expand('<cword>'), '/\'))
" for gaia
map <F8> :!gf<CR>
map <F9> :!gf -o<CR>
" use ctrl + space in supertab
" in terminal windows, ctrl + space inserts null characters
let g:SuperTabMappingForward = '<nul>'
let g:SuperTabMappingBackward = '<s-nul>'
" context completion
"let g:SuperTabDefaultCompletionType = "context"
" use jshint for syntastic
let g:syntastic_javascript_checkers = ['jshint', 'gjslint']
"for the indent guides plugin
let g:indent_guides_start_level = 2
let g:indent_guides_guides_size = 1
" useful with the delitMate plugin
imap <C-c> <CR><Esc>O
" ident guides stuff
let g:indent_guides_auto_colors = 0
let g:indent_guides_enable_on_vim_startup = 1
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=black ctermbg=black
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=233 ctermbg=233
"super undo
nnoremap <leader>u :GundoToggle<CR>