-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
197 lines (170 loc) · 5.18 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
188
189
190
191
192
193
194
195
196
197
let mapleader =","
call plug#begin('~/.vim/plugged')
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex'}
Plug 'tpope/vim-rails'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree'
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'Raimondi/delimitMate'
Plug 'advpetc/vim-template'
Plug 'honza/vim-snippets'
Plug 'kien/ctrlp.vim'
Plug 'SirVer/ultisnips'
Plug 'ryanoasis/vim-devicons'
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
Plug 'Shougo/deoplete-clangx'
Plug 'majutsushi/tagbar'
Plug 'junegunn/goyo.vim'
Plug 'Yggdroot/indentLine'
Plug 'Chiel92/vim-autoformat'
Plug 'tpope/vim-surround'
" Plug 'gauteh/vim-cppman'
call plug#end()
" ================================================================================
" basic settings
" ================================================================================
filetype plugin on
" Load plugins according to detected filetype.
filetype plugin indent on
nnoremap c "_c
set nocompatible
syntax on
set encoding=utf-8
set nu rnu
set tw=80
" Enable autocompletion
set wildmode=longest,list,full
" show invisibles
set list
set listchars=tab:‣\ ,trail:·,precedes:«,extends:»,eol:¬
" indentations
" Indent according to previous line.
set autoindent
" Use spaces instead of tabs.
set expandtab
set cindent
set smartindent
" Tab key indents by 4 spaces.
set softtabstop=4
" >> indents by 4 spaces.
set shiftwidth=4
" >> indents to next multiple of 'shiftwidth'.
set shiftround
" copy ignore line number
set mouse=a
set bg=light
set go=a
set mouse=a
set nohlsearch
set clipboard=unnamedplus
" Spell-check set to <leader>o, 'o' for 'orthography':
map <leader>o :setlocal spell! spelllang=en_us<CR>
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
set splitbelow splitright
" Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed):
vnoremap <C-c> "+y
map <C-p> "+P
" ================================================================================
" Keybindings
" ================================================================================
" Quick Update
noremap <Leader>s :update<CR>
" Keep your eye to the center
nnoremap j jzz
nnoremap k kzz
" Jumping to previous copy pasted
nmap <Leader>j :call GotoJump()<CR>
" Quick access previous register
nmap <Leader>r :reg<CR>
" Quick Save
map <Leader>w :w<CR>
" Shortening split navigation, saving a keypress:
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" ================================================================================
" Plugin Settings
" ================================================================================
" Vim-airline and Vim-airline theme
" 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 = 'minimalist'
" support for vim-latex-live-preview
let g:livepreview_previewer = 'evince'
" Nerd tree
map <leader>n :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Vim-template
let g:email = "[email protected]"
" UltiSnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-f>"
let g:UltiSnipsJumpBackwardTrigger="<c-b>"
" Deoplete
let g:deoplete#enable_at_startup = 1
set completeopt-=preview
" Devicons
set encoding=UTF-8
let g:webdevicons_enable_nerdtree = 1
" adding the flags to NERDTree
let g:webdevicons_enable_nerdtree = 1
" adding the column to vimfiler
let g:webdevicons_enable_vimfiler = 1
" Tagbar
nnoremap <silent> <Leader>b :TagbarToggle<CR>
" Goyo
nnoremap <Leader>g :Goyo<CR>
" Ctrl-P
let g:ctrlp_use_caching = 0
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_root_markers = ['.gitignore']
" vim-autoformat
let g:autoformat_autoindent = 0
let g:autoformat_retab = 0
map <leader>f :Autoformat<CR>
" let g:autoformat_remove_trailing_spaces = 0
" au BufWrite * :Autoformat
" nerdcommenter
" ================================================================================
" Utilities
" ================================================================================
"Always set to current directory
autocmd BufEnter * silent! lcd %:p:h
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
" colorscheme
colorscheme elflord
" Compile
"let $CXX="g++"
"let $CFLAGS="-std=c++11 -g -Wall"
map <leader>b :!g++ % -std=c++11 -g -Wall -o %:r <CR>
" ================================================================================
" Functions
" ================================================================================
function! GotoJump()
jumps
let j = input("Please select your jump: ")
if j != ''
let pattern = '\v\c^\+'
if j =~ pattern
let j = substitute(j, pattern, '', 'g')
execute "normal " . j . "\<c-i>"
else
execute "normal " . j . "\<c-o>"
endif
endif
endfunction