nvim-config

Log | Files | Refs | Submodules | README

commit bd4f68479e8cca80575c957928e201661d0d4e90
parent 505616d1b39db3d296e51705f9a2dade484061ea
Author: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
Date:   Mon, 12 Sep 2022 09:57:22 +0200

update

Diffstat:
Mafter/ftplugin/tex.lua | 26++++++++++++++++++++++++++
Minit.lua | 2+-
Mlua/dap-config.lua | 6++----
3 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/after/ftplugin/tex.lua b/after/ftplugin/tex.lua @@ -13,3 +13,29 @@ vim.cmd [[normal zx]] if #vim.fs.find({ "Makefile", "makefile" }, { type = "file" }) == 0 then vim.cmd[[compiler latexmk]] end + +local edit = require"architext.edit" +local ts_utils = require'nvim-treesitter.ts_utils' +local p = require'nvim-treesitter.parsers' +local query = vim.treesitter.parse_query("latex", [[ + (generic_environment + (begin (curly_group_text text: (_) @envbegin)) + (end (curly_group_text text: (_) @envend))) +]]) +vim.keymap.set('n', 'ge', function() + local curbuf = vim.api.nvim_get_current_buf() + local curnode = ts_utils.get_node_at_cursor() + + while curnode and curnode:type() ~= "generic_environment" do + curnode = curnode:parent() + end + + if not curnode then return end + + local start_row, _, end_row, _ = curnode:range() + vim.ui.input({ prompt = "Replacement" }, function(replacement) + if replacement then + edit.edit(curbuf, p.get_parser(curbuf), query, { replacement, replacement }, start_row, end_row) + end + end) +end, { buffer = true }) diff --git a/init.lua b/init.lua @@ -28,7 +28,7 @@ o.lazyredraw = true o.foldenable = false o.spelllang = { "en", "fr" } vim.o.spellfile = table.concat(vim.api.nvim_get_runtime_file("spell/*.add", true) or {}, ",") -o.spelloptions:append "noplainbuffer" +o.spelloptions = { "noplainbuffer" } o.textwidth = 100 o.colorcolumn = "+0" o.signcolumn = "yes:1" diff --git a/lua/dap-config.lua b/lua/dap-config.lua @@ -35,14 +35,10 @@ 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() - sbar.open() end dap.listeners.after['event_terminated']['me'] = function() - sbar.close() end vim.keymap.set("n", "<LocalLeader>r", dap.continue) @@ -50,6 +46,8 @@ 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: '))