move files to directories for stow
This commit is contained in:
55
vim/.vim/autoload/togglebg.vim
Normal file
55
vim/.vim/autoload/togglebg.vim
Normal file
@@ -0,0 +1,55 @@
|
||||
" Toggle Background
|
||||
" Modified: 2011 Apr 29
|
||||
" Maintainer: Ethan Schoonover
|
||||
" License: OSI approved MIT license
|
||||
|
||||
if exists("g:loaded_togglebg")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_togglebg = 1
|
||||
|
||||
" noremap is a bit misleading here if you are unused to vim mapping.
|
||||
" in fact, there is remapping, but only of script locally defined remaps, in
|
||||
" this case <SID>TogBG. The <script> argument modifies the noremap scope in
|
||||
" this regard (and the noremenu below).
|
||||
nnoremap <unique> <script> <Plug>ToggleBackground <SID>TogBG
|
||||
inoremap <unique> <script> <Plug>ToggleBackground <ESC><SID>TogBG<ESC>a
|
||||
vnoremap <unique> <script> <Plug>ToggleBackground <ESC><SID>TogBG<ESC>gv
|
||||
nnoremenu <script> Window.Toggle\ Background <SID>TogBG
|
||||
inoremenu <script> Window.Toggle\ Background <ESC><SID>TogBG<ESC>a
|
||||
vnoremenu <script> Window.Toggle\ Background <ESC><SID>TogBG<ESC>gv
|
||||
tmenu Window.Toggle\ Background Toggle light and dark background modes
|
||||
nnoremenu <script> ToolBar.togglebg <SID>TogBG
|
||||
inoremenu <script> ToolBar.togglebg <ESC><SID>TogBG<ESC>a
|
||||
vnoremenu <script> ToolBar.togglebg <ESC><SID>TogBG<ESC>gv
|
||||
tmenu ToolBar.togglebg Toggle light and dark background modes
|
||||
noremap <SID>TogBG :call <SID>TogBG()<CR>
|
||||
|
||||
function! s:TogBG()
|
||||
let &background = ( &background == "dark"? "light" : "dark" )
|
||||
if exists("g:colors_name")
|
||||
exe "colorscheme " . g:colors_name
|
||||
endif
|
||||
endfunction
|
||||
|
||||
if !exists(":ToggleBG")
|
||||
command ToggleBG :call s:TogBG()
|
||||
endif
|
||||
|
||||
function! ToggleBackground()
|
||||
echo "Please update your ToggleBackground mapping. ':help togglebg' for information."
|
||||
endfunction
|
||||
|
||||
function! togglebg#map(mapActivation)
|
||||
try
|
||||
exe "silent! nmap <unique> ".a:mapActivation." <Plug>ToggleBackground"
|
||||
exe "silent! imap <unique> ".a:mapActivation." <Plug>ToggleBackground"
|
||||
exe "silent! vmap <unique> ".a:mapActivation." <Plug>ToggleBackground"
|
||||
finally
|
||||
return 0
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
if !exists("no_plugin_maps") && !hasmapto('<Plug>ToggleBackground')
|
||||
call togglebg#map("<F5>")
|
||||
endif
|
||||
BIN
vim/.vim/bitmaps/togglebg.png
Normal file
BIN
vim/.vim/bitmaps/togglebg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
1117
vim/.vim/colors/solarized.vim
Normal file
1117
vim/.vim/colors/solarized.vim
Normal file
File diff suppressed because it is too large
Load Diff
2
vim/.vim/ftdetect/icinga2.vim
Normal file
2
vim/.vim/ftdetect/icinga2.vim
Normal file
@@ -0,0 +1,2 @@
|
||||
" Modify
|
||||
au BufNewFile,BufRead /*etc/icinga2/*.conf,/*usr/share/icinga2/include/{itl,plugins,*.conf} set filetype=icinga2
|
||||
254
vim/.vim/indent/html.vim
Normal file
254
vim/.vim/indent/html.vim
Normal file
@@ -0,0 +1,254 @@
|
||||
|
||||
" Description: html indenter
|
||||
" Author: Johannes Zellner <johannes@zellner.org>
|
||||
" Last Change: Mo, 05 Jun 2006 22:32:41 CEST
|
||||
" Restoring 'cpo' and 'ic' added by Bram 2006 May 5
|
||||
" Globals: g:html_indent_tags -- indenting tags
|
||||
" g:html_indent_strict -- inhibit 'O O' elements
|
||||
" g:html_indent_strict_table -- inhibit 'O -' elements
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
"if exists("b:did_indent")
|
||||
"finish
|
||||
"endif
|
||||
"let b:did_indent = 1
|
||||
|
||||
if exists("g:js_indent")
|
||||
so g:js_indent
|
||||
else
|
||||
ru! indent/javascript.vim
|
||||
endif
|
||||
|
||||
echo "Sourcing html indent"
|
||||
|
||||
|
||||
" [-- local settings (must come before aborting the script) --]
|
||||
setlocal indentexpr=HtmlIndentGetter(v:lnum)
|
||||
setlocal indentkeys=o,O,*<Return>,<>>,{,}
|
||||
|
||||
|
||||
if exists('g:html_indent_tags')
|
||||
unlet g:html_indent_tags
|
||||
endif
|
||||
|
||||
" [-- helper function to assemble tag list --]
|
||||
fun! <SID>HtmlIndentPush(tag)
|
||||
if exists('g:html_indent_tags')
|
||||
let g:html_indent_tags = g:html_indent_tags.'\|'.a:tag
|
||||
else
|
||||
let g:html_indent_tags = a:tag
|
||||
endif
|
||||
endfun
|
||||
|
||||
|
||||
" [-- <ELEMENT ? - - ...> --]
|
||||
call <SID>HtmlIndentPush('a')
|
||||
call <SID>HtmlIndentPush('abbr')
|
||||
call <SID>HtmlIndentPush('acronym')
|
||||
call <SID>HtmlIndentPush('address')
|
||||
call <SID>HtmlIndentPush('b')
|
||||
call <SID>HtmlIndentPush('bdo')
|
||||
call <SID>HtmlIndentPush('big')
|
||||
call <SID>HtmlIndentPush('blockquote')
|
||||
call <SID>HtmlIndentPush('button')
|
||||
call <SID>HtmlIndentPush('caption')
|
||||
call <SID>HtmlIndentPush('center')
|
||||
call <SID>HtmlIndentPush('cite')
|
||||
call <SID>HtmlIndentPush('code')
|
||||
call <SID>HtmlIndentPush('colgroup')
|
||||
call <SID>HtmlIndentPush('del')
|
||||
call <SID>HtmlIndentPush('dfn')
|
||||
call <SID>HtmlIndentPush('dir')
|
||||
call <SID>HtmlIndentPush('div')
|
||||
call <SID>HtmlIndentPush('dl')
|
||||
call <SID>HtmlIndentPush('em')
|
||||
call <SID>HtmlIndentPush('fieldset')
|
||||
call <SID>HtmlIndentPush('font')
|
||||
call <SID>HtmlIndentPush('form')
|
||||
call <SID>HtmlIndentPush('frameset')
|
||||
call <SID>HtmlIndentPush('h1')
|
||||
call <SID>HtmlIndentPush('h2')
|
||||
call <SID>HtmlIndentPush('h3')
|
||||
call <SID>HtmlIndentPush('h4')
|
||||
call <SID>HtmlIndentPush('h5')
|
||||
call <SID>HtmlIndentPush('h6')
|
||||
call <SID>HtmlIndentPush('i')
|
||||
call <SID>HtmlIndentPush('iframe')
|
||||
call <SID>HtmlIndentPush('ins')
|
||||
call <SID>HtmlIndentPush('kbd')
|
||||
call <SID>HtmlIndentPush('label')
|
||||
call <SID>HtmlIndentPush('legend')
|
||||
call <SID>HtmlIndentPush('map')
|
||||
call <SID>HtmlIndentPush('menu')
|
||||
call <SID>HtmlIndentPush('noframes')
|
||||
call <SID>HtmlIndentPush('noscript')
|
||||
call <SID>HtmlIndentPush('object')
|
||||
call <SID>HtmlIndentPush('ol')
|
||||
call <SID>HtmlIndentPush('optgroup')
|
||||
" call <SID>HtmlIndentPush('pre')
|
||||
call <SID>HtmlIndentPush('q')
|
||||
call <SID>HtmlIndentPush('s')
|
||||
call <SID>HtmlIndentPush('samp')
|
||||
call <SID>HtmlIndentPush('script')
|
||||
call <SID>HtmlIndentPush('select')
|
||||
call <SID>HtmlIndentPush('small')
|
||||
call <SID>HtmlIndentPush('span')
|
||||
call <SID>HtmlIndentPush('strong')
|
||||
call <SID>HtmlIndentPush('style')
|
||||
call <SID>HtmlIndentPush('sub')
|
||||
call <SID>HtmlIndentPush('sup')
|
||||
call <SID>HtmlIndentPush('table')
|
||||
call <SID>HtmlIndentPush('textarea')
|
||||
call <SID>HtmlIndentPush('title')
|
||||
call <SID>HtmlIndentPush('tt')
|
||||
call <SID>HtmlIndentPush('u')
|
||||
call <SID>HtmlIndentPush('ul')
|
||||
call <SID>HtmlIndentPush('var')
|
||||
|
||||
|
||||
" [-- <ELEMENT ? O O ...> --]
|
||||
if !exists('g:html_indent_strict')
|
||||
call <SID>HtmlIndentPush('body')
|
||||
call <SID>HtmlIndentPush('head')
|
||||
call <SID>HtmlIndentPush('html')
|
||||
call <SID>HtmlIndentPush('tbody')
|
||||
endif
|
||||
|
||||
|
||||
" [-- <ELEMENT ? O - ...> --]
|
||||
if !exists('g:html_indent_strict_table')
|
||||
call <SID>HtmlIndentPush('th')
|
||||
call <SID>HtmlIndentPush('td')
|
||||
call <SID>HtmlIndentPush('tr')
|
||||
call <SID>HtmlIndentPush('tfoot')
|
||||
call <SID>HtmlIndentPush('thead')
|
||||
endif
|
||||
|
||||
delfun <SID>HtmlIndentPush
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo-=C
|
||||
|
||||
" [-- count indent-increasing tags of line a:lnum --]
|
||||
fun! <SID>HtmlIndentOpen(lnum, pattern)
|
||||
let s = substitute('x'.getline(a:lnum),
|
||||
\ '.\{-}\(\(<\)\('.a:pattern.'\)\>\)', "\1", 'g')
|
||||
let s = substitute(s, "[^\1].*$", '', '')
|
||||
return strlen(s)
|
||||
endfun
|
||||
|
||||
" [-- count indent-decreasing tags of line a:lnum --]
|
||||
fun! <SID>HtmlIndentClose(lnum, pattern)
|
||||
let s = substitute('x'.getline(a:lnum),
|
||||
\ '.\{-}\(\(<\)/\('.a:pattern.'\)\>>\)', "\1", 'g')
|
||||
let s = substitute(s, "[^\1].*$", '', '')
|
||||
return strlen(s)
|
||||
endfun
|
||||
|
||||
" [-- count indent-increasing '{' of (java|css) line a:lnum --]
|
||||
fun! <SID>HtmlIndentOpenAlt(lnum)
|
||||
return strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g'))
|
||||
endfun
|
||||
|
||||
" [-- count indent-decreasing '}' of (java|css) line a:lnum --]
|
||||
fun! <SID>HtmlIndentCloseAlt(lnum)
|
||||
return strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g'))
|
||||
endfun
|
||||
|
||||
" [-- return the sum of indents respecting the syntax of a:lnum --]
|
||||
fun! <SID>HtmlIndentSum(lnum, style)
|
||||
if a:style == match(getline(a:lnum), '^\s*</')
|
||||
if a:style == match(getline(a:lnum), '^\s*</\<\('.g:html_indent_tags.'\)\>')
|
||||
let open = <SID>HtmlIndentOpen(a:lnum, g:html_indent_tags)
|
||||
let close = <SID>HtmlIndentClose(a:lnum, g:html_indent_tags)
|
||||
if 0 != open || 0 != close
|
||||
return open - close
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
if '' != &syntax &&
|
||||
\ synIDattr(synID(a:lnum, 1, 1), 'name') =~ '\(css\|java\).*' &&
|
||||
\ synIDattr(synID(a:lnum, strlen(getline(a:lnum)), 1), 'name')
|
||||
\ =~ '\(css\|java\).*'
|
||||
if a:style == match(getline(a:lnum), '^\s*}')
|
||||
return <SID>HtmlIndentOpenAlt(a:lnum) - <SID>HtmlIndentCloseAlt(a:lnum)
|
||||
endif
|
||||
endif
|
||||
return 0
|
||||
endfun
|
||||
|
||||
fun! HtmlIndentGetter(lnum)
|
||||
|
||||
echo "Grabbing html indent for line: " . a:lnum
|
||||
" Find a non-empty line above the current line.
|
||||
let lnum = prevnonblank(a:lnum - 1)
|
||||
|
||||
" Hit the start of the file, use zero indent.
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let restore_ic = &ic
|
||||
setlocal ic " ignore case
|
||||
|
||||
" [-- special handling for <pre>: no indenting --]
|
||||
if getline(a:lnum) =~ '\c</pre>'
|
||||
\ || 0 < searchpair('\c<pre>', '', '\c</pre>', 'nWb')
|
||||
\ || 0 < searchpair('\c<pre>', '', '\c</pre>', 'nW')
|
||||
" we're in a line with </pre> or inside <pre> ... </pre>
|
||||
if restore_ic == 0
|
||||
setlocal noic
|
||||
endif
|
||||
return -1
|
||||
endif
|
||||
|
||||
" [-- special handling for <javascript>: use cindent --]
|
||||
let js = '<script.*type\s*=.*javascript'
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" by Tye Zdrojewski <zdro@yahoo.com>, 05 Jun 2006
|
||||
" ZDR: This needs to be an AND (we are 'after the start of the pair' AND
|
||||
" we are 'before the end of the pair'). Otherwise, indentation
|
||||
" before the start of the script block will be affected; the end of
|
||||
" the pair will still match if we are before the beginning of the
|
||||
" pair.
|
||||
"
|
||||
if 0 < searchpair(js, '', '</script>', 'nWb')
|
||||
\ && 0 < searchpair(js, '', '</script>', 'nW')
|
||||
" we're inside javascript
|
||||
|
||||
if getline(lnum) !~ js && getline(a:lnum) !~ '</script>'
|
||||
if restore_ic == 0
|
||||
setlocal noic
|
||||
endif
|
||||
return GetJsIndent(a:lnum)
|
||||
endif
|
||||
endif
|
||||
|
||||
if getline(lnum) =~ '\c</pre>'
|
||||
" line before the current line a:lnum contains
|
||||
" a closing </pre>. --> search for line before
|
||||
" starting <pre> to restore the indent.
|
||||
let preline = prevnonblank(search('\c<pre>', 'bW') - 1)
|
||||
if preline > 0
|
||||
if restore_ic == 0
|
||||
setlocal noic
|
||||
endif
|
||||
return indent(preline)
|
||||
endif
|
||||
endif
|
||||
|
||||
let ind = <SID>HtmlIndentSum(lnum, -1)
|
||||
let ind = ind + <SID>HtmlIndentSum(a:lnum, 0)
|
||||
|
||||
if restore_ic == 0
|
||||
setlocal noic
|
||||
endif
|
||||
|
||||
return indent(lnum) + (&sw * ind)
|
||||
endfun
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" [-- EOF <runtime>/indent/html.vim --]
|
||||
407
vim/.vim/indent/javascript.vim
Normal file
407
vim/.vim/indent/javascript.vim
Normal file
@@ -0,0 +1,407 @@
|
||||
" Vim indent file Language: JavaScript
|
||||
" Author: Preston Koprivica (pkopriv2@gmail.com)
|
||||
" URL:
|
||||
" Last Change: April 30, 2010
|
||||
|
||||
" 0. Standard Stuff
|
||||
" =================
|
||||
|
||||
" Only load one indent script per buffer
|
||||
if exists('b:did_indent')
|
||||
finish
|
||||
endif
|
||||
|
||||
let b:did_indent = 1
|
||||
|
||||
" Set the global log variable 1 = logging enabled, 0 = logging disabled
|
||||
if !exists("g:js_indent_log")
|
||||
let g:js_indent_log = 0
|
||||
endif
|
||||
|
||||
setlocal indentexpr=GetJsIndent(v:lnum)
|
||||
setlocal indentkeys=
|
||||
|
||||
|
||||
setlocal cindent
|
||||
setlocal autoindent
|
||||
|
||||
|
||||
" 1. Variables
|
||||
" ============
|
||||
|
||||
" Inline comments (for anchoring other statements)
|
||||
let s:js_mid_line_comment = '\s*\(\/\*.*\*\/\)*\s*'
|
||||
let s:js_end_line_comment = s:js_mid_line_comment . '\s*\(//.*\)*'
|
||||
let s:js_line_comment = s:js_end_line_comment
|
||||
|
||||
" Comment/String Syntax Key
|
||||
let s:syn_comment = '\(Comment\|String\|Regexp\)'
|
||||
|
||||
|
||||
" 2. Aux. Functions
|
||||
" =================
|
||||
|
||||
" = Method: IsInComment
|
||||
"
|
||||
" Determines whether the specified position is contained in a comment. "Note:
|
||||
" This depends on a
|
||||
function! s:IsInComment(lnum, cnum)
|
||||
return synIDattr(synID(a:lnum, a:cnum, 1), 'name') =~? s:syn_comment
|
||||
endfunction
|
||||
|
||||
|
||||
" = Method: IsComment
|
||||
"
|
||||
" Determines whether a line is a comment or not.
|
||||
function! s:IsComment(lnum)
|
||||
let line = getline(a:lnum)
|
||||
|
||||
return s:IsInComment(a:lnum, 1) && s:IsInComment(a:lnum, strlen(line)) "Doesn't absolutely work. Only Probably!
|
||||
endfunction
|
||||
|
||||
|
||||
" = Method: GetNonCommentLine
|
||||
"
|
||||
" Grabs the nearest non-commented line
|
||||
function! s:GetNonCommentLine(lnum)
|
||||
let lnum = prevnonblank(a:lnum)
|
||||
|
||||
while lnum > 0
|
||||
if s:IsComment(lnum)
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
else
|
||||
return lnum
|
||||
endif
|
||||
endwhile
|
||||
|
||||
return lnum
|
||||
endfunction
|
||||
|
||||
" = Method: SearchForPair
|
||||
"
|
||||
" Returns the beginning tag of a given pair starting from the given line.
|
||||
function! s:SearchForPair(lnum, beg, end)
|
||||
" Save the cursor position.
|
||||
let curpos = getpos(".")
|
||||
|
||||
" Set the cursor position to the beginning of the line (default
|
||||
" behavior when using ==)
|
||||
call cursor(a:lnum, 0)
|
||||
|
||||
" Search for the opening tag
|
||||
let mnum = searchpair(a:beg, '', a:end, 'bW',
|
||||
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? s:syn_comment' )
|
||||
|
||||
"Restore the cursor position
|
||||
call cursor(curpos)
|
||||
|
||||
" Finally, return the matched line number
|
||||
return mnum
|
||||
endfunction
|
||||
|
||||
|
||||
" Object Helpers
|
||||
" ==============
|
||||
let s:object_beg = '{[^}]*' . s:js_end_line_comment . '$'
|
||||
let s:object_end = '^' . s:js_mid_line_comment . '}[;,]\='
|
||||
|
||||
|
||||
function! s:IsObjectBeg(line)
|
||||
return a:line =~ s:object_beg
|
||||
endfunction
|
||||
|
||||
function! s:IsObjectEnd(line)
|
||||
return a:line =~ s:object_end
|
||||
endfunction
|
||||
|
||||
function! s:GetObjectBeg(lnum)
|
||||
return s:SearchForPair(a:lnum, '{', '}')
|
||||
endfunction
|
||||
|
||||
|
||||
" Array Helpers
|
||||
" ==============
|
||||
let s:array_beg = '\[[^\]]*' . s:js_end_line_comment . '$'
|
||||
let s:array_end = '^' . s:js_mid_line_comment . '[^\[]*\][;,]*' . s:js_end_line_comment . '$'
|
||||
|
||||
|
||||
function! s:IsArrayBeg(line)
|
||||
return a:line =~ s:array_beg
|
||||
endfunction
|
||||
|
||||
function! s:IsArrayEnd(line)
|
||||
return a:line =~ s:array_end
|
||||
endfunction
|
||||
|
||||
function! s:GetArrayBeg(lnum)
|
||||
return s:SearchForPair(a:lnum, '\[', '\]')
|
||||
endfunction
|
||||
|
||||
|
||||
" MultiLine Declaration/Invocation Helpers
|
||||
" ========================================
|
||||
let s:paren_beg = '([^)]*' . s:js_end_line_comment . '$'
|
||||
let s:paren_end = '^' . s:js_mid_line_comment . '[^(]*)[;,]*'
|
||||
|
||||
function! s:IsParenBeg(line)
|
||||
return a:line =~ s:paren_beg
|
||||
endfunction
|
||||
|
||||
function! s:IsParenEnd(line)
|
||||
return a:line =~ s:paren_end
|
||||
endfunction
|
||||
|
||||
function! s:GetParenBeg(lnum)
|
||||
return s:SearchForPair(a:lnum, '(', ')')
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
" Continuation Helpers
|
||||
" ====================
|
||||
let s:continuation = '\(+\|\\\)\{1}' . s:js_line_comment . '$'
|
||||
|
||||
function! s:IsContinuationLine(line)
|
||||
return a:line =~ s:continuation
|
||||
endfunction
|
||||
|
||||
function! s:GetContinuationBegin(lnum)
|
||||
let cur = a:lnum
|
||||
|
||||
while s:IsContinuationLine(getline(cur))
|
||||
let cur -= 1
|
||||
endwhile
|
||||
|
||||
return cur + 1
|
||||
endfunction
|
||||
|
||||
|
||||
" Switch Helpers
|
||||
" ==============
|
||||
let s:switch_beg_next_line = 'switch\s*(.*)\s*' . s:js_mid_line_comment . s:js_end_line_comment . '$'
|
||||
let s:switch_beg_same_line = 'switch\s*(.*)\s*' . s:js_mid_line_comment . '{\s*' . s:js_line_comment . '$'
|
||||
let s:switch_mid = '^.*\(case.*\|default\)\s*:\s*'
|
||||
|
||||
function! s:IsSwitchBeginNextLine(line)
|
||||
return a:line =~ s:switch_beg_next_line
|
||||
endfunction
|
||||
|
||||
function! s:IsSwitchBeginSameLine(line)
|
||||
return a:line =~ s:switch_beg_same_line
|
||||
endfunction
|
||||
|
||||
function! s:IsSwitchMid(line)
|
||||
return a:line =~ s:switch_mid
|
||||
endfunction
|
||||
|
||||
|
||||
" Control Helpers
|
||||
" ===============
|
||||
let s:cntrl_beg_keys = '\(\(\(if\|for\|with\|while\)\s*(.*)\)\|\(try\|do\)\)\s*'
|
||||
let s:cntrl_mid_keys = '\(\(\(else\s*if\|catch\)\s*(.*)\)\|\(finally\|else\)\)\s*'
|
||||
|
||||
let s:cntrl_beg = s:cntrl_beg_keys . s:js_end_line_comment . '$'
|
||||
let s:cntrl_mid = s:cntrl_mid_keys . s:js_end_line_comment . '$'
|
||||
|
||||
let s:cntrl_end = '\(while\s*(.*)\)\s*;\=\s*' . s:js_end_line_comment . '$'
|
||||
|
||||
function! s:IsControlBeg(line)
|
||||
return a:line =~ s:cntrl_beg
|
||||
endfunction
|
||||
|
||||
function! s:IsControlMid(line)
|
||||
return a:line =~ s:cntrl_mid
|
||||
endfunction
|
||||
|
||||
function! s:IsControlMidStrict(line)
|
||||
return a:line =~ s:cntrl_mid
|
||||
endfunction
|
||||
|
||||
function! s:IsControlEnd(line)
|
||||
return a:line =~ s:cntrl_end
|
||||
endfunction
|
||||
|
||||
" = Method: Log
|
||||
"
|
||||
" Logs a message to the stdout.
|
||||
function! s:Log(msg)
|
||||
if g:js_indent_log
|
||||
echo "LOG: " . a:msg
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
" 3. Indenter
|
||||
" ===========
|
||||
function! GetJsIndent(lnum)
|
||||
" Grab the first non-comment line prior to this line
|
||||
let pnum = s:GetNonCommentLine(a:lnum-1)
|
||||
|
||||
" First line, start at indent = 0
|
||||
if pnum == 0
|
||||
call s:Log("No, noncomment lines prior to the current line.")
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Grab the second non-comment line prior to this line
|
||||
let ppnum = s:GetNonCommentLine(pnum-1)
|
||||
|
||||
call s:Log("Line: " . a:lnum)
|
||||
call s:Log("PLine: " . pnum)
|
||||
call s:Log("PPLine: " . ppnum)
|
||||
|
||||
" Grab the lines themselves.
|
||||
let line = getline(a:lnum)
|
||||
let pline = getline(pnum)
|
||||
let ppline = getline(ppnum)
|
||||
|
||||
" Determine the current level of indentation
|
||||
let ind = indent(pnum)
|
||||
|
||||
|
||||
" Handle: Object Closers (ie })
|
||||
" =============================
|
||||
if s:IsObjectEnd(line) && !s:IsComment(a:lnum)
|
||||
call s:Log("Line matched object end")
|
||||
|
||||
let obeg = s:GetObjectBeg(a:lnum)
|
||||
let oind = indent(obeg)
|
||||
let oline = getline(obeg)
|
||||
|
||||
call s:Log("The object beg was found at: " . obeg)
|
||||
return oind
|
||||
endif
|
||||
|
||||
if s:IsObjectBeg(pline)
|
||||
call s:Log("Pline matched object beg")
|
||||
return ind + &sw
|
||||
endif
|
||||
|
||||
|
||||
" Handle: Array Closer (ie ])
|
||||
" ============================
|
||||
if s:IsArrayEnd(line) && !s:IsComment(a:lnum)
|
||||
call s:Log("Line matched array end")
|
||||
|
||||
let abeg = s:GetArrayBeg(a:lnum)
|
||||
let aind = indent(abeg)
|
||||
|
||||
call s:Log("The array beg was found at: " . abeg)
|
||||
return aind
|
||||
endif
|
||||
|
||||
if s:IsArrayBeg(pline)
|
||||
call s:Log("Pline matched array beg")
|
||||
return ind + &sw
|
||||
endif
|
||||
|
||||
" Handle: Parens
|
||||
" ==============
|
||||
if s:IsParenEnd(line) && !s:IsComment(a:lnum)
|
||||
call s:Log("Line matched paren end")
|
||||
|
||||
let abeg = s:GetParenBeg(a:lnum)
|
||||
let aind = indent(abeg)
|
||||
|
||||
call s:Log("The paren beg was found at: " . abeg)
|
||||
return aind
|
||||
endif
|
||||
|
||||
if s:IsParenBeg(pline)
|
||||
call s:Log("Pline matched paren beg")
|
||||
return ind + &sw
|
||||
endif
|
||||
|
||||
|
||||
" Handle: Continuation Lines.
|
||||
" ========================================================
|
||||
if s:IsContinuationLine(pline)
|
||||
call s:Log('Pline is a continuation line.')
|
||||
|
||||
let cbeg = s:GetContinuationBegin(pnum)
|
||||
let cind = indent(cbeg)
|
||||
|
||||
call s:Log('The continuation block begin found at: ' . cbeg)
|
||||
return cind + &sw
|
||||
endif
|
||||
|
||||
if s:IsContinuationLine(ppline)
|
||||
call s:Log('PPline was a continuation line but pline wasnt.')
|
||||
return ind - &sw
|
||||
endif
|
||||
|
||||
" Handle: Switch Control Blocks
|
||||
" =============================
|
||||
if s:IsSwitchMid(pline)
|
||||
call s:Log("PLine matched switch cntrl mid")
|
||||
if s:IsSwitchMid(line) || s:IsObjectEnd(line)
|
||||
call s:Log("Line matched a cntrl mid")
|
||||
return ind
|
||||
else
|
||||
call s:Log("Line didnt match a cntrl mid")
|
||||
return ind + &sw
|
||||
endif
|
||||
endif
|
||||
|
||||
if s:IsSwitchMid(line)
|
||||
call s:Log("Line matched switch cntrl mid")
|
||||
return ind - &sw
|
||||
endif
|
||||
|
||||
|
||||
" Handle: Single Line Control Blocks
|
||||
" ==================================
|
||||
if s:IsControlBeg(pline)
|
||||
call s:Log("Pline matched control beginning")
|
||||
|
||||
if s:IsControlMid(line)
|
||||
call s:Log("Line matched a control mid")
|
||||
return ind
|
||||
elseif line =~ '^\s*{\s*$'
|
||||
call s:Log("Line matched an object beg")
|
||||
return ind
|
||||
else
|
||||
return ind + &sw
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
if s:IsControlMid(pline)
|
||||
call s:Log("Pline matched a control mid")
|
||||
|
||||
if s:IsControlMid(line)
|
||||
call s:Log("Line matched a control mid")
|
||||
return ind
|
||||
elseif s:IsObjectBeg(line)
|
||||
call s:Log("Line matched an object beg")
|
||||
return ind
|
||||
else
|
||||
call s:Log("Line didn't match a control mid or object beg."
|
||||
return ind + &sw
|
||||
endif
|
||||
endif
|
||||
|
||||
if s:IsControlMid(line)
|
||||
call s:Log("Line matched a control mid.")
|
||||
|
||||
if s:IsControlEnd(pline) || s:IsObjectEnd(pline)
|
||||
call s:Log("PLine matched control end")
|
||||
return ind
|
||||
else
|
||||
call s:Log("Pline didn't match object end")
|
||||
return ind - &sw
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
if ( s:IsControlBeg(ppline) || s:IsControlMid(ppline) ) &&
|
||||
\ !s:IsObjectBeg(pline) && !s:IsObjectEnd(pline)
|
||||
call s:Log("PPLine matched single line control beg or mid")
|
||||
return ind - &sw
|
||||
endif
|
||||
|
||||
" Handle: No matches
|
||||
" ==================
|
||||
"call s:Log("Line didn't match anything. Retaining indent")
|
||||
return ind
|
||||
endfunction
|
||||
BIN
vim/.vim/spell/fr.latin1.spl
Normal file
BIN
vim/.vim/spell/fr.latin1.spl
Normal file
Binary file not shown.
BIN
vim/.vim/spell/fr.latin1.sug
Normal file
BIN
vim/.vim/spell/fr.latin1.sug
Normal file
Binary file not shown.
BIN
vim/.vim/spell/fr.utf-8.spl
Normal file
BIN
vim/.vim/spell/fr.utf-8.spl
Normal file
Binary file not shown.
BIN
vim/.vim/spell/fr.utf-8.sug
Normal file
BIN
vim/.vim/spell/fr.utf-8.sug
Normal file
Binary file not shown.
232
vim/.vim/syntax/icinga2.vim
Normal file
232
vim/.vim/syntax/icinga2.vim
Normal file
@@ -0,0 +1,232 @@
|
||||
" Vim syntax file
|
||||
" Filename: icinga2.vim
|
||||
" Language: Icinga2 object configuration file
|
||||
" Author: Carlos Cesario <carloscesario@gmail.com>
|
||||
" Version: 0.0.2
|
||||
" Based: javascript.vim / nagios.vim
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
if !exists("main_syntax")
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
let main_syntax = 'icinga2'
|
||||
endif
|
||||
|
||||
|
||||
" case off
|
||||
syntax case ignore
|
||||
|
||||
" comments
|
||||
syn keyword icinga2CommentTodo TODO FIXME XXX TBD contained
|
||||
syn match icinga2LineComment "\/\/.*" contains=icinga2CommentTodo
|
||||
syn match icinga2LineComment "#.*" contains=icinga2CommentTodo
|
||||
syn match icinga2CommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
|
||||
syn region icinga2Comment start="/\*" end="\*/" contains=icinga2CommentTodo
|
||||
|
||||
" type definitions
|
||||
" - double quotes "
|
||||
" - single quotes '
|
||||
" - brackets <>
|
||||
|
||||
syn region StringD start=+"+ end=+"\|$+
|
||||
syn region StringS start=+'+ end=+'\|$+
|
||||
syn match angleBrackets "<\w\+>"
|
||||
|
||||
|
||||
" Braces and Parens definition
|
||||
" Braces are used in dictionary definition
|
||||
|
||||
syn match Braces "[{}\[\]]"
|
||||
syn match Parens "[()]"
|
||||
|
||||
|
||||
" objects types
|
||||
syn match icinga2ObjDef "object[ \t]\+\(hostgroup\|host\|servicegroup\|service\|usergroup\|user\)"
|
||||
syn match icinga2ObjDef "object[ \t]\+\(checkcommand\|notificationcommand\|eventcommand\|notification\)"
|
||||
syn match icinga2Objdef "object[ \t]\+\(timeperiod\|scheduleddowntime\|dependency\|perfdatawriter\)"
|
||||
syn match icinga2ObjDef "object[ \t]\+\(graphitewriter\|idomysqlconnection\|idomysqlconnection\)"
|
||||
syn match icinga2ObjDef "object[ \t]\+\(livestatuslistener\|statusdatawriter\|externalcommandlistener\)"
|
||||
syn match icinga2ObjDef "object[ \t]\+\(compatlogger\|checkresultreader\|checkcomponent\|notificationcomponent\)"
|
||||
syn match icinga2ObjDef "object[ \t]\+\(filelogger\|sysloglogger\|icingaapplication\|apilistener\|apiuser\|endpoint\|zone\)"
|
||||
|
||||
|
||||
" apply def
|
||||
syn match icinga2ApplyDef "apply[ \t]\+\(Service\|Dependency\|Notification\|ScheduledDowntime\)"
|
||||
|
||||
|
||||
" objects attributes
|
||||
syn keyword icinga2ObjAttr contained accept_commands accept_config action_url address address6 arguments author bind_host
|
||||
syn keyword icinga2ObjAttr contained bind_port ca_path categories cert_path check_command check_interval
|
||||
syn keyword icinga2ObjAttr contained check_period child_host_name child_service_name cleanup client_cn command command_endpoint command_path
|
||||
syn keyword icinga2ObjAttr contained comment compat_log_path crl_path database disable_checks disable_notifications
|
||||
syn keyword icinga2ObjAttr contained display_name duration email enable_active_checks enable_event_handlers enable_event_handler
|
||||
syn keyword icinga2ObjAttr contained enable_flapping enable_ha enable_host_checks enable_notifications enable_passive_checks enable_perfdata
|
||||
syn keyword icinga2ObjAttr contained enable_service_checks endpoints env event_command failover_timeout fixed flapping_threshold groups host
|
||||
syn keyword icinga2ObjAttr contained host_format_template host_name host_name_template host_perfdata_path host_temp_path icon_image
|
||||
syn keyword icinga2ObjAttr contained icon_image_alt instance_description instance_name interval key_path log_dir
|
||||
syn keyword icinga2ObjAttr contained log_duration max_check_attempts methods name notes notes_url objects_path
|
||||
syn keyword icinga2ObjAttr contained pager parent parent_host_name parent_service_name password path period permissions
|
||||
syn keyword icinga2ObjAttr contained port ranges retry_interval rotation_interval rotation_method
|
||||
syn keyword icinga2ObjAttr contained service_format_template service_name service_name_template service_perfdata_path service_temp_path
|
||||
syn keyword icinga2ObjAttr contained severity socket_path socket_type spool_dir states status_path table_prefix
|
||||
syn keyword icinga2ObjAttr contained timeout times types update_interval user user_groups users volatile zone
|
||||
syn match icinga2ObjAttr contained "\(vars.\w\+\)"
|
||||
|
||||
|
||||
" keywords
|
||||
syn keyword icinga2Keyword template const import include include_recursive var function return to use locals globals this
|
||||
|
||||
|
||||
" Assign conditions
|
||||
syn match icinga2AssingCond contained "\(assign[ \t]\+\where\|ignore[ \t]\+\where\)"
|
||||
|
||||
|
||||
" Global functions
|
||||
syn keyword icinga2GFunction contained regex match cidr_match len union intersection keys string
|
||||
syn keyword icinga2GFunction contained number bool random log typeof get_time parse_performance_data dirname
|
||||
syn keyword icinga2GFunction contained basename escape_shell_arg escape_shell_cmd escape_create_process_arg exit
|
||||
|
||||
|
||||
" Accessor Functions
|
||||
syn keyword icinga2AFunction contained get_host get_service get_user get_check_command get_event_command get_notification_command
|
||||
syn keyword icinga2AFunction contained get_host_group get_service_group get_user_group get_time_period
|
||||
|
||||
|
||||
" Math functions
|
||||
syn match icinga2MathFunction contained "\(Math.E\|Math.LN2\|Math.LN10\|Math.LOG2E\|Math.PI\|Math.SQRT1_2\|Math.SQRT2\)"
|
||||
syn match icinga2MathFunction contained "\(Math.abs\|Math.acos\|Math.asin\|Math.atan\|Math.atan2\|Math.ceil\|Math.cos\)"
|
||||
syn match icinga2MathFunction contained "\(Math.exp\|Math.floor\|Math.isinf\|Math.isnan\|Math.log\|Math.max\|Math.min\)"
|
||||
syn match icinga2MathFunction contained "\(Math.pow\|Math.random\|Math.round\|Math.sign\|Math.sin\|Math.sqrt\|Math.tan\)"
|
||||
|
||||
" Json functions
|
||||
syn match icinga2JsonFunction contained "\(Json.encode\|Json.decode\)"
|
||||
|
||||
" String functions
|
||||
syn match icinga2StrFunction contained "\(\.find\)"
|
||||
syn match icinga2StrFunction contained "\(\.contains\)"
|
||||
syn match icinga2StrFunction contained "\(\.len\)"
|
||||
syn match icinga2StrFunction contained "\(\.lower\)"
|
||||
syn match icinga2StrFunction contained "\(\.upper\)"
|
||||
syn match icinga2StrFunction contained "\(\.replace\)"
|
||||
syn match icinga2StrFunction contained "\(\.split\)"
|
||||
syn match icinga2StrFunction contained "\(\.substr\)"
|
||||
syn match icinga2StrFunction contained "\(\.to_string\)"
|
||||
syn match icinga2StrFunction contained "\(\.reverse\)"
|
||||
|
||||
" Array and Dict Functions
|
||||
syn match icinga2ArrFunction contained "\(\.clone\)"
|
||||
syn match icinga2ArrFunction contained "\(\.add(\)"
|
||||
syn match icinga2ArrFunction contained "\(\.clear\)"
|
||||
syn match icinga2ArrFunction contained "\(\.shallow_clone\)"
|
||||
syn match icinga2ArrFunction contained "\(\.contains\)"
|
||||
syn match icinga2ArrFunction contained "\(\.len\)"
|
||||
syn match icinga2ArrFunction contained "\(\.remove\)"
|
||||
syn match icinga2ArrFunction contained "\(\.set\)"
|
||||
syn match icinga2ArrFunction contained "\(\.get\)"
|
||||
syn match icinga2ArrFunction contained "\(\.sort\)"
|
||||
syn match icinga2ArrFunction contained "\(\.join\)"
|
||||
syn match icinga2ArrFunction contained "\(\.reverse\)"
|
||||
syn match icinga2ArrFunction contained "\(\.keys\)"
|
||||
syn match icinga2ArrFunction contained "\(\.call\)"
|
||||
syn match icinga2ArrFunction contained "\(\.callv\)"
|
||||
|
||||
|
||||
" Conditional statements
|
||||
syn keyword icinga2Cond if else
|
||||
|
||||
" Loops
|
||||
syn keyword icinga2Loop while for break continue
|
||||
|
||||
" Operators
|
||||
syn match icinga2Operators "[ \t]\+\(\.\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(!\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(\~\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(+\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(-\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(*\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(/[^/\*]\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(%\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(+\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(-\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(=\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(<\)[ \t]\+"
|
||||
syn match icinga2Operators "[ \t]\+\(>\)[ \t]\+"
|
||||
syn match icinga2Operators "[ \t]\+\(<<\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(>>\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(<=\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(>=\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(in\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(!in\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(==\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(!=\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(&\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(\^\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(|\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(&&\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(||\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(=>\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(+=\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(-=\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(*=\)\+"
|
||||
syn match icinga2Operators "[ \t]\+\(/=\)\+"
|
||||
|
||||
" global constats
|
||||
syn keyword icinga2Gconst PrefixDir SysconfDir ZonesDir LocalStateDir RunDir PkgDataDir StatePath ObjectsPath
|
||||
syn keyword icinga2Gconst PidPath NodeName ApplicationType UseVfork RunAsUser RunAsGroup PluginDir
|
||||
" global types
|
||||
syn keyword icinga2Gconst Number String Boolean Array Dictionary Value Object ConfigObject Command CheckResult
|
||||
syn keyword icinga2Gconst Checkable CustomVarObject DbConnection Type PerfdataValue Comment Downtime Logger Application
|
||||
|
||||
" values type
|
||||
syn keyword valueBoolean contained true false
|
||||
syn keyword valueNull contained null
|
||||
|
||||
|
||||
|
||||
syn region nagiosDefBody start='{' end='}'
|
||||
\ contains=icinga2Comment, icinga2LineComment, StringD, Braces, Parens, icinga2ObjDef,
|
||||
\ icinga2ApplyDef, icinga2ObjAttr, icinga2Keyword, icinga2Keyword, icinga2AssignCond,
|
||||
\ icinga2Cond, icinga2Loop, icinga2Operators, icinga2GFunction, icinga2AFunction,
|
||||
\ icinga2MathFunction, icinga2Gconst, icinga2JsonFunction, icinga2StrFunction,
|
||||
\ icinga2ArrFunction, valueBoolean, valueNull
|
||||
|
||||
|
||||
" Highlighting
|
||||
hi link icinga2Comment Comment
|
||||
hi link icinga2LineComment Comment
|
||||
hi link icinga2CommentTodo Todo
|
||||
|
||||
hi link Braces Function
|
||||
hi link Parens Function
|
||||
|
||||
hi link StringS String
|
||||
hi link StringD String
|
||||
hi link angleBrackets String
|
||||
|
||||
hi link icinga2ObjDef Statement
|
||||
hi link icinga2ApplyDef Statement
|
||||
hi link icinga2ObjAttr Define
|
||||
hi link icinga2Keyword Keyword
|
||||
|
||||
hi link icinga2AssignCond Conditional
|
||||
|
||||
hi link icinga2Cond Statement
|
||||
hi link icinga2Loop Statement
|
||||
hi link icinga2Operators Operator
|
||||
|
||||
hi link icinga2AFunction Function
|
||||
hi link icinga2MathFunction Function
|
||||
hi link icinga2GFunction Function
|
||||
hi link icinga2JsonFunction Function
|
||||
hi link icinga2StrFunction Function
|
||||
hi link icinga2ArrFunction Function
|
||||
|
||||
|
||||
hi link icinga2Gconst Statement
|
||||
|
||||
hi link valueBoolean Boolean
|
||||
hi link valueNull Special
|
||||
169
vim/.vimrc
Normal file
169
vim/.vimrc
Normal file
@@ -0,0 +1,169 @@
|
||||
" {{{ Vundle
|
||||
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 'VundleVim/Vundle.vim'
|
||||
Plugin 'scrooloose/nerdtree.git'
|
||||
Plugin 'bling/vim-airline'
|
||||
Plugin 'vim-jp/vim-go-extra'
|
||||
Plugin 'fatih/vim-go'
|
||||
Plugin 'posva/vim-vue'
|
||||
Plugin 'leafgarland/typescript-vim'
|
||||
|
||||
Bundle 'Quramy/tsuquyomi'
|
||||
Bundle 'chase/vim-ansible-yaml'
|
||||
" }}}
|
||||
|
||||
" {{{ airline
|
||||
if !exists('g:airline_symbols')
|
||||
let g:airline_symbols = {}
|
||||
endif
|
||||
|
||||
" unicode symbols
|
||||
let g:airline_left_sep = '»'
|
||||
let g:airline_left_sep = '▶'
|
||||
let g:airline_right_sep = '«'
|
||||
let g:airline_right_sep = '◀'
|
||||
let g:airline_symbols.linenr = '␊'
|
||||
let g:airline_symbols.linenr = ''
|
||||
let g:airline_symbols.linenr = '¶'
|
||||
let g:airline_symbols.branch = '⎇'
|
||||
let g:airline_symbols.paste = 'ρ'
|
||||
let g:airline_symbols.paste = 'Þ'
|
||||
let g:airline_symbols.paste = '∥'
|
||||
let g:airline_symbols.whitespace = 'Ξ'
|
||||
|
||||
" powerline symbols
|
||||
let g:airline_left_sep = ''
|
||||
let g:airline_left_alt_sep = ''
|
||||
let g:airline_right_sep = ''
|
||||
let g:airline_right_alt_sep = ''
|
||||
let g:airline_symbols.branch = ''
|
||||
let g:airline_symbols.readonly = ''
|
||||
let g:airline_symbols.linenr = ''
|
||||
|
||||
set laststatus=2
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
let g:airline#extensions#tabline#tab_nr_type = 1 " tab number
|
||||
let g:airline#extensions#tabline#buffer_nr_show = 1
|
||||
let g:airline#extensions#tabline#show_close_button = 0
|
||||
let g:airline#extensions#tabline#fnamemod = ':t:.'
|
||||
" }}}
|
||||
|
||||
syntax enable
|
||||
set history=500
|
||||
set nu
|
||||
set cursorline
|
||||
set ai
|
||||
set smartindent
|
||||
" lignes autour du curseur lors d'un déplacement (j/k)
|
||||
set so=5
|
||||
" nombre de colonnes pour représenter une tabulation, nombre d'espaces d'une
|
||||
" tabulation, nombre d'espaces d'une indentation, ne pas remplacer les
|
||||
" tabulations par des espaces
|
||||
set ts=4 sts=4 sw=4 noexpandtab
|
||||
" detection du type de fichier et indentation adequate (touche =)
|
||||
filetype on
|
||||
filetype plugin on
|
||||
filetype indent on
|
||||
" permet de quiter un buffer modifié sans alerte (avec :bn ou :bp)
|
||||
" on a toujours l'alerte si on quitte vim
|
||||
set hidden
|
||||
" theme de couleur
|
||||
set t_Co=256
|
||||
set background=dark
|
||||
let g:solarized_termtrans=1
|
||||
let g:solarized_termcolors=256
|
||||
colorscheme solarized
|
||||
" recherche avec surbrillance
|
||||
set incsearch
|
||||
set showmatch
|
||||
set hlsearch
|
||||
" relecture fichier si modif externe
|
||||
set autoread
|
||||
" indent javascript
|
||||
filetype plugin indent on
|
||||
" completion améliorée, ignore certains fichiers
|
||||
set wildmenu
|
||||
set wildignore=*~,*/.git/*
|
||||
" changement de ligne en fin/debut de ligne pour ces mouvements
|
||||
set whichwrap+=h,l
|
||||
" abandon buffer quitté
|
||||
set hid
|
||||
|
||||
" remap <ESC>
|
||||
inoremap jk <ESC>
|
||||
" leader key
|
||||
let mapleader = "\<Space>"
|
||||
|
||||
" modeline
|
||||
set modeline
|
||||
" tabs
|
||||
set expandtab
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
|
||||
" {{{ Shortcuts
|
||||
" disable ex mode
|
||||
nnoremap Q <Nop>
|
||||
" clear search
|
||||
nnoremap <Leader>c :nohl<cr>
|
||||
" NERdTree
|
||||
nnoremap <Leader>o :NERDTree<cr>
|
||||
" save
|
||||
nnoremap <Leader>w :w<CR>
|
||||
" quit
|
||||
nnoremap <Leader>q :q<CR>
|
||||
" navigate buffers
|
||||
nnoremap <Leader>l :bn<CR>
|
||||
nnoremap <Leader>h :bp<CR>
|
||||
nnoremap <Leader>d :bd<CR>
|
||||
" copy/paste system clipboard
|
||||
nnoremap <Leader>pp :setlocal paste!<CR>
|
||||
vmap <Leader>y "+y
|
||||
vmap <Leader>d "+d
|
||||
nmap <Leader>p "+p
|
||||
nmap <Leader>P "+P
|
||||
vmap <Leader>p "+p
|
||||
vmap <Leader>P "+P
|
||||
" enter visual mode
|
||||
nmap <Leader><Leader> V
|
||||
" Automatically jump to end of text you pasted
|
||||
vnoremap <silent> y y`]
|
||||
vnoremap <silent> p p`]
|
||||
nnoremap <silent> p p`]
|
||||
" }}}
|
||||
|
||||
|
||||
" Stop that stupid window from popping up
|
||||
map q: :q
|
||||
|
||||
" {{{ Vundle
|
||||
" All of your Plugins must be added before the following line
|
||||
call vundle#end() " required
|
||||
filetype plugin indent on " required
|
||||
" }}}
|
||||
|
||||
" {{{ Go auto-format
|
||||
autocmd FileType go autocmd BufWritePre <buffer> Fmt
|
||||
nnoremap <Leader>i :GoImports<cr>
|
||||
" }}}
|
||||
|
||||
" {{{ Vue.js components
|
||||
autocmd FileType vue syntax sync fromstart
|
||||
" }}}
|
||||
|
||||
" {{{ Typescript
|
||||
autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript
|
||||
" }}}
|
||||
|
||||
" {{{ Markdown + spell
|
||||
au BufNewFile,BufFilePre,BufRead *.md set filetype=markdown
|
||||
au BufNewFile,BufFilePre,BufRead *.md set spell
|
||||
au BufNewFile,BufFilePre,BufRead *.md set linebreak
|
||||
set spelllang=fr
|
||||
" }}}
|
||||
|
||||
Reference in New Issue
Block a user