This repository has been archived by the owner on Sep 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
172 lines (162 loc) · 4.73 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
" vim:fdm=marker
" Editor {{{
set nocompatible "Non compatiblity with vi
set encoding=utf-8 "Default encoding
set ttyfast "More move while redraw
set lazyredraw "No redraw while doing macro
set hidden "Buffer are hide when abandoned
set visualbell "No sound
set title "Change term title
set autoread "Reload files changed outside vim
set noswapfile
set clipboard=unnamed "Use alt to paste in osx
set backspace=indent,eol,start "Delete w/ insert
let &titleold=getcwd() "Reset term title when exit vim
set wildmenu "Autocomplete filenames
set wildmode=longest:full,list:full
set cursorline "Hl the line of the cursor
set showcmd "Display cmd
set scrolloff=7 "Keep 7 lines when scroll (top|bottom)
set timeout timeoutlen=1000 ttimeoutlen=100
" 80 chars limit
if exists("&colorcolumn")
set colorcolumn=80
endif
" }}}
" Mouse {{{
set mouse=
" }}}
" Statusline {{{
set statusline=[%n]\ %< "Buffer Number
set statusline+=%<%w%f\ %=%y[%{&ff}] "FileName
set statusline+=[%6c] "Filetype
set statusline+=[%{printf('%'.strlen(line('$')).'s',line('.'))}/%L]
set statusline+=[%3p%%]
set statusline+=%{'['.(&readonly?'RO':'\ \ ').']'}
set statusline+=%{'['.(&modified?'+':'-').']'}
set laststatus=2 "Always show status bar
" }}}
" Search {{{
set hlsearch "Hihlight matches
set incsearch "Incremental searching
set ignorecase "Searches are case insisensitive
set smartcase " ... unless they contain one capital letter
" Center screen on occurence
nnoremap n nzz
nnoremap N Nzz
" clear the search buffer when hitting return
nnoremap <silent> <CR> :nohlsearch<CR>:w<CR>
" }}}
" Tabs & Indent {{{
set autoindent
set expandtab "Convert tab -> spacei
set tabstop=2 "A tab = 2 spaces
set shiftwidth=2
set softtabstop=2
set copyindent
set smarttab
set list listchars=tab:→\ ,trail:·,eol:↩,extends:»,precedes:«,nbsp:×
" Indent with tabs
vmap <Tab> >gv
vmap <S-Tab> <gv
" Keep selection after indent
vnoremap < <gv
vnoremap > >gv
" }}}
" Folds {{{
set foldmethod=syntax
set foldlevelstart=0
" Space to toggle folds.
nnoremap <Space> za
vnoremap <Space> za
" Make zO recursively open whatever fold we're in, even if it's partially open.
nnoremap zO zczO
let g:html_indent_tags = ['p', 'li']
augroup ft_html
au!
au FileType html setlocal foldmethod=manual
augroup END
augroup ft_javascript
au!
au FileType javascript setlocal foldmethod=marker
au FileType javascript setlocal foldmarker={,}
augroup END
" }}}
" Files {{{
autocmd BufNewFile,BufRead *.json set ft=javascript
autocmd BufNewFile,BufRead *.vue.php set ft=html
filetype on
filetype plugin on
" }}}
" Windows {{{
" Smart moving between windows r
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
autocmd VimResized * tabdo wincmd =
" }}}
" Diff {{{
if &diff
set diffopt+=iwhite
endif
" }}}
" Hard mode {{{
noremap <Up> <nop>
noremap <Down> <nop>
noremap <Left> <nop>
noremap <Right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
" }}}
" Binds {{{
function! EatChar(pat)
let c = nr2char(getchar(0))
return (c =~ a:pat) ? '' : c
endfunction
function! MakeSpacelessIabbrev(from, to)
execute "iabbrev <silent> ".a:from." ".a:to."<C-R>=EatChar('\\s')<CR>"
endfunction
nnoremap Q <nop>
" iabbrev </ </<C-x><C-o>
call MakeSpacelessIabbrev('</', '</<C-x><C-o>')
inoremap jk <Esc>
inoremap {<CR> {<CR>}<Esc>O<Tab>
let mapleader = "-"
" }}}
" Plugin:Pathogen {{{
call pathogen#runtime_append_all_bundles()
call pathogen#infect()
" }}}
" Plugin:Syntastic {{{
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd']
let g:syntastic_javascript_checkers = ['jshint', 'jscs']
" }}}
" Plugin:Php-cs-fixer {{{
let g:php_cs_fixer_path = "/usr/local/bin/php-cs-fixer"
let g:php_cs_fixer_level = "all"
let g:php_cs_fixer_config = "default"
nnoremap <silent><leader>pcd :call PhpCsFixerFixDirectory()<CR>
nnoremap <silent><leader>pcf :call PhpCsFixerFixFile()<CR>
autocmd BufWritePre *.php %s/\s\+$//ge
autocmd BufWritePre *.php %s/if ( /if (/ge
autocmd BufWritePre *.php %s/if(/if (/ge
autocmd BufWritePre *.php %s/,\$/, \$/ge
autocmd BufWritePre *.php %s/foreach(/foreach (/ge
" }}}
" Plugin:matchit {{{
runtime macros/matchit.vim " Enable jump betwen tags
" }}}
" Plugin:ctrlp {{{
let g:ctrlp_user_command = 'ag --nogroup --nobreak --noheading --nocolor --hidden -g "" %s '
" }}}
" Colors {{{
set background=dark
syntax on
let &t_Co=256
color default
" }}}