-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc.mac
216 lines (172 loc) · 7.1 KB
/
vimrc.mac
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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Line Numbering
set nu
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Formatting Options
set shiftwidth=4 "set default
set softtabstop=4
set autoindent
set smartindent
set smarttab
set expandtab
set ruler " iTerm needed for showing column,line number
set backspace=2 " Needed for backspace to work properly on OSX/iTerm2
syntax on
filetype plugin indent on
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Custom formatting
" Bash/SH
autocmd FileType sh set softtabstop=2 | set shiftwidth=2 | set expandtab
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Search Options
"
set magic " search using extended regex
" set incsearch " instant search
set ignorecase " Make search case insensitive
set smartcase " if the search pattern contains upper case letters, then make the search
set hlsearch " Highlight search matches
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Restore cursor to last postion in file """""""""""""""""""""""""""""""""""""""
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Tell vim to remember certain things when we exit
"
" " '10 : marks will be remembered for up to 10 previously edited files
" " "100 : will save up to 100 lines for each register
" " :20 : up to 20 lines of command-line history will be remembered
" " % : saves and restores the buffer list
" " n... : where to save the viminfo files
set viminfo='10,\"100,:20,%,n~/.vim/viminfo
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Mouse Options
" set mouse=a "Enable mouse use in term
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" Auto completion
"
"
" Omni Completion
set omnifunc=syntaxcomplete#Complete
" Autocomplete with wildchar in command mode
set wildmenu
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set Filetypes
" MarkDown
au BufRead,BufNewFile *.mkdhtml set filetype=markdown
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""" Templates
""""
"""" CPP
"""autocmd BufNewFile ~/Desktop/Programming/*.cpp 0r ~/.vim/templates/coding_template.cpp | 9 | exec "normal i \t"
"""
"""" ERLANG " Add autofilename insertion in module
"""autocmd BufNewFile *.erl 0r ~/.vim/templates/template.erl | 4 | :%s/{{filename}}/\=expand('%:t:r')
"""
"""" MARKDOWN
"""autocmd BufNewFile *.mkdhtml 0r ~/.vim/templates/template.mkdhtml | exec "normal o" | 3
""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" AIRLINE SETTINGS
""" Unicode glyphs
set encoding=utf-8 " Necessary to show Unicode glyphs
""" Disable vi-compatibilty
set nocompatible
set laststatus=2 " Always show the statusline
let g:Powerline_symbols = 'unicode' " Define dividers and shii, look at help: Powerline_symbols
let g:airline#extensions#tabline#enabled = 1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" COLORSCHEME SETTINGS
"
" Set ColorSchemes
" NOTE: Setting this after all the plugins and shii have loaded, because Monokai
" exists in one of added colorscheme plugins
set background=dark
colorscheme solarized8_flat
" Disable background highlighting by colorschemes in transparent/custom
" background term-emulator
highlight Normal ctermbg=NONE
" This is a lot faster than checking filetype for some reason
"" autocmd BufNewFile,BufRead *.py colorscheme Monokai
"" autocmd BufNewFile,BufRead * highlight WS ctermbg=yellow guibg=yellow | match WS /\s\+$/
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Temp whitespace highlighting
highlight WS ctermbg=DarkGreen guibg=DarkGreen
match WS '\s\+$'
highlight log ctermfg=215 guifg=SandyBrown
match log 'logging.\(debug\|info\|warning\|error\)'
highlight pyerr ctermfg=205 guifg=HotPink
match pyerr '\w\+Error'
" Automatic Highlighting of trailing Whitespaces """""""""""""""""""""""""""""""
"autocmd ColorScheme * highlight WS ctermbg=yellow guibg=yellow
" highlight WS ctermbg=yellow guibg=yellow
" highlight LOG ctermfg=green guifg=green
" " autocmd BufWinEnter * match WS '\s\+$'
" " autocmd BufRead *.py match LOG 'logging'
" " match WS '\s\+$'
" " match LOG 'logging'
" "match ExtraWhitespace /\s\+$/
" autocmd BufWinEnter * match WS /\s\+$/
" autocmd InsertEnter * match WS /\s\+\%#\@<!$/
" autocmd InsertLeave * match WS /\s\+$/
" autocmd BufWinLeave * call clearmatches()
"
" autocmd BufWinEnter * match LOG 'logging'
" autocmd InsertEnter * match LOG 'logging'
" autocmd InsertLeave * match LOG 'logging'
" autocmd BufWinLeave * call clearmatches()
"
" autocmd BufWinEnter * match inf '.info'
" autocmd InsertEnter * match inf '.info'
" autocmd InsertLeave * match inf '.info'
" autocmd BufWinLeave * call clearmatches()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CUSTOM FUNCTIONS """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" Add better word processing
function WordProcessing()
" Turn on UK English spell checker
set spell spelllang=en_gb
" Do not exceed 100 chars in a line
set textwidth=100
endfunction
"
" ack
function CodeProcessing()
set spell spelllang=en_us
set textwidth=80
endfunction
function FixBG()
highlight Normal ctermbg=NONE
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Custom Mappings """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" Toggle pastemode
nnoremap <F3> :set paste!<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Pretty Lambdas """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"au VimEnter * syntax keyword Statement lambda conceal cchar=λ
au VimEnter * syntax keyword racketSyntax lambda conceal cchar=λ
au VimEnter * hi! link Conceal racketSyntax
au VimEnter * set conceallevel=2
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Language Server Config """""""""""""""""""""""""""""""""""""""""""""""""""""""
" from https://github.com/autozimu/LanguageClient-neovim
set hidden
set runtimepath+=~/.vim-plugins/LanguageClient-neovim
let g:LanguageClient_serverCommands = {
\ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
\ }