Compare commits
14 Commits
7979afe0ad
...
05bace5665
Author | SHA1 | Date |
---|---|---|
iGor milhit | 05bace5665 | |
iGor milhit | e5298b6bb3 | |
iGor milhit | 43841e7a5b | |
iGor milhit | 5433a5538d | |
iGor milhit | 5167c5c6be | |
iGor milhit | 4d92ad9863 | |
iGor milhit | af95122e63 | |
iGor milhit | 8543c689b0 | |
iGor milhit | 8f5d37f313 | |
iGor milhit | ccf1fe4030 | |
iGor milhit | a9fc78d5b6 | |
iGor milhit | 4604bf5925 | |
iGor milhit | c2fdfafae4 | |
iGor milhit | 7c52a10de3 |
|
@ -0,0 +1,8 @@
|
||||||
|
-- Specific settings for JSON files
|
||||||
|
-- Use treesitter for folding
|
||||||
|
-- Disable the color column
|
||||||
|
|
||||||
|
vim.opt.foldmethod="expr"
|
||||||
|
vim.opt.foldexpr="nvim_treesitter#foldexpr()"
|
||||||
|
vim.opt.foldlevel=3
|
||||||
|
vim.opt.colorcolumn=""
|
73
init.lua
73
init.lua
|
@ -87,7 +87,7 @@ require('lazy').setup({
|
||||||
|
|
||||||
-- Useful status updates for LSP
|
-- Useful status updates for LSP
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||||
{ 'j-hui/fidget.nvim', opts = {} },
|
{ 'j-hui/fidget.nvim', tag = "legacy", opts = {} },
|
||||||
|
|
||||||
-- Additional lua configuration, makes nvim stuff amazing!
|
-- Additional lua configuration, makes nvim stuff amazing!
|
||||||
'folke/neodev.nvim',
|
'folke/neodev.nvim',
|
||||||
|
@ -106,6 +106,9 @@ require('lazy').setup({
|
||||||
-- Adds LSP completion capabilities
|
-- Adds LSP completion capabilities
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
|
|
||||||
|
-- Adds completion capabilities for text in buffers
|
||||||
|
'hrsh7th/cmp-buffer',
|
||||||
|
|
||||||
-- Adds path completion capabilities
|
-- Adds path completion capabilities
|
||||||
'hrsh7th/cmp-path',
|
'hrsh7th/cmp-path',
|
||||||
|
|
||||||
|
@ -160,7 +163,7 @@ require('lazy').setup({
|
||||||
icons_enabled = true,
|
icons_enabled = true,
|
||||||
theme = 'nord',
|
theme = 'nord',
|
||||||
component_separators = '|',
|
component_separators = '|',
|
||||||
section_separators = '/',
|
section_separators = '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -195,6 +198,16 @@ require('lazy').setup({
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- Extension to telescope to use Ag (or ripgrep) to filter results
|
||||||
|
{
|
||||||
|
'kelly-lin/telescope-ag'
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Allow to search for snippets
|
||||||
|
{
|
||||||
|
'benfowler/telescope-luasnip.nvim'
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
-- Highlight, edit, and navigate code
|
-- Highlight, edit, and navigate code
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
@ -227,7 +240,11 @@ vim.opt.rtp:append (vim.fn.stdpath ('data') .. '/site')
|
||||||
-- NOTE: You can change these options as you wish!
|
-- NOTE: You can change these options as you wish!
|
||||||
|
|
||||||
-- Set highlight on search
|
-- Set highlight on search
|
||||||
vim.o.hlsearch = false
|
vim.o.hlsearch = true
|
||||||
|
|
||||||
|
-- Preview changes when searching and substituing
|
||||||
|
-- nosplit avoid to display the preview in a separate split
|
||||||
|
vim.o.inccommand = "nosplit"
|
||||||
|
|
||||||
-- Make line numbers default
|
-- Make line numbers default
|
||||||
vim.wo.number = true
|
vim.wo.number = true
|
||||||
|
@ -237,10 +254,6 @@ vim.opt.textwidth = 79
|
||||||
-- Display the cusor column at 79+1 column
|
-- Display the cusor column at 79+1 column
|
||||||
vim.opt.colorcolumn:append('+1')
|
vim.opt.colorcolumn:append('+1')
|
||||||
|
|
||||||
-- Set text formatting options
|
|
||||||
-- 'a' is for autoformat
|
|
||||||
-- vim.opt.formatoptions:append('a')
|
|
||||||
|
|
||||||
-- Enable mouse mode
|
-- Enable mouse mode
|
||||||
vim.o.mouse = 'a'
|
vim.o.mouse = 'a'
|
||||||
|
|
||||||
|
@ -320,6 +333,10 @@ require('telescope').setup {
|
||||||
|
|
||||||
-- Enable telescope fzf native, if installed
|
-- Enable telescope fzf native, if installed
|
||||||
pcall(require('telescope').load_extension, 'fzf')
|
pcall(require('telescope').load_extension, 'fzf')
|
||||||
|
-- Enable telescope luasnip extension, if installed
|
||||||
|
pcall(require('telescope').load_extension, 'luasnip')
|
||||||
|
-- Enable telescope-ag extension, if installed
|
||||||
|
pcall(require('telescope').load_extension, 'ag')
|
||||||
|
|
||||||
-- See `:help telescope.builtin`
|
-- See `:help telescope.builtin`
|
||||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||||
|
@ -339,12 +356,13 @@ 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>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>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>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 ]]
|
-- [[ Configure Treesitter ]]
|
||||||
-- See `:help nvim-treesitter`
|
-- See `:help nvim-treesitter`
|
||||||
require('nvim-treesitter.configs').setup {
|
require('nvim-treesitter.configs').setup {
|
||||||
-- Add languages to be installed here that you want installed for treesitter
|
-- Add languages to be installed here that you want installed for treesitter
|
||||||
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' },
|
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim', 'json' },
|
||||||
|
|
||||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||||
auto_install = false,
|
auto_install = false,
|
||||||
|
@ -482,6 +500,27 @@ local servers = {
|
||||||
telemetry = { enable = false },
|
telemetry = { enable = false },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
texlab = {
|
||||||
|
settings = {
|
||||||
|
build = {
|
||||||
|
executable = "tectonic",
|
||||||
|
args = {
|
||||||
|
"-X",
|
||||||
|
"compile",
|
||||||
|
"%f",
|
||||||
|
"--syntex",
|
||||||
|
"--keep-logs",
|
||||||
|
"--keep-intermediates"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Require vscode-langservers-extracted
|
||||||
|
-- https://github.com/hrsh7th/vscode-langservers-extracted
|
||||||
|
jsonls = {
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Setup neovim lua configuration
|
-- Setup neovim lua configuration
|
||||||
|
@ -508,7 +547,7 @@ mason_lspconfig.setup_handlers {
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- [[ Configure nvim-cmp ]]
|
-- [[ Configure nvim-cmp, and LuaSnip ]]
|
||||||
-- See `:help cmp`
|
-- See `:help cmp`
|
||||||
local cmp = require 'cmp'
|
local cmp = require 'cmp'
|
||||||
local luasnip = require 'luasnip'
|
local luasnip = require 'luasnip'
|
||||||
|
@ -519,9 +558,16 @@ luasnip.config.setup {
|
||||||
snippets = {
|
snippets = {
|
||||||
markdown = {},
|
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/"})
|
||||||
|
|
||||||
|
-- Keymap to reload snippets
|
||||||
|
-- https://www.ejmastnak.com/tutorials/vim-latex/luasnip/#refreshing-snippets-from-a-separate-vim-instance
|
||||||
|
vim.keymap.set('n', '<Leader>L', '<Cmd>lua require("luasnip.loaders.from_lua").load({paths = "~/.config/nvim/my_snippets/"})<CR>', { desc = 'Reload [L]uaSnippets' })
|
||||||
|
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
|
@ -559,6 +605,13 @@ cmp.setup {
|
||||||
},
|
},
|
||||||
sources = {
|
sources = {
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
|
{
|
||||||
|
name = 'buffer',
|
||||||
|
option = {
|
||||||
|
keyword_length = 4,
|
||||||
|
keyword_pattern = [[\k\+]],
|
||||||
|
},
|
||||||
|
},
|
||||||
{ name = 'luasnip' },
|
{ name = 'luasnip' },
|
||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
-- Plugin to get Grammalecte checks in (neo)vim.
|
||||||
|
|
||||||
|
-- Set the path to the grammalecte-cli executable
|
||||||
|
vim.cmd([[ let g:grammalecte_cli_py = "/usr/bin/grammalecte-cli" ]])
|
||||||
|
|
||||||
|
return {
|
||||||
|
"dpelle/vim-Grammalecte",
|
||||||
|
ft = {
|
||||||
|
"pandoc",
|
||||||
|
"markdown",
|
||||||
|
"text",
|
||||||
|
"gitcommit"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,6 @@
|
||||||
-- makdown-preview.nvim
|
-- makdown-preview.nvim
|
||||||
-- installed with code found at https://github.com/iamcco/markdown-preview.nvim/issues/558#issuecomment-1514701537
|
-- installed with code found at https://github.com/iamcco/markdown-preview.nvim/issues/558#issuecomment-1514701537
|
||||||
|
|
||||||
-- Force the light theme, no matter the system option is.
|
|
||||||
vim.cmd([[ let g:mkdp_theme = 'light' ]])
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"iamcco/markdown-preview.nvim",
|
"iamcco/markdown-preview.nvim",
|
||||||
|
@ -12,6 +9,6 @@ return {
|
||||||
'markdown'
|
'markdown'
|
||||||
},
|
},
|
||||||
lazy = true,
|
lazy = true,
|
||||||
build = "cd app && yarn install",
|
build = "cd app && npm install && git reset --hard",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,18 +22,22 @@ return {
|
||||||
markdown = true,
|
markdown = true,
|
||||||
pandoc = true
|
pandoc = true
|
||||||
},
|
},
|
||||||
|
perspective = {
|
||||||
|
-- Ensure that paths are relative to the current file
|
||||||
|
priority = "current"
|
||||||
|
},
|
||||||
links = {
|
links = {
|
||||||
conceal = true,
|
conceal = true,
|
||||||
},
|
},
|
||||||
new_file_template = {
|
new_file_template = {
|
||||||
use_template = true,
|
use_template = true,
|
||||||
template = [[
|
template = [[
|
||||||
---
|
---
|
||||||
title:
|
title:
|
||||||
date: {{ date }}
|
date: {{ date }}
|
||||||
id: {{ id }}
|
id: {{ id }}
|
||||||
tags: []
|
tags: []
|
||||||
---
|
---
|
||||||
]],
|
]],
|
||||||
placeholders = {
|
placeholders = {
|
||||||
before = {
|
before = {
|
||||||
|
|
|
@ -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
|
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
||||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
|
@ -0,0 +1,16 @@
|
||||||
|
-- A neovim lua plugin to help easily manage multiple terminal windows
|
||||||
|
-- https://github.com/akinsho/toggleterm.nvim
|
||||||
|
|
||||||
|
-- Set ZSH as shell to get it in a terminal buffer
|
||||||
|
vim.opt.shell = "/usr/bin/zsh"
|
||||||
|
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'akinsho/toggleterm.nvim',
|
||||||
|
version = "*",
|
||||||
|
opts = {
|
||||||
|
-- Avoid terminal to be darker than the Nord colorscheme
|
||||||
|
shade_terminals = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,10 @@
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"folke/zen-mode.nvim",
|
"folke/zen-mode.nvim",
|
||||||
|
ft = {
|
||||||
|
"markdown",
|
||||||
|
"pandoc"
|
||||||
|
},
|
||||||
-- Twilight allows to dim text outside of the cursor line.
|
-- Twilight allows to dim text outside of the cursor line.
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"folke/twilight.nvim",
|
"folke/twilight.nvim",
|
||||||
|
@ -18,7 +22,7 @@ return {
|
||||||
width = 85,
|
width = 85,
|
||||||
height = .8,
|
height = .8,
|
||||||
options = {
|
options = {
|
||||||
-- Disable line numbering.
|
-- Disable line numbering, signcolumn and colorcolumn.
|
||||||
number = false,
|
number = false,
|
||||||
signcolumn = "no",
|
signcolumn = "no",
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
local ls = require("luasnip")
|
||||||
|
local s = ls.snippet
|
||||||
|
local t = ls.text_node
|
||||||
|
local f = ls.function_node
|
||||||
|
local fmt = require("luasnip.extras.fmt").fmt
|
||||||
|
|
||||||
|
-- Function to get the current date
|
||||||
|
local get_date = function()
|
||||||
|
return os.date("%Y-%m-%d")
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
s(
|
||||||
|
{
|
||||||
|
trig = "hr",
|
||||||
|
name = "Heures",
|
||||||
|
dscr = "Insert a commit message for saving the worked hours."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
t("organisation: enregistre les heures")
|
||||||
|
}
|
||||||
|
),
|
||||||
|
s(
|
||||||
|
{
|
||||||
|
trig = "ic",
|
||||||
|
name = "Incremental note commit message",
|
||||||
|
dscr = "Insert a commit message for my incremental notes commits."
|
||||||
|
},
|
||||||
|
fmt(
|
||||||
|
[[
|
||||||
|
Incrémente la note du {1}
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
f(get_date, {})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
|
s(
|
||||||
|
{
|
||||||
|
trig = "aou",
|
||||||
|
name = "AoU stats commit message",
|
||||||
|
dscr = "Commit message for an increment of AoU validation statistics."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
t("r+e: incrémente les stats de validation de l'AoU")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
-- My HTML snippets
|
||||||
|
-- Below, the duplicate of brackets, for instance in the CSS code, is for
|
||||||
|
-- escaping delimiters.
|
||||||
|
|
||||||
|
-- Set the local variables (shortcuts)
|
||||||
|
local ls = require("luasnip")
|
||||||
|
local s = ls.snippet
|
||||||
|
local i = ls.insert_node
|
||||||
|
local fmt = require("luasnip.extras.fmt").fmt
|
||||||
|
|
||||||
|
return {
|
||||||
|
-- A main snippet setting the outer structure, with the style tag.
|
||||||
|
-- Should be completed with the nested article item below.
|
||||||
|
s(
|
||||||
|
{
|
||||||
|
trig = "mcim",
|
||||||
|
name = "Main article structure for MC portal",
|
||||||
|
dscr = "Insert an HTML structure to add bibliographic description on the clinical medicine portal."
|
||||||
|
},
|
||||||
|
fmt(
|
||||||
|
[[
|
||||||
|
<article class="mc-{1}-main">
|
||||||
|
{2}
|
||||||
|
<style>
|
||||||
|
.mc-{1}-item > ul > li {{
|
||||||
|
padding: 0 !important;
|
||||||
|
}}
|
||||||
|
.mc-{1}-item li:not([class])::before,
|
||||||
|
.mc-{1}-item li::before {{
|
||||||
|
content: none;
|
||||||
|
}}
|
||||||
|
</style>
|
||||||
|
</article>
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
i(1, "Class identifier"),
|
||||||
|
i(0)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
repeat_duplicates = true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
|
-- Snippet that inserts an article with bibliographic metatada, to be nested
|
||||||
|
-- in the upper main structure.
|
||||||
|
s(
|
||||||
|
{
|
||||||
|
trig = "mcii",
|
||||||
|
name = "Item article structure for MC portal",
|
||||||
|
dscr = "Insert an HTML structure to add an item bibliographic description on the clinical medicine portal."
|
||||||
|
},
|
||||||
|
fmt(
|
||||||
|
[[
|
||||||
|
<article class="mc-{1}-item">
|
||||||
|
<ul>
|
||||||
|
<li>Dorland W. Dorland’s illustrated medical dictionary. 4th ed.</li>
|
||||||
|
<li>Philadelphia: Elsevier, 2020.</li>
|
||||||
|
<li>Cote : W 13 ed 4</li>
|
||||||
|
<li>
|
||||||
|
<a lang="fr"
|
||||||
|
dir="ltr"
|
||||||
|
type="html/text"
|
||||||
|
href="https://slsp-unige.primo.exlibrisgroup.com/articleermalink/41SLSP_UGE/l0hvjc/alma991008098789705502"
|
||||||
|
hreflang="français"
|
||||||
|
rel="nofollow"
|
||||||
|
target="_blank">
|
||||||
|
Le document dans le catalogue Swisscovery
|
||||||
|
</a>.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<span placeholder="coins metadata"></span>
|
||||||
|
</article>{2}
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
i(1, "Class identifier"),
|
||||||
|
i(0)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
repeat_duplicates = true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
|
-- Snippet that insert a list item with a link to an ebook online.
|
||||||
|
s(
|
||||||
|
{
|
||||||
|
trig = "eli",
|
||||||
|
name = "List item for an ebook link",
|
||||||
|
dscr = "Insert a link for an ebook nested in a list item. Designed for the medicine portal HTML structure."
|
||||||
|
},
|
||||||
|
fmt(
|
||||||
|
[[
|
||||||
|
<li>
|
||||||
|
<a dir="ltr"
|
||||||
|
type="html/text"
|
||||||
|
href="{1}"
|
||||||
|
lang="{2}"
|
||||||
|
hreflang="{3}"
|
||||||
|
ref="nofollow"
|
||||||
|
target="_blank">
|
||||||
|
Livre électronique en ligne
|
||||||
|
</a>.
|
||||||
|
</li>
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
i(1, "Ebook URL"),
|
||||||
|
i(2, "Language code (2 chars)"),
|
||||||
|
i(3, "Language name")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
|
@ -0,0 +1,172 @@
|
||||||
|
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 = "dt",
|
||||||
|
name = "Datetime",
|
||||||
|
dscr = "Insert the current datetime with locale daylight saving."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
f(get_datetime, {})
|
||||||
|
}
|
||||||
|
),
|
||||||
|
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 = "ie",
|
||||||
|
Name = "Inc entry",
|
||||||
|
dscr = "Insert an Inc entry for today (heading level 2)."
|
||||||
|
},
|
||||||
|
fmt(
|
||||||
|
[[
|
||||||
|
## {}
|
||||||
|
|
||||||
|
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
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}
|
||||||
|
date: {2}
|
||||||
|
id: {4}
|
||||||
|
tags: [notes, quotidien, {3}]
|
||||||
|
---
|
||||||
|
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
f(get_month_year, {}),
|
||||||
|
f(get_datetime, {}),
|
||||||
|
f(get_month, {}),
|
||||||
|
f(get_id, {})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
|
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}
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
i(1, "Link text"),
|
||||||
|
i(2, "Reference"),
|
||||||
|
i(3, "Link target")
|
||||||
|
},
|
||||||
|
{ repeat_duplicates = true }
|
||||||
|
)
|
||||||
|
),
|
||||||
|
s(
|
||||||
|
{
|
||||||
|
trig = "tags",
|
||||||
|
name = "Tags",
|
||||||
|
dscr = "Insert a one-line tags array, in a text file (markdown)."
|
||||||
|
},
|
||||||
|
fmt(
|
||||||
|
[[
|
||||||
|
tags: [{}]
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
i(1, "tags")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
|
@ -1,2 +1,15 @@
|
||||||
AoU
|
AoU
|
||||||
Floriane
|
Floriane
|
||||||
|
Séverine
|
||||||
|
HEG
|
||||||
|
neovim
|
||||||
|
lua
|
||||||
|
InfoBiblio
|
||||||
|
Réaménagement
|
||||||
|
biodiversité
|
||||||
|
hyperindustrialisés
|
||||||
|
lacto-fermentation
|
||||||
|
d'engrain
|
||||||
|
écorcheuse
|
||||||
|
écopolitique
|
||||||
|
Centralité
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue