-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
144 lines (125 loc) · 4.11 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
let s:IsUbuntu = -1
if (match(system("cat /etc/issue"), "Ubuntu") != -1)
let s:IsUbuntu=1
else
let s:IsUbuntu=0
endif
" General
set nocompatible
set noswapfile " Do not want swap and backups
set nobackup "
set history=100
set undolevels=1000
set noerrorbells visualbell t_vb=
set lazyredraw
set clipboard+=unnamed " Enable yank to clipboard. Not sure it is xplatform
"set clipboard+=unnamedplus
" Color theme and syntax hightlighting
syntax enable " Syntax highlighting
if !has('gui_running')
set t_Co=256 " Color set
set background=dark
endif
" UI
set cmdheight=2 " Better for long messages
set hlsearch " Highlight search results
set incsearch " Search as you type
set ignorecase " ignore case sensitivity...
set smartcase " ... unless CapitalCases
set linespace=0
set fillchars=""
set cursorline " Highlight cursor line
set backspace=indent,eol,start " Work as intended
set ruler " Always show
set showmatch " Show matching brackets
set number
set showcmd " Show cmd in status bar
set showmode
set wildmenu
set laststatus =2 " Status line
set statusline=%<%f%m\ \[%{&ff}:%{&fenc}:%Y]\
set statusline+=%{getcwd()}
set statusline+=%=\[%{strftime('%Y/%b/%d\ %a\ %I:%M\ %p')}\]\ %=\
set statusline+=Line:%l\/%L\ Column:%c%V\ %=\ %P
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
" Text options
set encoding=utf-8
set wrap " Don't wrap lines
set autoindent "
set smartindent "
set expandtab " Use spaces
set smarttab "
set tabstop=4 "
set shiftwidth=4 "
set softtabstop=4 "
set foldmethod=indent " enable folding
set foldlevelstart=42 " folds open when start
"set textwidth=80
"Spellcheck
"set spell spelllang=pt
"Vundle
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" My Bundles:
if (s:IsUbuntu)
let g:clang_use_library=1
let g:clang_library_path = '/usr/local/lib/'
let g:clang_auto_select=1
let g:clang_close_preview=1
let g:clang_user_options = '-std=c++11 -stdlib=libc++'
let g:clang_jumpto_declaration_key='<C-]>'
let g:clang_jumpto_back_key='<C-T>'
set conceallevel=2
set concealcursor=inv
let g:clang_snippets=1
let g:clang_conceal_snippets=1
let g:clang_snippets_engine='clang_complete'
set completeopt=menu,menuone
set pumheight=20
let g:clang_trailing_placeholder=1
let g:clang_sort_algo='alpha'
else
Bundle 'Valloric/YouCompleteMe'
endif
Bundle 'scrooloose/syntastic'
Bundle 'scrooloose/nerdtree'
Bundle 'jistr/vim-nerdtree-tabs'
Bundle 'airblade/vim-gitgutter'
Bundle 'godlygeek/tabular'
Bundle 'plasticboy/vim-markdown'
filetype plugin indent on
" Tab keybindings
nnoremap <silent> tn :tabnext<CR>
nnoremap <silent> tp :tabprev<CR>
nnoremap <silent> tc :tabnew<CR>
nnoremap <silent> tx :tabclose<CR>
" Folding keybindgins
nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
vnoremap <Space> zf
" Make keybindings
nnoremap <F5> :make run DEBUG=1<CR>
nnoremap <F6> :make clean; make DEBUG=1<CR>
" Syntax validation
if (s:IsUbuntu)
" Regular syntastic
nnoremap <F7> :SyntasticCheck<CR>
else
" Syntastic via YCM keybindings
nnoremap <F7> :YcmForceCompileAndDiagnostics<CR>
endif
" NERDTree keybindings
nnoremap <F4> :NERDTreeTabsToggle<CR>
" Search keybindings
nnoremap <F3> :grep --include=*.{c,cpp,h} -nRHI "
" clang-format keybindings
map <C-K> :pyf /usr/share/vim/addons/syntax/clang-format-3.4.py<CR>
imap <C-K> <ESC>:pyf /usr/share/vim/addons/syntax/clang-format-3.4.py<CR>i
" Close scratch area after completion is done
autocmd CursorMovedI * if pumvisible() == 0|silent! pclose|endif
autocmd InsertLeave * if pumvisible() == 0|silent! pclose|endif
" Disable expand tab for working with Makefiles
autocmd FileType make setlocal noexpandtab