feat(nvim): add rst snippets

Refs: #23
This commit is contained in:
Oliver Davies 2022-01-12 13:42:33 +00:00
parent 1c1eb68233
commit 9b4f4b2a7b
2 changed files with 24 additions and 0 deletions

View file

@ -39,11 +39,13 @@ end
local javascript = make(R "opdavies.snippets.ft.javascript")
local markdown = make(R "opdavies.snippets.ft.markdown")
local php = make(R "opdavies.snippets.ft.php")
local rst = make(R "opdavies.snippets.ft.rst")
local snippets = {
js = javascript,
markdown = markdown,
php = php,
rst = rst,
typescript = javascript,
vue = javascript,
}

View file

@ -0,0 +1,22 @@
local ls = require "luasnip"
local i = ls.insert_node
local f = ls.function_node
local fill_line = function(char)
return function()
local row = vim.api.nvim_win_get_cursor(0)[1]
local lines = vim.api.nvim_buf_get_lines(0, row - 2, row, false)
return string.rep(char, #lines[1])
end
end
local M = {
link = { ".. _", i(1), ":" },
head = f(fill_line "=", {}),
sub = f(fill_line "-", {}),
subsub = f(fill_line "^", {}),
}
return M