diff --git a/etc/soft/nvim/+ftplugin/ansible.vim b/etc/soft/nvim/+ftplugin/ansible.vim new file mode 100644 index 0000000..52201af --- /dev/null +++ b/etc/soft/nvim/+ftplugin/ansible.vim @@ -0,0 +1,6 @@ +" Slow yaml highlighting workaround +if exists('+regexpengine') && ('®expengine' == 0) + setlocal regexpengine=1 +endif +set isfname+=@-@ +set path+=./../templates,./../files,templates,files diff --git a/etc/soft/nvim/+ftplugin/ansible_hosts.vim b/etc/soft/nvim/+ftplugin/ansible_hosts.vim new file mode 100644 index 0000000..93b0766 --- /dev/null +++ b/etc/soft/nvim/+ftplugin/ansible_hosts.vim @@ -0,0 +1,10 @@ +if exists("b:did_ftplugin") + finish +else + let b:did_ftplugin = 1 +endif + +setlocal syntax=dosini +setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions-=c + +let b:undo_ftplugin = "setl comments< commentstring< formatoptions<" diff --git a/etc/soft/nvim/+ftplugin/haskell.vim b/etc/soft/nvim/+ftplugin/haskell.vim index 3223120..7a07bc7 100644 --- a/etc/soft/nvim/+ftplugin/haskell.vim +++ b/etc/soft/nvim/+ftplugin/haskell.vim @@ -1,4 +1,131 @@ set makeprg=ghc\ %\ -o\ %< " Компилятор -call SetHaskellFolding() +runtime syntax/custom/HaskellConceal.vim + + +" ============================================================================= +" Descriptions: Provide a function providing folding information for haskell +" files. +" Maintainer: Vincent B (twinside@gmail.com) +" Warning: Assume the presence of type signatures on top of your functions to +" work well. +" Usage: drop in ~/vimfiles/plugin or ~/.vim/plugin +" Version: 1.2 +" Changelog: - 1.2 : Reacting to file type instead of file extension. +" - 1.1 : Adding foldtext to bet more information. +" - 1.0 : initial version +" ============================================================================= +" Top level bigdefs +fun! s:HaskellFoldMaster( line ) "{{{ + return a:line =~# '^data\s' + \ || a:line =~# '^type\s' + \ || a:line =~# '^newtype\s' + \ || a:line =~# '^class\s' + \ || a:line =~# '^instance\s' + \ || a:line =~ '^[^:]\+\s*::' +endfunction "}}} + +" Top Level one line shooters. +fun! s:HaskellSnipGlobal(line) "{{{ + return a:line =~# '^module' + \ || a:line =~# '^import' + \ || a:line =~# '^infix[lr]\s' +endfunction "}}} + +" The real folding function +fun! HaskellFold( lineNum ) "{{{ + let line = getline( a:lineNum ) + + " Beginning of comment + if line =~ '^\s*--' || line =~ '^\s*{-' + return 2 + endif + + if line =~ '^import' + return 2 + endif + + if s:HaskellSnipGlobal( line ) + return 0 + endif + + if line =~ '^\s*$' + let nextline = getline(a:lineNum + 1) + if s:HaskellFoldMaster( nextline ) > 0 || s:HaskellSnipGlobal( nextline ) > 0 + \ || nextline =~ "^--" || nextline =~ "^{-" + return 0 + else + return -1 + endif + endif + + return 1 +endfunction "}}} + +" This function skim over function definitions +" skiping comments line : +" -- .... +" and merging lines without first non space element, to +" catch the full type expression. +fun! HaskellFoldText() "{{{ + let i = v:foldstart + let retVal = '' + let began = 0 + + let commentOnlyLine = '^\s*--.*$' + let monoLineComment = '\s*--.*$' + let nonEmptyLine = '^\s\+\S' + let emptyLine = '^\s*$' + let multilineCommentBegin = '^\s*{-' + let multilineCommentEnd = '-}' + + let short = get(g:, 'haskellFold_ShortText', 0) + let isMultiLine = 0 + + let line = getline(i) + while i <= v:foldend + + if isMultiLine + if line =~ multilineCommentEnd + let isMultiLine = 0 + let line = substitute(line, '.*-}', '', '') + + if line =~ emptyLine + let i = i + 1 + let line = getline(i) + end + else + let i = i + 1 + let line = getline(i) + end + else + if line =~ multilineCommentBegin + let isMultiLine = 1 + continue + elseif began == 0 && !(line =~ commentOnlyLine) + let retVal = substitute(line, monoLineComment, ' ','') + let began = 1 + elseif began != 0 && line =~ nonEmptyLine && !short + let tempVal = substitute( line, '\s\+\(.*\)$', ' \1', '' ) + let retVal = retVal . substitute(tempVal, '\s\+--.*', ' ','') + elseif began != 0 + break + endif + + let i = i + 1 + let line = getline(i) + endif + endwhile + + if retVal == '' + " We didn't found any meaningfull text + return foldtext() + endif + + return retVal +endfunction "}}} + +setlocal foldexpr=HaskellFold(v:lnum) +setlocal foldtext=HaskellFoldText() +setlocal foldmethod=expr diff --git a/etc/soft/nvim/+ftplugin/liquid.vim b/etc/soft/nvim/+ftplugin/liquid.vim new file mode 100644 index 0000000..b211a88 --- /dev/null +++ b/etc/soft/nvim/+ftplugin/liquid.vim @@ -0,0 +1,61 @@ +" Vim filetype plugin +" Language: Liquid +" Maintainer: Tim Pope +" Last Change: 2010 May 21 + +if exists('b:did_ftplugin') + finish +endif + +if !exists('g:liquid_default_subtype') + let g:liquid_default_subtype = 'html' +endif + +if !exists('b:liquid_subtype') + let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") + let b:liquid_subtype = matchstr(s:lines,'liquid_subtype=\zs\w\+') + if b:liquid_subtype == '' + let b:liquid_subtype = matchstr(&filetype,'^liquid\.\zs\w\+') + endif + if b:liquid_subtype == '' + let b:liquid_subtype = matchstr(substitute(expand('%:t'),'\c\%(\.liquid\)\+$','',''),'\.\zs\w\+$') + endif + if b:liquid_subtype == '' + let b:liquid_subtype = g:liquid_default_subtype + endif +endif + +if exists('b:liquid_subtype') && b:liquid_subtype != '' + exe 'runtime! ftplugin/'.b:liquid_subtype.'.vim ftplugin/'.b:liquid_subtype.'_*.vim ftplugin/'.b:liquid_subtype.'/*.vim' +else + runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim +endif +let b:did_ftplugin = 1 + +if exists('b:undo_ftplugin') + let b:undo_ftplugin .= '|' +else + let b:undo_ftplugin = '' +endif +if exists('b:browsefilter') + let b:browsefilter = "\n".b:browsefilter +else + let b:browsefilter = '' +endif +if exists('b:match_words') + let b:match_words .= ',' +elseif exists('loaded_matchit') + let b:match_words = '' +endif + +if has('gui_win32') + let b:browsefilter="Liquid Files (*.liquid)\t*.liquid" . b:browsefilter +endif + +if exists('loaded_matchit') + let b:match_words .= '\<\%(if\w*\|unless\|case\)\>:\<\%(elsif\|else\|when\)\>:\,\<\%(for\|tablerow\)\>:\%({%\s*\)\@<=empty\>:\,<\(capture\|comment\|highlight\)\>:\' +endif + +setlocal commentstring={%\ comment\ %}%s{%\ endcomment\ %} + +let b:undo_ftplugin .= 'setl cms< | unlet! b:browsefilter b:match_words' diff --git a/etc/soft/nvim/+ftplugin/mru.vim b/etc/soft/nvim/+ftplugin/mru.vim new file mode 100644 index 0000000..d4c9199 --- /dev/null +++ b/etc/soft/nvim/+ftplugin/mru.vim @@ -0,0 +1 @@ +set number diff --git a/etc/soft/nvim/+ftplugin/racket.vim b/etc/soft/nvim/+ftplugin/racket.vim index 4cacd2b..ff19924 100644 --- a/etc/soft/nvim/+ftplugin/racket.vim +++ b/etc/soft/nvim/+ftplugin/racket.vim @@ -1 +1,4 @@ set makeprg=racket\ % " Проверка на ошибки и синтаксис + +runtime syntax/custom/RainbowParenthsis.vim + diff --git a/etc/soft/nvim/+ftplugin/scheme.vim b/etc/soft/nvim/+ftplugin/scheme.vim index 7233a26..62f64a2 100644 --- a/etc/soft/nvim/+ftplugin/scheme.vim +++ b/etc/soft/nvim/+ftplugin/scheme.vim @@ -3,3 +3,6 @@ set keywordprg=hs()\ {\ echo\ \"(help\ $1)\"\|guile\|less;\ };\ hs set makeprg=guile\ % " Проверка на ошибки и синтаксис set errorformat=%tRROR:\ %f:%l:%c:\ %m " Формат строки с информацией" + +runtime syntax/custom/RainbowParenthsis.vim + diff --git a/etc/soft/nvim/+ftplugin/sls.vim b/etc/soft/nvim/+ftplugin/sls.vim new file mode 100644 index 0000000..32bc6ff --- /dev/null +++ b/etc/soft/nvim/+ftplugin/sls.vim @@ -0,0 +1,61 @@ +" Slow yaml highlighting workaround +if exists('+regexpengine') && ('®expengine' == 0) + setlocal regexpengine=1 +endif + +" Use two-spaces for indentation +setlocal expandtab +setlocal softtabstop=2 +setlocal shiftwidth=2 +setlocal commentstring=#%s + +setlocal formatoptions=crl +" r -> don't add comment leader after an Enter +" c -> wrap long comments, including # +" l -> do not wrap long lines + +" indentation +setlocal autoindent + +" This function is from https://gist.github.com/871107 +" Author: Ian Young +" +function! GetYamlIndent() + let cnum = v:lnum + let lnum = v:lnum - 1 + if lnum == 0 + return 0 + endif + let line = substitute(getline(lnum),'\s\+$','','') + let cline = substitute(getline(cnum),'\s\+$','','') + let indent = indent(lnum) + let increase = indent + &sw + let decrease = indent - &sw + if line =~ ':$' + return increase + elseif line !~ ':$' && cline =~ ':$' + return decrease + elseif line =~ ':$' + else + return indent + endif +endfunction + +setlocal indentexpr=GetYamlIndent() + +" folding +setlocal foldmethod=indent +setlocal foldlevel=20 " by default do not fold + + +" Visual warning about UTF8 characters in SLS file. +" salt does not like them much, so they should be red +augroup utfsls + autocmd! + highlight UTFsls ctermbg=red guibg=red + match UTFsls /[\x7F-\xFF]/ + autocmd BufWinEnter match UTFsls /[\x7F-\xFF]/ + autocmd InsertEnter match UTFsls /[\x7F-\xFF]/ + autocmd InsertLeave match UTFsls /[\x7F-\xFF]/ + autocmd BufWinLeave call clearmatches() +augroup END diff --git a/etc/soft/nvim/+ftplugin/terraform.vim b/etc/soft/nvim/+ftplugin/terraform.vim new file mode 100644 index 0000000..43fdd21 --- /dev/null +++ b/etc/soft/nvim/+ftplugin/terraform.vim @@ -0,0 +1,184 @@ +" terraform.vim - basic vim/terraform integration +" Maintainer: HashiVim + +let s:cpo_save = &cpoptions +set cpoptions&vim + +" Ensure no conflict with arguments from the environment +let $TF_CLI_ARGS_fmt='' + +function! TerraformFmt() abort + " Save the view. + let curw = winsaveview() + + " Make a fake change so that the undo point is right. + normal! ix + normal! "_x + + " Execute `terraform fmt`, redirecting stderr to a temporary file. + let tmpfile = tempname() + let shellredir_save = &shellredir + let &shellredir = '>%s 2>'.tmpfile + silent execute '%!'.g:terraform_binary_path.' fmt -no-color -' + let &shellredir = shellredir_save + + " If there was an error, undo any changes and show stderr. + if v:shell_error != 0 + silent undo + let output = readfile(tmpfile) + echo join(output, "\n") + endif + + " Delete the temporary file, and restore the view. + call delete(tmpfile) + call winrestview(curw) +endfunction + +function! TerraformAlign() abort + let p = '^.*=[^>]*$' + if exists(':Tabularize') && getline('.') =~# '^.*=' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) + let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g')) + let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*')) + Tabularize/=/l1 + normal! 0 + call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) + endif +endfunction + +function! TerraformCommands(ArgLead, CmdLine, CursorPos) abort + let commands = [ + \ 'init', + \ 'validate', + \ 'plan', + \ 'apply', + \ 'destroy', + \ 'console', + \ 'fmt', + \ 'force-unlock', + \ 'get', + \ 'graph', + \ 'import', + \ 'login', + \ 'logout', + \ 'output', + \ 'providers', + \ 'refresh', + \ 'show', + \ 'state', + \ 'taint', + \ 'untaint', + \ 'version', + \ 'workspace' + \ ] + return join(commands, "\n") +endfunction + +let &cpoptions = s:cpo_save +unlet s:cpo_save + +" ------------------------------------------------------------------------------ + +if exists('b:did_ftplugin') || v:version < 700 || &compatible + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpoptions +set cpoptions&vim + +" j is a relatively recent addition; silence warnings when setting it. +setlocal formatoptions-=t formatoptions+=croql +silent! setlocal formatoptions+=j +let b:undo_ftplugin = 'setlocal formatoptions<' + +if !has('patch-7.4.1142') + " Include hyphens as keyword characters so that a keyword appearing as + " part of a longer name doesn't get partially highlighted. + setlocal iskeyword+=- + let b:undo_ftplugin .= ' iskeyword<' +endif + +if get(g:, 'terraform_fold_sections', 0) + setlocal foldmethod=syntax + let b:undo_ftplugin .= ' foldmethod<' +endif + +" Set the commentstring +setlocal commentstring=#%s +let b:undo_ftplugin .= ' commentstring<' + +if get(g:, 'terraform_align', 0) && exists(':Tabularize') + inoremap = =:call TerraformAlign()a + let b:undo_ftplugin .= '|iunmap =' +endif + +let &cpoptions = s:cpo_save +unlet s:cpo_save + +if !exists('g:terraform_binary_path') + let g:terraform_binary_path='terraform' +endif + +if !executable(g:terraform_binary_path) + finish +endif + +let s:cpo_save = &cpoptions +set cpoptions&vim + +command! -nargs=+ -complete=custom,TerraformCommands -buffer Terraform + \ execute '!'.g:terraform_binary_path.' '..' -no-color' + +" command! -nargs=0 -buffer TerraformFmt call TerraformFmt() +let b:undo_ftplugin .= '|delcommand Terraform|delcommand TerraformFmt' + +if get(g:, 'terraform_fmt_on_save', 0) + augroup vim.terraform.fmt + autocmd! + autocmd BufWritePre *.tf call TerraformFmt() + autocmd BufWritePre *.tfvars call TerraformFmt() + augroup END +endif + +let &cpoptions = s:cpo_save +unlet s:cpo_save + +" ------------------------------------------------------------------------------ +" https://github.com/jgerry/terraform-vim-folding +" ------------------------------------------------------------------------------ + +function! TerraformFolds() + let thisline = getline(v:lnum) + if match(thisline, '^resource') >= 0 + return ">1" + elseif match(thisline, '^provider') >= 0 + return ">1" + elseif match(thisline, '^module') >= 0 + return ">1" + elseif match(thisline, '^variable') >= 0 + return ">1" + elseif match(thisline, '^output') >= 0 + return ">1" + elseif match(thisline, '^data') >= 0 + return ">1" + elseif match(thisline, '^locals') >= 0 + return ">1" + elseif match(thisline, '^terraform') >= 0 + return ">1" + else + return "=" + endif +endfunction + +function! TerraformFoldText() + let foldsize = (v:foldend-v:foldstart) + return getline(v:foldstart).' ('.foldsize.' lines)' +endfunction + +setlocal foldmethod=expr +setlocal foldexpr=TerraformFolds() +setlocal foldlevel=0 +setlocal foldtext=TerraformFoldText() + +" ------------------------------------------------------------------------------ + diff --git a/etc/soft/nvim/+ftplugin/vimwiki.vim b/etc/soft/nvim/+ftplugin/vimwiki.vim index c26c3b7..8be7d94 100644 --- a/etc/soft/nvim/+ftplugin/vimwiki.vim +++ b/etc/soft/nvim/+ftplugin/vimwiki.vim @@ -7,3 +7,6 @@ vmap - :normal - set textwidth=80 +" Vimwiki тормозит +set nocursorline + diff --git a/etc/soft/nvim/autoload/pathogen.vim b/etc/soft/nvim/autoload/pathogen.vim index a13ae08..b2891cd 100644 --- a/etc/soft/nvim/autoload/pathogen.vim +++ b/etc/soft/nvim/autoload/pathogen.vim @@ -1,6 +1,6 @@ " pathogen.vim - path option manipulation " Maintainer: Tim Pope -" Version: 2.3 +" Version: 2.4 " Install in ~/.vim/autoload (or ~\vimfiles\autoload). " @@ -16,22 +16,29 @@ endif let g:loaded_pathogen = 1 " Point of entry for basic default usage. Give a relative path to invoke -" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke -" pathogen#surround(). Curly braces are expanded with pathogen#expand(): -" "bundle/{}" finds all subdirectories inside "bundle" inside all directories -" in the runtime path. +" pathogen#interpose() or an absolute path to invoke pathogen#surround(). +" Curly braces are expanded with pathogen#expand(): "bundle/{}" finds all +" subdirectories inside "bundle" inside all directories in the runtime path. +" If no arguments are given, defaults "bundle/{}", and also "pack/{}/start/{}" +" on versions of Vim without native package support. function! pathogen#infect(...) abort - for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}'] - if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]' + if a:0 + let paths = filter(reverse(copy(a:000)), 'type(v:val) == type("")') + else + let paths = ['bundle/{}', 'pack/{}/start/{}'] + endif + if has('packages') + call filter(paths, 'v:val !~# "^pack/[^/]*/start/[^/]*$"') + endif + let static = '^\%([$~\\/]\|\w:[\\/]\)[^{}*]*$' + for path in filter(copy(paths), 'v:val =~# static') + call pathogen#surround(path) + endfor + for path in filter(copy(paths), 'v:val !~# static') + if path =~# '^\%([$~\\/]\|\w:[\\/]\)' call pathogen#surround(path) - elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)' - call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') - call pathogen#surround(path . '/{}') - elseif path =~# '[{}*]' - call pathogen#interpose(path) else - call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') - call pathogen#interpose(path . '/{}') + call pathogen#interpose(path) endif endfor call pathogen#cycle_filetype() @@ -90,27 +97,28 @@ function! pathogen#cycle_filetype() abort endfunction " Check if a bundle is disabled. A bundle is considered disabled if its -" basename or full name is included in the list g:pathogen_disabled. +" basename or full name is included in the list g:pathogen_blacklist or the +" comma delimited environment variable $VIMBLACKLIST. function! pathogen#is_disabled(path) abort if a:path =~# '\~$' return 1 endif let sep = pathogen#slash() - let blacklist = map( - \ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + - \ pathogen#split($VIMBLACKLIST), - \ 'substitute(v:val, "[\\/]$", "", "")') + let blacklist = get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + pathogen#split($VIMBLACKLIST) + if !empty(blacklist) + call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")') + endif return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1 -endfunction "}}}1 +endfunction " Prepend the given directory to the runtime path and append its corresponding " after directory. Curly braces are expanded with pathogen#expand(). function! pathogen#surround(path) abort let sep = pathogen#slash() let rtp = pathogen#split(&rtp) - let path = fnamemodify(a:path, ':p:?[\\/]\=$??') + let path = fnamemodify(a:path, ':s?[\\/]\=$??') let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)') - let after = filter(reverse(pathogen#expand(path.sep.'after')), '!pathogen#is_disabled(v:val[0:-7])') + let after = filter(reverse(pathogen#expand(path, sep.'after')), '!pathogen#is_disabled(v:val[0 : -7])') call filter(rtp, 'index(before + after, v:val) == -1') let &rtp = pathogen#join(before, rtp, after) return &rtp @@ -128,7 +136,7 @@ function! pathogen#interpose(name) abort let list = [] for dir in pathogen#split(&rtp) if dir =~# '\,'edit',,0) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(,'edit',,0) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(,'edit',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(,'split',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(,'vsplit',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(,'tabedit',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',,1) - " vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=': diff --git a/etc/soft/nvim/cheat40.txt b/etc/soft/nvim/cheat40.txt index b36f919..da1f8f6 100644 --- a/etc/soft/nvim/cheat40.txt +++ b/etc/soft/nvim/cheat40.txt @@ -18,14 +18,14 @@ Press q to dismiss, to lose focus Конец предыдущего слова ge Конец предыдущего СЛОВА gE -ex {{{1 +ex {{{2 Замена результатов поиска:%s///g C Замена в найденных стр. :g/../s/a/b/g C Замена с подтверждением :s/a/b/gc C Повтор последней замены :%&g C -Регистры {{{1 +Регистры {{{2 Содержимое регистров :registers N Копировать строку в `a` "ayy N @@ -48,3 +48,14 @@ ex {{{1 ~ \p без цифр \P последняя строка поиска ~ +signature.vim {{{1 + +Toggle mark 'x' mx +Remove mark 'x' dmx +Place the next available mark m, +Delete all line marks m- +Delete all buffer marks m +Jump to next mark ]` +Jump to prev mark [` +Open buffer marks list m/ + diff --git a/etc/soft/nvim/coc-settings.json b/etc/soft/nvim/coc-settings.json index f44b113..b9cf49b 100644 --- a/etc/soft/nvim/coc-settings.json +++ b/etc/soft/nvim/coc-settings.json @@ -1,10 +1,8 @@ { - "diagnostic.errorSign": "✖", - "suggest.autoTrigger": "none", "coc.preferences.formatOnSaveFiletypes": [], "codeLens.enable": true, - "coc.preferences.formatOnSaveFiletypes": ["haskell"], - "coc.preferences.snippets.enable": true, + "diagnostic.errorSign": "✖", + "suggest.autoTrigger": "none", "languageserver": { "golang": { "command": "/Users/m.likhachev/go/bin/gopls", diff --git a/etc/soft/nvim/ftdetect/detect.vim b/etc/soft/nvim/ftdetect/detect.vim index 83df7d3..1398a3e 100644 --- a/etc/soft/nvim/ftdetect/detect.vim +++ b/etc/soft/nvim/ftdetect/detect.vim @@ -1,69 +1,118 @@ -au BufNewFile,BufRead *.test set filetype=tcl -au BufNewFile,BufRead *.txt set textwidth=80 -au BufNewFile,BufRead *.txt set filetype=txt - -au BufRead,BufNewFile *.tex set filetype=tex -au BufRead,BufNewFile *.pro set filetype=prolog -au BufRead,BufNewFile *.xpt.vim set filetype=xpt.vim -au BufRead,BufNewFile *.xpt.vim set filetype=xpt.vim -au BufRead,BufNewFile *.vim set filetype=vim -au BufRead,BufNewFile *.mutt set filetype=muttrc -au BufRead,BufNewFile *rtorrent.rc* set filetype=rtorrent -au BufRead,BufNewFile *.gv set filetype=graphviz -au BufRead,BufNewFile *.r set filetype=rebol -au BufRead,BufNewFile rfc* set filetype=rfc -au BufRead,BufNewFile bash-fc* set filetype=sh -au BufRead,BufNewFile *.wiki set filetype=vimwiki -au BufWinEnter,BufRead,BufNewFile *.wiki set nocursorline -au BufRead,BufNewFile *.timelog set filetype=timelog -au BufRead,BufNewFile *.rkt set filetype=racket - -au BufRead,BufNewFile *.scm runtime plugin/RainbowParenthsis.vim -au BufRead,BufNewFile *.lisp runtime plugin/RainbowParenthsis.vim -au BufRead,BufNewFile *.rkt runtime plugin/RainbowParenthsis.vim - -au BufRead,BufNewFile *.scm set lisp -au BufRead,BufNewFile *.lisp set lisp - -au BufReadPre *.doc set ro -au BufReadPre *.doc set hlsearch! -au BufReadPost *.doc %!antiword "%" -au BufReadPost *.doc set filetype=txt - -au BufReadPre *.docx set ro -au BufReadPre *.docx set hlsearch! -au BufReadPost *.docx %!docx2txt "%" - -au BufReadPost *.docx set filetype=txt - -au BufReadPre *.odt set ro -au BufReadPre *.odt set hlsearch! -au BufReadPost *.odt %!odt2txt "%" -au BufReadPost *.odt set filetype=txt - -au BufReadPre *.rtf set ro -au BufReadPre *.rtf set hlsearch! -au BufReadPost *.rtf %!catdoc "%" -au BufReadPost *.rtf set filetype=txt - -au BufReadPre *.pdf set ro -au BufReadPre *.pdf set hlsearch! -au BufReadPost *.pdf %!pdftotext -nopgbrk "%" - | fmt -csw78 -au BufReadPost *.pdf set filetype=txt - -au BufRead,BufNewFile *.note setf note - -au BufRead,BufNewFile *.rsc set filetype=rsc - -au BufNewFile,BufRead *.rename set filetype=rename - -au BufNewFile,BufRead Vagrantfile set filetype=ruby - -au BufNewFile,BufRead *.tf setlocal filetype=terraform -au BufNewFile,BufRead *.tfvars setlocal filetype=terraform -au BufNewFile,BufRead *.tfstate setlocal filetype=json - -au BufNewFile,BufRead Containerfile setlocal filetype=dockerfile +au BufRead,BufNewFile *.gv setlocal filetype=graphviz +au BufRead,BufNewFile *.lisp,*.scm setlocal lisp +au BufRead,BufNewFile *.mutt setlocal filetype=muttrc +au BufRead,BufNewFile *.note setlocal filetype=note +au BufRead,BufNewFile *.pro setlocal filetype=prolog +au BufRead,BufNewFile *.r setlocal filetype=rebol +au BufRead,BufNewFile *.rename setlocal filetype=rename +au BufRead,BufNewFile *.rkt setlocal filetype=racket +au BufRead,BufNewFile *.rsc setlocal filetype=rsc +au BufRead,BufNewFile *.sls,Saltfile setlocal filetype=sls +au BufRead,BufNewFile *.test setlocal filetype=tcl +au BufRead,BufNewFile *.tex setlocal filetype=tex +au BufRead,BufNewFile *.tf,*.tfvars setlocal filetype=terraform +au BufRead,BufNewFile *.tfstate setlocal filetype=json +au BufRead,BufNewFile *.timelog setlocal filetype=timelog +au BufRead,BufNewFile *.txt setlocal filetype=txt +au BufRead,BufNewFile *.txt setlocal textwidth=80 +au BufRead,BufNewFile *.vim setlocal filetype=vim +au BufRead,BufNewFile *.wiki setlocal filetype=vimwiki +au BufRead,BufNewFile *.xpt.vim setlocal filetype=xpt.vim +au BufRead,BufNewFile *.xpt.vim setlocal filetype=xpt.vim +au BufRead,BufNewFile */templates/*.yaml,*/templates/*.tpl setlocal filetype=helm +au BufRead,BufNewFile *rtorrent.rc* setlocal filetype=rtorrent +au BufRead,BufNewFile Containerfile setlocal filetype=dockerfile +au BufRead,BufNewFile Vagrantfile setlocal filetype=ruby +au BufRead,BufNewFile bash-fc* setlocal filetype=sh +au BufRead,BufNewFile rfc* setlocal filetype=rfc + +au BufWinEnter,BufRead,BufNewFile *.wiki setlocal nocursorline + +au BufReadPost *.doc setlocal filetype=txt +au BufReadPost *.doc %!antiword "%" +au BufReadPre *.doc setlocal hlsearch! +au BufReadPre *.doc setlocal ro + +au BufReadPost *.docx %!docx2txt "%" - +au BufReadPost *.docx setlocal filetype=txt +au BufReadPre *.docx setlocal hlsearch! +au BufReadPre *.docx setlocal ro + +au BufReadPost *.odt setlocal filetype=txt +au BufReadPost *.odt %!odt2txt "%" +au BufReadPre *.odt setlocal hlsearch! +au BufReadPre *.odt setlocal ro + +au BufReadPost *.pdf setlocal filetype=txt +au BufReadPost *.pdf %!pdftotext -nopgbrk "%" - | fmt -csw78 +au BufReadPre *.pdf setlocal hlsearch! +au BufReadPre *.pdf setlocal ro + +au BufReadPost *.rtf setlocal filetype=txt +au BufReadPost *.rtf %!catdoc "%" +au BufReadPre *.rtf setlocal hlsearch! +au BufReadPre *.rtf setlocal ro + +" Liquid +au BufNewFile,BufRead *.liquid setlocal filetype=liquid +au BufNewFile,BufRead */_layouts/*.html,*/_includes/*.html setlocal filetype=liquid +au BufNewFile,BufRead *.html,*.xml,*.textile + \ if getline(1) == '---' | setlocal filetype=liquid | endif +au BufNewFile,BufRead *.markdown,*.mkd,*.mkdn,*.md + \ if getline(1) == '---' | + \ let b:liquid_subtype = 'markdown' | + \ setlocal filetype=liquid | + \ endif + +" Set subtype for Shopify alternate templates +au BufNewFile,BufRead */templates/**.liquid,*/layout/**.liquid,*/snippets/**.liquid + \ let b:liquid_subtype = 'html' | + \ setlocal filetype=liquid | " Открывать справку в вертикальном окне au! BufEnter * if &ft ==# 'help' | wincmd L | endif +" Ansible +function! s:isAnsible() + let filepath = expand("%:p") + let filename = expand("%:t") + if filepath =~ '\v/(defaults|tasks|roles|handlers|meta|vars)/.*\.ya?ml$' | return 1 | en + if filepath =~ '\v/(group|host)_vars/' | return 1 | en + if filename =~ '\v(playbook|site|main|local)\.ya?ml$' | return 1 | en + + let shebang = getline(1) + if shebang =~# '^#!.*/bin/env\s\+ansible-playbook\>' | return 1 | en + if shebang =~# '^#!.*/bin/ansible-playbook\>' | return 1 | en + + return 0 +endfunction + +function! s:setupTemplate() + if exists("g:ansible_template_syntaxes") + let filepath = expand("%:p") + for syntax_name in items(g:ansible_template_syntaxes) + let s:syntax_string = '\v/'.syntax_name[0] + if filepath =~ s:syntax_string + execute 'setlocal filetype='.syntax_name[1].'.jinja' + return + endif + endfor + endif + setlocal filetype=jinja +endfunction + +augroup ansible_vim_ftyaml_ansible + au! + au BufNewFile,BufRead * if s:isAnsible() | setlocal filetype=yaml.ansible | en +augroup END + +augroup ansible_vim_ftjinja2 + au! + au BufNewFile,BufRead *.j2 call s:setupTemplate() +augroup END + +augroup ansible_vim_fthosts + au! + au BufNewFile,BufRead *inventory* setlocal filetype=ansible_hosts +augroup END + diff --git a/etc/soft/nvim/ftplugin/ansible/ansible.custom.vim b/etc/soft/nvim/ftplugin/ansible/ansible.custom.vim new file mode 120000 index 0000000..71862d9 --- /dev/null +++ b/etc/soft/nvim/ftplugin/ansible/ansible.custom.vim @@ -0,0 +1 @@ +../../+ftplugin/ansible.vim \ No newline at end of file diff --git a/etc/soft/nvim/ftplugin/ansible_hosts/ansible_hosts.custom.vim b/etc/soft/nvim/ftplugin/ansible_hosts/ansible_hosts.custom.vim new file mode 120000 index 0000000..abf0617 --- /dev/null +++ b/etc/soft/nvim/ftplugin/ansible_hosts/ansible_hosts.custom.vim @@ -0,0 +1 @@ +../../+ftplugin/ansible_hosts.vim \ No newline at end of file diff --git a/etc/soft/nvim/ftplugin/liquid/liquid.custom.vim b/etc/soft/nvim/ftplugin/liquid/liquid.custom.vim new file mode 120000 index 0000000..f545906 --- /dev/null +++ b/etc/soft/nvim/ftplugin/liquid/liquid.custom.vim @@ -0,0 +1 @@ +../../+ftplugin/liquid.vim \ No newline at end of file diff --git a/etc/soft/nvim/ftplugin/mru/mru.custom.vim b/etc/soft/nvim/ftplugin/mru/mru.custom.vim new file mode 120000 index 0000000..11e2247 --- /dev/null +++ b/etc/soft/nvim/ftplugin/mru/mru.custom.vim @@ -0,0 +1 @@ +../../+ftplugin/mru.vim \ No newline at end of file diff --git a/etc/soft/nvim/ftplugin/sls/sls.custom.vim b/etc/soft/nvim/ftplugin/sls/sls.custom.vim new file mode 120000 index 0000000..e547788 --- /dev/null +++ b/etc/soft/nvim/ftplugin/sls/sls.custom.vim @@ -0,0 +1 @@ +../../+ftplugin/sls.vim \ No newline at end of file diff --git a/etc/soft/nvim/ftplugin/terraform/terraform.custom.vim b/etc/soft/nvim/ftplugin/terraform/terraform.custom.vim new file mode 120000 index 0000000..bacd658 --- /dev/null +++ b/etc/soft/nvim/ftplugin/terraform/terraform.custom.vim @@ -0,0 +1 @@ +../../+ftplugin/terraform.vim \ No newline at end of file diff --git a/etc/soft/nvim/indent/ansible.vim b/etc/soft/nvim/indent/ansible.vim new file mode 100644 index 0000000..6f40e38 --- /dev/null +++ b/etc/soft/nvim/indent/ansible.vim @@ -0,0 +1,59 @@ +let s:save_cpo = &cpo +set cpo&vim + +setlocal indentexpr=GetAnsibleIndent(v:lnum) +setlocal indentkeys=!^F,o,O,0#,0},0],<:>,-,* +setlocal nosmartindent +setlocal expandtab +setlocal softtabstop=2 +setlocal shiftwidth=2 +setlocal commentstring=#%s +setlocal formatoptions+=cl +" c -> wrap long comments, including # +" l -> do not wrap long lines + +let s:comment = '\v^\s*#' " # comment +let s:array_entry = '\v^\s*-\s' " - foo +let s:named_module_entry = '\v^\s*-\s*(name|hosts|role):\s*\S' " - name: 'do stuff' +let s:dictionary_entry = '\v^\s*[^:-]+:\s*$' " with_items: +let s:key_value = '\v^\s*[^:-]+:\s*\S' " apt: name=package +let s:scalar_value = '\v:\s*[>|\|]\s*$' " shell: > + +if exists('*GetAnsibleIndent') + finish +endif + +function GetAnsibleIndent(lnum) + if a:lnum == 1 || !prevnonblank(a:lnum-1) + return 0 + endif + if exists("g:ansible_unindent_after_newline") + if (a:lnum -1) != prevnonblank(a:lnum - 1) + return 0 + endif + endif + let prevlnum = prevnonblank(a:lnum - 1) + let maintain = indent(prevlnum) + let increase = maintain + &sw + + let line = getline(prevlnum) + if line =~ s:array_entry + if line =~ s:named_module_entry + return increase + else + return maintain + endif + elseif line =~ s:dictionary_entry + return increase + elseif line =~ s:key_value + if line =~ s:scalar_value + return increase + else + return maintain + endif + else + return maintain + endif +endfunction + +let &cpo = s:save_cpo diff --git a/etc/soft/nvim/indent/liquid.vim b/etc/soft/nvim/indent/liquid.vim new file mode 100644 index 0000000..a304886 --- /dev/null +++ b/etc/soft/nvim/indent/liquid.vim @@ -0,0 +1,63 @@ +" Vim indent file +" Language: Liquid +" Maintainer: Tim Pope +" Last Change: 2010 May 21 + +if exists('b:did_indent') + finish +endif + +set indentexpr= +if exists('b:liquid_subtype') + exe 'runtime! indent/'.b:liquid_subtype.'.vim' +else + runtime! indent/html.vim +endif +unlet! b:did_indent + +if &l:indentexpr == '' + if &l:cindent + let &l:indentexpr = 'cindent(v:lnum)' + else + let &l:indentexpr = 'indent(prevnonblank(v:lnum-1))' + endif +endif +let b:liquid_subtype_indentexpr = &l:indentexpr + +let b:did_indent = 1 + +setlocal indentexpr=GetLiquidIndent() +setlocal indentkeys=o,O,*,<>>,{,},0),0],o,O,!^F,=end,=endif,=endunless,=endifchanged,=endcase,=endfor,=endtablerow,=endcapture,=else,=elsif,=when,=empty + +" Only define the function once. +if exists('*GetLiquidIndent') + finish +endif + +function! s:count(string,pattern) + let string = substitute(a:string,'\C'.a:pattern,"\n",'g') + return strlen(substitute(string,"[^\n]",'','g')) +endfunction + +function! GetLiquidIndent(...) + if a:0 && a:1 == '.' + let v:lnum = line('.') + elseif a:0 && a:1 =~ '^\d' + let v:lnum = a:1 + endif + let vcol = col('.') + call cursor(v:lnum,1) + exe "let ind = ".b:liquid_subtype_indentexpr + let lnum = prevnonblank(v:lnum-1) + let line = getline(lnum) + let cline = getline(v:lnum) + let line = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','') + let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+') + let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','') + let sw = exists('*shiftwidth') ? shiftwidth() : &sw + let ind += sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>') + let ind -= sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>') + let ind -= sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>') + let ind -= sw * s:count(cline,'{%\s*end\w*$') + return ind +endfunction diff --git a/etc/soft/nvim/indent/terraform.vim b/etc/soft/nvim/indent/terraform.vim new file mode 100644 index 0000000..b5e866d --- /dev/null +++ b/etc/soft/nvim/indent/terraform.vim @@ -0,0 +1,64 @@ +" Only load this file if no other indent file was loaded +if exists('b:did_indent') + finish +endif +let b:did_indent = 1 + +let s:cpo_save = &cpoptions +set cpoptions&vim + +setlocal nolisp +setlocal autoindent shiftwidth=2 tabstop=2 softtabstop=2 expandtab +setlocal indentexpr=TerraformIndent(v:lnum) +setlocal indentkeys+=<:>,0=},0=) +let b:undo_indent = 'setlocal lisp< autoindent< shiftwidth< tabstop< softtabstop<' + \ . ' expandtab< indentexpr< indentkeys<' + +let &cpoptions = s:cpo_save +unlet s:cpo_save + +if exists('*TerraformIndent') + finish +endif + +let s:cpo_save = &cpoptions +set cpoptions&vim + +function! TerraformIndent(lnum) + " Beginning of the file should have no indent + if a:lnum == 0 + return 0 + endif + + " Usual case is to continue at the same indent as the previous non-blank line. + let prevlnum = prevnonblank(a:lnum-1) + let thisindent = indent(prevlnum) + + " If that previous line is a non-comment ending in [ { (, increase the + " indent level. + let prevline = getline(prevlnum) + if prevline !~# '^\s*\(#\|//\)' && prevline =~# '[\[{\(]\s*$' + let thisindent += &shiftwidth + endif + + " If the current line ends a block, decrease the indent level. + let thisline = getline(a:lnum) + if thisline =~# '^\s*[\)}\]]' + let thisindent -= &shiftwidth + endif + + " If the previous line starts a block comment /*, increase by one + if prevline =~# '/\*' + let thisindent += 1 + endif + + " If the previous line ends a block comment */, decrease by one + if prevline =~# '\*/' + let thisindent -= 1 + endif + + return thisindent +endfunction + +let &cpoptions = s:cpo_save +unlet s:cpo_save diff --git a/etc/soft/nvim/init.vim b/etc/soft/nvim/init.vim index 26d9d2a..058c127 100644 --- a/etc/soft/nvim/init.vim +++ b/etc/soft/nvim/init.vim @@ -1,3 +1,3 @@ set runtimepath^=~/.config/nvim runtimepath+=~/.config/nvim/after let &packpath = &runtimepath -source ~/.config/nvim/vimrc +runtime vimrc diff --git a/etc/soft/nvim/syntax/ansible.vim b/etc/soft/nvim/syntax/ansible.vim new file mode 100644 index 0000000..9682c90 --- /dev/null +++ b/etc/soft/nvim/syntax/ansible.vim @@ -0,0 +1,104 @@ +" Vim syntax file +" Language: Ansible YAML/Jinja templates +" Maintainer: Dave Honneffer +" Last Change: 2018.02.08 + +if !exists("main_syntax") + let main_syntax = 'yaml' +endif + +if exists('b:current_syntax') + let s:current_syntax=b:current_syntax + unlet b:current_syntax +endif + +syntax include @Jinja syntax/jinja.vim + +if exists('s:current_syntax') + let b:current_syntax=s:current_syntax +endif + +" Jinja +" ================================ + +syn cluster jinjaSLSBlocks add=jinjaTagBlock,jinjaVarBlock,jinjaComment +" https://github.com/mitsuhiko/jinja2/blob/6b7c0c23/ext/Vim/jinja.vim +syn region jinjaTagBlock matchgroup=jinjaTagDelim start=/{%-\?/ end=/-\?%}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment,@jinjaSLSBlocks +syn region jinjaVarBlock matchgroup=jinjaVarDelim start=/{{-\?/ end=/-\?}}/ containedin=ALLBUT,yamlComment,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment,@jinjaSLSBlocks +syn region jinjaComment matchgroup=jinjaCommentDelim start="{#" end="#}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString,@jinjaSLSBlocks +highlight link jinjaVariable Constant +highlight link jinjaVarDelim Delimiter + +" YAML +" ================================ + +if exists("g:ansible_yamlKeyName") + let s:yamlKey = g:ansible_yamlKeyName +else + let s:yamlKey = "yamlBlockMappingKey" +endif + +" Reset some YAML to plain styling +" the number 80 in Ansible isn't any more important than the word root +highlight link yamlInteger NONE +highlight link yamlBool NONE +highlight link yamlFlowString NONE +" but it does make sense we visualize quotes easily +highlight link yamlFlowStringDelimiter Delimiter +" This is only found in stephypy/vim-yaml, since it's one line it isn't worth +" making conditional +highlight link yamlConstant NONE + +fun! s:attribute_highlight(attributes) + if a:attributes =~ 'a' + syn match ansible_attributes "\v\w+\=" containedin=yamlPlainScalar + else + syn match ansible_attributes "\v^\s*\w+\=" containedin=yamlPlainScalar + endif + if a:attributes =~ 'n' + highlight link ansible_attributes NONE + elseif a:attributes =~ 'd' + highlight link ansible_attributes Comment + else + highlight link ansible_attributes Structure + endif +endfun + +if exists("g:ansible_attribute_highlight") + call s:attribute_highlight(g:ansible_attribute_highlight) +else + call s:attribute_highlight('ad') +endif + +if exists("g:ansible_name_highlight") + execute 'syn keyword ansible_name name containedin='.s:yamlKey.' contained' + if g:ansible_name_highlight =~ 'd' + highlight link ansible_name Comment + else + highlight link ansible_name Underlined + endif +endif + +execute 'syn keyword ansible_debug_keywords debug containedin='.s:yamlKey.' contained' +highlight link ansible_debug_keywords Debug + +if exists("g:ansible_extra_keywords_highlight") + execute 'syn keyword ansible_extra_special_keywords register always_run changed_when failed_when no_log args vars delegate_to ignore_errors containedin='.s:yamlKey.' contained' + highlight link ansible_extra_special_keywords Statement +endif + +execute 'syn keyword ansible_normal_keywords include include_tasks import_tasks until retries delay when only_if become become_user block rescue always notify containedin='.s:yamlKey.' contained' +if exists("g:ansible_normal_keywords_highlight") + execute 'highlight link ansible_normal_keywords '.g:ansible_normal_keywords_highlight +else + highlight link ansible_normal_keywords Statement +endif + +execute 'syn match ansible_with_keywords "\vwith_.+" containedin='.s:yamlKey.' contained' +if exists("g:ansible_with_keywords_highlight") + execute 'highlight link ansible_with_keywords '.g:ansible_with_keywords_highlight +else + highlight link ansible_with_keywords Statement +endif + +let b:current_syntax = "ansible" diff --git a/etc/soft/nvim/syntax/custom/HaskellConceal.vim b/etc/soft/nvim/syntax/custom/HaskellConceal.vim new file mode 100644 index 0000000..7b99908 --- /dev/null +++ b/etc/soft/nvim/syntax/custom/HaskellConceal.vim @@ -0,0 +1,103 @@ +"============================================================================= +" What Is This: Add some conceal operator for your haskell files +" File: haskell.vim (conceal enhancement) +" Author: Vincent Berthoux +" Last Change: 2011-09-07 +" Version: 1.3.2 +" Require: +" set nocompatible +" somewhere on your .vimrc +" +" Vim 7.3 or Vim compiled with conceal patch. +" Use --with-features=big or huge in order to compile it in. +" +" Usage: +" Drop this file in your +" ~/.vim/after/syntax folder (Linux/MacOSX/BSD...) +" ~/vimfiles/after/syntax folder (Windows) +" +" For this script to work, you have to set the encoding +" to utf-8 :set enc=utf-8 +" +" Additional: +" * if you want to avoid the loading, add the following +" line in your .vimrc : +" let g:no_haskell_conceal = 1 +" Changelog: +" - 1.3.1: putting undefined in extra conceal, not appearing on windows +" - 1.3: adding new arrow characters used by GHC in Unicode extension. +" - 1.2: Fixing conceal level to be local (thx Erlend Hamberg) +" - 1.1: Better handling of non utf-8 systems, and avoid some +" concealing operations on windows on some fonts +" +if exists('g:no_haskell_conceal') || !has('conceal') || &enc != 'utf-8' + finish +endif + +" vim: set fenc=utf-8: +syntax match hsNiceOperator "\\\ze[[:alpha:][:space:]_([]" conceal cchar=λ +syntax match hsNiceOperator "<-" conceal cchar=← +syntax match hsNiceOperator "->" conceal cchar=→ +syntax match hsNiceOperator "\" conceal cchar=∑ +syntax match hsNiceOperator "\" conceal cchar=∏ +syntax match hsNiceOperator "\" conceal cchar=√ +syntax match hsNiceOperator "\" conceal cchar=π +syntax match hsNiceOperator "==" conceal cchar=≡ +syntax match hsNiceOperator "\/=" conceal cchar=≠ +syntax match hsNiceOperator ">>" conceal cchar=» + +let s:extraConceal = 1 +" Some windows font don't support some of the characters, +" so if they are the main font, we don't load them :) +if has("win32") + let s:incompleteFont = [ 'Consolas' + \ , 'Lucida Console' + \ , 'Courier New' + \ ] + let s:mainfont = substitute( &guifont, '^\([^:,]\+\).*', '\1', '') + for s:fontName in s:incompleteFont + if s:mainfont ==? s:fontName + let s:extraConceal = 0 + break + endif + endfor +endif + +if s:extraConceal + syntax match hsNiceOperator "\" conceal cchar=⊥ + + " Match greater than and lower than w/o messing with Kleisli composition + syntax match hsNiceOperator "<=\ze[^<]" conceal cchar=≤ + syntax match hsNiceOperator ">=\ze[^>]" conceal cchar=≥ + + syntax match hsNiceOperator "=>" conceal cchar=⇒ + syntax match hsNiceOperator "=\zs<<" conceal cchar=« + + " Redfining to get proper '::' concealing + syntax match hs_DeclareFunction /^[a-z_(]\S*\(\s\|\n\)*::/me=e-2 nextgroup=hsNiceOperator contains=hs_FunctionName,hs_OpFunctionName + syntax match hsNiceOperator "\:\:" conceal cchar=∷ + + syntax match hsniceoperator "++" conceal cchar=⧺ + syntax match hsNiceOperator "\" conceal cchar=∀ + syntax match hsNiceOperator "-<" conceal cchar=↢ + syntax match hsNiceOperator ">-" conceal cchar=↣ + syntax match hsNiceOperator "-<<" conceal cchar=⤛ + syntax match hsNiceOperator ">>-" conceal cchar=⤜ + " the star does not seem so good... + " syntax match hsNiceOperator "*" conceal cchar=★ + + " Only replace the dot, avoid taking spaces around. + syntax match hsNiceOperator /\s\.\s/ms=s+1,me=e-1 conceal cchar=∘ + syntax match hsNiceOperator "\.\." conceal cchar=‥ + + syntax match hsQQEnd "|\]" contained conceal cchar=〛 + " sy match hsQQEnd "|\]" contained conceal=〚 + + syntax match hsNiceOperator "`elem`" conceal cchar=∈ + syntax match hsNiceOperator "`notElem`" conceal cchar=∉ +endif + +hi link hsNiceOperator Operator +hi! link Conceal Operator +setlocal conceallevel=2 + diff --git a/etc/soft/nvim/syntax/custom/RainbowParenthsis.vim b/etc/soft/nvim/syntax/custom/RainbowParenthsis.vim new file mode 100644 index 0000000..23744ec --- /dev/null +++ b/etc/soft/nvim/syntax/custom/RainbowParenthsis.vim @@ -0,0 +1,61 @@ +" This is a simple script. It extends the syntax highlighting to +" highlight each matching set of parens in different colors, to make +" it visually obvious what matches which. + +" Obviously, most useful when working with lisp. But it's also nice othe +" times. + +" I don't intend to maintain this script. I hacked it together for my +" own purposes, and it is sufficient to the day. If you want to improve it, +" knock yourself out. + +" This file is public domain. + +if &ft == "vimwiki" + finish +endif + +" define colors. Note that the one numbered '16' is the outermost pair, +" keep that in mind if you want to change the colors. +" Also, if this script doesn't work on your terminal, you may need to add +" guifg=xx or ever termfg=, though what good this script will do on a +" black and white terminal I don't know. +hi level1c ctermfg=brown +hi level2c ctermfg=76 +hi level3c ctermfg=202 +hi level4c ctermfg=darkgreen +hi level5c ctermfg=45 +hi level6c ctermfg=darkred +hi level7c ctermfg=darkmagenta +hi level8c ctermfg=brown +hi level9c ctermfg=3 +hi level10c ctermfg=100 +hi level11c ctermfg=darkmagenta +hi level12c ctermfg=33 +hi level13c ctermfg=46 +hi level14c ctermfg=darkcyan +hi level15c ctermfg=darkred +hi level16c ctermfg=208 + +""() + +" These are the regions for each pair. +" This could be improved, perhaps, by makeing them match [ and { also, +" but I'm not going to take the time to figure out haw to make the +" end pattern match only the proper type. +syn region level1 matchgroup=level1c start=/(/ end=/)/ contains=TOP,level1,level2,level3,level4,level5,level6,level7,level8,level9,level10,level11,level12,level13,level14,level15, level16,NoInParens +syn region level2 matchgroup=level2c start=/(/ end=/)/ contains=TOP,level2,level3,level4,level5,level6,level7,level8,level9,level10,level11,level12,level13,level14,level15, level16,NoInParens +syn region level3 matchgroup=level3c start=/(/ end=/)/ contains=TOP,level3,level4,level5,level6,level7,level8,level9,level10,level11,level12,level13,level14,level15, level16,NoInParens +syn region level4 matchgroup=level4c start=/(/ end=/)/ contains=TOP,level4,level5,level6,level7,level8,level9,level10,level11,level12,level13,level14,level15, level16,NoInParens +syn region level5 matchgroup=level5c start=/(/ end=/)/ contains=TOP,level5,level6,level7,level8,level9,level10,level11,level12,level13,level14,level15, level16,NoInParens +syn region level6 matchgroup=level6c start=/(/ end=/)/ contains=TOP,level6,level7,level8,level9,level10,level11,level12,level13,level14,level15, level16,NoInParens +syn region level7 matchgroup=level7c start=/(/ end=/)/ contains=TOP,level7,level8,level9,level10,level11,level12,level13,level14,level15, level16,NoInParens +syn region level8 matchgroup=level8c start=/(/ end=/)/ contains=TOP,level8,level9,level10,level11,level12,level13,level14,level15, level16,NoInParens +syn region level9 matchgroup=level9c start=/(/ end=/)/ contains=TOP,level9,level10,level11,level12,level13,level14,level15, level16,NoInParens +syn region level10 matchgroup=level10c start=/(/ end=/)/ contains=TOP,level10,level11,level12,level13,level14,level15, level16,NoInParens +syn region level11 matchgroup=level11c start=/(/ end=/)/ contains=TOP,level11,level12,level13,level14,level15, level16,NoInParens +syn region level12 matchgroup=level12c start=/(/ end=/)/ contains=TOP,level12,level13,level14,level15, level16,NoInParens +syn region level13 matchgroup=level13c start=/(/ end=/)/ contains=TOP,level13,level14,level15, level16,NoInParens +syn region level14 matchgroup=level14c start=/(/ end=/)/ contains=TOP,level14,level15, level16,NoInParens +syn region level15 matchgroup=level15c start=/(/ end=/)/ contains=TOP,level15, level16,NoInParens +syn region level16 matchgroup=level16c start=/(/ end=/)/ contains=TOP,level16,NoInParens diff --git a/etc/soft/nvim/syntax/helm.vim b/etc/soft/nvim/syntax/helm.vim new file mode 100644 index 0000000..17e87c7 --- /dev/null +++ b/etc/soft/nvim/syntax/helm.vim @@ -0,0 +1,103 @@ +" vim syntax for helm templates (yaml + gotmpl + sprig + custom) +" +" Install via vundle: +" +" ```vim +" Plugin 'towolf/vim-helm' +" ``` + +if exists("b:current_syntax") + finish +endif + +if !exists("main_syntax") + let main_syntax = 'yaml' +endif + +let b:current_syntax = '' +unlet b:current_syntax +runtime! syntax/yaml.vim + +let b:current_syntax = '' +unlet b:current_syntax +syntax include @Yaml syntax/yaml.vim + +syn case match + +" Go escapes +syn match goEscapeOctal display contained "\\[0-7]\{3}" +syn match goEscapeC display contained +\\[abfnrtv\\'"]+ +syn match goEscapeX display contained "\\x\x\{2}" +syn match goEscapeU display contained "\\u\x\{4}" +syn match goEscapeBigU display contained "\\U\x\{8}" +syn match goEscapeError display contained +\\[^0-7xuUabfnrtv\\'"]+ + +hi def link goEscapeOctal goSpecialString +hi def link goEscapeC goSpecialString +hi def link goEscapeX goSpecialString +hi def link goEscapeU goSpecialString +hi def link goEscapeBigU goSpecialString +hi def link goSpecialString Special +hi def link goEscapeError Error + +" Strings and their contents +syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError +syn region goString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup +syn region goRawString contained start=+`+ end=+`+ + +hi def link goString String +hi def link goRawString String + +" Characters; their contents +syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU +syn region goCharacter contained start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup + +hi def link goCharacter Character + +" Integers +syn match goDecimalInt contained "\<\d\+\([Ee]\d\+\)\?\>" +syn match goHexadecimalInt contained "\<0x\x\+\>" +syn match goOctalInt contained "\<0\o\+\>" +syn match goOctalError contained "\<0\o*[89]\d*\>" +syn cluster goInt contains=goDecimalInt,goHexadecimalInt,goOctalInt +" Floating point +syn match goFloat contained "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>" +syn match goFloat contained "\<\.\d\+\([Ee][-+]\d\+\)\?\>" +syn match goFloat contained "\<\d\+[Ee][-+]\d\+\>" +" Imaginary literals +syn match goImaginary contained "\<\d\+i\>" +syn match goImaginary contained "\<\d\+\.\d*\([Ee][-+]\d\+\)\?i\>" +syn match goImaginary contained "\<\.\d\+\([Ee][-+]\d\+\)\?i\>" +syn match goImaginary contained "\<\d\+[Ee][-+]\d\+i\>" + +hi def link goInt Number +hi def link goFloat Number +hi def link goImaginary Number + +" Token groups +syn cluster gotplLiteral contains=goString,goRawString,goCharacter,@goInt,goFloat,goImaginary +syn keyword gotplControl contained if else end range with template include tpl required define +syn keyword gotplFunctions contained and call html index js len not or print printf println urlquery eq ne lt le gt ge +syn keyword goSprigFunctions contained abbrev abbrevboth add add1 adler32sum ago append atoi b32dec b32enc b64dec b64enc base biggest buildCustomCert camelcase cat ceil clean coalesce \contains compact date dateInZone dateModify date_in_zone date_modify default derivePassword dict dir div empty ext fail first float64 floor fromJson fromYaml genCA genPrivateKey genSelfSignedCert genSignedCert has hasKey hasPrefix hasSuffix hello htmlDate htmlDateInZone indent initial initials int int64 isAbs join kebabcase keys kindIs kindOf last list lower max merge mergeOverwrite min mod mul nindent nospace now omit pick pluck plural prepend quote randAlpha randAlphaNum randAscii randNumeric regexFind regexFindAll regexMatch regexReplaceAll regexReplaceAllLiteral regexSplit repeat replace rest reverse round semver semverCompare set sha1sum sha256sum shuffle slice snakecase sortAlpha split splitList splitn squote sub substr swapcase ternary title toDate toJson toPrettyJson toString toStrings toToml toYaml trim trimAll trimPrefix trimSuffix trimall trunc tuple typeIs typeIsLike typeOf uniq unixEpoch unset until untilStep untitle upper uuidv4 values without wrap wrapWith +syn match goTplVariable contained /\$[a-zA-Z0-9_]*\>/ +syn match goTplIdentifier contained /\.[^\s}]+\>/ + +" hi def link gotplControl Keyword +" hi def link gotplFunctions Function +" hi def link goSprigFunctions Function +" hi def link goTplVariable Special +hi def link gotplControl goConditional +hi def link gotplFunctions goConditional +hi def link goSprigFunctions goConditional +hi def link goTplVariable goStatement + +syn region gotplAction start="{{\(-? \)\?" end="\( -?\)\?}}" contains=@gotplLiteral,gotplControl,gotplFunctions,goSprigFunctions,gotplVariable,goTplIdentifier containedin=yamlFlowString display +syn region gotplAction start="\[\[\(-? \)\?" end="\( -?\)\?\]\]" contains=@gotplLiteral,gotplControl,gotplFunctions,goSprigFunctions,gotplVariable containedin=yamlFlowString display +syn region goTplComment start="{{\(-? \)\?/\*" end="\*/\( -?\)\?}}" display +syn region goTplComment start="\[\[\(-? \)\?/\*" end="\*/\( -?\)\?\]\]" display + +hi def link goTplAction Operator +hi def link goTplComment Comment +let b:current_syntax = "helm" + +" vim: sw=2 ts=2 et diff --git a/etc/soft/nvim/syntax/liquid.vim b/etc/soft/nvim/syntax/liquid.vim new file mode 100644 index 0000000..a52c780 --- /dev/null +++ b/etc/soft/nvim/syntax/liquid.vim @@ -0,0 +1,138 @@ +" Vim syntax file +" Language: Liquid +" Maintainer: Tim Pope +" Filenames: *.liquid +" Last Change: 2010 May 21 + +if exists('b:current_syntax') + finish +endif + +if !exists('main_syntax') + let main_syntax = 'liquid' +endif + +if !exists('g:liquid_default_subtype') + let g:liquid_default_subtype = 'html' +endif + +if !exists('b:liquid_subtype') && main_syntax == 'liquid' + let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") + let b:liquid_subtype = matchstr(s:lines,'liquid_subtype=\zs\w\+') + if b:liquid_subtype == '' + let b:liquid_subtype = matchstr(&filetype,'^liquid\.\zs\w\+') + endif + if b:liquid_subtype == '' + let b:liquid_subtype = matchstr(substitute(expand('%:t'),'\c\%(\.liquid\)\+$','',''),'\.\zs\w\+$') + endif + if b:liquid_subtype == '' + let b:liquid_subtype = g:liquid_default_subtype + endif +endif + +if exists('b:liquid_subtype') && b:liquid_subtype != '' + exe 'runtime! syntax/'.b:liquid_subtype.'.vim' + unlet! b:current_syntax +endif + +syn case match + +if exists('b:liquid_subtype') && b:liquid_subtype != 'yaml' + " YAML Front Matter + syn include @liquidYamlTop syntax/yaml.vim + unlet! b:current_syntax + syn region liquidYamlHead start="\%^---$" end="^---\s*$" keepend contains=@liquidYamlTop,@Spell +endif + +if !exists('g:liquid_highlight_types') + let g:liquid_highlight_types = [] +endif + +if !exists('s:subtype') + let s:subtype = exists('b:liquid_subtype') ? b:liquid_subtype : '' + + for s:type in map(copy(g:liquid_highlight_types),'matchstr(v:val,"[^=]*$")') + if s:type =~ '\.' + let b:{matchstr(s:type,'[^.]*')}_subtype = matchstr(s:type,'\.\zs.*') + endif + exe 'syn include @liquidHighlight'.substitute(s:type,'\.','','g').' syntax/'.matchstr(s:type,'[^.]*').'.vim' + unlet! b:current_syntax + endfor + unlet! s:type + + if s:subtype == '' + unlet! b:liquid_subtype + else + let b:liquid_subtype = s:subtype + endif + unlet s:subtype +endif + +syn region liquidStatement matchgroup=liquidDelimiter start="{%" end="%}" contains=@liquidStatement containedin=ALLBUT,@liquidExempt keepend +syn region liquidExpression matchgroup=liquidDelimiter start="{{" end="}}" contains=@liquidExpression containedin=ALLBUT,@liquidExempt keepend +syn region liquidComment matchgroup=liquidDelimiter start="{%\s*comment\s*%}" end="{%\s*endcomment\s*%}" contains=liquidTodo,@Spell containedin=ALLBUT,@liquidExempt keepend +syn region liquidRaw matchgroup=liquidDelimiter start="{%\s*raw\s*%}" end="{%\s*endraw\s*%}" contains=TOP,@liquidExempt containedin=ALLBUT,@liquidExempt keepend + +syn cluster liquidExempt contains=liquidStatement,liquidExpression,liquidComment,liquidRaw,@liquidStatement,liquidYamlHead +syn cluster liquidStatement contains=liquidConditional,liquidRepeat,liquidKeyword,@liquidExpression +syn cluster liquidExpression contains=liquidOperator,liquidString,liquidNumber,liquidFloat,liquidBoolean,liquidNull,liquidEmpty,liquidPipe,liquidForloop + +syn keyword liquidKeyword highlight nextgroup=liquidTypeHighlight skipwhite contained +syn keyword liquidKeyword endhighlight contained +syn region liquidHighlight start="{%\s*highlight\s\+\w\+\s*%}" end="{% endhighlight %}" keepend + +for s:type in g:liquid_highlight_types + exe 'syn match liquidTypeHighlight "\<'.matchstr(s:type,'[^=]*').'\>" contained' + exe 'syn region liquidHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' start="{%\s*highlight\s\+'.matchstr(s:type,'[^=]*').'\s*%}" end="{% endhighlight %}" keepend contains=@liquidHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') +endfor +unlet! s:type + +syn region liquidString matchgroup=liquidQuote start=+"+ end=+"+ contained +syn region liquidString matchgroup=liquidQuote start=+'+ end=+'+ contained +syn match liquidNumber "-\=\<\d\+\>" contained +syn match liquidFloat "-\=\<\d\+\>\.\.\@!\%(\d\+\>\)\=" contained +syn keyword liquidBoolean true false contained +syn keyword liquidNull null nil contained +syn match liquidEmpty "\" contained + +syn keyword liquidOperator and or not contained +syn match liquidPipe '|' contained skipwhite nextgroup=liquidFilter + +syn keyword liquidFilter date capitalize downcase upcase first last join sort size strip_html strip_newlines newline_to_br replace replace_first remove remove_first truncate truncatewords prepend append minus plus times divided_by contained + +syn keyword liquidConditional if elsif else endif unless endunless case when endcase ifchanged endifchanged contained +syn keyword liquidRepeat for endfor tablerow endtablerow in contained +syn match liquidRepeat "\%({%\s*\)\@<=empty\>" contained +syn keyword liquidKeyword assign cycle include with contained + +syn keyword liquidForloop forloop nextgroup=liquidForloopDot contained +syn match liquidForloopDot "\." nextgroup=liquidForloopAttribute contained +syn keyword liquidForloopAttribute length index index0 rindex rindex0 first last contained + +syn keyword liquidTablerowloop tablerowloop nextgroup=liquidTablerowloopDot contained +syn match liquidTablerowloopDot "\." nextgroup=liquidTableForloopAttribute contained +syn keyword liquidTablerowloopAttribute length index index0 col col0 index0 rindex rindex0 first last col_first col_last contained + +hi def link liquidDelimiter PreProc +hi def link liquidComment Comment +hi def link liquidTypeHighlight Type +hi def link liquidConditional Conditional +hi def link liquidRepeat Repeat +hi def link liquidKeyword Keyword +hi def link liquidOperator Operator +hi def link liquidString String +hi def link liquidQuote Delimiter +hi def link liquidNumber Number +hi def link liquidFloat Float +hi def link liquidEmpty liquidNull +hi def link liquidNull liquidBoolean +hi def link liquidBoolean Boolean +hi def link liquidFilter Function +hi def link liquidForloop Identifier +hi def link liquidForloopAttribute Identifier + +let b:current_syntax = 'liquid' + +if exists('main_syntax') && main_syntax == 'liquid' + unlet main_syntax +endif diff --git a/etc/soft/nvim/syntax/sls.vim b/etc/soft/nvim/syntax/sls.vim new file mode 100644 index 0000000..18fc487 --- /dev/null +++ b/etc/soft/nvim/syntax/sls.vim @@ -0,0 +1,71 @@ +" Vim syntax file +" Language: Salt States template +" Maintainer: Seth House +" Last Change: 2012 June 20 +" +if exists("b:current_syntax") + finish +endif + +if !exists("main_syntax") + let main_syntax = 'yaml' +endif + +let b:current_syntax = '' +unlet b:current_syntax +runtime! syntax/yaml.vim + +let b:current_syntax = '' +unlet b:current_syntax +syntax include @Yaml syntax/yaml.vim + +let b:current_syntax = '' +unlet b:current_syntax + +" Default to look for Jinja syntax file +let s:load_jinja_syntax = 0 +let s:search_for_jinja_syntax = 1 +if exists("g:sls_use_jinja_syntax") + let s:search_for_jinja_syntax = 0 + let s:load_jinja_syntax = g:sls_use_jinja_syntax +endif +if s:search_for_jinja_syntax + let s:jinja_path = findfile("syntax/jinja.vim", &rtp, 1) + if s:jinja_path != "" + let s:load_jinja_syntax = 1 + endif +endif + +if s:load_jinja_syntax + syntax include @Jinja syntax/jinja.vim + + syn cluster jinjaSLSBlocks add=jinjaTagBlock,jinjaVarBlock,jinjaComment + " Mostly copy/pasted from + " https://github.com/mitsuhiko/jinja2/blob/6b7c0c23/ext/Vim/jinja.vim + syn region jinjaTagBlock matchgroup=jinjaTagDelim start=/{%-\?/ end=/-\?%}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment,@jinjaSLSBlocks + syn region jinjaVarBlock matchgroup=jinjaVarDelim start=/{{-\?/ end=/-\?}}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment,@jinjaSLSBlocks + syn region jinjaComment matchgroup=jinjaCommentDelim start="{#" end="#}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString,@jinjaSLSBlocks +else + " Fall back to Django template syntax + syntax include @Jinja syntax/django.vim + + syn cluster djangoBlocks add=djangoTagBlock,djangoVarBlock,djangoComment,djangoComBlock + syn region djangoTagBlock start="{%" end="%}" contains=djangoStatement,djangoFilter,djangoArgument,djangoTagError display containedin=ALLBUT,@djangoBlocks + syn region djangoVarBlock start="{{" end="}}" contains=djangoFilter,djangoArgument,djangoVarError display containedin=ALLBUT,@djangoBlocks + syn region djangoComBlock start="{#" end="#}" contains=djangoTodo containedin=ALLBUT,@djangoBlocks +endif + +syn keyword salt_stateInclude include extend containedin=yamlBlockMappingKey +highlight link salt_stateInclude Include + +syn keyword salt_stateSpecialArgs name names check_cmd listen listen_in onchanges onchanges_in onfail onfail_in onlyif prereq prereq_in require require_in unless use use_in watch watch_in containedin=yamlBlockMappingKey +highlight link salt_stateSpecialArgs Special + +syn keyword salt_stateErrors requires requires_in watches watches_in includes extends containedin=yamlBlockMappingKey +highlight link salt_stateErrors Error + +let g:NERDCustomDelimiters = { + \ 'sls': { 'left': '#' }, +\ } + +let b:current_syntax = "sls" diff --git a/etc/soft/nvim/syntax/terraform.vim b/etc/soft/nvim/syntax/terraform.vim new file mode 100644 index 0000000..0a1d2bb --- /dev/null +++ b/etc/soft/nvim/syntax/terraform.vim @@ -0,0 +1,71 @@ +" Forked from Larry Gilbert's syntax file +" github.com/L2G/vim-syntax-terraform + +if exists('b:current_syntax') + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" Identifiers are made up of alphanumeric characters, underscores, and +" hyphens. +if has('patch-7.4.1142') + syn iskeyword a-z,A-Z,48-57,_,- +endif + +syn case match + +" A block is introduced by a type, some number of labels - which are either +" strings or identifiers - and an opening curly brace. Match the type. +syn match terraBlockIntroduction /^\s*\zs\K\k*\ze\s\+\(\("\K\k*"\|\K\k*\)\s\+\)*{/ contains=terraBlockType +syn keyword terraBlockType contained data locals module output provider resource terraform variable + +syn keyword terraValueBool true false on off yes no + +syn keyword terraTodo contained TODO FIXME XXX BUG TF-UPGRADE-TODO +syn region terraComment start="/\*" end="\*/" contains=terraTodo,@Spell +syn region terraComment start="#" end="$" contains=terraTodo,@Spell +syn region terraComment start="//" end="$" contains=terraTodo,@Spell + +""" misc. +syn match terraValueDec "\<[0-9]\+\([kKmMgG]b\?\)\?\>" +syn match terraValueHexaDec "\<0x[0-9a-f]\+\([kKmMgG]b\?\)\?\>" +syn match terraBraces "[\[\]]" + +""" skip \" and \\ in strings. +syn region terraValueString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=terraStringInterp +syn region terraStringInterp matchgroup=terraBraces start=/\${/ end=/}/ contained contains=ALL +syn region terraHereDocText start=/<<-\?\z([a-z0-9A-Z]\+\)/ end=/^\s*\z1/ contains=terraStringInterp + +"" Functions. +syn match terraFunction "[a-z0-9]\+(\@=" + +""" HCL2 +syn keyword terraRepeat for in +syn keyword terraConditional if +syn keyword terraType string bool number object tuple list map set any +syn keyword terraValueNull null + +" enable block folding +syn region terraBlockBody matchgroup=terraBraces start="{" end="}" fold transparent + +hi def link terraComment Comment +hi def link terraTodo Todo +hi def link terraBraces Delimiter +hi def link terraBlockType Structure +hi def link terraValueBool Boolean +hi def link terraValueDec Number +hi def link terraValueHexaDec Number +hi def link terraValueString String +hi def link terraHereDocText String +hi def link terraFunction Function +hi def link terraRepeat Repeat +hi def link terraConditional Conditional +hi def link terraType Type +hi def link terraValueNull Constant + +let b:current_syntax = 'terraform' + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/etc/soft/nvim/vimrc b/etc/soft/nvim/vimrc index 761e312..d53c422 100644 --- a/etc/soft/nvim/vimrc +++ b/etc/soft/nvim/vimrc @@ -22,26 +22,15 @@ set winminwidth=0 " Минимальная ширина окна set winaltkeys=menu " Включение Win/Alt set autochdir " Переходить в каталог файла set viewdir=$HOME/.shellrc/var/vim/view " Директория файлов состояний буферов +set modeline " Настройка modeline +set modelineexpr " Настройка modeline " При выходе запоминать состояние файла au BufWinLeave * if bufname("") =~ "..*" | mkview | endif -" Восстановление состояния -function RestoreState() - if getline(1) != "" - if bufname("") =~ "..*" - " !empty(expand("")) - silent loadview - endif - endif -endfunction - -" au BufWinEnter * call RestoreState() +au BufWinEnter * call RestoreState() au BufWinEnter * set cursorline -" Vimwiki тормозит -au BufWinEnter *.wiki set nocursorline - " Отключение zip let g:loaded_zipPlugin = 1 let g:loaded_zip = 1 @@ -149,9 +138,10 @@ set foldcolumn=1 " Видимая колонка фолдинга " }}}--------------------------------------------------------------------------- -" {{{-------------------------- Настройки поиска ------------------------------- +" {{{---------------------- Настройки поиска и замены -------------------------- set incsearch " Поиск по набору текста +set inccommand=nosplit " Поиск и замена по ходу набора set hlsearch " Подсветка результатов поиска set wrapscan " Не останавливать поиск при достижении конца файла set ignorecase " Игнорировать регистр букв при поиске @@ -255,55 +245,13 @@ set ch=1 " Количество строк set cmdheight=1 " Коммандная строка в одну линию set laststatus=2 " Всегда отображать статусную строку -" Функция отображения конструкции языка -function! SyntaxItem() - if synIDattr(synID(line("."),col("."),1),"name") == "" - return " --- " - else - return synIDattr(synID(line("."),col("."),1),"name") -endfunction - -set statusline=%#Question# " Цвет -set statusline+=%t%m%r%h%w " Имя файла -" set statusline+=%{strlen(GitBranch())?'@'.GitBranch().'.git':''} " Ветка Git -set statusline+=%= " Выравн. справа -" set statusline+=%#Function# " Цвет -" set statusline+=%{functionator#GetName()} " Функция -" set statusline+=%#Question# " Цвет -" set statusline+=\ [ЛЕКСЕМА:\ %{SyntaxItem()}] " Лексема -" set statusline+=%#WarningMsg# " Цвет -set statusline+=%#Function# " Цвет -set statusline+=\ [%{strlen(&ft)?&ft:'none'} " Тип файла -set statusline+=\/\%{(&fenc==\"\"?&enc:&fenc)} " Кодировка -" set statusline+=%#String# " Цвет -set statusline+=\|%L:%03l,%03v\ %p%%] " Строка/столбец - -" }}}########################################################################### -" {{{ ДОПОЛНИТЕЛЬНЫЕ ФУНКЦИИ -" ############################################################################## - -" Автоматически делать файл исполняемым -function ModeChange() - if getline(1) =~ "^#!/" - silent !chmod a+x - endif -endfunction -au BufWritePost * call ModeChange() - -" Отображение декларации функции -function GetDeclaration() - if strlen(glob("~/.vim/+scripts/declarations/".&ft)) - echo system("~/.vim/+scripts/declarations/".&ft." '".expand("")."' ".expand("%")) - endif - - " elseif &ft == 'perl' - " echo system("echo -n $(perldoc -i -f " - " \ .expand("") - " \ . " | head -1 | sed -r 's/^[[:space:]]+//g')") - " endif -endfunction - -nmap fd :call GetDeclaration() +" set statusline=%#Question# " Цвет +" set statusline+=%t%m%r%h%w " Имя файла +" set statusline+=%= " Выравн. справа +" set statusline+=%#Function# " Цвет +" set statusline+=\ [%{strlen(&ft)?&ft:'none'} " Тип файла +" set statusline+=\/\%{(&fenc==\"\"?&enc:&fenc)} " Кодировка +" set statusline+=\|%L:%03l,%03v\ %p%%] " Строка/столбец " }}}########################################################################### " {{{ КОМБИНАЦИИ КЛАВИШ @@ -399,19 +347,6 @@ nmap :copen imap :copen imap :copen -" Выполнение файла с параметрами -nmap :call Run("") -vmap :call Run("") -imap :call Run("") - - function Run(...) - if getline(1) =~ "^#!/" - execute "!%:p" a:1 - else - execute "!\'".getcwd()."/%<\'" a:1 - endif - endfunction - nmap :echo system("robodoc &"):echo "MAKING DOCUMENTATION" imap :echo system("robodoc &"):echo "MAKING DOCUMENTATION" vmap :echo system("robodoc &"):echo "MAKING DOCUMENTATION" @@ -441,167 +376,16 @@ cnoremap nn @ :='let @'.v:register.' = \ '.string(getreg(v:register)) -" Редактирование окружений (cib/dap/...) {{{ -" Редактирование СЛЕДУЮЩЕГО окружения" -nnoremap cinb f(ci( -nnoremap canb f(ca( -nnoremap cinB f{ci{ -nnoremap canB f{ca{ -nnoremap cin( f(ci( -nnoremap can( f(ca( -nnoremap cin{ f{ci{ -nnoremap can{ f{ca{ -nnoremap cin) f(ci( -nnoremap can) f(ca( -nnoremap cin} f{ci{ -nnoremap can} f{ca{ -nnoremap cin[ f[ci[ -nnoremap can[ f[ca[ -nnoremap cin] f[ci[ -nnoremap can] f[ca[ -nnoremap cin< f f f f f f f F F F F F Fm :MRU let MRU_File = $HOME . '/.shellrc/var/vim/mru/vim_mru_files' +let MRU_Add_Menu = 0 let MRU_Max_Entries = 150 let MRU_Exclude_Files = '^/tmp/.*\|^/var/tmp/.*\|MERGE_MSG\|.*COMMIT_EDITMSG.*\|viper.*\|_cheat\|bash-fc.*\|vifm\.rename.*\|tmpprms2en3.yml' "}}} @@ -738,19 +523,22 @@ nmap qr (quickhl-reset) vmap qr (quickhl-reset) "}}} -" CommentToggle"{{{ -nmap CommentToggle -imap CommentToggle -vmap CommentToggle +" vim-commentary {{{ +nmap Commentary +nmap CommentaryLine +imap Commentary +vmap Commentary "}}} -" Calendar"{{{ -let g:calendar_navi_label = 'Пред,Тек,След' -let g:calendar_mruler = 'Январь,Февраль,Март,Апрель,Май,Июнь,Июль,Август,Сентябрь' - \.',Октябрь,Ноябрь,Декабрь' -let g:calendar_wruler = 'Вс Пн Вт Ср Чт Пт Сб' -let g:calendar_monday = 1 -"}}} +" vim-signify {{{ + +let g:signify_sign_add = '⭢' +let g:signify_sign_delete = '⭠' +let g:signify_sign_delete_first_line = '⬿' +let g:signify_sign_change = '~' " '⮂' +let g:signify_sign_change_delete = g:signify_sign_change . g:signify_sign_delete_first_line + +" }}} " Tasklist"{{{ let g:tlWindowPosition = 1 " Открывать окно снизу экрана @@ -816,27 +604,10 @@ let g:nnn#command = 'nnn -C' let g:nnn#set_default_mappings = 0 " Start nnn in the current file's directory -nnoremap n :NnnPicker '%:p:h' +nnoremap n :NnnPicker %:p:h " Floating window (neovim) -function! s:layout() - let buf = nvim_create_buf(v:false, v:true) - - let height = &lines - (float2nr(&lines / 3)) - let width = float2nr(&columns - (&columns * 2 / 3)) - - let opts = { - \ 'relative': 'editor', - \ 'row': 2, - \ 'col': 8, - \ 'width': width, - \ 'height': height - \ } - - call nvim_open_win(buf, v:true, opts) -endfunction - -let g:nnn#layout = 'call ' . string(function('layout')) . '()' +let g:nnn#layout = { 'window': { 'width': 0.3, 'height': 0.9, 'highlight': 'Debug', 'xoffset': 0.07, 'yoffset': 0.5 } } let g:nnn#action = { 't': 'tab split' } @@ -851,52 +622,6 @@ hi EasyMotionTarget2First ctermbg=155 ctermfg=black cterm=bold hi EasyMotionTarget2Second ctermbg=119 ctermfg=black cterm=bold " }}} -" cheat.sh {{{ - -" Cheat sheet file type -let g:CheatSheetFt='markdown' - -" Program used to retrieve cheat sheet with its arguments -let g:CheatSheetUrlGetter='curl --silent' - -" Flag to add cookie file to the query -let g:CheatSheetUrlGetterIdFlag='-b' - -" cheat sheet base url -let g:CheatSheetBaseUrl='https://cht.sh' - -" cheat sheet settings do not include style settings neiter comments, -" see other options below -let g:CheatSheetUrlSettings='q' - -" cheat sheet pager -let g:CheatPager='less -R' - -" Show comments in answers by default -" (setting this to 0 means giving ?Q to the server) -let g:CheatSheetShowCommentsByDefault=0 - -" cheat sheet buffer name -let g:CheatSheetBufferName="_cheat" - -" Default selection in normal mode (line for whole line, word for word under cursor) -let g:CheatSheetDefaultSelection="line" - -" Default query mode -" 0 => buffer -" 1 => replace (do not use or you might loose some lines of code) -" 2 => pager -" 3 => paste after query -" 4 => paste before query -let g:CheatSheetDefaultMode=0 - -let g:CheatSheetFrameworks = {} - -" imap