-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
203 lines (167 loc) · 4.65 KB
/
vimrc
File metadata and controls
203 lines (167 loc) · 4.65 KB
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
syntax on
let mapleader = ','
"set t_Co=256
" Emojis
" 🤔
imap <C-v>ut <C-v>U0001F914
" z commands
nnoremap <silent> z<Up> :wincmd k<CR>
nnoremap <silent> z<Down> :wincmd j<CR>
nnoremap <silent> z<Left> :wincmd h<CR>
nnoremap <silent> z<Right> :wincmd l<CR>
nnoremap <silent> zk :wincmd k<CR>
nnoremap <silent> zj :wincmd j<CR>
nnoremap <silent> zh :wincmd h<CR>
nnoremap <silent> zl :wincmd l<CR>
nnoremap <silent> ZH Hzz
nnoremap <silent> ZL Lzz
nnoremap <silent> ZM :tabmove -1<CR>
nnoremap <silent> zm :tabmove +1<CR>
nnoremap ZZ <nop>
inoremap <C-c> <Esc>
" tabs
nnoremap zv :tabnext<CR>
nnoremap zx :tabprev<CR>
nnoremap zn :tabedit
" diffs
vnoremap ;dp :'<,'>diffput<CR>
vnoremap ;dg :'<,'>diffget<CR>
vnoremap ;du :diffupdate<CR>
" Plugins
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" - Stable
Plugin 'VundleVim/Vundle.vim'
Plugin 'ervandew/supertab'
" Plugin 'SirVer/ultisnips'
" Plugin 'honza/vim-snippets'
" Plugin 'Valloric/YouCompleteMe'
Plugin 'scrooloose/nerdtree'
Plugin 'sheerun/vim-polyglot'
Plugin 'tpope/vim-commentary'
Plugin 'easymotion/vim-easymotion'
Plugin 'junegunn/fzf'
Plugin 'junegunn/fzf.vim'
Plugin 'jremmen/vim-ripgrep'
Plugin 'tpope/vim-fugitive'
Plugin 'itchyny/lightline.vim'
Plugin 'morhetz/gruvbox'
Plugin 'r0mai/vim-djinni'
Plugin 'majutsushi/tagbar'
Plugin 'junegunn/vim-peekaboo'
" - Experimental
call vundle#end()
filetype plugin indent on
set runtimepath+=~/.vim/my-snippets/
" auto-formating
set nocompatible
set backspace=2
set ruler
set laststatus=2
set expandtab
set tabstop=2
set shiftwidth=2
set nu
" F-keys
" - Toggle outline
map <F2> :TagbarToggle<cr>
" - Run formatting on selection
map <F8> :!clang-format -style=file<cr>
" map <F8> :!~/work/capi/bazel-capi/external/llvm_toolchain/bin/clang-format -style=file<cr>
" - Run formatting on method
map <F9> mW[[va{<F8>`Wzz<cr>
" - Run formatting on fike
map <F10> mWggVG<F8>`Wzz<CR>
" no backup files
set nobackup
set nowb
set noswapfile
" set constants
let author = "Marcos Reis"
" Highlight search
set hlsearch
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
set noincsearch
" EasyMotion
map ff <Plug>(easymotion-f)
map FF <Plug>(easymotion-F)
map <Leader> <Plug>(easymotion-prefix)
" YCM
" let g:ycm_enable_diagnostic_signs = 0
" let g:ycm_extra_conf_globlist = ['~/*']
" let g:ycm_global_ycm_extra_conf = '~/work/.ycm_extra_conf.py'
" let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/bazel-compilation-database/.ycm_extra_conf.py'
" nmap ;t :YcmCompleter GetType<CR>
" nmap ;g :YcmCompleter GoTo<CR>
" nmap ;u :YcmForceCompileAndDiagnostics<CR>
" nmap ;r :YcmRestartServer<CR>
" nmap ;f :YcmCompleter FixIt<CR>
" nmap ;e :YcmDiags<CR>
" make YCM compatible with UltiSnips (using supertab)
" let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
" let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
" let g:SuperTabDefaultCompletionType = '<C-n>'
" make YCM compatible with peekaboo
" let g:ycm_filetype_blacklist = {
" \ 'peekaboo': 1,
" \ 'notes': 1,
" \ 'markdown': 1,
" \ 'netrw': 1,
" \ 'unite': 1,
" \ 'pandoc': 1,
" \ 'tagbar': 1,
" \ 'mail': 1,
" \ 'vimwiki': 1,
" \ 'text': 1,
" \ 'infolog': 1
" \}
" better key bindings for UltiSnipsExpandTrigger
" let g:UltiSnipsExpandTrigger = "<tab>"
" let g:UltiSnipsJumpForwardTrigger = "<tab>"
" let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
" My snippets
" NERDTree configs
map za :NERDTreeToggle<CR>
" Lightline
let g:lightline = {
\ 'active': {
\ 'left': [['mode', 'paste'], ['relativepath', 'modified']],
\ 'right': [['lineinfo'], ['percent'], ['readonly'], ['filetype'], ['ycmCount']]
\ },
\ 'component_function': {
\ 'ycmCount': 'MyYcmCount'
\ }
\}
" Commentary
autocmd FileType c,cpp,cs,java setlocal commentstring=//\ %s
" Fuzzy finder
nmap ;; :Files<CR>
nmap ;b :Buffer<CR>
set rtp+=/opt/homebrew/bin/fzf
set rtp+=~/.fzf
" Quick fix window
nmap ;l :cnext<CR>
nmap ;k :cprev<CR>
" Quick search under cursor
nmap ;s :Rg <cword><CR>
" Force highlights
autocmd BufNewFile,BufRead *.mm set syntax=objcpp
autocmd BufNewFile,BufRead *.BUILD set syntax=bzl
" Fix colors
let g:gruvbox_bold=0
set background=dark
colorscheme gruvbox
" highlight YcmErrorLine ctermbg=052
" highlight YcmErrorSign ctermbg=052
" highlight YcmErrorSection ctermbg=052
" highlight YcmWarningLine ctermbg=052
" highlight YcmWarningSign ctermbg=052
" highlight YcmWarningSection ctermbg=052
" highlight Search cterm=NONE ctermfg=grey ctermbg=054
" NeoVim adjusts
set guicursor=
" command JsonPretty %!jq
"
source ~/environment/vimrc.extra
" source ~/extra.vim