nvim-config

Log | Files | Refs | Submodules | README

commit 4c187fb6630e91f31d595ce88c88a18387749092
Author: Thomas Vigouroux <tomvig38@gmail.com>
Date:   Wed, 31 Mar 2021 17:06:00 +0200

Initial commit

Diffstat:
A.gitignore | 1+
Aafter/colors/dracula.vim | 0
Aafter/compiler/black_pylint.vim | 9+++++++++
Aafter/compiler/frama-c.vim | 10++++++++++
Aafter/compiler/gropdf.vim | 11+++++++++++
Aafter/compiler/latexmk.vim | 35+++++++++++++++++++++++++++++++++++
Aafter/compiler/mdpdf.vim | 12++++++++++++
Aafter/compiler/pdflatex.vim | 8++++++++
Aafter/compiler/pylint.vim | 9+++++++++
Aafter/ftplugin/ada.vim | 1+
Aafter/ftplugin/c.vim | 17+++++++++++++++++
Aafter/ftplugin/css.vim | 3+++
Aafter/ftplugin/gph.vim | 3+++
Aafter/ftplugin/groff.vim | 2++
Aafter/ftplugin/help.vim | 3+++
Aafter/ftplugin/java.vim | 9+++++++++
Aafter/ftplugin/javascript.vim | 3+++
Aafter/ftplugin/lua.vim | 8++++++++
Aafter/ftplugin/mail.vim | 3+++
Aafter/ftplugin/man.vim | 5+++++
Aafter/ftplugin/markdown.vim | 5+++++
Aafter/ftplugin/mem.vim | 3+++
Aafter/ftplugin/neosnippet.vim | 1+
Aafter/ftplugin/netrw.vim | 1+
Aafter/ftplugin/python.vim | 3+++
Aafter/ftplugin/rst.vim | 16++++++++++++++++
Aafter/ftplugin/rust.vim | 6++++++
Aafter/ftplugin/tex.vim | 13+++++++++++++
Aafter/ftplugin/vim.vim | 19+++++++++++++++++++
Aafter/ftplugin/xml.vim | 12++++++++++++
Aafter/ftplugin/yaml.vim | 3+++
Aafter/plugin/colors.vim | 7+++++++
Aafter/plugin/config/completion.vim | 45+++++++++++++++++++++++++++++++++++++++++++++
Aafter/plugin/config/dispatch.vim | 3+++
Aafter/plugin/config/fugitive.vim | 7+++++++
Aafter/plugin/config/languagetool.vim | 25+++++++++++++++++++++++++
Aafter/plugin/config/nvim-lsp.vim | 14++++++++++++++
Aafter/plugin/config/nvim-treesitter.vim | 14++++++++++++++
Aafter/plugin/config/templar.vim | 12++++++++++++
Aafter/plugin/mappings.vim | 31+++++++++++++++++++++++++++++++
Aafter/plugin/statusline.vim | 43+++++++++++++++++++++++++++++++++++++++++++
Aafter/queries/c/highlights.scm | 2++
Aafter/queries/highlights.scm | 6++++++
Aafter/queries/mem/highlights.scm | 6++++++
Aafter/queries/rust/highlights.scm | 6++++++
Aftdetect/bip.vim | 2++
Aftdetect/fish.vim | 1+
Aftdetect/gph.vim | 1+
Aftdetect/groff.vim | 2++
Aftdetect/mbsync.vim | 1+
Ainit.vim | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alua/lsp-config.lua | 104+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alua/mappings.lua | 35+++++++++++++++++++++++++++++++++++
Alua/plugins.lua | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alua/tele-config.lua | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alua/ts-config.lua | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
Aparser/java.so | 0
Aparser/markdown.so | 0
Aparser/mem.so | 0
Aplugin/change_date.vim | 0
Aplugin/floatting_win.vim | 20++++++++++++++++++++
Aplugin/packer_compiled.vim | 374+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aplugin/swapword.vim | 25+++++++++++++++++++++++++
Aplugin/utils.vim | 26++++++++++++++++++++++++++
Asnippets/c.json | 24++++++++++++++++++++++++
Asnippets/gitcommit.json | 27+++++++++++++++++++++++++++
Asnippets/gitcommit.snip | 242+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asnippets/global.json | 23+++++++++++++++++++++++
Asnippets/json.json | 15+++++++++++++++
Asnippets/lua.json | 48++++++++++++++++++++++++++++++++++++++++++++++++
Asnippets/markdown.json | 29+++++++++++++++++++++++++++++
Asnippets/tex.json | 32++++++++++++++++++++++++++++++++
Asnippets/text.json | 17+++++++++++++++++
Asnippets/vim.json | 12++++++++++++
Asnippets/vim.snip | 22++++++++++++++++++++++
Asnippets/xml.json | 15+++++++++++++++
Asyntax/bip.vim | 166+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asyntax/fish.vim | 8++++++++
Asyntax/gph.vim | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asyntax/mbsync.vim | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atemplates/template.h | 6++++++
Atemplates/template.lua | 5+++++
Atemplates/template.sh | 1+
Atemplates/template.vim | 1+
84 files changed, 2172 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1 @@ +spell diff --git a/after/colors/dracula.vim b/after/colors/dracula.vim diff --git a/after/compiler/black_pylint.vim b/after/compiler/black_pylint.vim @@ -0,0 +1,9 @@ + +" Vim pylint integration +if exists("current_compiler") + finish +endif +let current_compiler = "pylint" + +CompilerSet makeprg=black\ %:p;\ pylint\ -sn\ --msg-template=\"{path}:{line}:\ [{msg_id}({symbol}),\ {obj}]\ {msg}\"\ %:p +CompilerSet errorformat=%f:%l:\ %m diff --git a/after/compiler/frama-c.vim b/after/compiler/frama-c.vim @@ -0,0 +1,10 @@ +" Last Change: 2020 Dec 08 +" Vim frama-c +if exists("current_compiler") + finish +endif +let current_compiler = "frama-c" + +CompilerSet makeprg=frama-c\ -rte\ -eva\ -wp\ %:p +CompilerSet errorformat=%W[%o]\ %f:%l:\ Warning:\ ,%C\ %m,[%o]\ %f:%l:\ %m + diff --git a/after/compiler/gropdf.vim b/after/compiler/gropdf.vim @@ -0,0 +1,11 @@ +" Last Change: 2020 avril 23 + +" Check if current compiler is not set +if exists("current_compiler") + finish +endif +let current_compiler = "gropdf" + +" Set compiler options +setlocal makeprg=groff\ -k\ -ms\ -Tpdf\ %:t\ >\ %:t:r.pdf +setlocal errorformat=%f:%l:\ %m diff --git a/after/compiler/latexmk.vim b/after/compiler/latexmk.vim @@ -0,0 +1,35 @@ +" Vim latexmk integration +if exists("current_compiler") + finish +endif +let current_compiler = "latexmk" + +CompilerSet makeprg=latexmk\ -pdf\ -shell-escape\ -pvc\ %:t:r +CompilerSet errorformat=%E!\ LaTeX\ %trror:\ %m, + \%E!\ %m, + \%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#, + \%+W%.%#\ at\ lines\ %l--%*\\d, + \%WLaTeX\ %.%#Warning:\ %m, + \%Cl.%l\ %m, + \%+C\ \ %m., + \%+C%.%#-%.%#, + \%+C%.%#[]%.%#, + \%+C[]%.%#, + \%+C%.%#%[{}\\]%.%#, + \%+C<%.%#>%.%#, + \%C\ \ %m, + \%-GSee\ the\ LaTeX%m, + \%-GType\ \ H\ <return>%m, + \%-G\ ...%.%#, + \%-G%.%#\ (C)\ %.%#, + \%-G(see\ the\ transcript%.%#), + \%-G\\s%#, + \%+O(%*[^()])%r, + \%+O%*[^()](%*[^()])%r, + \%+P(%f%r, + \%+P\ %\\=(%f%r, + \%+P%*[^()](%f%r, + \%+P[%\\d%[^()]%#(%f%r, + \%+Q)%r, + \%+Q%*[^()])%r, + \%+Q[%\\d%*[^()])%r diff --git a/after/compiler/mdpdf.vim b/after/compiler/mdpdf.vim @@ -0,0 +1,12 @@ +" Last Change: 2020 avril 30 + +" Check if current compiler is not set +if exists("current_compiler") + finish +endif +let current_compiler = "mdpdf" + +" Set compiler options +" pandoc exam.md --from markdown+yaml_metadata_block --to ms -o %.pdf +setlocal makeprg=pandoc\ %:t\ --from\ markdown+yaml_metadata_block\ --to\ latex\ --toc\ -o\ %:t:r.pdf +setlocal errorformat=%f:%l:\ %m diff --git a/after/compiler/pdflatex.vim b/after/compiler/pdflatex.vim @@ -0,0 +1,8 @@ +" Vim pylint integration +if exists("current_compiler") + finish +endif +let current_compiler = "pylint" + +CompilerSet makeprg=pdflatex\ -file-line-error-style\ -interaction=nonstopmode\ %:p +CompilerSet errorformat=%f:%l:\ %m diff --git a/after/compiler/pylint.vim b/after/compiler/pylint.vim @@ -0,0 +1,9 @@ +" Vim pylint integration +if exists("current_compiler") + finish +endif +let current_compiler = "pylint" + +CompilerSet makeprg=pylint\ -sn\ --msg-template=\"{path}:{line}:\ [{msg_id}({symbol}),\ {obj}]\ {msg}\"\ %:p +CompilerSet errorformat=%f:%l:\ %m + diff --git a/after/ftplugin/ada.vim b/after/ftplugin/ada.vim @@ -0,0 +1 @@ +" Last Change: 2020 Oct 13 diff --git a/after/ftplugin/c.vim b/after/ftplugin/c.vim @@ -0,0 +1,17 @@ +" Last Change: 2020 Nov 23 + +setlocal expandtab +setlocal textwidth=80 " Nvim uses this +setlocal tabstop=2 +setlocal foldmethod=expr +setlocal foldexpr=nvim_treesitter#foldexpr() +setlocal foldlevel=0 + +augroup CPerso + autocmd! + autocmd BufWrite *.c,*.h call GenerateTagsAsync('.') +augroup END + +if !empty(findfile('.clang-format', ';')) + setlocal formatprg=clang-format\ -style=file +endif diff --git a/after/ftplugin/css.vim b/after/ftplugin/css.vim @@ -0,0 +1,3 @@ +" Last Change: 2020 mai 26 +packadd nvim-colorizer.lua +ColorizerToggle diff --git a/after/ftplugin/gph.vim b/after/ftplugin/gph.vim @@ -0,0 +1,3 @@ +" Last Change: 2020 Dec 07 + +setlocal textwidth=80 diff --git a/after/ftplugin/groff.vim b/after/ftplugin/groff.vim @@ -0,0 +1,2 @@ +setlocal spell +compiler gropdf diff --git a/after/ftplugin/help.vim b/after/ftplugin/help.vim @@ -0,0 +1,3 @@ +set colorcolumn= +autocmd BufWritePost *.txt helptags %:h + diff --git a/after/ftplugin/java.vim b/after/ftplugin/java.vim @@ -0,0 +1,9 @@ +" Last Change: 2020 avril 30 + +setlocal expandtab +setlocal shiftwidth=2 +setlocal softtabstop=2 + +if exists('g:JavaComplete_PluginLoaded') + setlocal omnifunc=javacomplete#Complete +endif diff --git a/after/ftplugin/javascript.vim b/after/ftplugin/javascript.vim @@ -0,0 +1,3 @@ +" Last Change: 2020 juil. 09 +set expandtab +set tabstop=2 softtabstop=2 shiftwidth=2 diff --git a/after/ftplugin/lua.vim b/after/ftplugin/lua.vim @@ -0,0 +1,8 @@ +" Last Change: 2020 Sep 22 +setlocal foldmethod=expr +setlocal foldexpr=nvim_treesitter#foldexpr() +setlocal tabstop=2 +setlocal shiftwidth=2 +setlocal softtabstop=2 + +setlocal makeprg=TEST_FILE=%:p\ make\ test diff --git a/after/ftplugin/mail.vim b/after/ftplugin/mail.vim @@ -0,0 +1,3 @@ +" Last Change: 2020 mai 11 +setlocal textwidth=0 +setlocal spell diff --git a/after/ftplugin/man.vim b/after/ftplugin/man.vim @@ -0,0 +1,5 @@ +" Last Change: 2020 avril 29 +nnoremap <buffer> q :qa<CR> +nnoremap <buffer> j <C-E> +nnoremap <buffer> k <C-Y> +setlocal laststatus=0 nonu nornu diff --git a/after/ftplugin/markdown.vim b/after/ftplugin/markdown.vim @@ -0,0 +1,5 @@ +" Last Change: 2021 Jan 20 + +setlocal textwidth=70 +setlocal nowrap +compiler mdpdf diff --git a/after/ftplugin/mem.vim b/after/ftplugin/mem.vim @@ -0,0 +1,3 @@ +" Last Change: 2020 Sep 11 +setlocal foldmethod=expr +setlocal foldexpr=nvim_treesitter#foldexpr() diff --git a/after/ftplugin/neosnippet.vim b/after/ftplugin/neosnippet.vim @@ -0,0 +1 @@ +setlocal noexpandtab diff --git a/after/ftplugin/netrw.vim b/after/ftplugin/netrw.vim @@ -0,0 +1 @@ +set colorcolumn= diff --git a/after/ftplugin/python.vim b/after/ftplugin/python.vim @@ -0,0 +1,3 @@ +if globpath('.', '?akefile*') ==? '' + compiler pylint +endif diff --git a/after/ftplugin/rst.vim b/after/ftplugin/rst.vim @@ -0,0 +1,16 @@ +function! s:ResizeHeading(char) abort + normal mm + exe "1,$-1g/^" . a:char . "\\+$/normal ddkyypVr" . a:char + normal `m +endfunction + +function! ResizeHeadings() abort + call s:ResizeHeading("=") + call s:ResizeHeading("-") +endfunction + + +augroup RST + autocmd! + autocmd InsertLeave *.rst call ResizeHeadings() +augroup END diff --git a/after/ftplugin/rust.vim b/after/ftplugin/rust.vim @@ -0,0 +1,6 @@ +if exists('AutoPairsDefine') + let b:AutoPairs = AutoPairsDefine({"\\w\\zs<'" : '>'}) +endif + +set makeprg=cargo\ build\ --message-format\ short +let b:dispatch = "cargo test %:t:r" diff --git a/after/ftplugin/tex.vim b/after/ftplugin/tex.vim @@ -0,0 +1,13 @@ +" Last Change: 2021 Jan 08 +setlocal spell +setlocal formatoptions+=tc +setlocal textwidth=100 +set conceallevel=0 +set foldmethod=marker +set foldmarker=%(,%) + +normal zx + +if globpath('.', '?akefile*') ==? '' + compiler latexmk +endif diff --git a/after/ftplugin/vim.vim b/after/ftplugin/vim.vim @@ -0,0 +1,19 @@ +" Last Change: 2021 Jan 27 +function! s:UpdateLastMod() + " Save window and cursor location: + if expand('%:t:r') != 'change_date' + let l:last_line = line('$') > 3 ? 3 : line('$') + let l:winview = winsaveview() + " Use rst's preferred format for the time: + execute '1,' . l:last_line . 's/\mLast Change:\(\s*\).*/Last Change:\1' . strftime('%Y %b %d') . '/' + " Restore window and cursor location: + call winrestview(l:winview) + endif +endfunction + +setlocal foldenable +setlocal foldmethod=marker +setlocal tabstop=2 +setlocal shiftwidth=2 +setlocal softtabstop=2 +autocmd BufWritePre *.vim silent! call s:UpdateLastMod() diff --git a/after/ftplugin/xml.vim b/after/ftplugin/xml.vim @@ -0,0 +1,12 @@ +" Last Change: 2020 Dec 08 + +function! s:updateLastMod() + " Save window and cursor location: + let l:winview = winsaveview() + " Use rss's preferred format for the time: + execute '%s/\m\(\s*<lastBuildDate>\).*\(<\/lastBuildDate>\)/\1' . strftime('%c %Z') . '\2/' + " Restore window and cursor location: + call winrestview(l:winview) +endfunction + +autocmd BufWritePre *.xml call s:updateLastMod() diff --git a/after/ftplugin/yaml.vim b/after/ftplugin/yaml.vim @@ -0,0 +1,3 @@ +" Last Change: 2020 Sep 16 +" Fix auto-indentation for YAML files +setlocal ts=2 sts=2 sw=2 expandtab indentkeys-=0# indentkeys-=<:> diff --git a/after/plugin/colors.vim b/after/plugin/colors.vim @@ -0,0 +1,7 @@ +" Last Change: 2020 Nov 27 +colorscheme oak +" Hardcoded, du coup c'est moche, trouver un autre moyen +" C'est juste le fg de CursorLineNr et le bg de Vertsplit +highlight clear CursorLine +highlight clear SignColumn +highlight! link CursorLineNr Normal diff --git a/after/plugin/config/completion.vim b/after/plugin/config/completion.vim @@ -0,0 +1,45 @@ +" Last Change: 2021 Jan 11 + +if !exists('g:loaded_completion') + finish +endif + +let g:completion_auto_change_source = 1 + +let g:completion_chain_complete_list = { + \'default' : { + \ 'default' : [{'complete_items' : ['lsp', 'snippet']}], + \ 'comment' : [], + \ 'string' : [{'mode' : 'file'}], + \ }, + \'vim' : [ + \ {'mode' : 'cmd'}, + \ ], + \'c' : [ + \ {'complete_items': ['lsp', 'snippet']}, + \ ], + \'lua' : [ + \ {'complete_items': ['ts', 'snippet']} + \ ], + \'mem' : [ + \ {'complete_items': ['ts', 'snippet']} + \ ], + \'java' : [ + \ { 'mode' : 'omni', 'triggered_only': ['.', '::']}, + \ { 'mode' : 'tags' }, + \ ], + \'groff' : [], + \'mail' : [], + \'vimwiki' : [], + \'markdown': [ + \ { 'mode' : 'file' }, + \ { 'complete_items' : [ 'snippet' ] } + \] + \} + +let g:completion_enable_snippet = 'vim-vsnip' + +let g:vsnip_snippet_dir = expand("$HOME") . '/.config/nvim/snippets/' + +" Use completion-nvim in every buffer +autocmd BufEnter * lua require'completion'.on_attach() diff --git a/after/plugin/config/dispatch.vim b/after/plugin/config/dispatch.vim @@ -0,0 +1,3 @@ +if !exists('g:loaded_dispatch') + finish +endif diff --git a/after/plugin/config/fugitive.vim b/after/plugin/config/fugitive.vim @@ -0,0 +1,7 @@ +" Last Change: 2020 Aug 27 +if !exists("g:loaded_fugitive") || exists(":GCheckout") < 2 + finish +endif + +nnoremap <Leader>g :Git<Space> +nnoremap <silent> <Leader>c :GCheckout<CR> diff --git a/after/plugin/config/languagetool.vim b/after/plugin/config/languagetool.vim @@ -0,0 +1,25 @@ +let g:languagetool_server_command='languagetool --http' +let g:languagetool_server='$HOME/LanguageTool/languagetool-server.jar' +let g:languagetool = { + \ '.' : { + \ 'disabledRules' : '' + \ }, + \ 'text' : { + \ 'language' : 'en-GB' + \ }, + \ 'python' : { 'language' : 'en-GB' }, + \ 'markdown' : { 'language' : 'fr' }, + \ 'tex' : {'language' : 'fr'} + \ } + +let g:languagetool_preview_flags = 'MC' +let g:languagetool_useFloatting = 1 + +let g:languagetool_debug = 1 +map <silent> <Leader>p :LanguageToolErrorAtPoint<CR> + +autocmd User LanguageToolCheckDone LanguageToolSummary +" autocmd CursorHold * LanguageToolErrorAtPoint + +hi LanguageToolGrammarError guisp=#8be9fd gui=undercurl guifg=#8be9fd guibg=NONE ctermfg=white ctermbg=blue term=underline cterm=none +hi LanguageToolSpellingError guisp=#ff5555 gui=undercurl guifg=#ff5555 guibg=NONE ctermfg=white ctermbg=red term=underline cterm=none diff --git a/after/plugin/config/nvim-lsp.vim b/after/plugin/config/nvim-lsp.vim @@ -0,0 +1,14 @@ +" Last Change: 2020 Nov 27 +" Utility to store lsp/completion config + +lua require'lsp-config' + +nnoremap <silent> <Leader>d <cmd>lua vim.lsp.buf.definition()<CR> +nnoremap <silent> gD <cmd>lua vim.lsp.buf.implementation()<CR> +nnoremap <silent> <C-S-K> <cmd>lua vim.lsp.buf.signature_help()<CR> +nnoremap <silent> 1gD <cmd>lua vim.lsp.buf.type_definition()<CR> +nnoremap <silent> gr <cmd>lua vim.lsp.buf.rename()<CR> +nnoremap <silent> <Leader>= <cmd>lua vim.lsp.buf.formatting_sync()<CR> + +" autocmd CursorHold,CursorHoldI * lua vim.lsp.util.show_line_diagnostics() +" autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync() diff --git a/after/plugin/config/nvim-treesitter.vim b/after/plugin/config/nvim-treesitter.vim @@ -0,0 +1,14 @@ +" Last Change: 2020 Nov 23 + +if !exists('g:loaded_nvim_treesitter') + finish +endif + +lua require'ts-config' + +" hi! link TSParameter DraculaOrangeItalic +" hi! link TSFuncBuiltin DraculaCyan +" hi! link TSKeywordFunction Function + +hi! link TSStrong Type +hi! link TSEmphasis markdownBold diff --git a/after/plugin/config/templar.vim b/after/plugin/config/templar.vim @@ -0,0 +1,12 @@ +" Last Change: 2021 Jan 11 +if !exists('g:loaded_templar') + finish +endif + +lua << EOF +local templar = require'templar' +templar.register('*.vim', '~/.config/nvim/templates/template.vim') +templar.register('*.h', '~/.config/nvim/templates/template.h') +templar.register('*.sh', '~/.config/nvim/templates/template.sh') +templar.register('*.lua', '~/.config/nvim/templates/template.lua') +EOF diff --git a/after/plugin/mappings.vim b/after/plugin/mappings.vim @@ -0,0 +1,31 @@ +" Last Change: 2020 Nov 30 +vnoremap <silent> < <gv +vnoremap <silent> > >gv + +nnoremap <silent> yq :copen<CR> +nnoremap <silent> yQ :cclose<CR> + +inoremap <expr><CR> pumvisible() ? "\<C-y>" : "\<CR>" + +imap <expr><TAB> v:lua.tab_complete() +smap <expr><TAB> v:lua.tab_complete() + +imap <expr><S-TAB> v:lua.s_tab_complete() +smap <expr><S-TAB> v:lua.s_tab_complete() + +nnoremap <expr>K v:lua.K_help_hover() + +imap <expr><S-Tab> pumvisible() ? "\<C-P>" : "\<S-TAB>" + +nnoremap ' ` +nnoremap ` ' +nnoremap <silent> [p ]p +nnoremap <silent> <Leader><Leader> <C-^> + +nnoremap <silent> <C-O> <C-O>zz +nnoremap <silent> <C-I> <C-I>zz + +" Got from https://prettier.io/docs/en/vim.html +nnoremap gp :silent %!prettier --stdin-filepath % --trailing-comma all --single-quote<CR> + +nnoremap <Leader>f <cmd>lua require'mem'.open()<CR> diff --git a/after/plugin/statusline.vim b/after/plugin/statusline.vim @@ -0,0 +1,43 @@ +" Last Change: 2020 Nov 19 + +function! GitFileSummary() abort + if ! exists('b:gitgutter') + return "" + else + let l:git_summary = GitGutterGetHunkSummary() + return "+".l:git_summary[0] . " ~".l:git_summary[1] . " -".l:git_summary[2] + endif +endfunction + +" Statusline +function! LspStatus() abort + " if luaeval('#vim.lsp.buf_get_clients() > 0') + " return luaeval("require('lsp-status').status()") + " endif + return '' +endfunction + + +function! StatusLineActive() + let l:status = "%-6.{mode(6)}\ " + let l:status .= "%<%.50f%m\ " + let l:status .= "%y%q%w%{ObsessionStatus()}%12.{GitFileSummary()}\ %{LspStatus()}%=" + let l:status .= "%16.(%10.(%l/%LL%),\ %-5.(%c%V%)%)" + let l:status .= "\ %10.P" + + return l:status +endfunction + + +function! StatusLineInactive() + return "\ \ \ \ \ \ \ %<%.50f%m\ %y%q%w" +endfunction + +augroup Wins + autocmd! + autocmd WinEnter * setlocal statusline=%!StatusLineActive() + autocmd WinLeave * setlocal statusline=%!StatusLineInactive() +augroup END + +" Pour avoir un bon defaut +set statusline=%!StatusLineActive() diff --git a/after/queries/c/highlights.scm b/after/queries/c/highlights.scm @@ -0,0 +1,2 @@ +; ((identifier) @parameter +; (#is? @parameter parameter)) diff --git a/after/queries/highlights.scm b/after/queries/highlights.scm @@ -0,0 +1,6 @@ +; (function_call (identifier) @function.builtin +; (#contains? @function.builtin "require" "pairs")) +; (do_statement ["do" "end"] @keyword) +; +; ((identifier) @parameter +; (#is? @parameter parameter)) diff --git a/after/queries/mem/highlights.scm b/after/queries/mem/highlights.scm @@ -0,0 +1,6 @@ +[ + "{" + "}" + ":" + "+" +] @DraculaYellow diff --git a/after/queries/rust/highlights.scm b/after/queries/rust/highlights.scm @@ -0,0 +1,6 @@ +(type_arguments + "<" @DraculaPink + ">" @DraculaPink) +(type_parameters + "<" @DraculaPink + ">" @DraculaPink) diff --git a/ftdetect/bip.vim b/ftdetect/bip.vim @@ -0,0 +1,2 @@ +" Last Change: 2020 mai 25 +au BufRead,BufNewFile bip.conf set filetype=bip diff --git a/ftdetect/fish.vim b/ftdetect/fish.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile *.fish set filetype=fish diff --git a/ftdetect/gph.vim b/ftdetect/gph.vim @@ -0,0 +1 @@ +au BufNewFile,BufRead *.gph set ft=gph syn=gph diff --git a/ftdetect/groff.vim b/ftdetect/groff.vim @@ -0,0 +1,2 @@ +" Last Change: 2019 Nov 14 +au BufRead,BufNewFile *.m{s,m} set filetype=groff diff --git a/ftdetect/mbsync.vim b/ftdetect/mbsync.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile .mbsyncrc set filetype=mbsync diff --git a/init.vim b/init.vim @@ -0,0 +1,77 @@ +" Last Change: 2021 Jan 07 + +let OS=substitute(system('uname -s'),"\n","","") +if (OS == "Darwin") + let g:python_host_prog='/bin/python' + let g:python3_host_prog = '/usr/bin/python3' + set rtp+=/usr/local/opt/fzf +elseif ( OS == 'Linux' ) + let g:python_host_prog='/bin/python' + let g:python3_host_prog = '/bin/python3' + set rtp+=/usr/share/vim/vimfiles/plugin + source /usr/share/vim/vimfiles/plugin/fzf.vim +endif + +" I always need it +packadd termdebug +packadd packer.nvim +lua require"plugins" + +" Options {{{ + +set number relativenumber " nombre hybrides (relatifs + absolu) +set noshowmode " Don't echo -- NORMAL -- ect... +set hidden " la masse de buffers, sauvés, pas sauvés belek a :qa +set cursorline " Jolies couleurs pour le nombre absolu +set termguicolors " Des jolies couleurs +set splitright " Faire les splits à droite +set lazyredraw " Performances ?? +set nofoldenable " "Si tu fold, c'est que c'est pas assez refactor" -- Léo Paquet, 2019 +set spelllang=en,fr +set spellfile=~/.config/nvim/spell/correct.UTF-8.add +set textwidth=100 +set colorcolumn=+0 +set signcolumn=yes:2 " Pour eviter que ça clignotte à gauche +set scrolloff=5 +set winblend=10 " Des fenetres flottantes transparentes, tro stylé +set updatetime=500 +set nowrap +set nocursorline +set mouse=n +set previewheight=10 + +set inccommand=nosplit " preview des recherches © Ensimag bb +set completeopt=preview,menuone,noinsert " j'ai pas encore tout compris +set list listchars=tab:\|-,trail:•,nbsp:!,conceal::,precedes:<,extends:> " Afficher les caractères moches +set tags=.tags;/ " Chercher les tags dans les dossiers superieurs +set undofile " Undo persistants +set grepprg="rg --vimgrep" " plus vite que grep +set shortmess+=c + +set sessionoptions-=buffers + +" For conceal markers. +set conceallevel=1 concealcursor=niv + +" netrw +let g:netrw_liststyle=3 +let g:netrw_list_hide = netrw_gitignore#Hide() . ',\(^\|\s\s\)\zs\.\S\+' + +" tabs +set tabstop=2 +set shiftwidth=2 +set softtabstop=2 +set expandtab + +" Leader +let mapleader = "\<Space>" +let maplocalleader = "&" + +" }}} + +au TextYankPost * silent! lua vim.highlight.on_yank {on_visual=false, higroup="Visual"} + +lua require'colorizer'.setup() +lua require'mappings' + +language time POSIX diff --git a/lua/lsp-config.lua b/lua/lsp-config.lua @@ -0,0 +1,104 @@ +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.snippetSupport = true + +-- To re-enable when https://github.com/neovim/neovim/issues/13476 is fixed +-- function handle_publish_diags(err, method, result, client_id, bufnr, config) +-- vim.lsp.diagnostic.on_publish_diagnostics(err, method, result, client_id, bufnr, { +-- underline = true, +-- virtual_text = true, +-- signs = true, +-- update_in_insert = true, +-- }) + +-- vim.lsp.diagnostic.set_loclist { +-- open_loclist = false, +-- client_id = client_id, +-- severity_limit = "Warning", +-- } + +-- local loclist = vim.fn.getloclist(vim.fn.bufwinid(bufnr or 0)) +-- end + +-- vim.lsp.handlers["textDocument/publishDiagnostics"] = handle_publish_diags +vim.cmd[[packadd nvim-lsp]] + +local nvim_lsp = require'lspconfig' +local protocol = require'vim.lsp.protocol' + +-- Not sure this is useful +nvim_lsp.util.default_config = vim.tbl_extend( + "force", + nvim_lsp.util.default_config, + { log_level = vim.lsp.protocol.MessageType.Info } +) + +nvim_lsp.ccls.setup{ capabilities = capabilities } +nvim_lsp.als.setup{ capabilities = capabilities } +nvim_lsp.rust_analyzer.setup{ capabilities = capabilities } +nvim_lsp.ghcide.setup{ capabilities = capabilities } +nvim_lsp.tsserver.setup{ capabilities = capabilities } + +-- texlab +local function texlab_attach() + protocol.SymbolKind = { + 'file'; + 'sec'; + 'fold'; + ''; + 'class'; + 'float'; + 'lib'; + 'field'; + 'label'; + 'enum'; + 'misc'; + 'cmd'; + 'thm'; + 'equ'; + 'strg'; + 'arg'; + ''; + ''; + 'PhD'; + ''; + ''; + 'item'; + 'book'; + 'artl'; + 'part'; + 'coll'; + } + protocol.CompletionItemKind = { + 'string'; + ''; + ''; + ''; + 'field'; + ''; + 'class'; + 'misc'; + ''; + 'library'; + 'thesis'; + 'argument'; + ''; + ''; + 'snippet'; + 'color'; + 'file'; + ''; + 'folder'; + ''; + ''; + 'book'; + 'article'; + 'part'; + 'collect'; + } +end + +nvim_lsp.texlab.setup{ + cmd = {vim.fn.expand("$HOME") ..'/.cargo/bin/texlab'}, + on_attach = texlab_attach, +} + diff --git a/lua/mappings.lua b/lua/mappings.lua @@ -0,0 +1,35 @@ +-- Completion and so on +local rt = function(codes) + return vim.api.nvim_replace_termcodes(codes, true, true, true) +end + +local call = vim.api.nvim_call_function + +function tab_complete() + if vim.fn.pumvisible() == 1 then + return rt('<C-N>') + elseif call('vsnip#available', {1}) == 1 then + return rt('<Plug>(vsnip-expand-or-jump)') + else + return rt('<Tab>') + end +end + +function s_tab_complete() + if vim.fn.pumvisible() == 1 then + return rt('<C-P>') + elseif call('vsnip#jumpable', {-1}) == 1 then + return rt('<Plug>(vsnip-jump-prev)') + else + return rt('<S-Tab>') + end +end + +-- Help +function K_help_hover() + if vim.tbl_isempty(vim.lsp.buf_get_clients(0)) then + return "K" + else + return rt("<cmd>lua vim.lsp.buf.hover()<CR>") + end +end diff --git a/lua/plugins.lua b/lua/plugins.lua @@ -0,0 +1,82 @@ +-- vim: et +return require"packer".startup(function(use) + + local function localuse(spec) + local function path_trans(path) + return '~/src/plugins/' .. string.gsub(path, ".+/", "") + end + + if type(spec) == "string" then + use(path_trans(spec)) + else + local path = spec[1] + spec[1] = path_trans(path) + use(spec) + end + end + + use {'wbthomason/packer.nvim', opt = true} + + -- Basic + use { + 'nvim-telescope/telescope.nvim', + requires = { + 'nvim-lua/popup.nvim', + 'nvim-lua/plenary.nvim', + 'nvim-telescope/telescope-fzy-native.nvim' + }, + config = function() + require'tele-config' + end + } + + -- use { 'neovim/nvimdev.nvim', requires = {'neomake/neomake'}} + + -- Running things + use {'tpope/vim-dispatch', opt = true, keys = {'m<CR>', '`<CR>'}, cmd = {'Make', 'Dispatch'}} + + -- tpope <3 + use 'tpope/vim-obsession' + use 'tpope/vim-commentary' + use 'tpope/vim-surround' + + -- LSP related + use { + 'nvim-lua/completion-nvim', + requires = { + 'hrsh7th/vim-vsnip', + 'hrsh7th/vim-vsnip-integ', + 'neovim/nvim-lspconfig' + } + } + + -- Treesitter related + localuse 'nvim-treesitter/nvim-treesitter' + use 'nvim-treesitter/completion-treesitter' + use 'nvim-treesitter/nvim-tree-docs' + use 'nvim-treesitter/playground' + + -- experiments for treesitter + use 'bakpakin/fennel.vim' + use 'Olical/aniseed' + localuse 'vigoux/ratatoskr.nvim' + + -- Filetypes + use 'cespare/vim-toml' + use 'PProvost/vim-ps1' + use 'tamarin-prover/editors' + + -- Mine + use 'vigoux/templar.nvim' + use { 'vigoux/LanguageTool.nvim', opt = true } + + -- Misc + localuse 'vim-conf-live/pres.vim' + localuse 'vigoux/architext.nvim' + localuse 'vigoux/mem.nvim' + localuse 'vigoux/scope-tree' + use 'norcalli/nvim-colorizer.lua' + + -- One true colorscheme + localuse 'vigoux/oak' -- Not sure it is that binary +end) diff --git a/lua/tele-config.lua b/lua/tele-config.lua @@ -0,0 +1,58 @@ +local M = {} + +if not pcall(require, 'telescope') then return end + +local tele = require'telescope' + +local tele_builtin = require'telescope.builtin' + +local function lua_call(package, func_name, opts) + return string.format( + "<cmd>lua require'%s'.%s%s<CR>", + package, + func_name, + string.gsub(vim.inspect(opts or {}), '%s', '')) +end + +local function map(mode, lhs, rhs, opts) + vim.api.nvim_set_keymap(mode, lhs, rhs, opts or { silent = true, noremap = true}) +end + +map('n', '<Leader>e', lua_call('telescope.builtin', 'find_files')) +map('n', '<Leader>h', lua_call('telescope.builtin', 'help_tags')) +map('n', '<Leader>oc', lua_call('telescope.builtin', 'find_files', { cwd = '/home/thomas/.config/nvim' })) +map('n', '<Leader>b', lua_call('telescope.builtin', 'buffers')) +map('n', '<Leader>q', lua_call('telescope.builtin', 'quickfix')) +map('n', '<Leader>r', lua_call('telescope.builtin', 'live_grep')) +map('n', 'gR', lua_call('telescope.builtin', 'lsp_references')) +map('n', '<Leader>a', lua_call('telescope.builtin', 'lsp_code_actions')) +map('n', '<Leader>S', lua_call('tele-config', 'workspace_symbols')) +map('n', 'z=', lua_call('telescope.builtin', 'spell_suggest')) + +local sorters = require'telescope.sorters' +local previewers = require'telescope.previewers' + +tele.setup { + defaults = { + winblend = 10, + results_height = 20, + sorting_strategy = 'ascending', + preview_cutoff = 0, + generic_sorter = sorters.get_fzy_sorter, + file_sorter = sorters.get_fzy_sorter, + layout_strategy = 'center', + file_previewer = previewers.vim_buffer_cat.new, + grep_previewer = previewers.vim_buffer_vimgrep.new, + qflist_previewer = previewers.vim_buffer_qflist.new, + } +} + +tele.load_extension('fzy_native') + +function M.workspace_symbols() + local query = vim.fn.input('Query : ') + + tele_builtin.lsp_workspace_symbols { timeout = math.inf, query = query } +end + +return M diff --git a/lua/ts-config.lua b/lua/ts-config.lua @@ -0,0 +1,52 @@ +local parser_config = require "nvim-treesitter.parsers".get_parser_configs() +parser_config.vim = { + install_info = { + url = "~/projects/ts/tree-sitter-viml", -- local path or git repo + files = {"src/parser.c", "src/scanner.c"} + }, +} + +require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, -- false will disable the whole extension + -- use_languagetree = true, + disable = {}, -- list of language that will be disabled + }, + incremental_selection = { + enable = true, + disable = {}, + keymaps = { -- mappings for incremental selection (visual mappings) + init_selection = 'gnn', -- maps in normal mode to init the node/scope selection + node_incremental = "grn", -- increment to the upper named parent + scope_incremental = "grc", -- increment to the upper scope (as defined in locals.scm) + node_decremental = "grm", -- decrement to the previous node + } + }, + indent = { + enable = true, + disable = { 'c' } + }, + refactor = { + highlight_definitions = { + enable = true + }, + highlight_current_scope = { + enable = true + }, + smart_rename = { + enable = false, + keymaps = { + smart_rename = "grr" -- mapping to rename reference under cursor + } + }, + navigation = { + enable = false, + keymaps = { + goto_definition = "gnd", -- mapping to go to definition of symbol under cursor + list_definitions = "gnD" -- mapping to list all definitions in current file + } + } + }, + playground = { enable = true }, + ensure_installed = {'rust', 'c', 'lua', 'query', 'fennel'} -- one of 'all', 'language', or a list of languages +} diff --git a/parser/java.so b/parser/java.so Binary files differ. diff --git a/parser/markdown.so b/parser/markdown.so Binary files differ. diff --git a/parser/mem.so b/parser/mem.so Binary files differ. diff --git a/plugin/change_date.vim b/plugin/change_date.vim diff --git a/plugin/floatting_win.vim b/plugin/floatting_win.vim @@ -0,0 +1,20 @@ +function! FloatingCenteredWin() abort + let buf = nvim_create_buf(v:false, v:true) + + " Adjust window size + let height = float2nr(3 * &lines / 5) + let width = float2nr(&columns - (&columns / 4)) + let col = float2nr((&columns - width) / 2) + + let opts = { + \ 'relative': 'editor', + \ 'row': &lines / 5, + \ 'col': col, + \ 'width': width, + \ 'height': height, + \ 'style' : 'minimal' + \ } + + " Create window + let win = nvim_open_win(buf, v:true, opts) +endfunction diff --git a/plugin/packer_compiled.vim b/plugin/packer_compiled.vim @@ -0,0 +1,374 @@ +" Automatically generated packer.nvim plugin loader code + +if !has('nvim-0.5') + echohl WarningMsg + echom "Invalid Neovim version for packer.nvim!" + echohl None + finish +endif +try + +lua << END + local package_path_str = "/home/thomas/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/thomas/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/thomas/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/thomas/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" + local install_cpath_pattern = "/home/thomas/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" + if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str + end + + if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern + end + +_G.packer_plugins = { + ["LanguageTool.nvim"] = { + loaded = false, + only_sequence = false, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/opt/LanguageTool.nvim" + }, + aniseed = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/aniseed" + }, + ["architext.nvim"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/architext.nvim" + }, + ["completion-nvim"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/completion-nvim" + }, + ["completion-treesitter"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/completion-treesitter" + }, + editors = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/editors" + }, + ["fennel.vim"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/fennel.vim" + }, + ["mem.nvim"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/mem.nvim" + }, + ["nvim-colorizer.lua"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua" + }, + ["nvim-lspconfig"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/nvim-lspconfig" + }, + ["nvim-tree-docs"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/nvim-tree-docs" + }, + ["nvim-treesitter"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/nvim-treesitter" + }, + oak = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/oak" + }, + ["packer.nvim"] = { + loaded = false, + only_sequence = false, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/opt/packer.nvim" + }, + playground = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/playground" + }, + ["plenary.nvim"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/plenary.nvim" + }, + ["popup.nvim"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/popup.nvim" + }, + ["pres.vim"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/pres.vim" + }, + ["ratatoskr.nvim"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/ratatoskr.nvim" + }, + ["scope-tree"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/scope-tree" + }, + ["telescope-fzy-native.nvim"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/telescope-fzy-native.nvim" + }, + ["telescope.nvim"] = { + config = { "\27LJ\2\n+\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\16tele-config\frequire\0" }, + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/telescope.nvim" + }, + ["templar.nvim"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/templar.nvim" + }, + ["vim-commentary"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/vim-commentary" + }, + ["vim-dispatch"] = { + commands = { "Make", "Dispatch" }, + keys = { { "", "m<CR>" }, { "", "`<CR>" } }, + loaded = false, + only_sequence = false, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/opt/vim-dispatch" + }, + ["vim-obsession"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/vim-obsession" + }, + ["vim-ps1"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/vim-ps1" + }, + ["vim-surround"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/vim-surround" + }, + ["vim-toml"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/vim-toml" + }, + ["vim-vsnip"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/vim-vsnip" + }, + ["vim-vsnip-integ"] = { + loaded = true, + only_sequence = true, + only_setup = false, + path = "/home/thomas/.local/share/nvim/site/pack/packer/start/vim-vsnip-integ" + } +} + +local function handle_bufread(names) + for _, name in ipairs(names) do + local path = packer_plugins[name].path + for _, dir in ipairs({ 'ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin' }) do + if #vim.fn.finddir(dir, path) > 0 then + vim.cmd('doautocmd BufRead') + return + end + end + end +end + +local packer_load = nil +local function handle_after(name, before) + local plugin = packer_plugins[name] + plugin.load_after[before] = nil + if next(plugin.load_after) == nil then + packer_load({name}, {}) + end +end + +packer_load = function(names, cause) + local some_unloaded = false + for _, name in ipairs(names) do + if not packer_plugins[name].loaded then + some_unloaded = true + break + end + end + + if not some_unloaded then return end + + local fmt = string.format + local del_cmds = {} + local del_maps = {} + for _, name in ipairs(names) do + if packer_plugins[name].commands then + for _, cmd in ipairs(packer_plugins[name].commands) do + del_cmds[cmd] = true + end + end + + if packer_plugins[name].keys then + for _, key in ipairs(packer_plugins[name].keys) do + del_maps[key] = true + end + end + end + + for cmd, _ in pairs(del_cmds) do + vim.cmd('silent! delcommand ' .. cmd) + end + + for key, _ in pairs(del_maps) do + vim.cmd(fmt('silent! %sunmap %s', key[1], key[2])) + end + + for _, name in ipairs(names) do + if not packer_plugins[name].loaded then + vim.cmd('packadd ' .. name) + if packer_plugins[name].config then + for _i, config_line in ipairs(packer_plugins[name].config) do + loadstring(config_line)() + end + end + + if packer_plugins[name].after then + for _, after_name in ipairs(packer_plugins[name].after) do + handle_after(after_name, name) + vim.cmd('redraw') + end + end + + packer_plugins[name].loaded = true + end + end + + handle_bufread(names) + + if cause.cmd then + local lines = cause.l1 == cause.l2 and '' or (cause.l1 .. ',' .. cause.l2) + vim.cmd(fmt('%s%s%s %s', lines, cause.cmd, cause.bang, cause.args)) + elseif cause.keys then + local keys = cause.keys + local extra = '' + while true do + local c = vim.fn.getchar(0) + if c == 0 then break end + extra = extra .. vim.fn.nr2char(c) + end + + if cause.prefix then + local prefix = vim.v.count ~= 0 and vim.v.count or '' + prefix = prefix .. '"' .. vim.v.register .. cause.prefix + if vim.fn.mode('full') == 'no' then + if vim.v.operator == 'c' then + prefix = '' .. prefix + end + + prefix = prefix .. vim.v.operator + end + + vim.fn.feedkeys(prefix, 'n') + end + + local escaped_keys = vim.api.nvim_replace_termcodes(cause.keys .. extra, true, true, true) + vim.api.nvim_feedkeys(escaped_keys, 'm', true) + elseif cause.event then + vim.cmd(fmt('doautocmd <nomodeline> %s', cause.event)) + elseif cause.ft then + vim.cmd(fmt('doautocmd <nomodeline> %s FileType %s', 'filetypeplugin', cause.ft)) + vim.cmd(fmt('doautocmd <nomodeline> %s FileType %s', 'filetypeindent', cause.ft)) + end +end + +_packer_load_wrapper = function(names, cause) + success, err_msg = pcall(packer_load, names, cause) + if not success then + vim.cmd('echohl ErrorMsg') + vim.cmd('echomsg "Error in packer_compiled: ' .. vim.fn.escape(err_msg, '"') .. '"') + vim.cmd('echomsg "Please check your config for correctness"') + vim.cmd('echohl None') + end +end + +-- Runtimepath customization + +-- Pre-load configuration +-- Post-load configuration +-- Config for: telescope.nvim +loadstring("\27LJ\2\n+\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\16tele-config\frequire\0")() +-- Conditional loads +-- Load plugins in order defined by `after` +END + +function! s:load(names, cause) abort + call luaeval('_packer_load_wrapper(_A[1], _A[2])', [a:names, a:cause]) +endfunction + + +" Command lazy-loads +command! -nargs=* -range -bang -complete=file Make call s:load(['vim-dispatch'], { "cmd": "Make", "l1": <line1>, "l2": <line2>, "bang": <q-bang>, "args": <q-args> }) +command! -nargs=* -range -bang -complete=file Dispatch call s:load(['vim-dispatch'], { "cmd": "Dispatch", "l1": <line1>, "l2": <line2>, "bang": <q-bang>, "args": <q-args> }) + +" Keymap lazy-loads +noremap <silent> m<CR> <cmd>call <SID>load(['vim-dispatch'], { "keys": "m\<CR\>", "prefix": "" })<cr> +noremap <silent> `<CR> <cmd>call <SID>load(['vim-dispatch'], { "keys": "`\<CR\>", "prefix": "" })<cr> + +augroup packer_load_aucmds + au! + " Filetype lazy-loads + " Event lazy-loads + " Function lazy-loads +augroup END + +catch + echohl ErrorMsg + echom "Error in packer_compiled: " .. v:exception + echom "Please check your config for correctness" + echohl None +endtry diff --git a/plugin/swapword.vim b/plugin/swapword.vim @@ -0,0 +1,25 @@ +" Source : https://stackoverflow.com/a/3579112 +" Usage : :call SwapWords({'foo':'bar'}) +" Si / dans le mot: :call SwapWords({'foo/bar':'foo/baz'}, '@') + +function! s:Mirror(dict) + for [key, value] in items(a:dict) + let a:dict[value] = key + endfor + return a:dict +endfunction + +function! SwapWords(dict, ...) range + let words = keys(a:dict) + values(a:dict) + let words = map(words, 'escape(v:val, "|")') + if(a:0 == 1) + let delimiter = a:1 + else + let delimiter = '/' + endif + let pattern = '\v(' . join(words, '|') . ')' + exe a:firstline . ',' . a:lastline . 's' . delimiter . pattern . delimiter + \ . '\=' . string(s:Mirror(a:dict)) . '[submatch(0)]' + \ . delimiter . 'g' +endfunction + diff --git a/plugin/utils.vim b/plugin/utils.vim @@ -0,0 +1,26 @@ +" Last Change: 2020 Nov 22 +function! IsRealFile() abort + return bufname("%") !=? "" +endfunction + +function! GenerateTagsAsync(path) abort + if empty(tagfiles()) + let l:cmd_str = "ctags -R " . a:path + else + let l:cmd_str = "ctags -f ". tagfiles()[0] . " -R " . a:path + endif + return jobstart(l:cmd_str) +endfunction + +function! SetAsTitle(type) "{{{ + execute 'normal yypVr' . a:type +endfunction "}}} + +nmap <leader>sp :call <SID>SynStack()<CR> +function! <SID>SynStack() + if !exists("*synstack") + return + endif + echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') +endfunc + diff --git a/snippets/c.json b/snippets/c.json @@ -0,0 +1,24 @@ +{ + "Switch" : { + "prefix" : "switch", + "body" : [ + "switch ($1) {", + "\t$2", + "\tdefault:", + "\t\t$3", + "}", + "$0" + ], + "description" : "A switch statement." + }, + "Case" : { + "prefix" : "case", + "body" : [ + "case $1:", + "\t$2", + "\tbreak", + "$0" + ], + "description" : "A case statement." + } +} diff --git a/snippets/gitcommit.json b/snippets/gitcommit.json @@ -0,0 +1,27 @@ +{ + "Co Author" : { + "prefix" : "coauth", + "body" : [ + "Co-authored-by: ${1:name} <${2:email}>" + ], + "description" : "A co-author on github." + }, + "Fix" : { + "prefix" : "fix", + "body" : [ + "fix: ${1:description}", + "", + "${0:body}" + ], + "description" : "Fix without scope or breaking change" + }, + "Feature" : { + "prefix" : "feat", + "body" : [ + "feat: ${1:description}", + "", + "${0:body}" + ], + "description" : "New feature without scope or breaking change" + } +} diff --git a/snippets/gitcommit.snip b/snippets/gitcommit.snip @@ -0,0 +1,242 @@ +snippet revert +abbr revert: ... +options head + revert: ${1:description} + + ${2:#:body} + + ${3:#:footer} + +snippet reverts +abbr revert(...): ... +options head + revert(${1:scope}): ${2:description} + + ${3:#:body} + + ${4:#:footer} + +snippet revertsb +abbr revert!(...): ... +options head + revert!(${1:scope}): ${2:description} + + BREAKING CHANGE: ${3:#:body} + + ${4:#:footer} + +snippet config +abbr config: ... +options head + config: ${1:description} + + ${2:#:body} + + ${3:#:footer} + +snippet configs +abbr config(...): ... +options head + config(${1:scope}): ${2:description} + + ${3:#:body} + + ${4:#:footer} + +snippet configsb +abbr config!(...): ... +options head + config!(${1:scope}): ${2:description} + + BREAKING CHANGE: ${3:#:body} + + ${4:#:footer} + +snippet feat +abbr feat: ... +options head + feat: ${1:description} + + ${2:#:body} + + ${3:#:footer} + +snippet feats +abbr feat(...): ... +options head + feat(${1:scope}): ${2:description} + + ${3:#:body} + + ${4:#:footer} + +snippet featsb +abbr feat!(...): ... +options head + feat!(${1:scope}): ${2:description} + + BREAKING CHANGE: ${3:#:body} + + ${4:#:footer} + +snippet fix +abbr fix: ... +options head + fix: ${1:description} + + ${2:#:body} + + ${3:#:footer} + +snippet fixs +abbr fix(...): ... +options head + fix(${1:scope}): ${2:description} + + ${3:#:body} + + ${4:#:footer} + +snippet fixsb +abbr fix!(...): ... +options head + fix!(${1:scope}): ${2:description} + + BREAKING CHANGE: ${3:#:body} + + ${4:#:footer} + +snippet chore +abbr chore: ... +options head + chore: ${1:description} + + ${2:#:body} + + ${3:#:footer} + +snippet chores +abbr chore(...): ... +options head + chore(${1:scope}): ${2:description} + + ${3:#:body} + + ${4:#:footer} + +snippet choresb +abbr chore!(...): ... +options head + chore!(${1:scope}): ${2:description} + + BREAKING CHANGE: ${3:#:body} + + ${4:#:footer} + +snippet refactor +abbr refactor: ... +options head + refactor: ${1:description} + + ${2:#:body} + + ${3:#:footer} + +snippet refactors +abbr refactor(...): ... +options head + refactor(${1:scope}): ${2:description} + + ${3:#:body} + + ${4:#:footer} + +snippet refactorsb +abbr refactor!(...): ... +options head + refactor!(${1:scope}): ${2:description} + + BREAKING CHANGE: ${3:#:body} + + ${4:#:footer} + +snippet perf +abbr perf: ... +options head + perf: ${1:description} + + ${2:#:body} + + ${3:#:footer} + +snippet perfs +abbr perf(...): ... +options head + perf(${1:scope}): ${2:description} + + ${3:#:body} + + ${4:#:footer} + +snippet perfsb +abbr perf!(...): ... +options head + perf!(${1:scope}): ${2:description} + + BREAKING CHANGE: ${3:#:body} + + ${4:#:footer} + +snippet docs +abbr docs: ... +options head + docs: ${1:description} + + ${2:#:body} + + ${3:#:footer} + +snippet docss +abbr docs(...): ... +options head + docs(${1:scope}): ${2:description} + + ${3:#:body} + + ${4:#:footer} + +snippet style +abbr style: ... +options head + style: ${1:description} + + ${2:#:body} + + ${3:#:footer} + +snippet styles +abbr style(...): ... +options head + style(${1:scope}): ${2:description} + + ${3:#:body} + + ${4:#:footer} + +snippet test +abbr test: ... +options head + test: ${1:description} + + ${2:#:body} + + ${3:#:footer} + +snippet tests +abbr test(...): ... +options head + test(${1:scope}): ${2:description} + + ${3:#:body} + + ${4:#:footer} diff --git a/snippets/global.json b/snippets/global.json @@ -0,0 +1,23 @@ +{ + "TODO" : { + "prefix" : "todo", + "body" : [ + "TODO(vigoux): ${0:content}" + ], + "description" : "A todo placeholder" + }, + "FIXME" : { + "prefix" : "fixme", + "body" : [ + "FIXME(vigoux): ${0:content}" + ], + "description" : "A fixme code tag" + }, + "HACK" : { + "prefix" : "hack", + "body" : [ + "HACK(vigoux): ${0:content}" + ], + "description" : "A hack code tag" + } +} diff --git a/snippets/json.json b/snippets/json.json @@ -0,0 +1,15 @@ +{ + "Snippet": { + "prefix": "snip", + "body": [ + "\"${1:name}\" : {", + "\t\"prefix\" : \"${2:pref}\",", + "\t\"body\" : [", + "\t\t\"${3:content}\"", + "\t],", + "\t\"description\" : \"${4:desc}\"", + "}" + ], + "description" : "Snippet snippet" + } +} diff --git a/snippets/lua.json b/snippets/lua.json @@ -0,0 +1,48 @@ +{ + "For" : { + "prefix" : "for", + "body" : [ + "for ${1:i}=${2:start},${3:stop} do", + "\t$4", + "end", + "$0" + ], + "description" : "" + }, + "ForIn" : { + "prefix" : "forin", + "body" : [ + "for ${1:var} in ${2:iter} do", + "\t$3", + "end", + "$0" + ], + "description" : "" + }, + "Iterate" : { + "prefix" : "iter", + "body" : [ + "for _, ${1:var} in ipairs(${2:table}) do", + "\t$3", + "end", + "$0" + ], + "description" : "" + }, + "LocalRequire" : { + "prefix" : "req", + "body" : [ + "local $1 = require'$2'" + ], + "description" : "Local require" + }, + "Test" : { + "prefix" : "test", + "body" : [ + "it(\"$1\", function()", + "\t$0", + "end)" + ], + "description" : "A busted test case" + } +} diff --git a/snippets/markdown.json b/snippets/markdown.json @@ -0,0 +1,29 @@ +{ + "Slide" : { + "prefix" : "slide", + "body" : [ + "---", + "", + "# ${1:Title}", + "", + "${2:body}", + "", + "???", + "", + "${3:notes}" + ], + "description" : "A new pres.nvim slide" + }, + "Header" : { + "prefix" : "header", + "body" : [ + "---", + "author: Thomas Vigouroux", + "title: ${1:Title}", + "toc: false", + "", + "---" + ], + "description" : "A Pandoc yaml header" + } +} diff --git a/snippets/tex.json b/snippets/tex.json @@ -0,0 +1,32 @@ +{ + "GlossaryEntry" : { + "prefix" : "gloss", + "body" : [ + "\\newglossaryentry{$1}{", + "\tname={$2},", + "\tdescription={$3}", + "}" + ], + "description" : "A glossary entry." + }, + "section" : { + "prefix" : "section", + "body" : [ + "% $1 %(", + "\\section{$1}", + "$0", + "%)" + ], + "description" : "A section with folding" + }, + "Frame" : { + "prefix" : "frame", + "body" : [ + "\\begin{frame}", + "\t\\frametitle{$1}", + "\t$0", + "\\end{frame}" + ], + "description" : "A beamer frame" + } +} diff --git a/snippets/text.json b/snippets/text.json @@ -0,0 +1,17 @@ +{ + "TSTest" : { + "prefix" : "ts", + "body" : [ + "=============================", + "$1", + "=============================", + "", + "$2", + "", + "---", + "", + "$3" + ], + "description" : "A treesitter test case" + } +} diff --git a/snippets/vim.json b/snippets/vim.json @@ -0,0 +1,12 @@ +{ + "If Exists" : { + "prefix" : "ife", + "body" : [ + "if exists(\"g:loaded_$1\")", + "\tfinish", + "endif", + "$0" + ], + "description" : "Classic vim load guard" + } +} diff --git a/snippets/vim.snip b/snippets/vim.snip @@ -0,0 +1,22 @@ +snippet ifmakefile +abbr if makefile ... endif +options head + if globpath('.', '?akefile*') ==? '' + compiler ${0:TARGET} + endif + +snippet ifplugin +abbr if !exists("g:loaded_{plugin}") +options head + if !exists('g:loaded_${1}') + finish + endif + +snippet function +abbr function ... endfunction +options head + " ${2:doc} + function! ${1} "{{{ + ${0:TARGET} + endfunction "}}} + diff --git a/snippets/xml.json b/snippets/xml.json @@ -0,0 +1,15 @@ +{ + "RSSEntry" : { + "prefix" : "item", + "body" : [ + "<item>", + "\t<title>${1:title}</title>", + "\t<description>${2:desc}</description>", + "\t<link>gopher://vigoux.giize.com/0/phlog/${3:file_path}</link>", + "\t<guid isPermaLink=\"true\">gopher://vigoux.giize.com/0/phlog/$3</guid>", + "\t<pubDate>${VIM:strftime('%c %Z')}</pubDate>", + "</item>" + ], + "description" : "RSS XML entry" + } +} diff --git a/syntax/bip.vim b/syntax/bip.vim @@ -0,0 +1,166 @@ +" Vim syntax file +" Language: Bip configuration file +" Copyright: Copyright (C) 2004 Arnaud Cornet and Loïc Gomez +" License: This file is part of the bip project. See the file 'COPYING' for +" the exact licensing terms. +" +" +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn case ignore + +" Global elements +syn match bipComment contained %\s*#.*$% +syn match bipEndError contained /\(#.*\)\@<![^;{]$/ + +" Possible values types. +syn region bipString contained start=+"+ end=+"+ +syn keyword bipBool contained true false +syn match bipNumeric contained /\d\d*/ +syn region bipIP contained start=+"+ end=+"+ + \ contains=bipAddrTk,bipDot +syn region bipNetmask contained start=+"+ end=+"+ + \ contains=bipAddrTk,bipDot,bipSlash,bipMask +syn match bipAddrTk contained #\d\{1,3}# +syn match bipDot contained #\.# +syn match bipSlash contained #/# +syn match bipMask contained #\d\{1,2}# +syn match bipWhite contained +#\@!\s*+ +" wrong +" syn match bipWhite contained +^\s*\ze[^#]*+ + +" Values syntax +syn region bipStringV contained matchgroup=Delimiter start=/\s*=\s*/ + \ end=/\s*;\s*/ contains=bipString +syn region bipBoolV contained matchgroup=Delimiter start=/\s*=\s*/ + \ end=/\s*;\s*/ contains=bipBool +syn region bipNumericV contained matchgroup=Delimiter start=/\s*=\s*/ + \ end=/\s*;\s*/ contains=bipNumeric +syn region bipIPV contained matchgroup=Delimiter start=/\s*=\s*/ + \ end=/\s*;\s*/ contains=bipIP +syn region bipNetmaskV contained matchgroup=Delimiter start=/\s*=\s*/ + \ end=/\s*;\s*/ contains=bipNetmask + + +syn region bipMain start=/\%^/ end=/\%$/ + \ contains=bipKeyword,bipNetwork,bipUser,bipComment,bipEndError + +" Top level elements +syn keyword bipKeyword contained nextgroup=bipBoolV client_side_ssl + \ log log_system +syn keyword bipKeyword contained nextgroup=bipStringV log_root + \ log_format oidentd_file pid_file client_side_ssl_pem client_side_ciphers + \ client_side_dh_param ssl_default_ciphers +syn keyword bipKeyword contained nextgroup=bipNumericV port log_level + \ log_sync_interval +syn keyword bipKeyword contained nextgroup=bipIPV ip + +" Network block (level 1) +syn region bipNetwork contained matchgroup=Macro + \ start=/network\s*{\s*/ end=/};/ + \ contains=bipNKeyword,bipServer,bipComment,bipEndError,bipWhite +syn keyword bipNKeyword contained nextgroup=bipStringV name ciphers +syn keyword bipNKeyword contained nextgroup=bipBoolV ssl + +" User block (level 1) +syn region bipUser contained matchgroup=Macro start=/user\s*{\s*/ + \ end=/};/ + \ contains=bipUKeyword,bipConnection,bipComment,bipEndError,bipWhite +syn keyword bipUKeyword contained nextgroup=bipStringV password name + \ default_nick default_user default_realname ssl_check_store + \ ssl_check_mode ssl_client_certfile +syn keyword bipUKeyword contained nextgroup=bipNumericV backlog_lines +syn keyword bipUKeyword contained nextgroup=bipBoolV admin +" DEPRECATED \ always_backlog bl_msg_only blreset_on_talk + \ backlog_no_timestamp backlog backlog_reset_on_talk + \ backlog_msg_only backlog_always bip_use_notice + +" Connection block (level 2) +syn region bipConnection contained matchgroup=Macro + \ start=/connection\s*{\s*/ end=/};/ + \ contains=bipCoKeyword,bipChannel,bipComment,bipEndError,bipWhite +syn keyword bipCoKeyword contained nextgroup=bipBoolV follow_nick + \ ignore_first_nick log +syn keyword bipCoKeyword contained nextgroup=bipStringV name user nick + \ network password vhost away_nick on_connect_send realname + \ no_client_away_msg ssl_check_mode +syn keyword bipCoKeyword contained nextgroup=bipNumericV source_port + +" Channel elements (lvl 2) +syn region bipChannel contained matchgroup=Macro + \ start=/channel\s*{\s*/ end=/};/ + \ contains=bipCKeyword,bipComment,bipEndError,bipWhite +syn keyword bipCKeyword contained nextgroup=bipStringV name key +syn keyword bipCKeyword contained nextgroup=bipBoolV backlog + +" Server elements (lvl 2) +syn region bipServer contained matchgroup=Macro + \ start=/server\s*{\s*/ end=/};/ + \ contains=bipSKeyword,bipComment,bipEndError,bipWhite +syn keyword bipSKeyword contained nextgroup=bipStringV host +syn keyword bipSKeyword contained nextgroup=bipNumericV port + +" Client elements (lvl 2) +"syn region bipClient contained matchgroup=Macro +" \ start=/client\s*{\s*/ end=/};/ +" \ contains=bipCLKeyword,bipComment,bipEndError,bipWhite +"syn keyword bipCLKeyword contained nextgroup=bipStringV user password + +" Synchronization +syn sync match bipSyncNet grouphere bipNetwork /\_.\s*\(network\s*{\)\@=+/ +syn sync match bipSyncUser grouphere bipUser /\_.\s*\(user\s*{\)\@=+/ + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version < 508 + command -nargs=+ HiLink hi link <args> +else + command -nargs=+ HiLink hi def link <args> +endif + +HiLink bipMain Error +HiLink bipNetwork Error +HiLink bipChannel Error +HiLink bipServer Error +HiLink bipUser Error +HiLink bipConnection Error + +" We do not HiLink bipWhite, siec we only want to ignore it. +HiLink bipKeyword Keyword +HiLink bipNKeyword Keyword +HiLink bipUKeyword Keyword +HiLink bipCKeyword Keyword +HiLink bipSKeyword Keyword +HiLink bipCoKeyword Keyword + +HiLink bipComment Comment + +HiLink bipMatch Include + +HiLink bipStringV Error +HiLink bipBoolV Error +HiLink bipNumericV Error +HiLink bipIPV Error + +HiLink bipEndError Error + +HiLink bipString String +HiLink bipBool Boolean +HiLink bipNumeric Number +HiLink bipIP String +HiLink bipAddrTk String +HiLink bipDot Delimiter +HiLink bipSlash Delimiter +HiLink bipMask Number + +delcommand HiLink + +let b:current_syntax = "bip" +" vim: ts=8 diff --git a/syntax/fish.vim b/syntax/fish.vim @@ -0,0 +1,8 @@ +" Last Change: + +syntax region String start=/"/ skip=/\\"/ end=/"/ +syntax region Comment start=/#/ end=/$/ + +syntax match Keyword /function/ nextgroup=Function +syntax match Keyword /end/ +syntax match Keyword /source/ diff --git a/syntax/gph.vim b/syntax/gph.vim @@ -0,0 +1,80 @@ +" Last Change: 2020 Dec 07 +" Syntax colouring for gopher .gph files used by geomyidae +" Muddled about a bit by dive @ freenode / #gopherproject +" 2017-11-15 + +set shiftwidth=4 +set tabstop=4 +set noexpandtab + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +hi def link gopherComment Comment +hi def link gopherType Preproc +hi def link gopherURL Statement +hi def link gopherHtml Statement +hi def link gopherLink Statement +hi def link gopherServerPort Keyword +hi def link gopherBracket Preproc +hi def link gopherPipe Preproc +hi def link gopherCGI Type +hi def link gopherCGI2 Type +hi def link gopherQuery Type +hi def link gopherErr Error +hi def link SynError Error + +" Format of lines: +" [<type>|<desc>|<path>|<host>|<port>] + +"<desc> = description of gopher item. Most printable characters should work. +" +"<path> = full path to gopher item (base value is "/" ). Use the "Err" path for +"items not intended to be served. +" +"<host> = hostname or IP hosting the gopher item. Must be resolvable for the +"intended clients. If this is set to "server" , the server's hostname is used. +" +"<port> = TCP port number (usually 70) If this is set to "port" , the default +"port of the server is used. + +" Comments +syn region gopherComment start="<!--" end="-->" + +" URLs +syn match gopherURL "http:" +syn region gopherLink start="http:"lc=5 end="|"me=e-1 +syn match gopherURL "gopher:" +syn match gopherURL "URL:" +syn match gopherURL "URI:" +syn region gopherLink start="gopher:"lc=7 end="|"me=e-1 + +" Pipes +syn match gopherPipe "|" containedin=gopherServerPort + +" Queries and CGI +syn match gopherQuery "^\[7"lc=1 +syn match gopherCGI "|[^|]*\.cgi[^|]*"lc=1 +syn match gopherCGI2 "|[^|]*\.dcgi[^|]*"lc=1 + +" Server|Port +syn match gopherServerPort "|[^|]*|[^|]*]" + +" Start and end brackets +match gopherBracket "[\[\]]" + +" Entity +syn region gopherType start="^\[[0123456789ghHmswITi\+:;<PcMd\*\.]"lc=1 end="|" oneline + +" HTML and networking +syn match gopherHtml "^\[[hHw8]"lc=1 + +" Text comments beginning with 't' +syn match gopherComment "^t" + +" Err +syn match gopherErr "Err" +syn match gopherErr "^\[3"lc=1 diff --git a/syntax/mbsync.vim b/syntax/mbsync.vim @@ -0,0 +1,83 @@ +" Vim syntax file +" Language: mbsync setup files +" Maintainer: Stephen Gregoratto <themanhimself@sgregoratto.me> +" Last Change: 2018-03-13 +" Filenames: mbsyncrc +" Version: 0.2 +" Licence: GPLv3+ +" +" Note: This config borrows heavily from msmtprc.vim +" by Simon Ruderich and Eric Pruitt + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" OPTIONS - Ripped directly from mbsync(1) +" All Stores +syntax match mbsyncOption /^\<\(Path\|MaxSize\|MapInbox\|Flatten\|Trash\|TrashNewOnly\|TrashRemoteNew\)\>/ +" Maildir Stores +syntax match mbsyncOption /^\<\(MaildirStore\|AltMap\|Inbox\|InfoDelimiter\|SubFolders\)\>/ +" IMAP4 Account +syntax match mbsyncOption /^\<\(IMAPAccount\|Host\|Port\|Timeout\|User\|Pass\|PassCmd\|Tunnel\|AuthMechs\|SSLType\|SSLVersions\|SystemCertificates\|CertificateFile\|ClientCertificate\|ClientKey\|PipelineDepth\|DisableExtension.*\)\>/ +" IMAP Stores +syntax match mbsyncOption /^\<\(IMAPStore\|Account\|UseNameSpace\|PathDelimiter\)\>/ +" Channels +syntax match mbsyncOption /^\<\(Channel\|Master\|Slave\|Pattern\|Patterns\|MaxSize\|MaxMessaages\|ExpireUnread\|Sync\|Create\|Remove\|Expunge\|CopyArrivalDate\|SyncState\)\>/ +" Groups +syntax match mbsyncOption /^\<\(Group\|Channel\)\>/ +" Global +syntax match mbsyncOption /^\<\(FSync\|FieldDelimiter\|BufferLimit\)\>/ + +" VALUES +" Options that accept only yes|no values +syntax match mbsyncWrongOption /^\<\(TrashNewOnly\|TrashRemoteNew\|AltMap\|SystemCertificates\|UseNameSpace\|ExpireUnread\|CopyArrivalDate\|FSync\) \(yes$\|no$\)\@!.*$/ +" Option SubFolders accepts Verbatim|Maildir++|Legacy +syntax match mbsyncWrongOption /^\<\(SubFolders\) \(Verbatim$\|Maildir++$\|Legacy$\)\@!.*$/ +" Option SSLType accepts None|STARTTLS|IMAPS +syntax match mbsyncWrongOption /^\<\(SSLType\) \(None$\|STARTTLS$\|IMAPS$\)\@!.*$/ +" Option SSLVersions accepts SSLv3|TLSv1|TLSv1.1|TLSv1.2 +syntax match mbsyncWrongOption /^\<\(SSLVersions\) \(SSLv3$\|TLSv1$\|TLSv1.1$\|TLSv1.2$\)\@!.*$/ +" Option Sync +syntax match mbsyncWrongOption /^\<\(Sync\) \(None$\|Pull$\|Push$\|New$\|ReNew$\|Delete$\|Flags$\|All$\)\@!.*$/ +" Options Create|Remove|Expunge accept None|Master|Slave|Both +syntax match mbsyncWrongOption /^\<\(Create\|Remove\|Expunge\) \(None$\|Master$\|Slave$\|Both$\)\@!.*$/ +" Marks all wrong option values as errors. +syntax match mbsyncWrongOptionValue /\S* \zs.*$/ contained containedin=mbsyncWrongOption +" Mark the option part as a normal option. +highlight default link mbsyncWrongOption mbsyncOption + +" SPECIALS +" Email Addresses (yanked from esmptrc) +syntax match mbsyncAddress /[a-z0-9_.-]*[a-z0-9]\+@[a-z0-9_.-]*[a-z0-9]\+\.[a-z]\+/ +" Host names +syntax match mbsyncHost /[a-z0-9_.-]\+\.[a-z]\+$/ +" Numeric values +syntax match mbsyncNumber /\<\(\d\+$\)/ +" File Sizes +syntax match mbsyncNumber /\d\+[k|m][b]/ +" Master|Slave stores +syntax match mbsyncStores /:[^-].*:[^-]*$/ +" Strings +syntax region mbsyncString start=/"/ end=/"/ +syntax region mbsyncString start=/'/ end=/'/ +" Comments +syntax match mbsyncComment /#.*$/ contains=@Spell +" File/Dir paths - Neovim exclusive +if has ('nvim') + syntax match mbsyncPath "~\%(/[^/]\+\)\+" +endif + +highlight default link mbsyncAddress Constant +highlight default link mbsyncComment Comment +highlight default link mbsyncHost Constant +highlight default link mbsyncNumber Number +highlight default link mbsyncOption Type +highlight default link mbsyncPath Constant +highlight default link mbsyncStores Identifier +highlight default link mbsyncString String +highlight default link mbsyncWrongOptionValue Error + +let b:current_syntax = "mbsync" +\ No newline at end of file diff --git a/templates/template.h b/templates/template.h @@ -0,0 +1,6 @@ +#ifndef %{'__' . substitute(toupper(expand('%:t')), '\(\.\|-\)', '_', 0) . '__'} +#define %{0} + +%{CURSOR} + +#endif /* %{0} */ diff --git a/templates/template.lua b/templates/template.lua @@ -0,0 +1,5 @@ +local M = {} + +%{CURSOR} + +return M diff --git a/templates/template.sh b/templates/template.sh @@ -0,0 +1 @@ +#!/bin/sh diff --git a/templates/template.vim b/templates/template.vim @@ -0,0 +1 @@ +" Last Change: