From 692ff13e18dc0e65b7412f9c812d409191393cef Mon Sep 17 00:00:00 2001 From: iGor milhit Date: Tue, 13 Jun 2023 07:04:36 +0200 Subject: [PATCH] LSP: install and configure texlab - Installs and configure texlab which provides LSP and linter for LaTeX. Should also allow to build a project, but It is failling right now, I don't get why. - Adds a markdown snippet to get the number of the curret day. - Adds a markdown snippet to get the current date. - Improves the syntax of the markdown snippets descriptions. - Documents the feature of the plugin that provides the snippets search through telescope. Co-Authored-by: iGor milhit --- init.lua | 23 +++++++++++++++++++++-- my_snippets/markdown.lua | 40 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 57 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 3403eaa..fe52973 100644 --- a/init.lua +++ b/init.lua @@ -195,7 +195,10 @@ require('lazy').setup({ end, }, - { 'benfowler/telescope-luasnip.nvim' }, + { + -- Allow to search for snippets + 'benfowler/telescope-luasnip.nvim' + }, { -- Highlight, edit, and navigate code @@ -472,7 +475,7 @@ local servers = { -- pyright = {}, -- rust_analyzer = {}, -- tsserver = {}, - + marksman = { ft = { 'markdown', @@ -486,6 +489,22 @@ local servers = { telemetry = { enable = false }, }, }, + + texlab = { + settings = { + build = { + executable = "tectonic", + args = { + "-X", + "compile", + "%f", + "--syntex", + "--keep-logs", + "--keep-intermediates" + } + } + } + }, } -- Setup neovim lua configuration diff --git a/my_snippets/markdown.lua b/my_snippets/markdown.lua index 231450b..6a6c590 100644 --- a/my_snippets/markdown.lua +++ b/my_snippets/markdown.lua @@ -8,14 +8,21 @@ local fmt = require("luasnip.extras.fmt").fmt -- Function to get the datetime -- with daylight saving time -- according to the locale -local get_date = function() +local get_datetime = function() return os.date("%Y-%m-%dT%H:%M:%S%z") end +-- Function to get the current date +local get_date = function() + return os.date("%Y-%m-%d") +end + +-- Function to get the current month local get_month = function() return os.date("%B") end +-- Function to get the current year local get_month_year = function() return os.date("%B-%Y") end @@ -25,27 +32,52 @@ local get_id = function() return os.date("%Y%m%d%H%M%S") end +-- Function to get the number of the current day +local get_day = function() + return os.date("%d") +end + return { s( { trig = "datetime", name = "Datetime", - dscr = "Insert datetime with locale daylight saving" + dscr = "Insert the current datetime with locale daylight saving." }, { - f(get_date, {}) + f(get_datetime, {}) + } + ), + s( + { + trig = "date", + name = "Date", + dscr = "Insert the current date." + }, + { + f(get_datetime, {}) } ), s( { trig = "id", Name = "ID", - dscr = "Insert an id based on the datetime" + dscr = "Insert an id based on the current datetime." }, { f(get_id, {}) } ), + s( + { + trig = "today", + Name = "Today", + dscr = "Insert the number of the current day." + }, + { + f(get_day, {}) + } + ), s( { trig = "fm",