commit eb457f4edf4a2248cd71d22bd642d6bd689e2845
parent 32228f9640d6d43f32be6017a294ecdcf2fd23e5
Author: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
Date: Fri, 1 Mar 2024 10:04:37 +0100
Update number n
Diffstat:
14 files changed, 377 insertions(+), 338 deletions(-)
diff --git a/after/compiler/mypy.vim b/after/compiler/mypy.vim
@@ -0,0 +1,9 @@
+" 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/ftplugin/css.vim b/after/ftplugin/css.vim
@@ -1,3 +0,0 @@
-" Last Change: 2020 mai 26
-packadd nvim-colorizer.lua
-ColorizerToggle
diff --git a/after/ftplugin/python.vim b/after/ftplugin/python.vim
@@ -1,3 +1,3 @@
if globpath('.', '?akefile*') ==? ''
- compiler pylint
+ compiler mypy
endif
diff --git a/after/ftplugin/tex.lua b/after/ftplugin/tex.lua
@@ -36,14 +36,11 @@ local function with_current_position(func)
end
local function lazy_query(lang, content)
- return setmetatable({
- _lang = lang,
- _content = content,
- }, {
+ return setmetatable({}, {
__index = function(tbl, index)
local query = rawget(tbl, "_query")
if not query then
- query = vim.treesitter.query.parse(rawget(tbl, "_lang"), rawget(tbl, "_content"))
+ query = vim.treesitter.query.parse(lang, content)
rawset(tbl, "_query", query)
end
local qmeta = getmetatable(query)
@@ -114,295 +111,249 @@ do
end), { buffer = true })
end
---- Sets up a set of mappings for ts based text objects
----
---- The matches must have an `outer` capture to denote the 'a' mapping selection, and either `inner`
---- or `inner.left` and `inner.right` captures to denote the 'i' mapping selection.
----@param query Query The query to use
----@param tail string The "tail" of the mapping like '(' in 'a('
-local function query_textobject(query, tail)
- vim.keymap.set({ 'o', 'v' }, 'a' .. tail, with_current_position(function(curbuf, _, cursor)
- local _, node = utls.find_smallest_match(cursor[1] - 1, cursor[2], query, curbuf, 'outer')
- if node then
- utls.select(node)
+local spec_treesitter = require('mini.ai').gen_spec.treesitter
+vim.b.miniai_config = {
+ custom_textobjects = {
+ m = spec_treesitter { a = "@math.outer", i = "@math.inner" },
+ e = spec_treesitter { a = "@env.outer", i = "@env.inner" },
+ s = spec_treesitter { a = "@section.outer", i = "@section.inner" },
+ i = spec_treesitter { a = "@item.outer", i = "@item.inner" }
+ }
+}
+
+vim.b.minioperators_config = {
+ funcwrap = {
+ prefix = "<LocalLeader>f",
+ func = function(content)
+ -- TODO: add support for linewise and blockwise
+ local newlines = content.lines
+ newlines[1] = "\\func{" .. newlines[1]
+ newlines[#newlines] = newlines[#newlines] .. "}"
+ return newlines
end
- end), { buffer = true })
-
- vim.keymap.set({ 'o', 'v' }, 'i' .. tail, with_current_position(function(curbuf, _, cursor)
- local match = utls.find_smallest_match(cursor[1] - 1, cursor[2], query, curbuf, 'outer')
- if not match then return end
-
- local node = utls.index_by_name(query, match, 'inner')
- local end_ = utls.index_by_name(query, match, 'inner.end')
- if node then
- utls.select(node, end_)
- end
- end), { buffer = true })
-end
-
-
---- Math textobjects
-do
- local query = lazy_query("latex", [[
- (displayed_equation . (_) @inner (_)? @inner.end .) @outer
- (inline_formula . (_) @inner (_)? @inner.end .) @outer
-
- (math_environment begin: (_) . (_) @inner (_)? @inner.end . end: (_)) @outer
- ]])
-
- query_textobject(query, 'm')
-end
-
---- Environment textobjects
-do
- local query = lazy_query("latex", [[
- (generic_environment begin: (_) . (_) @inner (_)? @inner.end . end: (_)) @outer
- (math_environment begin: (_) . (_) @inner (_)? @inner.end . end: (_)) @outer
- ]])
-
- query_textobject(query, 'e')
-end
-
---- Sections and subsections
-do
- local query = lazy_query("latex", [[
- ;; No need to match the inner.end differently: the end of the section is its last node
- (section text: _ . (_) @inner) @outer @inner.end
- (subsection text: _ . (_) @inner) @outer @inner.end
- ]])
-
- query_textobject(query, 's')
-end
-
---- Enumerate items
-do
- local query = lazy_query("latex", [[
- (enum_item . (_) @inner) @outer @inner.end
- ]])
-
- query_textobject(query, 'i')
-end
-
-local function buf_line_length(buf, row)
- return vim.api.nvim_buf_get_offset(buf, row + 1) - vim.api.nvim_buf_get_offset(buf, row) - 1
-end
-
---- Utilities to wrap visual text into something
-local function charpos_to_bytepos(buf, row, col)
- local line = vim.api.nvim_buf_get_lines(buf, row, row + 1, true)[1]
- return vim.str_byteindex(line, col)
-end
-
-local function correct_position_wrap(ty, spos, epos, func)
- local curbuf = vim.api.nvim_get_current_buf()
- local start = vim.fn.getcharpos(spos)
- local stop = vim.fn.getcharpos(epos)
-
- if start[2] > stop[2] or (start[2] == stop[2] and start[3] > stop[3]) then
- -- Swap these if the order is wrong
- start, stop = stop, start
- end
-
- local start_line = start[2] - 1
- local start_col = charpos_to_bytepos(curbuf, start_line, start[3] - 1)
-
- local end_line = stop[2] - 1
- local end_col = charpos_to_bytepos(curbuf, end_line, stop[3])
-
- -- Now if we are in line mode, correct the offsets to span the whole lines
- if ty == 'line' then
- start_col = 0
- end_col = buf_line_length(curbuf, end_line)
- end
-
- local text = vim.api.nvim_buf_get_text(curbuf, start_line, start_col, end_line, end_col, {})
- local indent = vim.fn.indent(start[2])
-
- func(ty, curbuf, start_line, start_col, end_line, end_col, text, vim.fn['repeat'](' ', indent))
-end
-
-TexDispatch = function()
-end
-
-local function vis_mapping(map, func)
- -- First handle the visual mapping
- vim.keymap.set('v', map, function()
- -- First determine the current mode
- local vmode = vim.fn.mode()
- local ty
- if vmode == 'v' then
- ty = 'char'
- elseif vmode == 'V' then
- ty = 'line'
- else
- ty = 'block'
- end
-
- correct_position_wrap(ty, 'v', '.', func)
- end, { buffer = true })
-
- -- Then create the operator mapping
- vim.keymap.set('n', map, function()
- -- Ensure that the operator func is this correct one
- local tmpopf = vim.o.operatorfunc
- vim.o.operatorfunc = 'v:lua.TexDispatch'
-
- _G.TexDispatch = function(ty)
- correct_position_wrap(ty, "'[", "']", func)
- vim.o.operatorfunc = tmpopf
- end
-
- return 'g@'
- end, { buffer = true, expr = true })
-
- -- Doubling works on the current line
- vim.keymap.set('n', map .. map, function()
- correct_position_wrap('line', '.', '.', func)
- end)
-end
-
-local function vis_input_change(map, input_name, func)
- vis_mapping(map, function(type, curbuf, start_line, start_col, end_line, end_col, text, indent)
- vim.ui.input({ prompt = input_name }, function(input)
- if not input then return end
-
- -- Func must modify the text array
- func(type, text, input, indent)
- vim.api.nvim_buf_set_text(curbuf, start_line, start_col, end_line, end_col, text)
- end)
- end)
-end
-
-local function preffix_suffix_change(func)
- return function(type, text, input, indent)
- local preffix, suffix = func(input)
-
- if type == 'char' then
- -- Add an articial spaces when necessary
- if preffix:match "%S$" and preffix:sub(#preffix) ~= '{' then
- preffix = preffix .. ' '
- end
-
- if suffix:match "^%S" and suffix:sub(1, 1) ~= '}' then
- suffix = ' ' .. suffix
- end
-
- text[1] = preffix .. text[1]
- text[#text] = text[#text] .. suffix
- elseif type == 'line' then
- table.insert(text, 1, indent .. preffix)
- text[#text + 1] = indent .. suffix
- elseif type == 'block' then
- error "Block type not supported"
- end
- end
-end
-
--- Wrap the selection in a call
-vis_input_change('<LocalLeader>f', 'Function name: ', preffix_suffix_change(function(input)
- return string.format('\\%s{', input), '}'
-end))
-
--- Wrap the selection in an inline environment
-vis_input_change('<LocalLeader>ie', 'Inline env name: ', preffix_suffix_change(function(input)
- return '{\\' .. input, '}'
-end))
-
--- Wrap the selection in a color block
-vis_input_change('<LocalLeader>c', 'Color name: ', preffix_suffix_change(function(input)
- return string.format('{\\color{%s}', input), '}'
-end))
-
--- Wrap into an environment
-vis_input_change('<LocalLeader>e', 'Environment name: ', preffix_suffix_change(function(input)
- return string.format('\\begin{%s}', input), string.format('\\end{%s}', input)
-end))
-
-local function toggle_thing(query, left, right)
- return function(buf, win, cursor)
- local match, node = utls.find_smallest_match(cursor[1] - 1, cursor[2], query, buf)
-
- local innode = utls.index_by_name(query, match or {}, "in")
- if not innode then
- if node then
- local sline, scol, eline, ecol = vim.treesitter.get_node_range(node)
- vim.api.nvim_buf_set_text(buf, sline, scol, eline, ecol, {})
- else
- vim.api.nvim_buf_set_text(buf, cursor[1] - 1, cursor[2], cursor[1] - 1, cursor[2], { left .. right })
- vim.api.nvim_win_set_cursor(win, { cursor[1], cursor[2] + #left })
- end
- else
- local _, _, _, ecol = vim.treesitter.get_node_range(innode)
- if ecol == cursor[2] then
- -- At the end of the node, move out
- vim.api.nvim_win_set_cursor(win, { cursor[1], cursor[2] + #right })
- end
- end
- end
-end
-
-do
- local inline_fml_query = lazy_query("latex", [[
- (inline_formula . (_)? @in) @_root
- ]])
- vim.keymap.set('i', '<C-F>', with_current_position(toggle_thing(inline_fml_query, "\\(", "\\)")))
-
- local italics_query = lazy_query("latex", [[
- ((generic_command
- command: (command_name) @_name
- arg: (curly_group (_)? @in))
- (#match? @_name "^(\\\\textit|\\\\mathit)$")) @_root
- ]])
- vim.keymap.set('i', '<C-T>', with_current_position(toggle_thing(italics_query, "\\textit{", "}")))
-
- local bold_query = lazy_query("latex", [[
- ((generic_command
- command: (command_name) @_name
- arg: (curly_group (_)? @in))
- (#match? @_name "^(\\\\textbf|\\\\mathbf)$")) @_root
- ]])
- vim.keymap.set('i', '<C-B>', with_current_position(toggle_thing(bold_query, "\\textbf{", "}")))
-end
-
--- Delete surrounding environment / function call
-do
- local function_query = lazy_query("latex", [[
- (generic_command
- command: (command_name) @_name
- arg: (curly_group (_) @in)) @_root
- ]])
-
- vim.keymap.set('n', '<LocalLeader>df', with_current_position(function(curbuf, curwin, cursor)
- local match, node = utls.find_smallest_match(cursor[1] - 1, cursor[2], function_query, curbuf)
-
- if not match then
- print("Not in an function")
- return
- end
-
- local start_row, _, end_row, _ = node:range()
-
- local innode = utls.index_by_name(function_query, match, "in")
-
- -- Correct the cursor position (this is at best a guesstimation)
- local cname = utls.index_by_name(function_query, match, "_name")
- local cstartline = cname:start()
- local srow, scol, _, ecol = innode:range()
- if cstartline == cursor[1] - 1 then
- cursor[2] = math.min(math.max(scol, cursor[2]), ecol - 1)
- local offset = #vim.treesitter.get_node_text(cname, curbuf) + 1 -- the bracket
- vim.api.nvim_win_set_cursor(curwin, { cursor[1], cursor[2] - offset })
- elseif srow == cursor[1] - 1 then
- vim.api.nvim_win_set_cursor(curwin, { cursor[1] - 1, math.max(scol, cursor[2]) - scol })
- else
- vim.api.nvim_win_set_cursor(curwin, { cursor[1] - 1, cursor[2] })
- end
-
- local current = vim.treesitter.get_node_text(innode, curbuf)
- edit.edit_match(curbuf, match, function_query, { _root = current }, start_row, end_row)
- end), { buffer = true })
-end
-
---- Tiny mapping to select the node type at cursor and input it
-do
-end
+ }
+}
+--
+-- local function buf_line_length(buf, row)
+-- return vim.api.nvim_buf_get_offset(buf, row + 1) - vim.api.nvim_buf_get_offset(buf, row) - 1
+-- end
+--
+-- --- Utilities to wrap visual text into something
+-- local function charpos_to_bytepos(buf, row, col)
+-- local line = vim.api.nvim_buf_get_lines(buf, row, row + 1, true)[1]
+-- return vim.str_byteindex(line, col)
+-- end
+--
+-- local function correct_position_wrap(ty, spos, epos, func)
+-- local curbuf = vim.api.nvim_get_current_buf()
+-- local start = vim.fn.getcharpos(spos)
+-- local stop = vim.fn.getcharpos(epos)
+--
+-- if start[2] > stop[2] or (start[2] == stop[2] and start[3] > stop[3]) then
+-- -- Swap these if the order is wrong
+-- start, stop = stop, start
+-- end
+--
+-- local start_line = start[2] - 1
+-- local start_col = charpos_to_bytepos(curbuf, start_line, start[3] - 1)
+--
+-- local end_line = stop[2] - 1
+-- local end_col = charpos_to_bytepos(curbuf, end_line, stop[3])
+--
+-- -- Now if we are in line mode, correct the offsets to span the whole lines
+-- if ty == 'line' then
+-- start_col = 0
+-- end_col = buf_line_length(curbuf, end_line)
+-- end
+--
+-- local text = vim.api.nvim_buf_get_text(curbuf, start_line, start_col, end_line, end_col, {})
+-- local indent = vim.fn.indent(start[2])
+--
+-- func(ty, curbuf, start_line, start_col, end_line, end_col, text, vim.fn['repeat'](' ', indent))
+-- end
+--
+-- TexDispatch = function()
+-- end
+--
+-- local function vis_mapping(map, func)
+-- -- First handle the visual mapping
+-- vim.keymap.set('v', map, function()
+-- -- First determine the current mode
+-- local vmode = vim.fn.mode()
+-- local ty
+-- if vmode == 'v' then
+-- ty = 'char'
+-- elseif vmode == 'V' then
+-- ty = 'line'
+-- else
+-- ty = 'block'
+-- end
+--
+-- correct_position_wrap(ty, 'v', '.', func)
+-- end, { buffer = true })
+--
+-- -- Then create the operator mapping
+-- vim.keymap.set('n', map, function()
+-- -- Ensure that the operator func is this correct one
+-- local tmpopf = vim.o.operatorfunc
+-- vim.o.operatorfunc = 'v:lua.TexDispatch'
+--
+-- _G.TexDispatch = function(ty)
+-- correct_position_wrap(ty, "'[", "']", func)
+-- vim.o.operatorfunc = tmpopf
+-- end
+--
+-- return 'g@'
+-- end, { buffer = true, expr = true })
+--
+-- -- Doubling works on the current line
+-- vim.keymap.set('n', map .. map, function()
+-- correct_position_wrap('line', '.', '.', func)
+-- end)
+-- end
+--
+-- local function vis_input_change(map, input_name, func)
+-- vis_mapping(map, function(type, curbuf, start_line, start_col, end_line, end_col, text, indent)
+-- vim.ui.input({ prompt = input_name }, function(input)
+-- if not input then return end
+--
+-- -- Func must modify the text array
+-- func(type, text, input, indent)
+-- vim.api.nvim_buf_set_text(curbuf, start_line, start_col, end_line, end_col, text)
+-- end)
+-- end)
+-- end
+--
+-- local function preffix_suffix_change(func)
+-- return function(type, text, input, indent)
+-- local preffix, suffix = func(input)
+--
+-- if type == 'char' then
+-- -- Add an articial spaces when necessary
+-- if preffix:match "%S$" and preffix:sub(#preffix) ~= '{' then
+-- preffix = preffix .. ' '
+-- end
+--
+-- if suffix:match "^%S" and suffix:sub(1, 1) ~= '}' then
+-- suffix = ' ' .. suffix
+-- end
+--
+-- text[1] = preffix .. text[1]
+-- text[#text] = text[#text] .. suffix
+-- elseif type == 'line' then
+-- table.insert(text, 1, indent .. preffix)
+-- text[#text + 1] = indent .. suffix
+-- elseif type == 'block' then
+-- error "Block type not supported"
+-- end
+-- end
+-- end
+--
+-- -- Wrap the selection in a call
+-- vis_input_change('<LocalLeader>f', 'Function name: ', preffix_suffix_change(function(input)
+-- return string.format('\\%s{', input), '}'
+-- end))
+--
+-- -- Wrap the selection in an inline environment
+-- vis_input_change('<LocalLeader>ie', 'Inline env name: ', preffix_suffix_change(function(input)
+-- return '{\\' .. input, '}'
+-- end))
+--
+-- -- Wrap the selection in a color block
+-- vis_input_change('<LocalLeader>c', 'Color name: ', preffix_suffix_change(function(input)
+-- return string.format('{\\color{%s}', input), '}'
+-- end))
+--
+-- -- Wrap into an environment
+-- vis_input_change('<LocalLeader>e', 'Environment name: ', preffix_suffix_change(function(input)
+-- return string.format('\\begin{%s}', input), string.format('\\end{%s}', input)
+-- end))
+--
+-- local function toggle_thing(query, left, right)
+-- return function(buf, win, cursor)
+-- local match, node = utls.find_smallest_match(cursor[1] - 1, cursor[2], query, buf)
+--
+-- local innode = utls.index_by_name(query, match or {}, "in")
+-- if not innode then
+-- if node then
+-- local sline, scol, eline, ecol = vim.treesitter.get_node_range(node)
+-- vim.api.nvim_buf_set_text(buf, sline, scol, eline, ecol, {})
+-- else
+-- vim.api.nvim_buf_set_text(buf, cursor[1] - 1, cursor[2], cursor[1] - 1, cursor[2], { left .. right })
+-- vim.api.nvim_win_set_cursor(win, { cursor[1], cursor[2] + #left })
+-- end
+-- else
+-- local _, _, _, ecol = vim.treesitter.get_node_range(innode)
+-- if ecol == cursor[2] then
+-- -- At the end of the node, move out
+-- vim.api.nvim_win_set_cursor(win, { cursor[1], cursor[2] + #right })
+-- end
+-- end
+-- end
+-- end
+--
+-- do
+-- local inline_fml_query = lazy_query("latex", [[
+-- (inline_formula . (_)? @in) @_root
+-- ]])
+-- vim.keymap.set('i', '<C-F>', with_current_position(toggle_thing(inline_fml_query, "\\(", "\\)")))
+--
+-- local italics_query = lazy_query("latex", [[
+-- ((generic_command
+-- command: (command_name) @_name
+-- arg: (curly_group (_)? @in))
+-- (#match? @_name "^(\\\\textit|\\\\mathit)$")) @_root
+-- ]])
+-- vim.keymap.set('i', '<C-T>', with_current_position(toggle_thing(italics_query, "\\textit{", "}")))
+--
+-- local bold_query = lazy_query("latex", [[
+-- ((generic_command
+-- command: (command_name) @_name
+-- arg: (curly_group (_)? @in))
+-- (#match? @_name "^(\\\\textbf|\\\\mathbf)$")) @_root
+-- ]])
+-- vim.keymap.set('i', '<C-B>', with_current_position(toggle_thing(bold_query, "\\textbf{", "}")))
+-- end
+--
+-- -- Delete surrounding environment / function call
+-- do
+-- local function_query = lazy_query("latex", [[
+-- (generic_command
+-- command: (command_name) @_name
+-- arg: (curly_group (_) @in)) @_root
+-- ]])
+--
+-- vim.keymap.set('n', '<LocalLeader>df', with_current_position(function(curbuf, curwin, cursor)
+-- local match, node = utls.find_smallest_match(cursor[1] - 1, cursor[2], function_query, curbuf)
+--
+-- if not match then
+-- print("Not in an function")
+-- return
+-- end
+--
+-- local start_row, _, end_row, _ = node:range()
+--
+-- local innode = utls.index_by_name(function_query, match, "in")
+--
+-- -- Correct the cursor position (this is at best a guesstimation)
+-- local cname = utls.index_by_name(function_query, match, "_name")
+-- local cstartline = cname:start()
+-- local srow, scol, _, ecol = innode:range()
+-- if cstartline == cursor[1] - 1 then
+-- cursor[2] = math.min(math.max(scol, cursor[2]), ecol - 1)
+-- local offset = #vim.treesitter.get_node_text(cname, curbuf) + 1 -- the bracket
+-- vim.api.nvim_win_set_cursor(curwin, { cursor[1], cursor[2] - offset })
+-- elseif srow == cursor[1] - 1 then
+-- vim.api.nvim_win_set_cursor(curwin, { cursor[1] - 1, math.max(scol, cursor[2]) - scol })
+-- else
+-- vim.api.nvim_win_set_cursor(curwin, { cursor[1] - 1, cursor[2] })
+-- end
+--
+-- local current = vim.treesitter.get_node_text(innode, curbuf)
+-- edit.edit_match(curbuf, match, function_query, { _root = current }, start_row, end_row)
+-- end), { buffer = true })
+-- end
+--
+-- --- Tiny mapping to select the node type at cursor and input it
+-- do
+-- end
diff --git a/after/plugin/config/templar.lua b/after/plugin/config/templar.lua
@@ -1,6 +1,6 @@
-local templar = require'templar'
-templar.register('*.vim')
-templar.register('*.h')
-templar.register('*.sh')
-templar.register('*.lua')
-templar.register('shell.nix')
+-- local templar = require'templar'
+-- templar.register('*.vim')
+-- templar.register('*.h')
+-- templar.register('*.sh')
+-- templar.register('*.lua')
+-- templar.register('shell.nix')
diff --git a/after/queries/latex/textobjects.scm b/after/queries/latex/textobjects.scm
@@ -0,0 +1,20 @@
+((displayed_equation . (_) @_ibegin (_)? @_iend .) @math.outer
+ (#make-range! "math.inner" @_ibegin @_iend))
+
+((inline_formula . (_) @_ibegin (_)? @_iend .) @math.outer
+ (#make-range! "math.inner" @_ibegin @_iend))
+
+((math_environment begin: (_) . (_) @_ibegin (_)? @_iend . end: (_)) @math.outer @env.outer
+ (#make-range! "math.inner" @_ibegin @_iend)
+ (#make-range! "env.inner" @_ibegin @_iend))
+
+((generic_environment begin: (_) . (_) @_ibegin (_)? @_iend . end: (_)) @env.outer
+ (#make-range! "env.inner" @_ibegin @_iend))
+
+((section text: _ . (_) @_ibegin) @section.outer
+ (#make-range! "section.inner" @_ibegin @section.outer))
+((subsection text: _ . (_) @_ibegin) @section.outer
+ (#make-range! "section.inner" @_ibegin @section.outer))
+
+((enum_item . (_) @_ibegin) @item.outer
+ (#make-range! "item.inner" @_ibegin @item.outer))
diff --git a/colors/oakv2.lua b/colors/oakv2.lua
@@ -9,6 +9,8 @@ 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" })
@@ -17,6 +19,7 @@ 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 })
@@ -40,8 +43,10 @@ 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" })
@@ -73,7 +78,6 @@ hi(0, "StatusLine", { bg = "#43251a", bold = true, ctermbg = 236, ctermfg = 255,
hi(0, "StatusLineNC", { bg = "#43251a", ctermbg = 236, ctermfg = 255, fg = "#ffebe2" })
hi(0, "String", { ctermfg = 37, fg = "#00bdbf" })
hi(0, "TabLine", {})
-hi(0, "TabLineFill", { link = "TabLine" })
hi(0, "Title", { ctermfg = 209, fg = "#ef855c" })
hi(0, "Todo", { link = "Normal" })
hi(0, "Type", { ctermfg = 71, fg = "#69bd6b", italic = true })
diff --git a/init.lua b/init.lua
@@ -45,7 +45,7 @@ o.laststatus = 3
-- Completion and ui
o.inccommand = "nosplit"
-o.completeopt = { "preview", "menuone", "noinsert" }
+o.completeopt = { "menuone", "noinsert" }
o.list = true
o.listchars = {
tab = "|-",
@@ -89,6 +89,10 @@ o.suffixes:prepend {
".snm"
}
+o.foldmethod = "expr"
+o.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
+o.foldtext = 'v:lua.vim.treesitter.foldtext()'
+
vim.g.mapleader = " "
vim.g.maplocalleader = "$"
@@ -101,7 +105,7 @@ vim.api.nvim_create_autocmd("TextYankPost", {
})
vim.cmd [[language en_US.utf8]]
vim.cmd [[language time POSIX]]
-vim.cmd.colorscheme "oakv2"
+vim.cmd.colorscheme "dracula"
-- Now load plugins and such
require "mappings"
@@ -110,7 +114,6 @@ require "neogit-config"
-- Set up some useful diagnostics stuff
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 })
-vim.keymap.set('n', '<Leader>ll', require("lsp_lines").toggle, { remap = false, silent = true })
vim.api.nvim_create_autocmd("InsertEnter", {
callback = function()
-- Force off lsp_lines on enter
@@ -151,3 +154,19 @@ do
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
diff --git a/lua/azy_config.lua b/lua/azy_config.lua
@@ -2,7 +2,7 @@ local M = {}
require'azy'.setup {
-- preview = true,
- -- debug = true,
+ debug = true,
}
local ab = require'azy.builtins'
diff --git a/lua/completree-config.lua b/lua/completree-config.lua
@@ -46,7 +46,8 @@ local fuzzy_lsp = cc.pipeline(s.lsp_matches {}, ccomp.fzy)
local lsp_completion = {
default = fuzzy_lsp,
string = cdef.ins_completion "C-F",
- comment = cdef.snippy,
+ comment = cdef.dummy,
+ -- comment = cdef.snippy,
}
comp.setup {
@@ -73,6 +74,9 @@ comp.setup {
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/lsp_config.lua b/lua/lsp_config.lua
@@ -2,7 +2,6 @@ vim.diagnostic.config {
virtual_text = false,
severity_sort = true,
signs = true,
- virtual_lines = false
}
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' })
@@ -54,9 +53,9 @@ local function on_attach(client, bufnr)
set_keymap('<Leader>lr', vim.lsp.codelens.run)
end
- if client.supports_method 'textDocument/inlayHint' then
- vim.lsp.inlay_hint(bufnr, true)
- end
+ -- if client.supports_method 'textDocument/inlayHint' then
+ -- vim.lsp.inlay_hint(bufnr, true)
+ -- end
end
-- TexLab and LTeX things
@@ -202,17 +201,28 @@ local system_lsps = {
enable_snippets = true,
enable_inlay_hints = true,
include_at_in_builtins = true,
- inlay_hints_hide_redundant_param_names_last_token = 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" ,}
+ root_markers = { "CMakeLists.txt", ".git", }
},
tsserver = {
@@ -255,7 +265,7 @@ local system_lsps = {
},
codeql = {
- command = { 'codeql', 'execute', 'language-server', '--check-errors=ON_CHANGE'},
+ command = { 'codeql', 'execute', 'language-server', '--check-errors=ON_CHANGE' },
filetypes = { 'ql' },
},
@@ -263,7 +273,6 @@ local system_lsps = {
return {
filetypes = { "lua" },
cfg = {
- before_init = require("neodev.lsp").before_init,
capabilities = capabilities,
on_attach = on_attach,
settings = {
@@ -313,7 +322,7 @@ local system_lsps = {
texlab = {
command = { "texlab", "-vvvv" },
- filetypes = { "tex", "bib" },
+ filetypes = { "tex", "bib", "latex" },
root_markers = { ".latexmkrc", ".git" },
ucommands = {
Build = function(client, bufnr)
diff --git a/lua/mappings.lua b/lua/mappings.lua
@@ -2,7 +2,7 @@
require "completree-config"
local complementree = require 'complementree'
local mpairs = require'mini.pairs'
-local snippy = require 'snippy'
+-- local snippy = require 'snippy'
-- local luasnip = require 'luasnip'
local rt = function(codes)
return vim.api.nvim_replace_termcodes(codes, true, true, true)
@@ -17,8 +17,8 @@ end
local function sjump()
vim.schedule(function()
- if snippy.can_jump(1) and snippy.is_active() then
- snippy.next()
+ if vim.snippet.jumpable(1) and vim.snippet.active() then
+ vim.snippet.jump(1)
end
-- if luasnip.jumpable(1) and luasnip.in_snippet() then
-- luasnip.jump(1)
@@ -63,7 +63,7 @@ vim.keymap.set('i', '<CR>', cr_confirm, { noremap = true })
vim.keymap.set({'i', 's'}, '<Tab>', tab_complete)
vim.keymap.set({'i', 's'}, '<BS>', backspace)
-vim.keymap.set({'i', 's'}, '<C-l>', snippy.next)
+vim.keymap.set({'i', 's'}, '<C-l>', function() vim.snippet.jump(1) end)
--- Tiny mapping to select the node at cursor and input it
do
diff --git a/lua/oakgen.lua b/lua/oakgen.lua
@@ -30,6 +30,8 @@ local palette = {
}
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 }
@@ -51,6 +53,8 @@ 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 }
@@ -118,6 +122,9 @@ 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 }
diff --git a/lua/plugins.lua b/lua/plugins.lua
@@ -34,10 +34,10 @@ paq {
-- List your packages
--local complementree.nvim
- -- 'L3MON4D3/LuaSnip',
- 'dcampos/nvim-snippy',
- 'honza/vim-snippets',
- { 'nvim-treesitter/nvim-treesitter', run = ":TSUpdate" },
+ -- 'dcampos/nvim-snippy',
+ -- 'honza/vim-snippets',
+ { 'nvim-treesitter/nvim-treesitter', build = ":TSUpdate" },
+ "Mofiqul/dracula.nvim",
--local azy.nvim
'mfussenegger/nvim-qwahl',
@@ -45,12 +45,6 @@ paq {
-- LSP stuff
{
- url = "https://git.sr.ht/~whynothugo/lsp_lines.nvim",
- config = function()
- require("lsp_lines").setup()
- end
- },
- {
"williamboman/mason.nvim",
config = function()
require "mason".setup {}
@@ -60,13 +54,12 @@ paq {
{ 'mfussenegger/nvim-dap', opt = true }, -- TODO load dap-config
--local architext.nvim
- 'vigoux/templar.nvim',
+ -- 'vigoux/templar.nvim',
--local ratatoskr in opt
'nvim-lua/plenary.nvim',
'lewis6991/gitsigns.nvim',
- 'folke/neodev.nvim',
{ 'github/copilot.vim', opt = true },
--local oak
@@ -84,7 +77,7 @@ paq {
require 'mini.surround'.setup {
mappings = {
add = 'gsa',
- delete = 'gsd',
+ delete = 'gsdd',
find = 'gsf',
find_left = 'gsF',
highlight = 'gsh',
@@ -92,6 +85,32 @@ paq {
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.operators").setup {
+ funcwrap = {
+ prefix = '',
+ func = nil
+ }
+ }
+ require("mini.operators").make_mappings(
+ 'funcwrap',
+ { textobject = '<LocalLeader>f', line = '<LocalLeader>ff', selection = '<LocalLeader>f' }
+ )
end
}
}