nvim-config

Log | Files | Refs | README

commit d452bb8141ea6c2ed96a49b3da8aa8138581e0d2
parent 100f6dc524833f52b8245f2e65d2d659d8a01223
Author: Thomas Vigouroux <me@vigoux.eu>
Date:   Wed, 21 Aug 2024 17:04:37 +0200

feat: switch to rocks.nvim

Diffstat:
D.gitmodules | 0
Dafter/compiler/black_pylint.vim | 9---------
Dafter/compiler/frama-c.vim | 10----------
Dafter/compiler/gropdf.vim | 11-----------
Dafter/compiler/latexmk.vim | 35-----------------------------------
Dafter/compiler/mdpdf.vim | 12------------
Dafter/compiler/mypy.vim | 9---------
Dafter/compiler/pdflatex.vim | 8--------
Dafter/compiler/pylint.vim | 9---------
Dafter/ftdetect/sh.vim | 2--
Mafter/ftplugin/man.vim | 10+++++-----
Mafter/ftplugin/tex.lua | 7+++----
Dafter/plugin/colors.vim | 20--------------------
Dafter/plugin/config/completion.vim | 46----------------------------------------------
Dafter/plugin/config/nvim-lsp.vim | 4----
Dafter/plugin/config/templar.lua | 6------
Dafter/plugin/mappings.lua | 3---
Mafter/plugin/mappings.vim | 2--
Dcolors/oakv2.lua | 106-------------------------------------------------------------------------------
Dftdetect/bip.vim | 2--
Dftdetect/fish.vim | 1-
Dftdetect/gph.vim | 1-
Dftdetect/groff.vim | 2--
Dftdetect/mbsync.vim | 1-
Dftdetect/seq.vim | 2--
Minit.lua | 91+++++++------------------------------------------------------------------------
Dlua/azy_config.lua | 18------------------
Dlua/completree-config.lua | 84-------------------------------------------------------------------------------
Dlua/dap-config.lua | 61-------------------------------------------------------------
Dlua/lsp_config.lua | 484-------------------------------------------------------------------------------
Dlua/lua-stack-check.lua | 560-------------------------------------------------------------------------------
Mlua/mappings.lua | 87++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------
Alua/mini-config.lua | 40++++++++++++++++++++++++++++++++++++++++
Alua/my-lspconfig.lua | 144+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mlua/neogit-config.lua | 4+++-
Dlua/nluarocks.lua | 7-------
Dlua/oakgen.lua | 159-------------------------------------------------------------------------------
Dlua/obsidian-config.lua | 6------
Dlua/plugins.lua | 134-------------------------------------------------------------------------------
Alua/rocks-bootstrap.lua | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Dlua/shadautls.lua | 66------------------------------------------------------------------
Dlua/tltypes.lua | 72------------------------------------------------------------------------
Dlua/ts_config.lua | 0
Dlua/zest.lua | 45---------------------------------------------
Dplugin/change_date.vim | 0
Dplugin/floatting_win.vim | 20--------------------
Dplugin/matchparrents.lua | 50--------------------------------------------------
Dplugin/show_languagetree.lua | 21---------------------
Dplugin/swapword.vim | 25-------------------------
Dplugin/utils.vim | 26--------------------------
Dqueries/c/highlights.scm | 4----
Dqueries/latex/highlights.scm | 28----------------------------
Dqueries/lua/highlights.scm | 5-----
Dqueries/lua/injections.scm | 4----
Arocks.toml | 34++++++++++++++++++++++++++++++++++
Dsyntax/bip.vim | 166-------------------------------------------------------------------------------
Dsyntax/fish.vim | 8--------
Dsyntax/gph.vim | 80-------------------------------------------------------------------------------
Dsyntax/mbsync.vim | 84-------------------------------------------------------------------------------
Dsyntax/seq.vim | 13-------------
Dtemplates/template.h | 6------
Dtemplates/template.lua | 5-----
Dtemplates/template.sh | 1-
Dtemplates/template.shell.nix | 10----------
Dtemplates/template.vim | 1-
65 files changed, 359 insertions(+), 2663 deletions(-)

diff --git a/.gitmodules b/.gitmodules diff --git a/after/compiler/black_pylint.vim b/after/compiler/black_pylint.vim @@ -1,9 +0,0 @@ - -" 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 @@ -1,10 +0,0 @@ -" 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 @@ -1,11 +0,0 @@ -" 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 @@ -1,35 +0,0 @@ -" Vim latexmk integration -if exists("current_compiler") - finish -endif -let current_compiler = "latexmk" - -CompilerSet makeprg=latexmk\ -pdf\ -shell-escape\ %: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 @@ -1,12 +0,0 @@ -" 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/mypy.vim b/after/compiler/mypy.vim @@ -1,9 +0,0 @@ -" Last Change: 2023 Oct 11 -if exists("current_compiler") - finish -endif -let current_compiler = "pylint" - -CompilerSet makeprg=mypy\ --strict\ %:p -CompilerSet errorformat=%f:%l:\ %m - diff --git a/after/compiler/pdflatex.vim b/after/compiler/pdflatex.vim @@ -1,8 +0,0 @@ -" 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 @@ -1,9 +0,0 @@ -" 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/ftdetect/sh.vim b/after/ftdetect/sh.vim @@ -1,2 +0,0 @@ -" Last Change: 2021 Apr 15 -autocmd BufEnter *template setlocal filetype=sh diff --git a/after/ftplugin/man.vim b/after/ftplugin/man.vim @@ -1,5 +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 +" Last Change: 2024 Jul 23 +" 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/tex.lua b/after/ftplugin/tex.lua @@ -7,15 +7,14 @@ vim.opt_local.foldmarker = "%(,%)" vim.opt_local.wrap = false vim.opt_local.spell = true -vim.cmd [[normal zx]] +vim.treesitter.start() -if #vim.fs.find({ "Makefile", "makefile" }, { type = "file" }) == 0 then - vim.cmd [[compiler latexmk]] -end +vim.cmd [[normal zx]] MiniPairs.map_buf(0, 'i', '$', { action = 'closeopen', pair = '$$', register = { cr = false } }) -- XXX: when calling map_buf, it resets the mapping for `<CR>` and `<BS>`, so we need to reset them require "mappings".set_mappings() +vim.keymap.set("n", "<Leader>m", vim.cmd.TexlabForward, {}) local edit = require "architext.edit" local utls = require "mytsutils" diff --git a/after/plugin/colors.vim b/after/plugin/colors.vim @@ -1,20 +0,0 @@ -" Last Change: 2024 May 07 -highlight link GitSignsAdd DiffAdd -highlight link GitSignsAddInline DiffAdd -highlight link GitSignsAddLn DiffAdd - -highlight link GitSignsChange DiffChange -highlight link GitSignsChangeInline DiffChange -highlight link GitSignsChangeLn DiffChange - -highlight link GitSignsDelete DiffDelete -highlight link GitSignsDeleteInline DiffDelete -highlight link GitSignsDeleteLn DiffDelete - -highlight link @module.latex @keyword -highlight DiagnosticUnderlineInfo gui=undercurl cterm=undercurl guisp=#8be9fd guifg=NONE -highlight DiagnosticUnderlineWarn gui=undercurl cterm=undercurl guisp=#ffb86c guifg=NONE -highlight DiagnosticUnderlineError gui=undercurl cterm=undercurl guisp=#ff5555 guifg=NONE - -" highlight! link StatusLine WinBar -" highlight! link StatusLineNC WinBarNC diff --git a/after/plugin/config/completion.vim b/after/plugin/config/completion.vim @@ -1,46 +0,0 @@ -" Last Change: 2021 May 19 - -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': ['lsp', 'snippet']} - \ ], - \'mem' : [ - \ {'complete_items': ['ts', 'snippet']} - \ ], - \'java' : [ - \ { 'mode' : 'omni', 'triggered_only': ['.', '::']}, - \ { 'mode' : 'tags' }, - \ ], - \'groff' : [], - \'ledger' : [ {"complete_items" : ["ts"]} ], - \'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/nvim-lsp.vim b/after/plugin/config/nvim-lsp.vim @@ -1,4 +0,0 @@ -" Last Change: 2021 Sep 03 -" Utility to store lsp/completion config - -lua require'lsp_config' diff --git a/after/plugin/config/templar.lua b/after/plugin/config/templar.lua @@ -1,6 +0,0 @@ --- local templar = require'templar' --- templar.register('*.vim') --- templar.register('*.h') --- templar.register('*.sh') --- templar.register('*.lua') --- templar.register('shell.nix') diff --git a/after/plugin/mappings.lua b/after/plugin/mappings.lua @@ -1,3 +0,0 @@ -vim.keymap.set('n', '<Leader>q', function() vim.diagnostic.setqflist{severity = vim.diagnostic.severity.ERROR} end) -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { remap = false, silent = true }) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { remap = false, silent = true }) diff --git a/after/plugin/mappings.vim b/after/plugin/mappings.vim @@ -7,8 +7,6 @@ nnoremap <silent> Q @@ nnoremap <silent> yq :copen<CR> nnoremap <silent> yQ :cclose<CR> -" imap <expr> <S-Tab> pumvisible() ? "\<C-P>" : "\<S-TAB>" - nnoremap ' ` nnoremap ` ' nnoremap <silent> [p ]p diff --git a/colors/oakv2.lua b/colors/oakv2.lua @@ -1,106 +0,0 @@ --- Made with 'mini.colors' module of https://github.com/echasnovski/mini.nvim - -if vim.g.colors_name ~= nil then vim.cmd('highlight clear') end -vim.g.colors_name = "oak" - --- Highlight groups -local hi = vim.api.nvim_set_hl - -hi(0, "@attribute", { link = "Keyword" }) -hi(0, "@constant.builtin", { bold = true, ctermfg = 95, fg = "#846154" }) -hi(0, "@function.builtin", { ctermfg = 95, fg = "#846154" }) -hi(0, "@lsp.type.keyword", { link = "@keyword" }) -hi(0, "@lsp.type.property", { link = "@property" }) -hi(0, "@namespace", { ctermfg = 71, fg = "#69bd6b" }) -hi(0, "@parameter", { ctermfg = 255, fg = "#ffebe2", italic = true }) -hi(0, "@punctuation.special", { ctermfg = 95, fg = "#846154" }) -hi(0, "@text.emphasis", { italic = true }) -hi(0, "@text.environment", { link = "Keyword" }) -hi(0, "@text.environment.name", { ctermfg = 95, fg = "#846154" }) -hi(0, "@text.reference", { ctermfg = 185, fg = "#e6c44b" }) -hi(0, "@text.strong", { bold = true }) -hi(0, "Bold", { bold = true }) -hi(0, "Boolean", { bold = true, ctermfg = 185, fg = "#e6c44b" }) -hi(0, "Char", { ctermfg = 71, fg = "#69bd6b" }) -hi(0, "ColorColumn", { bg = "#0e0200", ctermbg = 232 }) -hi(0, "Comment", { ctermfg = 95, fg = "#846154", italic = true }) -hi(0, "Conditional", { link = "Keyword" }) -hi(0, "Constant", { ctermfg = 185, fg = "#e6c44b", italic = true }) -hi(0, "CursorColumn", { bg = "#43251a", ctermbg = 236 }) -hi(0, "CursorLine", { bg = "#43251a", ctermbg = 236 }) -hi(0, "CursorLineNr", { bg = "#43251a", ctermbg = 236 }) -hi(0, "DiagnosticError", { ctermfg = 197, fg = "#fe394f" }) -hi(0, "DiagnosticHint", { ctermfg = 255, fg = "#ffebe2" }) -hi(0, "DiagnosticInfo", { ctermfg = 75, fg = "#53adfa" }) -hi(0, "DiagnosticUnderlineError", { sp = "#fe394f", underline = true }) -hi(0, "DiagnosticUnderlineHint", { sp = "#ffebe2", underline = true }) -hi(0, "DiagnosticUnderlineInfo", { sp = "#53adfa", underline = true }) -hi(0, "DiagnosticUnderlineWarn", { sp = "#e6c44b", underline = true }) -hi(0, "DiagnosticUnnecessary", { sp = "#ffebe2", underline = true }) -hi(0, "DiagnosticWarn", { ctermfg = 185, fg = "#e6c44b" }) -hi(0, "DiffAdd", { ctermfg = 71, fg = "#69bd6b" }) -hi(0, "DiffChange", { ctermfg = 185, fg = "#e6c44b" }) -hi(0, "DiffDelete", { ctermfg = 197, fg = "#fe394f" }) -hi(0, "Error", { ctermfg = 197, fg = "#fe394f" }) -hi(0, "ErrorMsg", { link = "Error" }) -hi(0, "Folded", { bg = "#43251a", ctermbg = 236 }) -hi(0, "Function", { ctermfg = 209, fg = "#ef855c" }) -hi(0, "Identifier", { link = "Normal" }) -hi(0, "Italic", { italic = true }) -hi(0, "Keyword", { ctermfg = 140, fg = "#af96e2" }) -hi(0, "LineNr", { ctermfg = 95, fg = "#846154" }) -hi(0, "LspInlayHint", { link = "Comment" }) -hi(0, "LspReferenceRead", { sp = "#ef855c", underline = true }) -hi(0, "LspReferenceText", { sp = "#ef855c", underline = true }) -hi(0, "LspReferenceWrite", { sp = "#ef855c", underline = true }) -hi(0, "Macro", { link = "Keyword" }) -hi(0, "MatchParen", { bg = "#43251a", ctermbg = 236 }) -hi(0, "NeogitDiffAddHighlight", { link = "DiffAdd" }) -hi(0, "NeogitDiffDeleteHighlight", { link = "DiffDelete" }) -hi(0, "NonText", { ctermfg = 236, fg = "#43251a" }) -hi(0, "Normal", { bg = "#0e0200", ctermbg = 232, ctermfg = 255, fg = "#ffebe2" }) -hi(0, "NormalFloat", { link = "Normal" }) -hi(0, "Number", { ctermfg = 185, fg = "#e6c44b" }) -hi(0, "Operator", { link = "Keyword" }) -hi(0, "Pmenu", { bg = "#43251a", ctermbg = 236 }) -hi(0, "PmenuSel", { bg = "#846154", ctermbg = 95 }) -hi(0, "PreProc", { link = "Keyword" }) -hi(0, "Search", { bg = "#ef855c", ctermbg = 209, ctermfg = 232, fg = "#0e0200" }) -hi(0, "SignColumn", { link = "Normal" }) -hi(0, "Special", { ctermfg = 255, fg = "#ffebe2" }) -hi(0, "SpecialChar", { ctermfg = 71, fg = "#69bd6b" }) -hi(0, "SpellBad", { sp = "#fe394f", undercurl = true }) -hi(0, "SpellCap", { sp = "#53adfa", undercurl = true }) -hi(0, "SpellLocal", { link = "SpellBad" }) -hi(0, "SpellRare", { sp = "#ef855c", undercurl = true }) -hi(0, "Statement", { link = "Keyword" }) -hi(0, "StatusLine", { bg = "#43251a", bold = true, ctermbg = 236, ctermfg = 255, fg = "#ffebe2" }) -hi(0, "StatusLineNC", { bg = "#43251a", ctermbg = 236, ctermfg = 255, fg = "#ffebe2" }) -hi(0, "String", { ctermfg = 37, fg = "#00bdbf" }) -hi(0, "TabLine", {}) -hi(0, "Title", { ctermfg = 209, fg = "#ef855c" }) -hi(0, "Todo", { link = "Normal" }) -hi(0, "Type", { ctermfg = 71, fg = "#69bd6b", italic = true }) -hi(0, "Underlined", { ctermfg = 255, fg = "#ffebe2", underline = true }) -hi(0, "Visual", { bg = "#43251a", ctermbg = 236 }) -hi(0, "WinSeparator", { ctermfg = 236, fg = "#43251a" }) - --- Terminal colors -local g = vim.g - -g.terminal_color_0 = "#0e0200" -g.terminal_color_1 = "#fe394f" -g.terminal_color_2 = "#69bd6b" -g.terminal_color_3 = "#e6c44b" -g.terminal_color_4 = "#53adfa" -g.terminal_color_5 = "#af96e2" -g.terminal_color_6 = "#00bdbf" -g.terminal_color_7 = "#ffebe2" -g.terminal_color_8 = "#0e0200" -g.terminal_color_9 = "#fe394f" -g.terminal_color_10 = "#69bd6b" -g.terminal_color_11 = "#e6c44b" -g.terminal_color_12 = "#53adfa" -g.terminal_color_13 = "#af96e2" -g.terminal_color_14 = "#00bdbf" -g.terminal_color_15 = "#ffebe2" diff --git a/ftdetect/bip.vim b/ftdetect/bip.vim @@ -1,2 +0,0 @@ -" Last Change: 2020 mai 25 -au BufRead,BufNewFile bip.conf set filetype=bip diff --git a/ftdetect/fish.vim b/ftdetect/fish.vim @@ -1 +0,0 @@ -au BufRead,BufNewFile *.fish set filetype=fish diff --git a/ftdetect/gph.vim b/ftdetect/gph.vim @@ -1 +0,0 @@ -au BufNewFile,BufRead *.gph set ft=gph syn=gph diff --git a/ftdetect/groff.vim b/ftdetect/groff.vim @@ -1,2 +0,0 @@ -" Last Change: 2019 Nov 14 -au BufRead,BufNewFile *.m{s,m} set filetype=groff diff --git a/ftdetect/mbsync.vim b/ftdetect/mbsync.vim @@ -1 +0,0 @@ -au BufRead,BufNewFile .mbsyncrc set filetype=mbsync diff --git a/ftdetect/seq.vim b/ftdetect/seq.vim @@ -1,2 +0,0 @@ -" Last Change: 2023 Mar 16 -au BufRead,BufNewFile *.seq set filetype=seq diff --git a/init.lua b/init.lua @@ -1,18 +1,10 @@ -vim.loader.enable() +require 'rocks-bootstrap' -vim.g.loaded_matchparen = 1 -vim.g.loaded_matchit = 1 - -vim.g.python_host_prog = "/bin/python" -vim.g.oak_statusline = 1 - -if jit.os == "Linux" then - vim.g.python3_host_prog = "/bin/python3" -elseif jit.os == "Darwin" then - vim.g.python3_host_prog = "/usr/bin/python3" -end +vim.cmd.colorscheme 'dracula' +-- My options local o = vim.opt + -- o.debug = "msg" o.number = true o.relativenumber = true @@ -93,74 +85,7 @@ o.foldtext = 'v:lua.vim.treesitter.foldtext()' vim.g.mapleader = " " vim.g.maplocalleader = "$" -require "plugins" -- Load all plugins - -vim.api.nvim_create_autocmd("TextYankPost", { - callback = function() - pcall(vim.highlight.on_yank, { higroup = "Visual", timeout = 250 }) - end -}) -vim.cmd [[language en_US.utf8]] -vim.cmd [[language time POSIX]] - --- Now load plugins and such -require "mappings".set_mappings() -require "neogit-config" - --- Set up some useful diagnostics stuff -vim.api.nvim_create_autocmd("InsertEnter", { - callback = function() - -- Force off lsp_lines on enter - vim.diagnostic.config { virtual_lines = false } - end -}) -vim.api.nvim_create_autocmd("CursorHold", { - callback = function() - if not vim.diagnostic.config().virtual_lines then - vim.diagnostic.open_float { focusable = false, scope = 'line' } - end - end -}) - -do - local filetypes = { - gitcommit = true, - gitrebase = true, - } - - local secs_in_day = 24 * 60 * 60 - - local function handle(opts) - local mark = require'shadautls'.mark_for_path(vim.fn.fnamemodify(opts.file, ":p")) - if mark and mark.time <= secs_in_day and not filetypes[opts.match] then - vim.cmd [[normal! g`"]] - end - return true - end - - vim.api.nvim_create_autocmd("BufRead", { - callback = function(opts) - vim.api.nvim_create_autocmd("FileType", { - callback = handle, - once = true, - buffer = opts.buf, - }) - end - }) -end - -vim.fn.digraph_setlist { - { "</", "⟨" }, - { "/>", "⟩"} -} - -function ReloadModule() - vim.ui.select(vim.tbl_keys(package.loaded), { - prompt = "Module:", - }, function(choice) - if choice then - package.loaded[choice] = nil - require(choice) - end - end) -end +require 'my-lspconfig' +require 'mappings'.set_mappings() +require 'mini-config' +require 'neogit-config' diff --git a/lua/azy_config.lua b/lua/azy_config.lua @@ -1,18 +0,0 @@ -local M = {} - -require'azy'.setup { - -- preview = true, - debug = true, -} -local ab = require'azy.builtins' - -vim.keymap.set("n", "<Leader>e", ab.files(), {}) -vim.keymap.set("n", "<Leader>r", ab.files_contents(), {}) -vim.keymap.set('n', '<Leader>oc', ab.files { vim.fn.stdpath'config' }, {}) -vim.keymap.set('n', '<Leader>h', ab.help(), {}) -vim.keymap.set('n', '<Leader>b', ab.buffers(), {}) -vim.keymap.set('n', '<Leader>q', ab.quickfix(), {}) - -vim.ui.select = ab.select - -return M diff --git a/lua/completree-config.lua b/lua/completree-config.lua @@ -1,84 +0,0 @@ -local comp = require "complementree" -local s = require "complementree.sources" -local cdef = require 'complementree.defaults' -local cc = require "complementree.combinators" -local ccomp = require 'complementree.comparators' -local cf = require 'complementree.filters' -local utils = require 'complementree.utils' -local api = vim.api - - -local function zest_complete(ltc, _) - local preffix = utils.prefix.lua_regex("[a-zA-Z0-9_-./\\]+", ltc) - local query - if preffix and #preffix ~= 0 then - query = string.format("*%s*", preffix) - else - query = "*" - end - local files = vim.fn.systemlist { "zest", "search", query } - - - local ret = {} - for _, fname in ipairs(files) do - local fullpath, title = unpack(vim.split(fname, ':', true)) - table.insert(ret, { - word = vim.fn.fnamemodify(fullpath, ":p:t"), - menu = title, - kind = "F" - }) - end - - return ret, preffix -end - -local function md_complete(...) - local fullpath = vim.fn.expand "%:p" - if vim.fn.executable 'zest' == 1 and #(vim.fn.system { 'zest', 'search', string.format('file:%s', fullpath) }) ~= 0 then - cc.wrap(zest_complete)(...) - else - cdef.ins_completion("C-F")(...) - end -end - -local fuzzy_lsp = cc.pipeline(s.lsp_matches {}, ccomp.fzy) - -local lsp_completion = { - default = fuzzy_lsp, - string = cdef.ins_completion "C-F", - comment = cdef.dummy, - -- comment = cdef.snippy, -} - -comp.setup { - default = cdef.ins_completion "C-N", - vim = cdef.ins_completion "C-V", - dockerfile = cdef.ins_completion "C-F", - query = cdef.ins_completion 'C-O', - org = cdef.ins_completion 'C-O', - c = lsp_completion, - cpp = lsp_completion, - lua = { - default = fuzzy_lsp, - string = cdef.ins_completion "C-F", - }, - rust = lsp_completion, - ocaml = lsp_completion, - python = lsp_completion, - ql = lsp_completion, - cmake = lsp_completion, - nix = { default = fuzzy_lsp, path_expression = cdef.ins_completion "C-F", path_fragment = cdef.ins_completion "C-F" }, - tex = lsp_completion, - haskell = lsp_completion, - go = lsp_completion, - javascript = lsp_completion, - typescript = lsp_completion, - zig = lsp_completion, - xml = lsp_completion, - html = lsp_completion, - - lean = lsp_completion, - - -- For git commit and text only do luasnip - markdown = md_complete -} diff --git a/lua/dap-config.lua b/lua/dap-config.lua @@ -1,61 +0,0 @@ -local dap = require('dap') -dap.adapters.cppdbg = { - id = 'cppdbg', - type = 'executable', - command = 'OpenDebugAD7', -} - -dap.configurations.cpp = { - { - name = "Launch file", - type = "cppdbg", - request = "launch", - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - end, - args = function() - local args_string = vim.fn.input('Arguments: ', "", "file") - return vim.split(args_string, " +") - end, - cwd = '${workspaceFolder}', - stopOnEntry = true, - }, -} - --- If you want to use this for Rust and C, add something like this: - -dap.configurations.c = dap.configurations.cpp -dap.configurations.rust = dap.configurations.cpp - -dap.defaults.fallback.external_terminal = { - command = vim.fn.exepath "st"; - args = { '-e' }; -} -dap.defaults.fallback.force_external_terminal = true - -local widgets = require "dap.ui.widgets" - -local sbar = widgets.sidebar(widgets.frames) - -dap.listeners.after['event_initialized']['me'] = function() -end - -dap.listeners.after['event_terminated']['me'] = function() -end - -vim.keymap.set("n", "<LocalLeader>r", dap.continue) -vim.keymap.set("n", "<LocalLeader>n", dap.step_over) -vim.keymap.set("n", "<LocalLeader>s", dap.step_into) -vim.keymap.set("n", "<LocalLeader>o", dap.step_out) -vim.keymap.set("n", "<LocalLeader>b", dap.toggle_breakpoint) -vim.keymap.set("n", "<LocalLeader>u", dap.up) -vim.keymap.set("n", "<LocalLeader>d", dap.down) -vim.keymap.set({"n", "v"}, "<LocalLeader><LocalLeader>", widgets.hover) -vim.keymap.set("n", "<LocalLeader>ib", function() - dap.set_breakpoint(vim.fn.input('Breakpoint condition: ')) -end) -vim.keymap.set("n", "<LocalLeader>lb", function() - dap.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) -end) - -require("nvim-dap-virtual-text").setup() diff --git a/lua/lsp_config.lua b/lua/lsp_config.lua @@ -1,484 +0,0 @@ -vim.diagnostic.config { - virtual_text = false, - severity_sort = true, - signs = true, -} - -vim.lsp.log.set_level(vim.lsp.log_levels.WARN) - -vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' }) -vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' }) - -local function on_attach(client, bufnr) - local function set_keymap(lhs, func, desc) - -- vim.api.nvim_echo({ {"Setup "}, {lhs} }, true, {}) - vim.keymap.set("n", lhs, "", { - remap = false, - silent = true, - buffer = bufnr, - callback = func, - desc = desc - }) - end - - local function set_autocmd(event, func) - vim.api.nvim_create_autocmd(event, { - buffer = bufnr, - callback = function() pcall(func) end, - }) - end - - -- Mappings. - -- See `:help vim.lsp.*` for documentation on any of the below functions - if client.server_capabilities and client.server_capabilities.hoverProvider then - set_keymap('K', vim.lsp.buf.hover, "Hover / print docs") - end - set_keymap('<Leader>d', vim.lsp.buf.definition, "Go to definition") - set_keymap('<Leader>gd', vim.lsp.buf.declaration, "Go to declaration") - set_keymap('<Leader>td', vim.lsp.buf.type_definition, "Go to type definition") - set_keymap('gr', vim.lsp.buf.rename, "Rename symbol at point") - set_keymap('<Leader>a', vim.lsp.buf.code_action, "Code action at point") - set_keymap('<Leader>=', vim.lsp.buf.format, "Format the whole buffer") - set_keymap('gR', require "azy.builtins".lsp.references(), "Search for references") - set_keymap('<Leader>s', require "azy.builtins".lsp.workspace_symbols(), "Search workspace symbols") - - vim.opt_local.tagfunc = "v:lua.vim.lsp.tagfunc" - - set_keymap('<Leader>e', require "azy.builtins".files(vim.tbl_filter(function(p) - return #p > 0 and p ~= vim.fn.expand("$HOME") - end, vim.lsp.buf.list_workspace_folders()))) - - if client.supports_method('textDocument/documentHighlight') then - set_autocmd("CursorHold", vim.lsp.buf.document_highlight) - set_autocmd("CursorMoved", vim.lsp.buf.clear_references) - end - - if client.supports_method('textDocument/codeLens') then - set_autocmd({ "BufEnter", "CursorHoldI", "InsertLeave" }, vim.lsp.codelens.refresh) - set_keymap('<Leader>lr', vim.lsp.codelens.run, "Run codelens") - end - - -- if client.supports_method 'textDocument/inlayHint' then - -- vim.lsp.inlay_hint(bufnr, true) - -- end -end - --- TexLab and LTeX things - -local function texlab_attach(client, bufnr) - vim.api.nvim_buf_set_keymap(bufnr, 'n', '<Leader>m', '<cmd>TexlabForward<CR>', { noremap = true, silent = true }) - - vim.lsp.protocol.SymbolKind = { - 'file', - 'sec', - 'fold', - '', - 'class', - 'float', - 'lib', - 'field', - 'label', - 'enum', - 'misc', - 'cmd', - 'thm', - 'equ', - 'strg', - 'arg', - '', - '', - 'PhD', - '', - '', - 'item', - 'book', - 'artl', - 'part', - 'coll', - } - vim.lsp.protocol.CompletionItemKind = { - 'string', - '', - '', - '', - 'field', - '', - 'class', - 'misc', - '', - 'library', - 'thesis', - 'argument', - '', - '', - 'snippet', - 'color', - 'file', - '', - 'folder', - '', - '', - 'book', - 'article', - 'part', - 'collect', - } - on_attach(client, bufnr) -end - -local augroup = vim.api.nvim_create_augroup("User_LSP", {}) - -local find_root = function(markers, file) - local dirs = vim.fs.find(markers, { upward = true, path = vim.fs.dirname(file) }) - local source = vim.fn.fnamemodify(dirs[1] or file, ":p") - if source:sub(-1) == "/" then - source = vim.fs.dirname(source) - end - return vim.fs.dirname(source) -end - -local function setup_lsp(name, filetypes, command, ucommands, config) - vim.api.nvim_create_autocmd("Filetype", { - pattern = filetypes, - group = augroup, - callback = function(args) - local cpreffix = name:gsub("[-_ ]", "") - cpreffix = cpreffix:sub(1, 1):upper() .. cpreffix:sub(2) - - -- Setup user commands if requested - for cname, func in pairs(ucommands) do - vim.api.nvim_create_user_command(cpreffix .. cname, function(...) - local client = vim.lsp.get_clients { name = name }[1] - func(client, args.buf, ...) - end, {}) - end - local cfg = vim.deepcopy(config) - cfg.name = name - cfg.cmd = command - - -- Find the root directory - if not cfg.root_dir then - cfg.root_dir = find_root(cfg.root_markers or { ".git" }, args.file) - end - vim.lsp.start(cfg, { bufnr = args.buf }) - end - }) -end - -local function execute_command(client, command, args, bufnr, handler) - return client.request("workspace/executeCommand", { command = command, arguments = args }, handler, bufnr) -end - --- System lsps - -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true -capabilities.workspace.configuration = true - -local default_cfg = { capabilities = capabilities, on_attach = on_attach } - --- A bit of notes for the future me --- filetypes (table) List of filetypes for this lsp --- command (table|nil) command to run to start the server, defaults to server name --- cfg (table) config as in vim.lsp.start_client() --- root_markers (list|nil) Files that are markers for the root directory --- ucommands (table) Mapping from valid command names to lua functions (as in --- nvim_create_user_command, with first argument being the client) to create in the buffer where the thing is started -local system_lsps = { - lemminx = { - filetypes = { 'xml' }, - }, - hls = { - command = { "haskell-language-server-wrapper", "--lsp" }, - filetypes = { "haskell" }, - root_markers = { "Setup.hs", "stack.yaml" }, - }, - - zls = { - filetypes = { "zig" }, - root_markers = { "build.zig", ".git" }, - cfg = { - capabilities = capabilities, - on_attach = on_attach, - settings = { - zls = { - enable_autofix = false, - enable_snippets = true, - enable_inlay_hints = true, - include_at_in_builtins = true, - inlay_hints_hide_redundant_param_names_last_token = true, - warn_style = true, - } - } - } - }, - - htmlsp = { - filetypes = { "html" }, - root_markers = { "index.html", ".git" }, - command = { "vscode-html-language-server", "--stdio" }, - }, - - lean = { - filetypes = { 'lean', }, - command = { 'lake', 'serve'}, - }, - - cmakels = { - command = { "cmake-language-server" }, - filetypes = { "cmake" }, - root_markers = { "CMakeLists.txt", ".git", } - }, - - tsserver = { - command = { "typescript-language-server", "--stdio" }, - filetypes = { "typescript", "javascript" }, - root_markers = { "tsconfig.json", "package.json", ".git" } - }, - - ocamllsp = { - filetypes = { "ocaml" }, - cfg = { - capabilites = capabilities, - on_attach = on_attach, - settings = { - ocaml = { - server = { - extraEnv = { - OCAMLLSP_SEMANTIC_HIGHLIGHTING = "full", - } - } - } - } - } - }, - - clangd = { - command = { "clangd", "--limit-results=0", "--suggest-missing-includes", "--all-scopes-completion", - "--compile-commands-dir=build/" }, - filetypes = { "c", "cpp" }, - root_markers = { "CMakeLists.txt", ".git" }, - }, - - pylsp = { - filetypes = { "python" }, - }, - - ["rnix-lsp"] = { - filetypes = { "nix" }, - }, - - ["vim-language-server"] = { - filetypes = { "vim" }, - }, - - gopls = { - filetypes = { "go" }, - }, - - rust_analyzer = { - filetypes = { "rust" }, - root_markers = { "Cargo.toml", ".git" }, - command = { "rustup", "run", "nightly", "rust-analyzer" }, - }, - - codeql = { - command = { 'codeql', 'execute', 'language-server', '--check-errors=ON_CHANGE' }, - filetypes = { 'ql' }, - }, - - ["lua-language-server"] = (function() - return { - filetypes = { "lua" }, - cfg = { - capabilities = capabilities, - on_attach = on_attach, - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = 'LuaJIT', - -- Setup your lua path - path = vim.split(package.path, ';'), - }, - hint = { - enable = true - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { 'vim' }, - - workspaceDelay = -1, - - groupFileStatus = { - strict = "Opened", - strong = "Opened", - }, - - groupSeverity = { - strong = "Warning", - strict = "Warning", - }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file('', true), - checkThirdParty = false, - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, - }, - completion = { - callSnippet = "Replace", - } - }, - }, - } - } - end)(), - - texlab = { - command = { "texlab" }, - filetypes = { "tex", "bib", "latex" }, - root_markers = { ".latexmkrc", ".git" }, - ucommands = { - Build = function(client, bufnr) - local texlab_build_status = vim.tbl_add_reverse_lookup { - Success = 0, - Error = 1, - Failure = 2, - Cancelled = 3, - } - - local params = vim.lsp.util.make_text_document_params(bufnr) - client.request('textDocument/build', params, function(err, result) - if err then - error(tostring(err)) - end - vim.notify('Build ' .. texlab_build_status[result.status]) - end, bufnr) - end, - - Forward = function(client, bufnr) - local texlab_forward_status = vim.tbl_add_reverse_lookup { - Success = 0, - Error = 1, - Failure = 2, - Unconfigured = 3, - } - - local params = { - textDocument = { uri = vim.uri_from_bufnr(bufnr) }, - position = { line = vim.fn.line '.' - 1, character = vim.fn.col '.' }, - } - - client.request('textDocument/forwardSearch', params, function(err, result) - if err then - error(tostring(err)) - end - vim.notify('Search ' .. texlab_forward_status[result.status]) - end) - end, - - CleanAuxiliary = function(client, bufnr) - client.request("workspace/executeCommand", - { command = "texlab.cleanAuxiliary", arguments = { document = vim.lsp.util.make_text_document_params(bufnr) } }, - function(...) end, bufnr) - end, - - CleanArtifacts = function(client, bufnr) - local uri = vim.uri_from_bufnr(bufnr) - client.request("workspace/executeCommand", - { command = "texlab.cleanArtifacts", arguments = { document = { uri = uri } } }) - end - }, - cfg = { - trace = "verbose", - capabilities = capabilities, - on_attach = texlab_attach, - settings = { - texlab = { - build = { - onSave = true, - forwardSearchAfter = true, - args = { "-interaction=nonstopmode", "-f", "-synctex=1", "-shell-escape", "-xelatex", "%f" } - }, - forwardSearch = { - executable = "zathura", - args = { "-x", - -- First level of escaping is for string.format, second level for escaping is for texlab - string.format("nvim --server %s --remote-send '<cmd>edit +%%%%{line} %%%%{input}<cr>'", - vim.fn.serverlist()[1]), - "--synctex-forward", "%l:1:%f", "%p" } - }, - } - }, - }, - } -} - -for lname, config in pairs(system_lsps) do - if not config.filetypes then - vim.notify(string.format("No filetypes defined for %s", lname)) - else - setup_lsp(lname, config.filetypes, config.command or { lname }, config.ucommands or {}, config.cfg or default_cfg) - end -end - -require 'ltex-ls'.setup { - on_attach = on_attach, - capabilities = capabilities, - filetypes = { "latex", "tex", "bib", "markdown", "gitcommit", "text", "mail" }, - use_spellfile = true, - handlers = { - ["ltex/workspaceSpecificConfiguration"] = vim.lsp.with(require 'ltex-ls.handlers'.workspace_configuration, - { debug = true }) - }, - settings = { - ltex = { - checkFrequency = "save", - enabled = { "latex", "tex", "bib", "markdown", }, - language = "auto", - diagnosticSeverity = "information", - additionalRules = { - enablePickyRules = true, - motherTongue = "fr", - }, - disabledRules = { - en = { "REGARD", "PASSIVE_VOICE", "ACTUALLY", "REST" }, - fr = { "APOS_TYP", "FRENCH_WHITESPACE", "FR_SPELLING_RULE", "COMMA_PARENTHESIS_WHITESPACE" } - }, - latex = { - commands = { - ["\\MaxMC"] = "dummy", - ["\\SSAT"] = "dummy", - ["\\SAT"] = "dummy", - ["\\todo"] = "ignore", - }, - environments = { - quote = 'ignore', - } - }, - dictionary = (function() - local files = {} - for _, file in ipairs(vim.api.nvim_get_runtime_file("spell/*.add", true)) do - local lang = vim.fn.fnamemodify(file, ":t:r:r") -- Because 'spellfile' is .{encoding}.add - local fullpath = vim.fn.fnamemodify(file, ":p") - files[lang] = { ":" .. fullpath } - end - - if files.default then - for lang, _ in pairs(files) do - if lang ~= "default" then - vim.list_extend(files[lang], files.default) - end - end - files.default = nil - end - return files - end)(), - trace = { server = "verbose" }, - }, - }, -} diff --git a/lua/lua-stack-check.lua b/lua/lua-stack-check.lua @@ -1,560 +0,0 @@ -local M = {} - -local api = vim.api -local ts = vim.treesitter -local tsq = require'vim.treesitter.query' - -local QUERY = [[ -;; Upvalues are defined before the function definition -((comment) @up_comment - . - (_ (function_declarator declarator: (identifier) @fname) - body: (_)) @body - (#lua-match? @up_comment "^//s ")) - -;; Stack arguments are defined in the first comment of the function body -(function_definition - declarator: (_ declarator: (identifier) @fname) - body: (compound_statement . (comment) @before_comment) - (#lua-match? @before_comment "^//s ")) @body - -;; Return stack state is defined in the last comment of the function body -(function_definition - declarator: (_ declarator: (identifier) @fname) - body: (compound_statement (comment) @after_comment . ) - (#lua-match? @after_comment "^//s ")) @body -]] -local query = tsq.parse_query('c', QUERY) - -local function parse_stack(comment) - comment = comment:sub(5) - -- First collect all items - local items = {} - local init = 1 - while true do - local start, stop = string.find(comment, "[a-z_]+", init) - if start then - table.insert(items, comment:sub(start, stop)) - init = stop + 1 - else - break - end - end - return items -end - ------------------- --- Type ------------------- - -local Type = { - UNKNOWN = 0, - STRING = 1, - INTEGER = 2, - BOOLEAN = 3, - TABLE = 4, - NIL = 5, - USERDATA = 6, -} -vim.tbl_add_reverse_lookup(Type) - -M.Type = Type - ------------------- --- Element ------------------- - -local Element = {} -Element.__index = Element - -function Element.new(name, type) - local self = setmetatable({ - _name = name or "", - _type = type or Type.UNKNOWN - }, Element) - return self -end - -function Element.nil_() - return Element.new("nil", Type.NIL) -end - -function Element.anon(type) - return Element.new("", type) -end - -M.Element = Element - ------------------- --- Stack ------------------- - -local Stack = {} -Stack.__index = Stack - -function Stack.new(items) - local inner = {} - if items then - for _, elem in pairs(parse_stack(items)) do - local type = Type.UNKNOWN - if elem == "nil" then - type = Type.NIL - end - table.insert(inner, Element.new(elem, type)) - end - end - local self = setmetatable({ - _inner = inner, - }, Stack) - return self -end - -function Stack:copy() - return setmetatable(vim.deepcopy(self), Stack) -end - --- Stack manipulation - -function Stack:insert(...) - table.insert(self._inner, ...) -end - -function Stack:push(element) - self:insert(element) -end - -function Stack:push_all(other) - for _,elem in pairs(other._inner) do - self:push(elem) - end -end - -function Stack:remove(...) - return table.remove(self._inner,...) -end - -function Stack:pop() - return self:remove() -end - -function Stack:get(index) - if index < 0 then - return self._inner[#self._inner + index + 1] - else - return self._inner[index] - end -end - -function Stack:print() - local to_print = {} - for index,element in ipairs(self._inner) do - to_print[index] = string.format("%s: %s", element._name, Type[element._type]) - end - print(vim.inspect(to_print)) -end - -function Stack:match(other, strict) - local short, long - - local function report() - print("Stacks not matching...") - self:print() - other:print() - end - - if strict then - short = self._inner - long = other._inner - if #short ~= #long then - report() - return false - end - else - if #self._inner > #other._inner then - short = other._inner - long = self._inner - else - short = self._inner - long = other._inner - end - end - - for i=1,#short do - local left = short[i] - local right = long[#long - #short + i] - - local function sync_names() - local left_has_name = #(left._name) - local right_has_name = #(right._name) - if left_has_name and not right_has_name then - right._name = left._name - elseif right_has_name and not left_has_name then - left._name = right._name - end - end - - local types_unknown = left._type == Type.UNKNOWN or right._type == Type.UNKNOWN - local types_are_nil = left._type == Type.NIL or right._type == Type.NIL - if not types_unknown - and left._type ~= right._type - and not types_are_nil then - report() - return false - elseif types_unknown then - if left._type == Type.UNKNOWN then - left._type = right._type - else - right._type = left._type - end - end - sync_names() - end - return true -end - -function Stack:len() - return #self._inner -end - -M.Stack = Stack - ------------------- --- FunctionTree ------------------- - -local FunctionTree = { } -FunctionTree.__index = FunctionTree - -local function lookup(q, match) - local lookup_match = {} - for id, node in pairs(match) do - lookup_match[q.captures[id]] = node - end - return lookup_match -end - --- A function that returns a function that returns a function --- Used to cache the arg_query in one place -local make_check_function = (function() - local arg_query = tsq.parse_query('c', [[ - (argument_list - (call_expression - function: (_) @fname - arguments: (argument_list (_) @num .) @call .)) - (argument_list (number_literal) @num .) - ]]) - - return function(type) - return function(call, caller, stack, bufnr) - local _,last_arg = arg_query:iter_matches(call, bufnr)() - last_arg = lookup(arg_query, last_arg) - if last_arg.call then - local fname = tsq.get_node_text(last_arg.fname, bufnr) - if fname == "lua_upvalueindex" then - if not caller.up then return false end - local index = tonumber(tsq.get_node_text(last_arg.num, bufnr)) - local element = caller.up:get(index) - if not element then return false end - - if element._type == Type.UNKNOWN then - element._type = type - return true - end - - return element._type == type - else - -- Can't analyze this call: assume it is correct - return true - end - else - local index = tonumber(tsq.get_node_text(last_arg.num, bufnr)) - local element = stack:get(index) - if not element then return false end - - return element._type == type - end - end - end -end)() - -local default_contracts = { - lua_pushboolean = { - post = function(_call, _caller, stack, _bufnr) - stack:push(Element.anon(Type.BOOLEAN)) - end - }, - lua_pushnil = { - post = function(_call, _caller, stack, _bufnr) - stack:push(Element.nil_()) - end - }, - lua_newuserdata = { - post = function(_call, _caller, stack, _bufnr) - stack:push(Element.anon(Type.USERDATA)) - end - }, - luaL_checkstring = { - pre = make_check_function(Type.STRING) - } -} - -local State = {} -State.__index = State -local state_count = 0 - -function State.new(name, func, bufnr, steps) - local stack - if func.before then - stack = func.before:copy() - else - stack = Stack.new() - end - - state_count = state_count + 1; - return setmetatable({ - _id = state_count, - _root = func, - _root_name = name, - _stack = stack, - _bufnr = bufnr, - _steps = steps, - _ignored = {}, - _node_index = 1 - }, State) -end - -function State:split() - local ignored = {} - for node,_ in pairs(self._ignored) do - ignored[node] = true - end - - state_count = state_count + 1; - return setmetatable({ - _id = state_count, - _root = self._root, - _root_name = self._root_name, - _stack = self._stack:copy(), - _bufnr = self._bufnr, - _steps = self._steps, - _ignored = ignored, - _node_index = self._node_index - }, State) -end - -function State:_is_ignored(node) - for _,dest in ipairs(self._ignored) do - local n_sr, n_sc, n_er, n_ec = node:range() - local d_sr, d_sc, d_er, d_ec = dest:range() - - local start_fits = n_sr > d_sr or (d_sr == n_sr and n_sc > d_sc) - local end_fits = n_er < d_er or (n_er == d_er and n_ec < d_ec) - if start_fits and end_fits then return true end - end - return false -end - -function State:report(...) - print(" ", self._id, ":", ...) -end - -function State:step(functree) - local match = self._steps[self._node_index] - self._node_index = self._node_index + 1 - - if not match then return {}, false end - if self:_is_ignored(match.node) then return { self }, false end - - if match.call then - -- This is a function call - local fname = tsq.get_node_text(match.fname, self._bufnr) - local contract = functree._contracts[fname] - if contract then - if contract.pre - and not contract.pre(match.call, self._root, self._stack, self._bufnr) then - local call_row = match.fname:range() - self:report(string.format("Precondition violation on row: %d (%s)", call_row, fname)) - return {}, true - end - - if contract.post then - contract.post(self.call, self._root, self._stack, self._bufnr) - end - else - self:report("Missing contract for", fname) - local to_analyze = functree._functions[fname] - if to_analyze then - self:report("Found", fname, "in functions to analyse") - functree:analyse_function(fname, to_analyze) - contract = functree._contracts[fname] - if contract then - if contract.pre - and not contract.pre(match.call, self._root, self._stack, self._bufnr) then - local call_row = match.fname:range() - self:report(string.format("Precondition violation on row: %d (%s)", call_row, fname)) - return {}, true - end - - if contract.post then - contract.post(self.call, self._root, self._stack, self._bufnr) - end - else - self:report(fname, "did not generate any contract") - end - end - end - return { self }, false - elseif match.ret then - -- TODO: handle lua_error calls in ret - local ret_row = match.ret:range() - if self._root.after and not self._root.after:match(self._stack, true) then - self:report(string.format("Post condition not matching on row %d", ret_row)) - return {}, true - end - - return {}, false - elseif match.ifs then - -- Split the state in two - local right = self:split() - if match.right then - table.insert(self._ignored, match.right) - end - table.insert(right._ignored, match.left) - - return { self, right } - elseif match.comment then - local ctext = tsq.get_node_text(match.comment, self._bufnr) - local assert_stack = Stack.new(ctext) - local assert_row = match.comment:range() - self:report("Verifying assertion row", assert_row) - if self._stack:match(assert_stack, match.strict) then - return { self }, false - else - self:report(string.format("Assertion failed at row %d: \"%s\"", assert_row, ctext)) - return {}, true - end - end -end - -function State:print() - print("State", self._id) - self._stack:print() -end - -function FunctionTree:analyse_function(name, func) - print("Analysing", name) - func.done = true - local ANALYZE_QUERY = [[ - ;; Root call - (call_expression function: (identifier) @fname) @call @node - - (if_statement consequence: (_) @left alternative: (_)? @right) @ifs @node - - ((comment) @comment @node (#lua-match? @comment "^//sa ")) - ((comment) @comment @node @strict (#lua-match? @comment "^//sA ")) - - (return_statement) @ret @node]] - local analyze_query = tsq.parse_query('c', ANALYZE_QUERY) - local steps = {} - for _,match in analyze_query:iter_matches(func.body, self._bufnr) do - match = lookup(analyze_query, match) - table.insert(steps, match) - end - - -- Sort the steps in the order of appearance in the file - table.sort(steps, function(a,b) - local a_srow, a_scol = a.node:range() - local b_srow, b_scol = b.node:range() - - return a_srow < b_srow or (a_srow == b_srow and a_scol < b_scol) - end) - - local states = { State.new(name, func, self._bufnr, steps) } - local iterations = 0 - local errored = false - while #states > 0 and iterations < 10000 do - local s = table.remove(states) - local new_states, has_error = s:step(self) - errored = errored or has_error - for _,new in ipairs(new_states) do - table.insert(states, new) - end - iterations = iterations + 1 - end - - if not errored then - self._contracts[name] = { - pre = function(_call, _caller, stack, _bufnr) - if func.up then - return stack:match(func.up) - end - if func.before then - return stack:match(func.before) - end - end, - post = function(_call, _caller, stack, _bufnr) - if func.before then - for i=1,func.before:len() do - stack:pop() - end - end - if func.after then - stack:push_all(func.after) - end - end - } - end -end - -function FunctionTree:analyse(funcnames) - if funcnames then - for _,fname in ipairs(funcnames) do - local to_analyze = self._functions[fname] - if to_analyze and not to_analyze.done then - self:analyse_function(fname, to_analyze) - end - end - else - for name,func in pairs(self._functions) do - if not func.done then - self:analyse_function(name, func) - end - end - end -end - -function FunctionTree.new(buffer) - buffer = buffer or api.nvim_get_current_buf() - - local self = setmetatable({ - _bufnr = buffer, - _functions = {}, - _contracts = vim.deepcopy(default_contracts) - }, FunctionTree) - - local parser = ts.get_parser(buffer, 'c', {}) - local root = parser:parse()[1]:root() - - for _,match in query:iter_matches(root, buffer) do - -- Massage the match a little - - local new_match = lookup(query, match) - local fname = tsq.get_node_text(new_match.fname, buffer) - if not self._functions[fname] then - self._functions[fname] = { body = new_match.body, done = false } - end - for _,id in pairs { "up", "before", "after" } do - local node = new_match[id .. "_comment"] - if node then - local text = tsq.get_node_text(node, buffer) - self._functions[fname][id] = Stack.new(text) - end - end - end - return self -end - - -M.FunctionTree = FunctionTree - -return M diff --git a/lua/mappings.lua b/lua/mappings.lua @@ -1,16 +1,57 @@ --- Completion and so on local M = {} -require "completree-config" -local complementree = require 'complementree' +local comp = require "complementree" +local s = require "complementree.sources" +local cdef = require 'complementree.defaults' +local cc = require "complementree.combinators" +local ccomp = require 'complementree.comparators' + +local fuzzy_lsp = cc.pipeline(s.lsp_matches {}, ccomp.fzy) + +local lsp_completion = { + default = fuzzy_lsp, + string = cdef.ins_completion "C-F", + comment = cdef.dummy, + -- comment = cdef.snippy, +} + +comp.setup { + default = cdef.ins_completion "C-N", + vim = cdef.ins_completion "C-V", + dockerfile = cdef.ins_completion "C-F", + query = cdef.ins_completion 'C-O', + org = cdef.ins_completion 'C-O', + c = lsp_completion, + cpp = lsp_completion, + lua = { + default = fuzzy_lsp, + string = cdef.ins_completion "C-F", + }, + rust = lsp_completion, + ocaml = lsp_completion, + python = lsp_completion, + ql = lsp_completion, + cmake = lsp_completion, + nix = { default = fuzzy_lsp, path_expression = cdef.ins_completion "C-F", path_fragment = cdef.ins_completion "C-F" }, + tex = lsp_completion, + haskell = lsp_completion, + go = lsp_completion, + javascript = lsp_completion, + typescript = lsp_completion, + zig = lsp_completion, + xml = lsp_completion, + html = lsp_completion, + + lean = lsp_completion, + + -- For git commit and text only do luasnip + markdown = cdef.ins_completion("C-F") +} + local mpairs = require 'mini.pairs' --- local snippy = require 'snippy' --- local luasnip = require 'luasnip' local rt = function(codes) return vim.api.nvim_replace_termcodes(codes, true, true, true) end -local call = vim.api.nvim_call_function - local function feed(codes) local keys = rt(codes) vim.api.nvim_feedkeys(keys, 'n', true) @@ -18,7 +59,7 @@ end local function sjump() vim.schedule(function() - if vim.snippet.jumpable(1) and vim.snippet.active() then + if vim.snippet.active { direction = 1 } then vim.snippet.jump(1) end -- if luasnip.jumpable(1) and luasnip.in_snippet() then @@ -34,7 +75,7 @@ local function tab() return feed '<Tab>' end - if not complementree.complete() then + if not comp.complete() then -- Maybe we did not complete, and I actually wanted to jump sjump() end @@ -55,23 +96,18 @@ local function bs() vim.api.nvim_feedkeys(mpairs.bs(), 'n', true) vim.schedule(function() if pumvisible == 1 then - complementree.complete(true) + comp.complete(true) end end) end function M.set_mappings() vim.keymap.set('i', '<CR>', cr, { noremap = true }) - vim.keymap.set({ 'i', 's' }, '<Tab>', tab) - vim.keymap.set({ 'i', 's' }, '<BS>', bs) - vim.keymap.set({ 'i', 's' }, '<C-l>', function() vim.snippet.jump(1) end) -end ---- Tiny mapping to select the node at cursor and input it -do + --- Tiny mapping to select the node at cursor and input it vim.keymap.set('c', '<C-R><C-N>', function() local node = vim.treesitter.get_node() if not node then return end @@ -83,6 +119,25 @@ do until not node vim.api.nvim_input(types[1]) end) + + vim.keymap.set('n', '<Leader>q', function() vim.diagnostic.setqflist{severity = vim.diagnostic.severity.ERROR} end) + vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { remap = false, silent = true }) + vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { remap = false, silent = true }) + + require'azy'.setup { + -- preview = true, + debug = true, + } + local ab = require'azy.builtins' + + vim.keymap.set("n", "<Leader>e", ab.files(), {}) + vim.keymap.set("n", "<Leader>r", ab.files_contents(), {}) + vim.keymap.set('n', '<Leader>oc', ab.files { vim.fn.stdpath'config' }, {}) + vim.keymap.set('n', '<Leader>h', ab.help(), {}) + vim.keymap.set('n', '<Leader>b', ab.buffers(), {}) + vim.keymap.set('n', '<Leader>q', ab.quickfix(), {}) + + vim.ui.select = ab.select end return M diff --git a/lua/mini-config.lua b/lua/mini-config.lua @@ -0,0 +1,40 @@ +require 'mini.comment'.setup() +require 'mini.pairs'.setup { + modes = { insert = true } +} +require 'mini.colors'.setup() +require 'mini.surround'.setup { + mappings = { + add = 'sa', + delete = 'sd', + find = 'sf', + find_left = 'sF', + highlight = 'sh', + replace = 'sr', + update_n_lines = '', + }, +} + +local hipatterns = require('mini.hipatterns') +hipatterns.setup({ + highlighters = { + -- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE' + fixme = { pattern = '%f[%w]()FIXME()%f[%W]', group = 'MiniHipatternsFixme' }, + hack = { pattern = '%f[%w]()HACK()%f[%W]', group = 'MiniHipatternsHack' }, + todo = { pattern = '%f[%w]()TODO()%f[%W]', group = 'MiniHipatternsTodo' }, + note = { pattern = '%f[%w]()NOTE()%f[%W]', group = 'MiniHipatternsNote' }, + + -- Highlight hex color strings (`#rrggbb`) using that color + hex_color = hipatterns.gen_highlighter.hex_color(), + }, +}) + +require('mini.ai').setup {} + +require 'mini.notify'.setup { + window = { + config = { + border = "none" + } + } +} diff --git a/lua/my-lspconfig.lua b/lua/my-lspconfig.lua @@ -0,0 +1,144 @@ +require "mason".setup() +require "mason-lspconfig".setup { + ensure_installed = { "lua_ls" }, + automatic_installation = true +} + +local lspconfig = require "lspconfig" + +local function on_attach(client, bufnr) + local function set_keymap(lhs, func, desc) + -- vim.api.nvim_echo({ {"Setup "}, {lhs} }, true, {}) + vim.keymap.set("n", lhs, "", { + remap = false, + silent = true, + buffer = bufnr, + callback = func, + desc = desc + }) + end + + local function set_autocmd(event, func) + vim.api.nvim_create_autocmd(event, { + buffer = bufnr, + callback = function() pcall(func) end, + }) + end + + -- Mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + if client.server_capabilities and client.server_capabilities.hoverProvider then + set_keymap('K', vim.lsp.buf.hover, "Hover / print docs") + end + set_keymap('<Leader>d', vim.lsp.buf.definition, "Go to definition") + set_keymap('<Leader>gd', vim.lsp.buf.declaration, "Go to declaration") + set_keymap('<Leader>td', vim.lsp.buf.type_definition, "Go to type definition") + set_keymap('gr', vim.lsp.buf.rename, "Rename symbol at point") + set_keymap('<Leader>a', vim.lsp.buf.code_action, "Code action at point") + set_keymap('<Leader>=', vim.lsp.buf.format, "Format the whole buffer") + set_keymap('gR', require "azy.builtins".lsp.references(), "Search for references") + set_keymap('<Leader>s', require "azy.builtins".lsp.workspace_symbols(), "Search workspace symbols") + + vim.opt_local.tagfunc = "v:lua.vim.lsp.tagfunc" + + set_keymap('<Leader>e', require "azy.builtins".files(vim.tbl_filter(function(p) + return #p > 0 and p ~= vim.fn.expand("$HOME") + end, vim.lsp.buf.list_workspace_folders()))) + + if client.supports_method('textDocument/documentHighlight') then + set_autocmd("CursorHold", vim.lsp.buf.document_highlight) + set_autocmd("CursorMoved", vim.lsp.buf.clear_references) + end + + -- if client.supports_method('textDocument/codeLens') then + -- set_autocmd({ "BufEnter", "CursorHoldI", "InsertLeave" }, vim.lsp.codelens.refresh) + -- set_keymap('<Leader>lr', vim.lsp.codelens.run, "Run codelens") + -- end + + -- if client.supports_method 'textDocument/inlayHint' then + -- vim.lsp.inlay_hint(bufnr, true) + -- end +end + +vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local bufnr = args.buf + local client = vim.lsp.get_client_by_id(args.data.client_id) + on_attach(client, bufnr) + end, +}) + +-- SERVERS + +lspconfig.lua_ls.setup { + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT', + -- Setup your lua path + path = vim.split(package.path, ';'), + }, + hint = { + enable = true + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { 'vim' }, + + workspaceDelay = -1, + + groupFileStatus = { + strict = "Opened", + strong = "Opened", + }, + + groupSeverity = { + strong = "Warning", + strict = "Warning", + }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file('', true), + checkThirdParty = false, + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + completion = { + callSnippet = "Replace", + } + }, + }, +} + +lspconfig.texlab.setup { + settings = { + texlab = { + build = { + onSave = true, + forwardSearchAfter = true, + args = { "-interaction=nonstopmode", "-f", "-synctex=1", "-shell-escape", "-xelatex", "%f" } + }, + forwardSearch = { + executable = "zathura", + args = { "-x", + -- First level of escaping is for string.format, second level for escaping is for texlab + string.format("nvim --server %s --remote-send '<cmd>edit +%%%%{line} %%%%{input}<cr>'", + vim.fn.serverlist()[1]), + "--synctex-forward", "%l:1:%f", "%p" } + }, + } + }, +} + +require'lean'.setup { + mappings = true, + lsp = { + init_options = { + editDelay = 1000, + } + } +} diff --git a/lua/neogit-config.lua b/lua/neogit-config.lua @@ -34,10 +34,12 @@ os: error("Could not open config file") end local function open_lz() - vim.cmd.terminal { "lazygit", "--use-config-file", lg_config_path } + vim.cmd.tabnew() vim.opt_local.number = false vim.opt_local.relativenumber = false + vim.cmd.terminal { "lazygit", "--use-config-file", lg_config_path } + vim.api.nvim_create_autocmd("TermClose", { buffer = vim.api.nvim_get_current_buf(), callback = function(opts) diff --git a/lua/nluarocks.lua b/lua/nluarocks.lua @@ -1,7 +0,0 @@ -local lrpath = vim.fn.systemlist { "luarocks", "path", "--lr-path" }[1] -local lrcpath = vim.fn.systemlist { "luarocks", "path", "--lr-cpath" }[1] - -package.path = package.path .. ";" .. lrpath -package.cpath = package.cpath .. ";" .. lrcpath - -require 'luarocks.loader' diff --git a/lua/oakgen.lua b/lua/oakgen.lua @@ -1,159 +0,0 @@ -local self = MiniColors.as_colorscheme { name = "oak" } - -local base = MiniColors.convert('#E27950', 'oklch') - -local function colorn(t, clip) - return MiniColors.convert({ - l = t.l or 68, - h = t.h or t.n * (360 / 7) + base.h, - c = t.c or base.c - }, 'hex', { gamut_clip = clip or 'chroma' }) -end - -local new_bg = colorn { n = 0, l = 3.5 } -local new_fg = colorn { n = 0, l = 95 } - -local palette = { - bg = new_bg, - dark = colorn { n = 0, l = 20, c = 5 }, - light = colorn { n = 0, l = 45, c = 5 }, - fg = new_fg, - green = colorn { n = 2 }, - blue = colorn { n = 4 }, - orange = colorn { n = 0 }, - yellow = colorn { n = 1, l = 80 }, - red = colorn { h = 21, c = 23, l = 60 }, - kwcold = colorn { n = 5, c = 11 }, - funchot = colorn { n = 0 }, - string = colorn { n = 3 }, - type = colorn { n = 2 }, -} -self.groups.Normal = { fg = palette.fg, bg = palette.bg } -self.groups.Identifier = { link = 'Normal' } -self.groups.Italic = { italic = true } -self.groups.Bold = { bold = true } - --- Tab line -self.groups.TabLineSel = { bold = true } -self.groups.TabLine = { bg = light } -self.groups.TabLineFill = { link = 'TabLine' } - -self.groups.Search = { bg = palette.orange, fg = palette.bg } - -self.groups.MatchParen = { bg = palette.dark } -self.groups.Visual = { bg = palette.dark } -self.groups.LineNr = { fg = palette.light } -self.groups.CursorLineNr = { bg = palette.dark } -self.groups.StatusLine = { bg = palette.dark, bold = true, fg = palette.fg } -self.groups.StatusLineNC = { bg = palette.dark, fg = palette.fg } -self.groups.WinSeparator = { fg = palette.dark } -self.groups.Pmenu = { bg = palette.dark } -self.groups.PmenuSel = { bg = palette.light } -self.groups.ColorColumn = { bg = palette.bg } -self.groups.CursorColumn = { bg = palette.dark } -self.groups.CursorLine = { bg = palette.dark } - -self.groups.Folded = { bg = palette.dark } - -self.groups.NonText = { fg = palette.dark } - -self.groups.Comment = { fg = palette.light, italic = true } -self.groups.Special = { fg = palette.fg } -self.groups["@namespace"] = { fg = palette.type } - -self.groups.Keyword = { fg = palette.kwcold } -self.groups.Statement = { link = 'Keyword' } -self.groups.Conditional = { link = 'Keyword' } -self.groups.Operator = { link = 'Keyword' } -self.groups.PreProc = { link = 'Keyword' } -self.groups.Macro = { link = 'Keyword' } - -self.groups.Function = { fg = palette.funchot } - -self.groups.String = { fg = palette.string } - -self.groups.Number = { fg = palette.yellow } -self.groups.Boolean = { fg = palette.yellow, bold = true } -self.groups.Constant = { fg = palette.yellow, italic = true } - -self.groups.Type = { fg = palette.type, italic = true } -self.groups.Char = { fg = palette.type } -self.groups.SpecialChar = { fg = palette.type } -self.groups.DiffAdd = { fg = palette.green } -self.groups.DiffChange = { fg = palette.yellow } -self.groups.DiffDelete = { fg = palette.red } - -self.groups.NormalFloat = { link = 'Normal' } -self.groups.SignColumn = { link = 'Normal' } --- self.groups.NormalFloat = { bg = colorn { n = 4 } } - -local function diag(name, color) - self.groups['Diagnostic' .. name] = { fg = color } - self.groups['DiagnosticUnderline' .. name] = { sp = color, underline = true } -end - -diag('Warn', palette.yellow) -diag('Hint', palette.fg) -diag('Info', palette.blue) -self.groups.Error = { fg = palette.red } -diag('Error', palette.red) -self.groups.ErrorMsg = { link = 'Error' } -self.groups.DiagnosticUnnecessary = { sp = palette.fg, underline = true } - -self.groups.Title = { fg = palette.orange } -self.groups.Underlined = { fg = palette.fg, underline = true } -self.groups.Todo = { link = 'Normal' } - --- Spell groups -self.groups.SpellBad = { sp = palette.red, undercurl = true } -self.groups.SpellLocal = { link = 'SpellBad' } -self.groups.SpellCap = { sp = palette.blue, undercurl = true } -self.groups.SpellRare = { sp = palette.orange, undercurl = true } - --- Tree sitter groups -self.groups['@parameter'] = { fg = palette.fg, italic = true } -self.groups['@text.reference'] = { fg = palette.yellow } -self.groups['@text.environment'] = { link = 'Keyword' } -self.groups['@text.environment.name'] = { fg = palette.light } -self.groups['@text.emphasis'] = { italic = true } -self.groups['@text.strong'] = { bold = true } -self.groups['@punctuation.special'] = { fg = palette.light } -self.groups['@attribute'] = { link = 'Keyword' } -self.groups['@function.builtin'] = { fg = palette.light } -self.groups['@constant.builtin'] = { fg = palette.light, bold = true } - -self.groups['@lsp.type.keyword'] = { link = '@keyword' } -self.groups['@lsp.type.property'] = { link = '@property'} - --- LSP groups -self.groups.LspReferenceText = { sp = palette.orange, underline = true } -self.groups.LspReferenceRead = { sp = palette.orange, underline = true } -self.groups.LspReferenceWrite = { sp = palette.orange, underline = true } -self.groups.LspInlayHint = { link = 'Comment' } - ---- Plugins - --- Neogit -self.groups.NeogitDiffAddHighlight = { link = 'DiffAdd' } -self.groups.NeogitDiffDeleteHighlight = { link = 'DiffDelete' } - --- self = self:resolve_links() -self = self:compress() --- vim.print(palette) -self = self:add_cterm_attributes() -self = self:add_terminal_colors(false) - -local function set_term_color(nr, color) - self.terminal[nr] = color - self.terminal[nr + 8] = color -end -set_term_color(1, palette.red) -set_term_color(2, palette.green) -set_term_color(3, palette.yellow) -set_term_color(4, palette.blue) -set_term_color(5, palette.kwcold) -self:write { name = 'oakv2' } - --- vim.print(palette) -self:apply() -vim.print(self) diff --git a/lua/obsidian-config.lua b/lua/obsidian-config.lua @@ -1,6 +0,0 @@ -require 'obsidian'.setup { - dir = "~/obsvault", - completion = { - nvim_cmp = false, -- if using nvim-cmp, otherwise set to false - } -} diff --git a/lua/plugins.lua b/lua/plugins.lua @@ -1,134 +0,0 @@ --- vim: et - --- Clone 'mini.nvim' manually in a way that it gets managed by 'mini.deps' -local path_package = vim.fn.stdpath('data') .. '/site/' -local mini_path = path_package .. 'pack/deps/start/mini.nvim' -if not vim.loop.fs_stat(mini_path) then - vim.cmd('echo "Installing `mini.nvim`" | redraw') - local clone_cmd = { - 'git', 'clone', '--filter=blob:none', - 'https://github.com/echasnovski/mini.nvim', mini_path - } - vim.fn.system(clone_cmd) - vim.cmd('packadd mini.nvim | helptags ALL') - vim.cmd('echo "Installed `mini.nvim`" | redraw') -end - --- Set up 'mini.deps' (customize to your liking) -require('mini.deps').setup { - path = { package = path_package }, - job = { - n_threads = 4, - } -} - -local add = MiniDeps.add - -require 'mini.comment'.setup() -require 'mini.pairs'.setup { - modes = { insert = true } -} -require 'mini.colors'.setup() -require 'mini.surround'.setup { - mappings = { - add = 'sa', - delete = 'sd', - find = 'sf', - find_left = 'sF', - highlight = 'sh', - replace = 'sr', - update_n_lines = '', - }, -} - -local hipatterns = require('mini.hipatterns') -hipatterns.setup({ - highlighters = { - -- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE' - fixme = { pattern = '%f[%w]()FIXME()%f[%W]', group = 'MiniHipatternsFixme' }, - hack = { pattern = '%f[%w]()HACK()%f[%W]', group = 'MiniHipatternsHack' }, - todo = { pattern = '%f[%w]()TODO()%f[%W]', group = 'MiniHipatternsTodo' }, - note = { pattern = '%f[%w]()NOTE()%f[%W]', group = 'MiniHipatternsNote' }, - - -- Highlight hex color strings (`#rrggbb`) using that color - hex_color = hipatterns.gen_highlighter.hex_color(), - }, -}) - -require('mini.ai').setup {} - -add 'maxmx03/dracula.nvim' -vim.cmd.colorscheme "dracula" - -add { - source = "nvim-treesitter/nvim-treesitter", - hooks = { - post_checkout = function() - vim.cmd "TSUpdate" - end - } -} - -require 'nvim-treesitter.configs'.setup { - highlight = { - enable = true, - disable = {}, - }, - ensure_installed = { 'c', 'lua', 'query', 'fennel', 'python', 'vim', 'bash', 'latex' } -} - --- LSP stuff -add "williamboman/mason.nvim" -require "mason".setup {} - -add "vigoux/ltex-ls.nvim" - --- My stuff -add { source = "ssh://git@git.sr.ht/~vigoux/complementree.nvim" } -add { source = "ssh://git@git.sr.ht/~vigoux/architext.nvim" } - -local function run_cmd(cmd) - return function(data) - local finished = false - vim.system(cmd, { - cwd = data.path - }, function() - finished = true - end) - vim.wait(10000, function() - return finished - end) - end -end - -local azy_build_lib = run_cmd { "make", "lib" } - -add { - source = 'ssh://git@git.sr.ht/~vigoux/azy.nvim', - hooks = { - post_checkout = azy_build_lib, - post_install = azy_build_lib, - } -} -require 'azy_config' - -add 'vigoux/notifier.nvim' -require 'notifier'.setup { - component_name_recall = true, -} - -add 'mfussenegger/nvim-qwahl' -add 'lewis6991/gitsigns.nvim' - -add 'nvim-orgmode/orgmode' -require('orgmode').setup { - org_agenda_files = '~/orgfiles/**/*', - org_default_notes_file = '~/orgfiles/refile.org', - org_todo_keywords = { 'TODO', 'DOING', '|', 'DONE' }, - mappings = { - global = { - org_agenda = "gA", - org_capture = "gC" - } - } -} diff --git a/lua/rocks-bootstrap.lua b/lua/rocks-bootstrap.lua @@ -0,0 +1,51 @@ +do + -- Specifies where to install/use rocks.nvim + local install_location = vim.fs.joinpath(vim.fn.stdpath("data"), "rocks") + + -- Set up configuration options related to rocks.nvim (recommended to leave as default) + local rocks_config = { + rocks_path = vim.fs.normalize(install_location), + } + + vim.g.rocks_nvim = rocks_config + + -- Configure the package path (so that plugin code can be found) + local luarocks_path = { + vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?.lua"), + vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?", "init.lua"), + } + package.path = package.path .. ";" .. table.concat(luarocks_path, ";") + + -- Configure the C path (so that e.g. tree-sitter parsers can be found) + local luarocks_cpath = { + vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.so"), + vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.so"), + } + package.cpath = package.cpath .. ";" .. table.concat(luarocks_cpath, ";") + + -- Load all installed plugins, including rocks.nvim itself + vim.opt.runtimepath:append(vim.fs.joinpath(rocks_config.rocks_path, "lib", "luarocks", "rocks-5.1", "rocks.nvim", "*")) +end + +-- If rocks.nvim is not installed then install it! +if not pcall(require, "rocks") then + local rocks_location = vim.fs.joinpath(vim.fn.stdpath("cache"), "rocks.nvim") + + if not vim.uv.fs_stat(rocks_location) then + -- Pull down rocks.nvim + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/nvim-neorocks/rocks.nvim", + rocks_location, + }) + end + + -- If the clone was successful then source the bootstrapping script + assert(vim.v.shell_error == 0, "rocks.nvim installation failed. Try exiting and re-entering Neovim!") + + vim.cmd.source(vim.fs.joinpath(rocks_location, "bootstrap.lua")) + + vim.fn.delete(rocks_location, "rf") +end diff --git a/lua/shadautls.lua b/lua/shadautls.lua @@ -1,66 +0,0 @@ -local M = {} - -local function iter_packed(str) - local unpacker = vim.mpack.Unpacker() - local current = 1 - return function() - if current > #str then - return - end - - local res, newoff = unpacker(str, current) - current = newoff - return res - end -end - -local function get_path() - return vim.fn.stdpath "state" .. "/shada/main.shada" -end - -local function shada_iterator() - local path = get_path() - local content = io.open(path):read "*a" - local mpack_iter = iter_packed(content) - return function() - -- see |shada-format| to get the actual format of this - local type = mpack_iter() - local timestamp = mpack_iter() - -- Drop the length of the entry - mpack_iter() - local data = mpack_iter() - - if type and timestamp and data then - return type, timestamp, data - else - return nil, nil, nil - end - end -end - -function M.read() - local path = get_path() - local content = io.open(path):read "*a" - local acc = {} - for thing in iter_packed(content) do - acc[#acc + 1] = thing - end - return acc -end - -function M.mark_for_path(path, mname) - local timenow = vim.fn.localtime() - mname = vim.fn.char2nr(mname or '"') - - for type, timestamp, data in shada_iterator() do - if type == 10 and data.f == path and (data.n or 34) == mname then - return { - time = timenow - timestamp, - line = data.l, - col = data.c - } - end - end -end - -return M diff --git a/lua/tltypes.lua b/lua/tltypes.lua @@ -1,72 +0,0 @@ -local M = {} -local a = vim.api - -local types - -local function get_type(id) - local tmp = types.types[tostring(id)] - - local meta = { - __index = function(tbl, index) - if index == 'file' or index == 'fields' or index == 'str' or index == 'ref' then - return rawget(tbl, index) - end - - if index == 'y' or index == 'x' then - return tonumber(rawget(tbl, index)) - end - - if rawget(tbl, 'fields') then - return get_type(tbl.fields[index]) - end - - return nil - end - } - - if not tmp then - error(string.format("Invalid type identifier: %s", tostring(id))) - end - - if tmp.ref then - return get_type(tmp.ref) - else - return setmetatable(tmp, meta) - end -end - -local function put_lines(lines) - a.nvim_buf_set_lines(0, -2, -1, false, vim.split(lines, '\n', { plain = true })) -end - -local function input_cb(text) - if tostring(tonumber(text)) == text then - put_lines(vim.inspect(get_type(text))) - elseif text:sub(1, 1) == '*' then - put_lines(vim.inspect(types.types[text:sub(2)])) - else - put_lines(text) - end - a.nvim_buf_set_option(0, 'modified', false) -end - -function M.repl(paths) - types = vim.json.decode(vim.fn.system { "tl", "types", unpack(vim.fn.glob(paths, false, true)) }) - vim.cmd[[split]] - local win = a.nvim_get_current_win() - - local repl_buf = a.nvim_create_buf(false, true) - - vim.fn.prompt_setcallback(repl_buf, input_cb) - - vim.fn.prompt_setprompt(repl_buf, "tltype> ") - - a.nvim_buf_set_option(repl_buf, 'buftype', 'prompt') - a.nvim_buf_set_option(repl_buf, 'bufhidden', 'wipe') - a.nvim_buf_set_name(repl_buf, [[Architext REPL]]) - a.nvim_win_set_buf(win, repl_buf) - - vim.cmd.startinsert() -end - -return M diff --git a/lua/ts_config.lua b/lua/ts_config.lua diff --git a/lua/zest.lua b/lua/zest.lua @@ -1,45 +0,0 @@ -local api = vim.api -local fn = vim.fn - -local azyui = require 'azy.ui' -local asinks = require 'azy.sinks' - -local M = {} - -local ZPATH = vim.fn.expand "$HOME" .. "/obsvault/" - -local function zpath(...) - return ZPATH .. "/" .. table.concat({ ... }, "/") -end - -local function list_files() - local ret = {} - - for index, path in ipairs(vim.fs.find(function(path) return vim.endswith(path, ".md") end, { path = ZPATH, limit = math.huge })) do - ret[index] = { - search_text = fn.fnamemodify(path, ":t:r"), - extra = path, - } - end - - return ret -end - -function M.find_file(name) - for _, file in ipairs(list_files()) do - vim.pretty_print(file) - if file.search_text == name then - return file - end - end -end - -local function zest_sink(element, modifiers) - asinks.open_file({ search_text = element.extra }, modifiers) -end - -function M.open() - azyui.create(list_files(), zest_sink) -end - -return M diff --git a/plugin/change_date.vim b/plugin/change_date.vim diff --git a/plugin/floatting_win.vim b/plugin/floatting_win.vim @@ -1,20 +0,0 @@ -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/matchparrents.lua b/plugin/matchparrents.lua @@ -1,50 +0,0 @@ -local PAREN_CHARS = { - ['('] = true, - [')'] = false, - ['{'] = true, - ['}'] = false, - ['['] = true, - [']'] = false, -} - --- local ns = vim.api.nvim_create_namespace('ts_matchpaten') --- vim.api.nvim_create_autocmd('CursorMoved', { --- callback = function() --- vim.api.nvim_buf_clear_namespace(0, ns, 0, -1) --- local cursor = vim.api.nvim_win_get_cursor(0) --- local row, col = cursor[1] - 1, cursor[2] --- local cursor_char = vim.api.nvim_buf_get_text(0, row, col, row, col + 1, {})[1] --- --- local match = PAREN_CHARS[cursor_char] --- if match == nil then --- return --- end --- --- local ok, res = pcall(vim.treesitter.get_node) --- if not ok then return end --- --- local node = {res:range()} --- local row2, col2 --- @type integer, integer --- if match then --- row2, col2 = node[3], node[4] -1 --- else --- row2, col2 = node[1], node[2] --- end --- --- local cursor_char2 = vim.api.nvim_buf_get_text(0, row2, col2, row2, col2 + 1, {})[1] --- --- vim.api.nvim_buf_set_extmark(0, ns, row, col, { --- end_row = row, --- end_col = col+1, --- end_right_gravity = false, --- hl_group = 'MatchParen' --- }) --- --- vim.api.nvim_buf_set_extmark(0, ns, row2, col2, { --- end_row = row2, --- end_col = col2+1, --- end_right_gravity = false, --- hl_group = 'MatchParen' --- }) --- end --- }) diff --git a/plugin/show_languagetree.lua b/plugin/show_languagetree.lua @@ -1,21 +0,0 @@ -local M = {} -local ts = vim.treesitter - -function ShowLangTree(langtree, indent) - langtree = langtree or ts.get_parser() - indent = indent or '' - - print(indent .. langtree:lang()) - for _, region in pairs(langtree:included_regions()) do - if type(region[1]) == 'table' then - print(indent .. ' ' .. vim.inspect(region)) - else - print(indent .. ' ' .. vim.inspect{region[1]:range()}) - end - end - for lang,child in pairs(langtree._children) do - ShowLangTree(child, indent .. ' ') - end -end - -return M diff --git a/plugin/swapword.vim b/plugin/swapword.vim @@ -1,25 +0,0 @@ -" 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 @@ -1,26 +0,0 @@ -" 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/queries/c/highlights.scm b/queries/c/highlights.scm @@ -1,4 +0,0 @@ -;; extends - -(preproc_if condition: (_) @_const (_) @comment - (#eq? @_const "0")) diff --git a/queries/latex/highlights.scm b/queries/latex/highlights.scm @@ -1,28 +0,0 @@ -;; extends - -;; Some commands should not be spellchecked -[ - (command_name) - (begin) - (end) - (citation) - (color_reference) - (package_include) - (new_command_definition) - (environment_definition) - (label_reference) - (label_definition) - ] @nospell - -;; Exclude some enviroments from spell-checking -( - (generic_environment (begin name: (curly_group_text text: (_) @_txt))) @nospell - (#eq? @_txt "tikzpicture") - ) - -( - (generic_command command: (_) @_name) @nospell - (#contains? @_name "cite") - ) - -(key_value_pair key: (_) @nospell) diff --git a/queries/lua/highlights.scm b/queries/lua/highlights.scm @@ -1,5 +0,0 @@ -;; extends - -((function_call . (identifier) @_exec - (arguments . (_) @none)) - (#eq? @_exec "exec_lua")) diff --git a/queries/lua/injections.scm b/queries/lua/injections.scm @@ -1,4 +0,0 @@ -;; extends - -((function_call . (identifier) @_exec (arguments (string) @lua)) - (#eq? @_exec "exec_lua")) diff --git a/rocks.toml b/rocks.toml @@ -0,0 +1,34 @@ +# This is your rocks.nvim plugins declaration file. +# Here is a small yet pretty detailed example on how to use it: +# +# [plugins] +# nvim-treesitter = "semver_version" # e.g. "1.0.0" + +# List of non-Neovim rocks. +# This includes things like `toml` or other lua packages. +[rocks] + +# List of Neovim plugins to install alongside their versions. +# If the plugin name contains a dot then you must add quotes to the key name! +[plugins] +"rocks.nvim" = "2.37.0" +"dracula.nvim" = "scm" +"azy.nvim" = "scm" +"mason-lspconfig.nvim" = "1.30.0" +"complementree.nvim" = "scm" +nvim-treesitter = "scm" +"mini.nvim" = "scm" +nvim-lspconfig = "0.1.8" +"architext.nvim" = "scm" +"rocks-treesitter.nvim" = "1.0.3" +tree-sitter-latex = "0.0.3" +"plenary.nvim" = "scm" +"rocks-git.nvim" = "2.0.1" + +[plugins."lean.nvim"] +git = "julian/lean.nvim" +rev = "v1.0.0^{}" + +[plugins."gitsigns.nvim"] +git = "lewis6991/gitsigns.nvim" +rev = "v0.9.0" diff --git a/syntax/bip.vim b/syntax/bip.vim @@ -1,166 +0,0 @@ -" 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 @@ -1,8 +0,0 @@ -" 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 @@ -1,80 +0,0 @@ -" 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 @@ -1,83 +0,0 @@ -" 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/syntax/seq.vim b/syntax/seq.vim @@ -1,13 +0,0 @@ -" Last Change: 2023 Mar 16 -syntax region Comment start=/\/\/ / end=/$/ -syntax match Keyword /&/ -syntax match Keyword /|/ -syntax match Keyword /,/ -syntax match Keyword /-/ - -syntax match Type /:-/ - -syntax match Delimiter /\.\./ -syntax match Delimiter /\./ -syntax match Constant /T/ -syntax match Constant /F/ diff --git a/templates/template.h b/templates/template.h @@ -1,6 +0,0 @@ -#ifndef %{'__' . substitute(toupper(expand('%:t')), '\(\.\|-\)', '_', 0) . '__'} -#define %{0} - -%{CURSOR} - -#endif /* %{0} */ diff --git a/templates/template.lua b/templates/template.lua @@ -1,5 +0,0 @@ -local M = {} - -%{CURSOR} - -return M diff --git a/templates/template.sh b/templates/template.sh @@ -1 +0,0 @@ -#!/bin/sh diff --git a/templates/template.shell.nix b/templates/template.shell.nix @@ -1,10 +0,0 @@ -{ pkgs ? import <nixpkgs> {} }: -pkgs.mkShell { - name = "shell"; - buildInputs = [ - %{CURSOR} - ]; - shellHook = '' - echo "Entered" - ''; -} diff --git a/templates/template.vim b/templates/template.vim @@ -1 +0,0 @@ -" Last Change: