-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
188 lines (154 loc) · 4.35 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
" Pathogen setup
source ~/.vim/pathogen/autoload/pathogen.vim
execute pathogen#infect()
" Enable filetype plugins
filetype plugin indent on
" Set to auto read when a file is changed from the outside
set autoread
set autowrite
" get the ruler back
set ruler
set laststatus=2
set number
set clipboard=unnamed
" :W sudo saves the file
" (useful for handling the permission-denied error)
command W w !sudo tee % > /dev/null
" Ignore binary files
set wildignore=*.o,*~,*.pyc
" highlight the search text
set hlsearch
" more better searching
set incsearch
set magic
set mat=3
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" Turn them colors on
syntax enable
colorscheme Tomorrow-Night-Eighties
let g:rehash256 = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Make backspace work
set backspace=indent,eol,start
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
" Linebreak on 500 characters
set lbr
set tw=500
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
" go-vim settings
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
let g:go_metalinter_autosave = 1
let g:go_fmt_command = "goimports"
let g:go_highlight_structs = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
" syntastic settings
let g:kernel_dir = '/usr/src/kernels/' . system('uname -r | tr -d "\n"') . '/include'
let g:syntastic_c_include_dirs = [g:kernel_dir]
let g:syntastic_aggregate_errors = 1
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0
let g:syntastic_loc_list_height=3
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_aggregate_errors = 1
fun! FileTime()
let ext=tolower(expand("%:e"))
let fname=tolower(expand('%<'))
let filename=fname . '.' . ext
let msg=""
let msg=msg." ".strftime("(Modified %b,%d %y %H:%M:%S)",getftime(filename))
return msg
endf
fun! CurTime()
let ftime=""
let ftime=ftime." ".strftime("%b,%d %y %H:%M:%S")
return ftime
endf
"airline
let g:airline#extensions#syntastic#enabled = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline_theme='tomorrow'
let g:airline_detect_modified=1
let g:airline_detect_paste=1
let g:airline#extensions#tabline#buffer_idx_mode = 1
let g:airline#extensions#bufferline#overwrite_variables = 1
let g:airline#extensions#bufferline#enabled = 1
nmap <leader>1 <Plug>AirlineSelectTab1
nmap <leader>2 <Plug>AirlineSelectTab2
nmap <leader>3 <Plug>AirlineSelectTab3
nmap <leader>4 <Plug>AirlineSelectTab4
nmap <leader>5 <Plug>AirlineSelectTab5
nmap <leader>6 <Plug>AirlineSelectTab6
nmap <leader>7 <Plug>AirlineSelectTab7
nmap <leader>8 <Plug>AirlineSelectTab8
nmap <leader>9 <Plug>AirlineSelectTab9
nmap <leader>- <Plug>AirlineSelectPrevTab
nmap <leader>+ <Plug>AirlineSelectNextTab
let g:airline#extensions#quickfix#quickfix_text = 'Quickfix'
let g:airline#extensions#quickfix#location_text = 'Location'
"tree view
noremap <Leader><Tab> :call VexToggle(getcwd())<CR>
nnoremap <Leader>b :bp<CR>
let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_browse_split = 4
let g:netrw_altv = 1
augroup NetrwGroup
autocmd! BufEnter * call NormalizeWidths()
augroup END
fun! VexToggle(dir)
if exists("t:vex_buf_nr")
call VexClose()
else
call VexOpen(a:dir)
endif
endf
fun! VexOpen(dir)
let g:newrw_browse_split=4
let vex_width = 25
execute "Vexplore " . a:dir
let t:vex_buf_nr = bufnr("%")
wincmd H
call VexSize(vex_width)
endf
fun! VexClose()
let cur_win_nr = winnr()
let target_nr = ( cur_win_nr == 1 ? winnr("#") : cur_win_nr )
1wincmd w
close
unlet t:vex_buf_nr
execute (target_nr -1) . "wincmd w"
call NormalizeWidths()
endf
fun! VexSize(vex_width)
execute "vertical resize" . a:vex_width
set winfixwidth
call NormalizeWidths()
endf
fun! NormalizeWidths()
let eadir_pref = &eadirection
set eadirection=hor
set equalalways! equalalways!
let &eadirection = eadir_pref
endf