-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc7
267 lines (231 loc) · 7.97 KB
/
.vimrc7
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
"################################################################################
"## VIMRC
"Author : Ofer Koren
"Revision History
" Ofer 01-Mar-2015 Initial version
"================================================================================
" Plugins
let VundleInstalled=1
let vundle_readme=expand($HOME.'/.vim/bundle/Vundle.vim/README.md')
if !filereadable(vundle_readme)
echo "Installing Vundle ..."
echo ""
silent !mkdir -p $HOME/.vim/bundle
silent !git clone https://github.com/VundleVim/Vundle.vim $HOME/.vim/bundle/Vundle.vim
let VundleInstalled=0
endif
if filereadable(vundle_readme)
set nocompatible " 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 'gmarik/Vundle.vim'
" Python
Plugin 'vim-python/python-syntax'
"Plugin 'davidhalter/jedi-vim'
" NerdTree
"Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-fugitive'
" Status line
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" Buffer explorer
Plugin 'fholgado/minibufexpl.vim'
" helm/yaml/gotmpl
Plugin 'towolf/vim-helm'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" add all your plugins here (note older versions of Vundle
" used Bundle instead of Plugin)
map <F2> :NERDTreeToggle<CR>
" Open NERDTree in the directory of the current file (or /home if no file is open)
nmap <F3> :call NERDTreeToggleInCurDir()<cr>
function! NERDTreeToggleInCurDir()
" If NERDTree is open in the current buffer
if (exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1)
exe ":NERDTreeClose"
else
exe ":NERDTreeFind"
endif
endfunction
let NERDTreeQuitOnOpen = 1
let g:jedi#completions_command = "<C-Space>"
let g:jedi#show_call_signatures= 2
" ...
"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_left_sep='>'
"let g:airline_right_sep='<'
"let g:airline_theme='dark'
if VundleInstalled == 0
echo "Installing Plugins, please ignore key map error messages"
echo ""
:PluginInstall
endif
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Configuration for python-syntax
let g:python_highlight_all = 1
endif
"================================================================================
" General
silent! E227
if filereadable("/etc/vim/vimrc")
source /etc/vim/vimrc
endif
"================================================================================
" load syntax files
if filereadable("/usr/share/vim/vim73/syntax/valgrind.vim")
source /usr/share/vim/vim73/syntax/valgrind.vim
endif
function! s:Log(eventName) abort
silent execute '!echo '.a:eventName.' >> log'
endfunction
"================================================================================
" General
"syntax on
set history=1000
set undolevels=1000
set nu
set tabstop=4
set shiftwidth=4
set autoindent
set smartindent
set ruler
set number
set title
set cmdheight=2
" Use system clipboard
set clipboard=unnamedplus
" Moving between Windows with Alt+<arrow key>
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>
" Allow move between un-saved buffers
set hidden
"================================================================================
" :find command (search file in sub-folders)
set path+=.,**
set wildmenu
set wildmode=list:full
"================================================================================
" Closing brace
"inoremap { {}<Left>
"inoremap {<CR> {<CR>}<Esc>O
"inoremap {{ {
"inoremap {} {}
"================================================================================
" Buffer Switch : <Tab>
set wildchar=<Tab> wildmenu wildmode=full
set wildcharm=<C-Z>
nnoremap <Tab> :b <C-Z>
"================================================================================
" File type specific settings
filetype on " enable file type detection
filetype plugin on " load the plugins for specific file types
filetype indent on " automatically indent code
autocmd FileType * set noexpandtab
set foldenable
au BufNewFile,BufRead,BufEnter,TabEnter *.sh set filetype=sh
au FileType sh let g:sh_fold_enabled=3
au FileType sh let g:is_bash=1
au FileType sh let g:is_sh=1
au FileType sh set foldmethod=syntax
syntax enable
au BufReadPost *.valgrind set syntax=valgrind
au FileType gradle set filetype=groovy
au BufNewFile,BufRead,BufEnter,TabEnter *.gradle set filetype=groovy
au BufNewFile,BufRead,BufEnter,TabEnter gradle.* set filetype=groovy
au BufNewFile,BufRead,BufEnter,TabEnter muse-scripts.properties set filetype=groovy
" Tabs to space in specific languages
autocmd FileType c set tabstop=4|set shiftwidth=4|set expandtab
autocmd FileType cpp set tabstop=4|set shiftwidth=4|set expandtab
"autocmd FileType yaml set tabstop=2|set shiftwidth=2|set expandtab
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType yaml setlocal re=1
autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab
autocmd BufNewFile,BufRead FileType python
\ set tabstop=4
\ set softtabstop=4
\ set shiftwidth=4
\ set textwidth=79
\ set expandtab
\ set autoindent
\ set fileformat=unix
"================================================================================
" Search
set ignorecase
set smartcase
set incsearch
set showmatch
set hlsearch
"Clear serach by space
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
"================================================================================
" Status line
highlight User1 ctermfg=black ctermbg=grey
highlight User2 ctermfg=darkred ctermbg=grey
highlight User3 ctermfg=darkblue ctermbg=grey
set laststatus=2
set statusline=
set statusline+=%1*\ %n\ %* "buffer number
set statusline+=%1*\ %<%F%* "full file name
set statusline+=%3*%=%y%* "file type
set statusline+=%3*%=%5{&ff}%* "file format
set statusline+=%2*%=%5l%* "current line
set statusline+=%2*/%L%* "total lines
set statusline+=%2*%4v\ %* "current column
set statusline+=%2*\ \ %m%r%w\ %P\ \ "modified readonly? Top/Bot "Top/Bot/Modified
"================================================================================
" Colors
if &term =~ '256color'
" Disable Background Color Erase (BCE) so that color schemes work
" properly within 256-color terminals
set t_ut=
endif
if has('gui_running')
set background=dark
colorscheme koehler
else
set background=dark
endif
highlight Comment ctermfg=DarkGreen
" Completion menu
highlight Pmenu ctermfg=white ctermbg=black
highlight PmenuSel ctermfg=red ctermbg=Black
" Highlight specific characters
highlight ExtraWhitespace ctermbg=red guibg=red
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
"================================================================================
" cscope
"if filereadable("cscope.out")
" cs add cscope.out
"elseif $CSCOPE_DB != ""
" cs add $CSCOPE_DB
"endif "
"================================================================================
"================================================================================
" commands
" Grep - grep files and open a results list
command -nargs=* Grep execute "lvim" '<args>' "| lw"
"================================================================================
" Functions (To launch type - :call <func name>)
" ShowAll - Show all characters
function! ShowAll()
set listchars=eol:$,tab:>-,trail:.,nbsp:_,extends:+,precedes:+
set list
endfunction
" ShowNone - Do not show all characters
function! ShowNone()
set nolist
endfunction