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 <igor@milhit.ch>
iGor milhit 2023-06-13 07:04:36 +02:00
parent 0dbcf730bf
commit 692ff13e18
Signed by: igor
GPG Key ID: 692D97C3D0228A99
2 changed files with 57 additions and 6 deletions

View File

@ -195,7 +195,10 @@ require('lazy').setup({
end, end,
}, },
{ 'benfowler/telescope-luasnip.nvim' }, {
-- Allow to search for snippets
'benfowler/telescope-luasnip.nvim'
},
{ {
-- Highlight, edit, and navigate code -- Highlight, edit, and navigate code
@ -486,6 +489,22 @@ local servers = {
telemetry = { enable = false }, telemetry = { enable = false },
}, },
}, },
texlab = {
settings = {
build = {
executable = "tectonic",
args = {
"-X",
"compile",
"%f",
"--syntex",
"--keep-logs",
"--keep-intermediates"
}
}
}
},
} }
-- Setup neovim lua configuration -- Setup neovim lua configuration

View File

@ -8,14 +8,21 @@ local fmt = require("luasnip.extras.fmt").fmt
-- Function to get the datetime -- Function to get the datetime
-- with daylight saving time -- with daylight saving time
-- according to the locale -- according to the locale
local get_date = function() local get_datetime = function()
return os.date("%Y-%m-%dT%H:%M:%S%z") return os.date("%Y-%m-%dT%H:%M:%S%z")
end 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() local get_month = function()
return os.date("%B") return os.date("%B")
end end
-- Function to get the current year
local get_month_year = function() local get_month_year = function()
return os.date("%B-%Y") return os.date("%B-%Y")
end end
@ -25,27 +32,52 @@ local get_id = function()
return os.date("%Y%m%d%H%M%S") return os.date("%Y%m%d%H%M%S")
end end
-- Function to get the number of the current day
local get_day = function()
return os.date("%d")
end
return { return {
s( s(
{ {
trig = "datetime", trig = "datetime",
name = "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( s(
{ {
trig = "id", trig = "id",
Name = "ID", Name = "ID",
dscr = "Insert an id based on the datetime" dscr = "Insert an id based on the current datetime."
}, },
{ {
f(get_id, {}) f(get_id, {})
} }
), ),
s(
{
trig = "today",
Name = "Today",
dscr = "Insert the number of the current day."
},
{
f(get_day, {})
}
),
s( s(
{ {
trig = "fm", trig = "fm",