forked from mathiasbynens/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc_remote
More file actions
237 lines (192 loc) · 6.37 KB
/
Copy path.vimrc_remote
File metadata and controls
237 lines (192 loc) · 6.37 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
" Vundle Configuration
" First you need to install Vundle: git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Additional plugins
" Keep Plugin commands between vundle#begin/end.
" CTRL+P - https://github.com/ctrlpvim/ctrlp.vim
Plugin 'ctrlpvim/ctrlp.vim'
" Editorconfig - https://github.com/editorconfig/editorconfig-vim
Plugin 'editorconfig/editorconfig-vim'
" Emmet Vim - https://github.com/mattn/emmet-vim
Plugin 'mattn/emmet-vim'
" NERD Commenter - https://github.com/scrooloose/nerdcommenter
Plugin 'scrooloose/nerdcommenter'
" Syntastic - https://github.com/scrooloose/syntastic
Plugin 'scrooloose/syntastic'
" Vim Airline - https://github.com/vim-airline/vim-airline
Plugin 'vim-airline/vim-airline'
" Vim Airline Themes - https://github.com/vim-airline/vim-airline-themes
Plugin 'vim-airline/vim-airline-themes'
" Vim BufOnly - https://github.com/schickling/vim-bufonly
Plugin 'schickling/vim-bufonly'
" Vim Solarized - https://github.com/altercation/vim-colors-solarized
Plugin 'altercation/vim-colors-solarized'
" Vim Seti - https://github.com/trusktr/seti.vim
"Plugin 'trusktr/seti.vim'
" Vim EasyMotion - https://github.com/Lokaltog/vim-easymotion
Plugin 'Lokaltog/vim-easymotion'
" Vim Base16 (colorscheme) - https://github.com/chriskempson/base16-vim
Plugin 'chriskempson/base16-vim'
" Vim Surround - https://github.com/tpope/vim-surround
Plugin 'tpope/vim-surround'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Set tabs to 4 spaces
set tabstop=4
" Set shift width indent
set shiftwidth=4
" Set code editor indenting
set smartindent
set autoindent
" Set autocompletion
set wildmode=list:longest
" Enable tree folding
set foldenable
" Enable syntax highlighting
syntax on
" Set colorscheme
if filereadable(expand("~/.vim_background"))
source ~/.vim_background
endif
"set background=dark
let g:airline_theme='base16_ocean'
colorscheme base16-ocean
"colorscheme seti
" Enable line numbers
set number
" Highlight current line
set cursorline
" Don't set cursor to start of line when moving around
set nostartofline
" Show invisible characters
set listchars=eol:~,tab:\|\ ,trail:*
set list
" Show the cursor position
set ruler
" Show current mode
set showmode
" Make Vim more useful
set nocompatible
" Use the OS clipboard by default on versions compiled with `+clipboard`
set clipboard=unnamed
" Enhance command-line completion
set wildmenu
" Allow cursor keys in insert mode
set esckeys
" Allow backspace in insert mode
set backspace=indent,eol,start
" Optimize for fast terminal connections
set ttyfast
" Add the g flag to search/replace by default
set gdefault
" Use UTF-8 without BOM
set encoding=utf-8 nobomb
" Change mapleader
let mapleader=","
" Don’t add empty newlines at the end of files
set binary
set noeol
" Centralize backups, swapfiles and undo history
set backupdir=~/.vim/backups
set directory=~/.vim/swaps
if exists("&undodir")
set undodir=~/.vim/undo
endif
" Respect modeline in files
set modeline
set modelines=4
" Highlight searches
set hlsearch
" Ignore case of searches
set ignorecase
" Highlight dynamically as pattern is typed
set incsearch
" Always show status line
set laststatus=2
" Enable mouse in all modes
set mouse=a
" Show filename in window titlebar
set title
" Show the partial command as it is being typed
set showcmd
" Start scrolling three lines before the horizontal window border
set scrolloff=3
" Add the g flag to search/replace by default
set gdefault
" Change mapleader
let mapleader=','
"Centralize backups, swapfiles, and undo history
set backupdir=~/.vim/backups
set directory=~/.vim/swaps
if exists("&undodir")
set undodir=~/.vim/undo
endif
" Use relative line numbers
if exists("&relativenumber")
set relativenumber
au BufReadPost * set relativenumber
endif
" Strip trailing whitespaces (,ss)
function! StripWhitespace()
let save_cursor = getpos('.')
let old_query = getreg('/')
:%s/\s\+$//e
call setpos('.', save_cursor)
call setreg('/', old_query)
endfunction
noremap <leader>ss :call StripWhitespace()<CR>
" Quicker window switching
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h
" Enable filetype plugins (nerdcommenter - https://github.com/scrooloose/nerdcommenter)
filetype plugin on
" Emmet settings and remappings
let g:user_emmet_leader_key = '<C-Z>'
"let g:user_emmet_leader_key = '<C-n>'
"let g:uder_emmet_expandabbr_key = '<s-tab>'
"let g:user_emmet_togglecomment_key = '<c-_>'
" NERDTree settings
noremap <leader><tab> :NERDTree<CR>
let g:NERDTreeDirArrows=0
" Specific file type settings
if has("autocmd")
autocmd BufNewFile,BufRead *.scss set filetype=scss
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
"add auto-close curly-braces
autocmd FileType html,css,scss,javascript,php inoremap <buffer> { {}<Left>
autocmd FileType html,css,scss,javascript,php inoremap <buffer> {} {}
autocmd FileType html,css,scss,javascript,php inoremap <buffer> {<CR> {<CR>}<Esc>O
autocmd FileType htmldjango inoremap <buffer> {{ {{<space><space>}}<Left><Left><Left>
autocmd FileType htmldjango inoremap <buffer> {% {%<space><space>%}<Left><Left><Left>
"add auto-close parenthesis
autocmd FileType html,css,scss,javascript,php inoremap <buffer> ( ()<Left>
"add auto-close brackets
autocmd FileType html,css,scss,javascript,php inoremap <buffer> [ []<Left>
"add auto-close quotes
autocmd FileType html,css,scss,javascript,php inoremap <buffer> ' ''<Left>
autocmd FileType html,css,scss,javascript,php inoremap <buffer> " ""<Left>
endif
" Syntastic settingSyntastic settings
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" Vim-Airline settings
let g:airline#extensions#tabline#enabled = 1