From 998b43ae81c8d26962a9521da686452c22c97c4c Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Thu, 19 Sep 2024 11:41:22 +0200 Subject: nvim: enhance surround + latex add, find, delete & introduce paragraph --- .config/nvim/after/ftplugin/tex.lua | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/.config/nvim/after/ftplugin/tex.lua b/.config/nvim/after/ftplugin/tex.lua index 2576d55..2cd03a7 100644 --- a/.config/nvim/after/ftplugin/tex.lua +++ b/.config/nvim/after/ftplugin/tex.lua @@ -1,24 +1,29 @@ require("nvim-surround").buffer_setup({ surrounds = { ["K"] = { - add = function() - return { { '\\textbf{' }, { '}' } } - end + add = { "\\textbf{", "}" }, + find = "\\textbf%b{}", + delete = "^(\\textbf{)().-(})()$", }, ["E"] = { - add = function() - return { { '\\emph{' }, { '}' } } - end + add = { "\\emph{", "}" }, + find = "\\emph%b{}", + delete = "^(\\emph{)().-(})()$", }, ["T"] = { - add = function() - return { { '\\texttt{' }, { '}' } } - end + add = { "\\texttt{", "}" }, + find = "\\texttt%b{}", + delete = "^(\\texttt{)().-(})()$", }, ['"'] = { - add = function() - return { { '\\enquote{' }, { '}' } } - end, + add = { "\\enquote{", "}" }, + find = "\\enquote%b{}", + delete = "^(\\enquote{)().-(})()$", + }, + ['P'] = { + add = { "\\paragraph{", "}" }, + find = "\\paragraph%b{}", + delete = "^(\\paragraph{)().-(})()$", }, } }) -- cgit v1.2.3-70-g09d2