aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Christian Pohle2016-05-09 17:00:35 +0200
committerMax Christian Pohle2016-05-09 17:00:35 +0200
commitc2a13ef3f498d90fb9f46b830e14c31156635676 (patch)
treee125ca03554399949d6ca0fd27b7cf1953cbf02c
parent8fd5f60d660f385b766b9c0e7ac874632c1cea1f (diff)
downloadvim-c2a13ef3f498d90fb9f46b830e14c31156635676.tar.bz2
vim-c2a13ef3f498d90fb9f46b830e14c31156635676.zip
moved repository up again
this repo shell be used for vim exclusively
-rw-r--r--.gitignore (renamed from .vim/.gitignore)0
-rw-r--r--.gitmodules4
-rw-r--r--.netrwhist4
-rw-r--r--.screen/doc/shortcuts.txt3
-rw-r--r--.screenrc27
-rw-r--r--.vim/.gitmodules3
m---------.vim/plugins/Vundle.vim0
-rw-r--r--colors/coderonline.vim (renamed from .vim/colors/coderonline.vim)0
-rw-r--r--doc/INSTALL (renamed from .vim/doc/INSTALL)0
-rw-r--r--doc/coderonline-vim.png (renamed from .vim/doc/coderonline-vim.png)bin195172 -> 195172 bytes
-rw-r--r--doc/readme.md (renamed from .vim/doc/readme.md)0
-rw-r--r--doc/shortcuts.txt (renamed from .vim/doc/shortcuts.txt)0
-rw-r--r--favicon.ico (renamed from .vim/favicon.ico)bin32038 -> 32038 bytes
-rw-r--r--gvim.desktop (renamed from .vim/gvim.desktop)0
-rw-r--r--indent/.keep (renamed from .vim/indent/.keep)0
-rw-r--r--indent/html5.vim387
-rw-r--r--indent/php.vim37
-rw-r--r--spell/.keep (renamed from .vim/spell/.keep)0
-rw-r--r--temp/.keep (renamed from .vim/temp/.keep)0
-rw-r--r--vimrc (renamed from .vim/vimrc)0
-rw-r--r--ycm_extra_conf.py145
-rw-r--r--ycm_extra_conf.pycbin0 -> 2659 bytes
22 files changed, 575 insertions, 35 deletions
diff --git a/.vim/.gitignore b/.gitignore
index 93df1ba..93df1ba 100644
--- a/.vim/.gitignore
+++ b/.gitignore
diff --git a/.gitmodules b/.gitmodules
index a7dea0d..57ae747 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
1[submodule ".vim/plugins/Vundle.vim"] 1[submodule "plugins/Vundle.vim"]
2 path = .vim/plugins/Vundle.vim 2 path = plugins/Vundle.vim
3 url = https://github.com/VundleVim/Vundle.vim.git 3 url = https://github.com/VundleVim/Vundle.vim.git
diff --git a/.netrwhist b/.netrwhist
new file mode 100644
index 0000000..430f97c
--- /dev/null
+++ b/.netrwhist
@@ -0,0 +1,4 @@
1let g:netrw_dirhistmax =10
2let g:netrw_dirhist_cnt =2
3let g:netrw_dirhist_1='/home/max/.config/google-chrome'
4let g:netrw_dirhist_2='/home/max/openvpn/cx20/client'
diff --git a/.screen/doc/shortcuts.txt b/.screen/doc/shortcuts.txt
deleted file mode 100644
index eba7846..0000000
--- a/.screen/doc/shortcuts.txt
+++ /dev/null
@@ -1,3 +0,0 @@
1[CTRL-A commands]
2
3:layout save default - saves current window layout for detach/reattach
diff --git a/.screenrc b/.screenrc
deleted file mode 100644
index 8beaf4c..0000000
--- a/.screenrc
+++ /dev/null
@@ -1,27 +0,0 @@
1# the following two lines give a two-line status, with the current window highlighted
2hardstatus alwayslastline
3hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]'
4
5# huge scrollback buffer
6defscrollback 5000
7
8# no welcome message
9startup_message off
10
11# 256 colors
12attrcolor b ".I"
13termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
14defbce on
15
16# mouse tracking allows to switch region focus by clicking
17mousetrack on
18defmousetrack on
19
20# default windows
21# get rid of silly xoff stuff
22bind s split
23
24
25# Use X scrolling mechanism
26termcapinfo xterm* ti@:te@
27
diff --git a/.vim/.gitmodules b/.vim/.gitmodules
deleted file mode 100644
index 57ae747..0000000
--- a/.vim/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
1[submodule "plugins/Vundle.vim"]
2 path = plugins/Vundle.vim
3 url = https://github.com/VundleVim/Vundle.vim.git
diff --git a/.vim/plugins/Vundle.vim b/.vim/plugins/Vundle.vim
deleted file mode 160000
Subproject 4984767509e3d05ca051e253c8a8b37de784be4
diff --git a/.vim/colors/coderonline.vim b/colors/coderonline.vim
index f842b28..f842b28 100644
--- a/.vim/colors/coderonline.vim
+++ b/colors/coderonline.vim
diff --git a/.vim/doc/INSTALL b/doc/INSTALL
index 50a2f08..50a2f08 100644
--- a/.vim/doc/INSTALL
+++ b/doc/INSTALL
diff --git a/.vim/doc/coderonline-vim.png b/doc/coderonline-vim.png
index ac76bff..ac76bff 100644
--- a/.vim/doc/coderonline-vim.png
+++ b/doc/coderonline-vim.png
Binary files differ
diff --git a/.vim/doc/readme.md b/doc/readme.md
index 800c1a2..800c1a2 100644
--- a/.vim/doc/readme.md
+++ b/doc/readme.md
diff --git a/.vim/doc/shortcuts.txt b/doc/shortcuts.txt
index 9c168f9..9c168f9 100644
--- a/.vim/doc/shortcuts.txt
+++ b/doc/shortcuts.txt
diff --git a/.vim/favicon.ico b/favicon.ico
index ca0b3c3..ca0b3c3 100644
--- a/.vim/favicon.ico
+++ b/favicon.ico
Binary files differ
diff --git a/.vim/gvim.desktop b/gvim.desktop
index 37c6e58..37c6e58 100644
--- a/.vim/gvim.desktop
+++ b/gvim.desktop
diff --git a/.vim/indent/.keep b/indent/.keep
index f8e463a..f8e463a 100644
--- a/.vim/indent/.keep
+++ b/indent/.keep
diff --git a/indent/html5.vim b/indent/html5.vim
new file mode 100644
index 0000000..94baa87
--- /dev/null
+++ b/indent/html5.vim
@@ -0,0 +1,387 @@
1" Description: HTML5 and inline SVG indenter
2" Changed By: HT de Beer <H.T.de.Beer@gmail.com>
3" Last Change: 20121013
4" Added the SVG elements to the list of indenting element. SVG elements
5" taken from http://www.w3.org/TR/SVG/eltindex.html
6"
7" Description: html5 (and html4) indenter
8" Changed By: Brian Gershon <brian.five@gmail.com>
9" Last Change: 30 Jan 2011
10"
11" 1. Started with vim72 html indent file authored by Johannes Zellner (below)
12" 2. Added html5 list as described here:
13" http://stackoverflow.com/questions/3232518/how-to-update-vim-to-color-code-new-html-elements
14" 3. Added this to a fork of https://github.com/othree/html5.vim
15" which already provides nice html5 syntax highlighting.
16"
17" Description: html indenter
18" Author: Johannes Zellner <johannes@zellner.org>
19" Last Change: Mo, 05 Jun 2006 22:32:41 CEST
20" Restoring 'cpo' and 'ic' added by Bram 2006 May 5
21" Globals:
22" let g:html_indent_tags = 'html\|p\|time'
23" let g:html_exclude_tags = ['html', 'style', 'script', 'body']
24
25
26" Only load this indent file when no other was loaded.
27if exists("b:did_indent")
28 finish
29endif
30runtime! indent/javascript.vim
31let s:jsindent = &indentexpr
32unlet b:did_indent
33runtime! indent/css.vim
34let s:cssindent = &indentexpr
35let b:did_indent = 1
36
37" [-- local settings (must come before aborting the script) --]
38setlocal indentexpr=HtmlIndentGet(v:lnum)
39setlocal indentkeys=o,O,*<Return>,<>>,{,},!^F
40
41
42let s:tags = []
43
44" [-- <ELEMENT ? - - ...> --]
45call add(s:tags, 'a')
46call add(s:tags, 'abbr')
47call add(s:tags, 'acronym')
48call add(s:tags, 'address')
49call add(s:tags, 'b')
50call add(s:tags, 'bdo')
51call add(s:tags, 'big')
52call add(s:tags, 'blockquote')
53call add(s:tags, 'button')
54call add(s:tags, 'caption')
55call add(s:tags, 'center')
56call add(s:tags, 'cite')
57call add(s:tags, 'code')
58call add(s:tags, 'colgroup')
59call add(s:tags, 'del')
60call add(s:tags, 'dfn')
61call add(s:tags, 'dir')
62call add(s:tags, 'div')
63call add(s:tags, 'dl')
64call add(s:tags, 'dt')
65call add(s:tags, 'dd')
66call add(s:tags, 'em')
67call add(s:tags, 'fieldset')
68call add(s:tags, 'font')
69call add(s:tags, 'form')
70call add(s:tags, 'frameset')
71call add(s:tags, 'h1')
72call add(s:tags, 'h2')
73call add(s:tags, 'h3')
74call add(s:tags, 'h4')
75call add(s:tags, 'h5')
76call add(s:tags, 'h6')
77call add(s:tags, 'i')
78call add(s:tags, 'iframe')
79call add(s:tags, 'ins')
80call add(s:tags, 'kbd')
81call add(s:tags, 'label')
82call add(s:tags, 'legend')
83call add(s:tags, 'li')
84call add(s:tags, 'map')
85call add(s:tags, 'menu')
86call add(s:tags, 'noframes')
87call add(s:tags, 'noscript')
88call add(s:tags, 'object')
89call add(s:tags, 'ol')
90call add(s:tags, 'optgroup')
91call add(s:tags, 'p')
92" call add(s:tags, 'pre')
93call add(s:tags, 'q')
94call add(s:tags, 's')
95call add(s:tags, 'samp')
96call add(s:tags, 'script')
97call add(s:tags, 'select')
98call add(s:tags, 'small')
99call add(s:tags, 'span')
100call add(s:tags, 'strong')
101call add(s:tags, 'style')
102call add(s:tags, 'sub')
103call add(s:tags, 'sup')
104call add(s:tags, 'table')
105call add(s:tags, 'textarea')
106call add(s:tags, 'title')
107call add(s:tags, 'tt')
108call add(s:tags, 'u')
109call add(s:tags, 'ul')
110call add(s:tags, 'var')
111
112" New HTML 5 elements
113call add(s:tags, 'article')
114call add(s:tags, 'aside')
115call add(s:tags, 'audio')
116call add(s:tags, 'canvas')
117call add(s:tags, 'datalist')
118call add(s:tags, 'details')
119call add(s:tags, 'figcaption')
120call add(s:tags, 'figure')
121call add(s:tags, 'footer')
122call add(s:tags, 'header')
123call add(s:tags, 'hgroup')
124call add(s:tags, 'main')
125call add(s:tags, 'mark')
126call add(s:tags, 'meter')
127call add(s:tags, 'nav')
128call add(s:tags, 'output')
129call add(s:tags, 'progress')
130call add(s:tags, 'picture')
131call add(s:tags, 'rb')
132call add(s:tags, 'rp')
133call add(s:tags, 'rt')
134call add(s:tags, 'rtc')
135call add(s:tags, 'ruby')
136call add(s:tags, 'section')
137call add(s:tags, 'source')
138call add(s:tags, 'summary')
139call add(s:tags, 'time')
140call add(s:tags, 'video')
141call add(s:tags, 'bdi')
142call add(s:tags, 'data')
143
144" Web Component
145call add(s:tags, 'template')
146
147" Common inline used SVG elements
148call add(s:tags, 'clipPath')
149call add(s:tags, 'defs')
150call add(s:tags, 'desc')
151call add(s:tags, 'filter')
152call add(s:tags, 'foreignObject')
153call add(s:tags, 'g')
154call add(s:tags, 'linearGradient')
155call add(s:tags, 'marker')
156call add(s:tags, 'mask')
157call add(s:tags, 'pattern')
158call add(s:tags, 'radialGradient')
159call add(s:tags, 'svg')
160call add(s:tags, 'switch')
161call add(s:tags, 'symbol')
162call add(s:tags, 'text')
163call add(s:tags, 'textPath')
164call add(s:tags, 'tref')
165call add(s:tags, 'tspan')
166
167call add(s:tags, 'html')
168call add(s:tags, 'head')
169call add(s:tags, 'body')
170
171call add(s:tags, 'thead')
172call add(s:tags, 'tbody')
173call add(s:tags, 'tfoot')
174call add(s:tags, 'tr')
175call add(s:tags, 'th')
176call add(s:tags, 'td')
177
178
179
180let s:omittable = [
181 \ ['address', 'article', 'aside', 'blockquote', 'dir', 'div', 'dl', 'fieldset', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'menu', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'],
182 \ ['dt', 'dd'],
183 \ ['li'],
184 \ ['thead', 'tbody', 'tfoot'],
185 \ ['th', 'td'],
186 \]
187
188if exists('g:html_exclude_tags')
189 for tag in g:html_exclude_tags
190 call remove(s:tags, index(s:tags, tag))
191 endfor
192endif
193let s:html_indent_tags = join(s:tags, '\|')
194let s:html_indent_tags = s:html_indent_tags.'\|\w\+\(-\w\+\)\+'
195if exists('g:html_indent_tags')
196 let s:html_indent_tags = s:html_indent_tags.'\|'.g:html_indent_tags
197endif
198
199let s:cpo_save = &cpo
200set cpo-=C
201
202" [-- count indent-increasing tags of line a:lnum --]
203fun! <SID>HtmlIndentOpen(lnum, pattern)
204 let s = substitute('x'.getline(a:lnum),
205 \ '.\{-}\(\(<\)\('.a:pattern.'\)\>\)', "\1", 'g')
206 let s = substitute(s, "[^\1].*$", '', '')
207 return strlen(s)
208endfun
209
210" [-- count indent-decreasing tags of line a:lnum --]
211fun! <SID>HtmlIndentClose(lnum, pattern)
212 let s = substitute('x'.getline(a:lnum),
213 \ '.\{-}\(\(<\)/\('.a:pattern.'\)\>>\)', "\1", 'g')
214 let s = substitute(s, "[^\1].*$", '', '')
215 return strlen(s)
216endfun
217
218" [-- count indent-increasing '{' of (java|css) line a:lnum --]
219fun! <SID>HtmlIndentOpenAlt(lnum)
220 return strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g'))
221endfun
222
223" [-- count indent-decreasing '}' of (java|css) line a:lnum --]
224fun! <SID>HtmlIndentCloseAlt(lnum)
225 return strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g'))
226endfun
227
228" [-- return the sum of indents respecting the syntax of a:lnum --]
229fun! <SID>HtmlIndentSum(lnum, style)
230 if a:style == match(getline(a:lnum), '^\s*</')
231 if a:style == match(getline(a:lnum), '^\s*</\<\('.s:html_indent_tags.'\)\>')
232 let open = <SID>HtmlIndentOpen(a:lnum, s:html_indent_tags)
233 let close = <SID>HtmlIndentClose(a:lnum, s:html_indent_tags)
234 if 0 != open || 0 != close
235 return open - close
236 endif
237 endif
238 endif
239
240 if '' != &syntax &&
241 \ synIDattr(synID(a:lnum, 1, 1), 'name') =~ '\(css\|java\).*' &&
242 \ synIDattr(synID(a:lnum, strlen(getline(a:lnum)), 1), 'name')
243 \ =~ '\(css\|java\).*'
244 if a:style == match(getline(a:lnum), '^\s*}')
245 return <SID>HtmlIndentOpenAlt(a:lnum) - <SID>HtmlIndentCloseAlt(a:lnum)
246 endif
247 endif
248 return 0
249endfun
250
251fun! HtmlIndentGet(lnum)
252 " Find a non-empty line above the current line.
253 let lnum = prevnonblank(a:lnum - 1)
254
255 " Hit the start of the file, use zero indent.
256 if lnum == 0
257 return 0
258 endif
259
260 let restore_ic = &ic
261 setlocal ic " ignore case
262
263 " [-- special handling for <pre>: no indenting --]
264 if getline(a:lnum) =~ '\c</pre>'
265 \ || 0 < searchpair('\c<pre>', '', '\c</pre>', 'nWb')
266 \ || 0 < searchpair('\c<pre>', '', '\c</pre>', 'nW')
267 " we're in a line with </pre> or inside <pre> ... </pre>
268 if restore_ic == 0
269 setlocal noic
270 endif
271 return -1
272 endif
273
274 " [-- special handling for <javascript>: use cindent --]
275 let js = '<script'
276 let jse = '</script>'
277
278 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
279 " by Tye Zdrojewski <zdro@yahoo.com>, 05 Jun 2006
280 " ZDR: This needs to be an AND (we are 'after the start of the pair' AND
281 " we are 'before the end of the pair'). Otherwise, indentation
282 " before the start of the script block will be affected; the end of
283 " the pair will still match if we are before the beginning of the
284 " pair.
285 "
286 if 0 < searchpair(js, '', jse, 'nWb')
287 \ && 0 < searchpair(js, '', jse, 'nW')
288 " we're inside javascript
289 if getline(searchpair(js, '', '</script>', 'nWb')) !~ '<script [^>]*type=["'']\?text\/\(html\|\(ng-\)\?template\)'
290 \ && getline(lnum) !~ js && getline(a:lnum) !~ jse
291 if restore_ic == 0
292 setlocal noic
293 endif
294 if s:jsindent == ''
295 return cindent(a:lnum)
296 else
297 execute 'let ind = ' . s:jsindent
298 return ind
299 endif
300 endif
301 if getline(a:lnum) =~ jse
302 return indent(searchpair(js, '', jse, 'nWb'))
303 endif
304 endif
305
306 let css = '<style'
307 let csse = '</style>'
308 if 0 < searchpair(css, '', csse, 'nWb')
309 \ && 0 < searchpair(css, '', csse, 'nW')
310 " we're inside style
311 if getline(lnum) !~ css && getline(a:lnum) !~ csse
312 if restore_ic == 0
313 setlocal noic
314 endif
315 if s:cssindent == ''
316 return cindent(a:lnum)
317 else
318 execute 'let ind = ' . s:cssindent
319 return ind
320 endif
321 endif
322 if getline(a:lnum) =~ csse
323 return indent(searchpair(css, '', csse, 'nWb'))
324 endif
325 endif
326
327 if getline(lnum) =~ '\c</pre>'
328 " line before the current line a:lnum contains
329 " a closing </pre>. --> search for line before
330 " starting <pre> to restore the indent.
331 let preline = prevnonblank(search('\c<pre>', 'bW') - 1)
332 if preline > 0
333 if restore_ic == 0
334 setlocal noic
335 endif
336
337 if 0 == match(getline(a:lnum), '^\s*</')
338 return indent(preline) - (1*&sw)
339 else
340 return indent(preline)
341 endif
342 endif
343 endif
344
345 let ind = <SID>HtmlIndentSum(lnum, -1)
346 let ind = ind + <SID>HtmlIndentSum(a:lnum, 0)
347
348 " Fix for conditional comment
349 if getline(a:lnum) =~ '\c<!--.*<\(html\|body\).*-->'
350 let ind = ind - 1
351 endif
352
353 let lind = indent(lnum)
354
355 " for tags in s:omittable
356 " let tags_exp = '<\(' . join(tags, '\|') . '\)>'
357 " let close_tags_exp = '</\(' . join(tags, '\|') . '\)>'
358 " if getline(a:lnum) =~ tags_exp
359 " let block_start = search('^'.repeat(' ', lind + (&sw * ind - 1)).'\S' , 'bnW')
360 " let prev_tag = search(tags_exp, 'bW', block_start)
361 " let prev_closetag = search(close_tags_exp, 'W', a:lnum)
362 " if prev_tag && !prev_closetag
363 " let ind = ind - 1
364 " endif
365 " endif
366
367 " if getline(a:lnum) =~ '</\w\+>'
368 " let block_start = search('^'.repeat(' ', lind + (&sw * ind - 1)).'\S' , 'bnW')
369 " let prev_tag = search(tags_exp, 'bW', block_start)
370 " let prev_closetag = search(close_tags_exp, 'W', a:lnum)
371 " if prev_tag && !prev_closetag
372 " let ind = ind - 1
373 " endif
374 " endif
375 " endfor
376
377 if restore_ic == 0
378 setlocal noic
379 endif
380
381 return lind + (&sw * ind)
382endfun
383
384let &cpo = s:cpo_save
385unlet s:cpo_save
386
387" [-- EOF <runtime>/indent/html.vim --]
diff --git a/indent/php.vim b/indent/php.vim
new file mode 100644
index 0000000..ef723a6
--- /dev/null
+++ b/indent/php.vim
@@ -0,0 +1,37 @@
1" Better indent support for PHP by making it possible to indent HTML sections
2" as well.
3if exists("b:did_indent")
4 finish
5endif
6" This script pulls in the default indent/php.vim with the :runtime command
7" which could re-run this script recursively unless we catch that:
8if exists('s:doing_indent_inits')
9 finish
10endif
11let s:doing_indent_inits = 1
12runtime! indent/html.vim
13unlet b:did_indent
14runtime! indent/php.vim
15unlet s:doing_indent_inits
16function! GetPhpHtmlIndent(lnum)
17 if exists('*HtmlIndent')
18 let html_ind = HtmlIndent()
19 else
20 let html_ind = HtmlIndentGet(a:lnum)
21 endif
22 let php_ind = GetPhpIndent()
23 " priority one for php indent script
24 if php_ind > -1
25 return php_ind
26 endif
27 if html_ind > -1
28 if getline(a:num) =~ "^<?" && (0< searchpair('<?', '', '?>', 'nWb')
29 \ || 0 < searchpair('<?', '', '?>', 'nW'))
30 return -1
31 endif
32 return html_ind
33 endif
34 return -1
35endfunction
36setlocal indentexpr=GetPhpHtmlIndent(v:lnum)
37setlocal indentkeys+=<>>
diff --git a/.vim/spell/.keep b/spell/.keep
index 6d81f6e..6d81f6e 100644
--- a/.vim/spell/.keep
+++ b/spell/.keep
diff --git a/.vim/temp/.keep b/temp/.keep
index 3d99c12..3d99c12 100644
--- a/.vim/temp/.keep
+++ b/temp/.keep
diff --git a/.vim/vimrc b/vimrc
index e03c5e1..e03c5e1 100644
--- a/.vim/vimrc
+++ b/vimrc
diff --git a/ycm_extra_conf.py b/ycm_extra_conf.py
new file mode 100644
index 0000000..c4cc609
--- /dev/null
+++ b/ycm_extra_conf.py
@@ -0,0 +1,145 @@
1# Generated by YCM Generator at 2015-09-05 13:02:32.549813
2
3# This file is NOT licensed under the GPLv3, which is the license for the rest
4# of YouCompleteMe.
5#
6# Here's the license text for this file:
7#
8# This is free and unencumbered software released into the public domain.
9#
10# Anyone is free to copy, modify, publish, use, compile, sell, or
11# distribute this software, either in source code form or as a compiled
12# binary, for any purpose, commercial or non-commercial, and by any
13# means.
14#
15# In jurisdictions that recognize copyright laws, the author or authors
16# of this software dedicate any and all copyright interest in the
17# software to the public domain. We make this dedication for the benefit
18# of the public at large and to the detriment of our heirs and
19# successors. We intend this dedication to be an overt act of
20# relinquishment in perpetuity of all present and future rights to this
21# software under copyright law.
22#
23# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29# OTHER DEALINGS IN THE SOFTWARE.
30#
31# For more information, please refer to <http://unlicense.org/>
32
33import os
34import ycm_core
35
36flags = [
37 '-x',
38 'c',
39 '-D_GNU_SOURCE',
40 '-I./',
41 '-I/usr/include',
42 '-I/usr/local/include',
43 '-Wall',
44 '-I', '../submodules/',
45 '-I', 'lib/',
46 '-I', 'submodules/qdecoder/src/',
47]
48
49
50# Set this to the absolute path to the folder (NOT the file!) containing the
51# compile_commands.json file to use that instead of 'flags'. See here for
52# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
53#
54# You can get CMake to generate this file for you by adding:
55# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
56# to your CMakeLists.txt file.
57#
58# Most projects will NOT need to set this to anything; you can just change the
59# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
60compilation_database_folder = ''
61
62if os.path.exists( compilation_database_folder ):
63 database = ycm_core.CompilationDatabase( compilation_database_folder )
64else:
65 database = None
66
67SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
68
69def DirectoryOfThisScript():
70 return os.path.dirname( os.path.abspath( __file__ ) )
71
72
73def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
74 if not working_directory:
75 return list( flags )
76 new_flags = []
77 make_next_absolute = False
78 path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
79 for flag in flags:
80 new_flag = flag
81
82 if make_next_absolute:
83 make_next_absolute = False
84 if not flag.startswith( '/' ):
85 new_flag = os.path.join( working_directory, flag )
86
87 for path_flag in path_flags:
88 if flag == path_flag:
89 make_next_absolute = True
90 break
91
92 if flag.startswith( path_flag ):
93 path = flag[ len( path_flag ): ]
94 new_flag = path_flag + os.path.join( working_directory, path )
95 break
96
97 if new_flag:
98 new_flags.append( new_flag )
99 return new_flags
100
101
102def IsHeaderFile( filename ):
103 extension = os.path.splitext( filename )[ 1 ]
104 return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
105
106
107def GetCompilationInfoForFile( filename ):
108 # The compilation_commands.json file generated by CMake does not have entries
109 # for header files. So we do our best by asking the db for flags for a
110 # corresponding source file, if any. If one exists, the flags for that file
111 # should be good enough.
112 if IsHeaderFile( filename ):
113 basename = os.path.splitext( filename )[ 0 ]
114 for extension in SOURCE_EXTENSIONS:
115 replacement_file = basename + extension
116 if os.path.exists( replacement_file ):
117 compilation_info = database.GetCompilationInfoForFile(
118 replacement_file )
119 if compilation_info.compiler_flags_:
120 return compilation_info
121 return None
122 return database.GetCompilationInfoForFile( filename )
123
124
125def FlagsForFile( filename, **kwargs ):
126 if database:
127 # Bear in mind that compilation_info.compiler_flags_ does NOT return a
128 # python list, but a "list-like" StringVec object
129 compilation_info = GetCompilationInfoForFile( filename )
130 if not compilation_info:
131 return None
132
133 final_flags = MakeRelativePathsInFlagsAbsolute(
134 compilation_info.compiler_flags_,
135 compilation_info.compiler_working_dir_ )
136
137 else:
138 relative_to = DirectoryOfThisScript()
139 final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
140
141 return {
142 'flags': final_flags,
143 'do_cache': True
144 }
145
diff --git a/ycm_extra_conf.pyc b/ycm_extra_conf.pyc
new file mode 100644
index 0000000..2f14c54
--- /dev/null
+++ b/ycm_extra_conf.pyc
Binary files differ
..