-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.vimrc
166 lines (134 loc) · 3.54 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
"Basic settings
set t_Co=256
set backspace=2
set pastetoggle=<F2>
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set encoding=utf-8
set fileformat=unix
set fileformats=unix,dos
set noswapfile
" Utile pour NerdCommenter
let mapleader = ","
" Use incremental search and highlight as we go.
set hlsearch
set incsearch
" Dont split word
set linebreak
"Plugins
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
let path='~/.vim/bundle'
call vundle#begin(path)
Plugin 'Joorem/vim-haproxy'
Plugin 'VundleVim/Vundle.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'alvan/vim-closetag'
Plugin 'bling/vim-airline'
Plugin 'chr4/nginx.vim'
Plugin 'chr4/sslsecure.vim'
Plugin 'ervandew/supertab'
Plugin 'gmarik/vundle.vim'
Plugin 'habamax/vim-asciidoctor'
Plugin 'hashivim/vim-terraform'
Plugin 'jiangmiao/auto-pairs'
Plugin 'kien/ctrlp.vim'
Plugin 'mattn/emmet-vim'
Plugin 'mustache/vim-mustache-handlebars'
Plugin 'sickill/vim-monokai'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'vim-airline/vim-airline-themes'
call vundle#end()
filetype plugin indent on
"Undo Dir
if !isdirectory($HOME."/.vim")
call mkdir($HOME."/.vim", "", 0770)
endif
if !isdirectory($HOME."/.vim/undo-dir")
call mkdir($HOME."/.vim/undo-dir", "", 0700)
endif
set undodir=~/.vim/undo-dir
set undofile
"Color
syntax on
try
colorscheme monokai
catch /^Vim\%((\a\+)\)\=:E185/
" deal with it
endtry
let g:airline_theme='molokai'
hi NonText ctermbg=none
"Status bar
set laststatus=2
"Shortcuts
nmap <S-t> :tabnew <CR>
nmap <S-Left> :tabprev <CR>
nmap <S-Right> :tabnext <CR>
nmap <C-f> /
nmap <silent> <C-S-Left> :bprevious<CR>
nmap <silent> <C-S-Right> :bnext<CR>
nmap <silent> <A-Up> :wincmd k<CR>
nmap <silent> <A-Down> :wincmd j<CR>
nmap <silent> <A-Left> :wincmd h<CR>
nmap <silent> <A-Right> :wincmd l<CR>
nmap <C-f> /
"CtrlP
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.idea/*,*/.DS_Store,*/vendor,*/build,*/bin
" JS Shortcuts
au FileType javascript nmap <C-u> :UnMinify<CR>
" Conf files syntax
autocmd BufNewFile,BufRead *.conf setf dosini
" Remove useless whitespace
autocmd BufWritePre * :%s/\s\+$//e
"Vim Airline
let g:airline_powerline_fonts = 1
let g:airline_section_x = '%{strftime("%m/%d %H:%M")}% '
" Functions
command! UnMinify call UnMinify()
function! UnMinify()
%s/{\ze[^\r\n]/{\r/g
%s/){/) {/g
%s/};\?\ze[^\r\n]/\0\r/g
%s/;\ze[^\r\n]/;\r/g
%s/[^\s]\zs[=&|]\+\ze[^\s]/ \0 /g
normal ggVG=
endfunction
" Pretty JSON (Require python)
command! PrettyJson call PrettyJson()
function! PrettyJson()
execute "%!python -m json.tool"
endfunction
" .NFO specific
au BufReadPre *.nfo call SetFileEncodings('cp437')|set ambiwidth=single
au BufReadPost *.nfo call RestoreFileEncodings()
" Common code for encodings
function! SetFileEncodings(encodings)
let b:myfileencodingsbak=&fileencodings
let &fileencodings=a:encodings
endfunction
function! RestoreFileEncodings()
let &fileencodings=b:myfileencodingsbak
unlet b:myfileencodingsbak
endfunction
" YAML
autocmd Filetype yaml setlocal tabstop=2 softtabstop=2 shiftwidth=2
" XML
au FileType xml setlocal equalprg=xmllint\ --format\ --recover\ -\ 2>/dev/null
au Filetype xml setlocal tabstop=2 softtabstop=2 shiftwidth=2
" Keep selection during indentation
" with the > and < keys
vnoremap > ><CR>gv
vnoremap < <<CR>gv
" Toggle True/False
let g:switch_mapping = "-"
" Fix scrolling for tmux
set ttymouse=xterm2
set mouse=
au BufRead,BufNewFile haproxy* set ft=haproxy
" Show tabs
set invlist
set list listchars=tab:❘⠀,trail:·,extends:»,precedes:«,nbsp:×