-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
221 lines (215 loc) · 7.38 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
" Vundle configuration
" ==============================================================
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" ========== My plugins ============
" Airline
Plugin 'vim-airline/vim-airline'
" Ultisnip
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
"rust
Plugin 'rust-lang/rust.vim'
" wakatime
"Plugin 'wakatime/vim-wakatime'
" moving through text easy
Plugin 'easymotion/vim-easymotion'
" Ctrl - p fuzzy finding
Plugin 'ctrlpvim/ctrlp.vim'
"Nerdtree
Plugin 'scrooloose/nerdtree'
"Nerdtree git plugin
Plugin 'Xuyuanp/nerdtree-git-plugin'
" Compleation
Plugin 'ervandew/supertab'
" Autoclose brackets
"Plugin 'Raimondi/delimitMate'
"Disable temporarily to enable swedish letters again
Plugin 'jiangmiao/auto-pairs'
" Colors
Plugin 'crusoexia/vim-monokai'
"Syntastic
Plugin 'scrooloose/syntastic'
" Search tab complete
Plugin 'vim-scripts/SearchComplete'
" NERDcommenter
Plugin 'scrooloose/nerdcommenter'
" Git fugitive
Plugin 'tpope/vim-fugitive'
"Fix colors in terminal
Plugin 'godlygeek/csapprox'
" More c++ syntax
Plugin 'octol/vim-cpp-enhanced-highlight'
" Vim restore sessions with tmux
Plugin 'tpope/vim-obsession'
" Type-script syntax highlight
Plugin 'leafgarland/typescript-vim'
" Set indent to the same as file is
Plugin 'ciaranm/detectindent'
" =================================
call vundle#end() " required
filetype plugin indent on " required
filetype plugin on
"========= Ctrl-p =========
set runtimepath^=~/.vim/bundle/ctrlp.vim
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
"========= delimitMate =========
let delimitMate_expand_cr=1
let delimitMate_jump_expansion = 1
" ======== gui settings for mvim ==========
" remove the scrollbars
set guifont=Inconsolata\ for\ Powerline:h13
set guioptions-=r
set guioptions-=L
" ======== Syntastic settings =========
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_cpp_compiler = "g++"
let g:syntastic_cpp_complier_options = "-std=c++11"
let g:syntastic_mode_map = {
\ "mode": "active",
\ "passive_filetypes": ["html", "tex"] }
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
" ====== md - syntax settings =======
let g:vim_markdown_folding_disabled=1
" ====== Ultisnip configuration =======
" Trigger configuration. Do not use <tab> if you use
" https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<leader><tab>"
"let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpForwardTrigger="<leader><tab>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" let g:UltiSnipsListSnippets="<leader><space>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
" ===== NERDTree settings===
" Map Nerdtree to f5
map <F5> :NERDTreeToggle<RETURN>
let NERDTreeIgnore=['\.o$', '\.out$', '.dSYM$[[dir]]']
" ===== General settings ====
" Old tab settings
"set tabstop=2
"set shiftwidth=2
"set softtabstop=2
"set expandtab
" use tab settings
set autoindent
set noexpandtab
set tabstop=4
set shiftwidth=4
"numbers
set number
set relativenumber
syntax on
"Reset backspace to work like ''normal''
set backspace=indent,eol,start
" vim reads a file when i changes
set autoread
" Automaticly detect indent when loading a file
autocmd BufReadPost * :DetectIndent
" ===== Color scheme ====
colorscheme monokai
" ===== Airline settings ====
set ttimeoutlen=50
set laststatus=2
let g:airline_powerline_fonts=1
let g:airline#extensions#branch#enabled = 1
" ==== Mappings ====
" Map leader
let mapleader=","
" visual up and down movement through wrapped lines/paragraphs
noremap j gj
noremap k gk
" Repmap for easy motion
let g:EasyMotion_do_mapping = 0
let g:EasyMotion_smartcase = 1
nmap <leader>o :Obsession<return>
nmap s <Plug>(easymotion-s)
" testing for make
nmap <leader>m :! make all -B<return><return>
nmap <leader>s :setlocal spell spelllang=en_gb<return>
" ===== Tab stuff ==== "
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#tab_nr_type = 1
" === Set directory for swp
:set directory=~/.vim/swapfiles//
" === tab function
set tabline=%!MyTabLine() " custom tab pages line
function MyTabLine()
let s = '' " complete tabline goes here
" loop through each tab page
for t in range(tabpagenr('$'))
" set highlight
if t + 1 == tabpagenr()
let s .= '%#TabLineSel#'
else
let s .= '%#TabLine#'
endif
" set the tab page number (for mouse clicks)
let s .= '%' . (t + 1) . 'T'
let s .= ' '
" set page number string
let s .= t + 1 . ' '
" get buffer names and statuses
let n = '' "temp string for buffer names while we loop and check buftype
let m = 0 " &modified counter
let bc = len(tabpagebuflist(t + 1)) "counter to avoid last ' '
" loop through each buffer in a tab
for b in tabpagebuflist(t + 1)
" buffer types: quickfix gets a [Q], help gets [H]{base fname}
" others get 1dir/2dir/3dir/fname shortened to 1/2/3/fname
if getbufvar( b, "&buftype" ) == 'help'
let n .= '[H]' . fnamemodify( bufname(b), ':t:s/.txt$//' )
elseif getbufvar( b, "&buftype" ) == 'quickfix'
let n .= '[Q]'
else
let n .= pathshorten(bufname(b))
endif
" check and ++ tab's &modified count
if getbufvar( b, "&modified" )
let m += 1
endif
" no final ' ' added...formatting looks better done later
if bc > 1
let n .= ' '
endif
let bc -= 1
endfor
" add modified label [n+] where n pages in tab are modified
if m > 0
let s .= '[' . m . '+]'
endif
" select the highlighting for the buffer names
" my default highlighting only underlines the active tab
" buffer names.
if t + 1 == tabpagenr()
let s .= '%#TabLineSel#'
else
let s .= '%#TabLine#'
endif
" add buffer names
if n == ''
let s.= '[New]'
else
let s .= n
endif
" switch to no underlining and add final space to buffer list
let s .= ' '
endfor
" after the last tab fill with TabLineFill and reset tab page nr
let s .= '%#TabLineFill#%T'
" right-align the label to close the current tab page
if tabpagenr('$') > 1
let s .= '%=%#TabLineFill#%999Xclose'
endif
return s
endfunction