snippets: load my own, add markdown snippets
- Renames the snippets folder to my_snippets. - Lazy loads my snippets. - Creates two snippet example available for all filetypes. - Creates three snippets for markdown filetype. - Creates a markdown snippet to get the number of the curret day. - Creates a markdown snippet to get the current date. - Creates a snippet to create a link in markdown reference syntax. - Creates a generic frontmatter snippet. - Creates a frontmatter snippet for my incremental notes (journal). - Improves the description and description syntax of my markdown snippets. - Adds the telescope luasnip plugin. - Sets a keymaping to fuzzy search all available snippets (<leader>ss). - Documents the feature of the plugin that provides the snippets search through telescope. - Enables the search highlighting. - Removes unnecessary lualine separator. - Renames the neo-tree plugin file. - Lazy loads the zen-mode for markdown files. - 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. Co-Authored-by: iGor milhit <igor@milhit.ch>main
parent
cc2ec20a73
commit
6c0e0b4de1
32
init.lua
32
init.lua
|
@ -160,7 +160,7 @@ require('lazy').setup({
|
|||
icons_enabled = true,
|
||||
theme = 'nord',
|
||||
component_separators = '|',
|
||||
section_separators = '/',
|
||||
section_separators = '',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -195,6 +195,11 @@ require('lazy').setup({
|
|||
end,
|
||||
},
|
||||
|
||||
{
|
||||
-- Allow to search for snippets
|
||||
'benfowler/telescope-luasnip.nvim'
|
||||
},
|
||||
|
||||
{
|
||||
-- Highlight, edit, and navigate code
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
|
@ -227,7 +232,7 @@ vim.opt.rtp:append (vim.fn.stdpath ('data') .. '/site')
|
|||
-- NOTE: You can change these options as you wish!
|
||||
|
||||
-- Set highlight on search
|
||||
vim.o.hlsearch = false
|
||||
vim.o.hlsearch = true
|
||||
|
||||
-- Make line numbers default
|
||||
vim.wo.number = true
|
||||
|
@ -320,6 +325,7 @@ require('telescope').setup {
|
|||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
pcall(require('telescope').load_extension, 'luasnip')
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||
|
@ -339,6 +345,7 @@ vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { de
|
|||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>sb', require('telescope.builtin').buffers, { desc = '[S]earch [B]uffers' })
|
||||
vim.keymap.set('n', '<leader>ss', require'telescope'.extensions.luasnip.luasnip , { desc = '[S]earch [S]nippets' })
|
||||
|
||||
-- [[ Configure Treesitter ]]
|
||||
-- See `:help nvim-treesitter`
|
||||
|
@ -482,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
|
||||
|
@ -519,9 +542,12 @@ luasnip.config.setup {
|
|||
snippets = {
|
||||
markdown = {},
|
||||
},
|
||||
luasnip.filetype_extend("pandoc", {"markdown"})
|
||||
luasnip.filetype_extend("pandoc", {"markdown"}),
|
||||
}
|
||||
|
||||
-- Load snippets from ~/.config/nvim/LuaSnip/
|
||||
require("luasnip.loaders.from_lua").load({paths = "~/.config/nvim/my_snippets/"})
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
-- Trying to add a custom plugin for file tree
|
||||
-- Plugin for file tree: neo-tree
|
||||
-- Using the kickstart and the neo-tree documentations
|
||||
|
||||
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
|
@ -3,6 +3,10 @@
|
|||
|
||||
return {
|
||||
"folke/zen-mode.nvim",
|
||||
ft = {
|
||||
"markdown",
|
||||
"pandoc"
|
||||
},
|
||||
-- Twilight allows to dim text outside of the cursor line.
|
||||
dependencies = {
|
||||
"folke/twilight.nvim",
|
||||
|
|
|
@ -0,0 +1,151 @@
|
|||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
|
||||
-- Function to get the datetime
|
||||
-- with daylight saving time
|
||||
-- according to the locale
|
||||
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
|
||||
|
||||
-- Function to get an id based on the datetime
|
||||
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 the current datetime with locale daylight saving."
|
||||
},
|
||||
{
|
||||
f(get_datetime, {})
|
||||
}
|
||||
),
|
||||
s(
|
||||
{
|
||||
trig = "date",
|
||||
name = "Date",
|
||||
dscr = "Insert the current date."
|
||||
},
|
||||
{
|
||||
f(get_date, {})
|
||||
}
|
||||
),
|
||||
s(
|
||||
{
|
||||
trig = "id",
|
||||
Name = "ID",
|
||||
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",
|
||||
name = "YAML frontmatter",
|
||||
dscr = "Insert a YAML frontmatter for markdown files.\n\nIt has a datetime with the locale daylight saving time, and an ID based on the datetime.\nTab to jump to next text input."
|
||||
},
|
||||
fmt(
|
||||
[[
|
||||
---
|
||||
title: {1}
|
||||
date: {3}
|
||||
id: {4}
|
||||
tags: [{2}]
|
||||
---
|
||||
|
||||
]],
|
||||
{
|
||||
i(1, "title"),
|
||||
i(2, "tags"),
|
||||
f(get_datetime, {}),
|
||||
f(get_id, {})
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
{
|
||||
trig = "inc",
|
||||
name = "INC YAML frontmatter",
|
||||
dscr = "Insert a YAML frontmatter for INC notes.\n\nIt has a datetime with the locale daylight saving time, prefilled title, author, categories and tags.\nAdjust the title manually."
|
||||
},
|
||||
fmt(
|
||||
[[
|
||||
---
|
||||
title: {1}
|
||||
creation_date: {2}
|
||||
author: iGor milhit
|
||||
categories: [inc]
|
||||
tags: [notes, quotidien, {3}]
|
||||
---
|
||||
|
||||
]],
|
||||
{
|
||||
f(get_month_year, {}),
|
||||
f(get_datetime, {}),
|
||||
f(get_month, {})
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
{
|
||||
trig="reflink",
|
||||
name = "Reference link",
|
||||
dscr="Insert a link with reference syntax",
|
||||
docstring = "[Link text][Reference]\n\n[Reference]: Link Target \"Title\"\n\nTab to jump to next text input. \"Reference\" is automatically repeated."
|
||||
},
|
||||
fmt(
|
||||
[[
|
||||
[{1}][{2}]
|
||||
|
||||
[{2}]: {3} "{4}"
|
||||
]],
|
||||
{
|
||||
i(1, "Link text"),
|
||||
i(2, "Reference"),
|
||||
i(3, "Link target"),
|
||||
i(4, "Title")
|
||||
},
|
||||
{ repeat_duplicates = true }
|
||||
)
|
||||
)
|
||||
}
|
|
@ -1,2 +1,6 @@
|
|||
AoU
|
||||
Floriane
|
||||
Séverine
|
||||
HEG
|
||||
neovim
|
||||
lua
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue