parent
1c1eb68233
commit
9b4f4b2a7b
|
@ -39,11 +39,13 @@ end
|
||||||
local javascript = make(R "opdavies.snippets.ft.javascript")
|
local javascript = make(R "opdavies.snippets.ft.javascript")
|
||||||
local markdown = make(R "opdavies.snippets.ft.markdown")
|
local markdown = make(R "opdavies.snippets.ft.markdown")
|
||||||
local php = make(R "opdavies.snippets.ft.php")
|
local php = make(R "opdavies.snippets.ft.php")
|
||||||
|
local rst = make(R "opdavies.snippets.ft.rst")
|
||||||
|
|
||||||
local snippets = {
|
local snippets = {
|
||||||
js = javascript,
|
js = javascript,
|
||||||
markdown = markdown,
|
markdown = markdown,
|
||||||
php = php,
|
php = php,
|
||||||
|
rst = rst,
|
||||||
typescript = javascript,
|
typescript = javascript,
|
||||||
vue = javascript,
|
vue = javascript,
|
||||||
}
|
}
|
||||||
|
|
22
roles/neovim/files/lua/opdavies/snippets/ft/rst.lua
Normal file
22
roles/neovim/files/lua/opdavies/snippets/ft/rst.lua
Normal 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
|
Loading…
Reference in a new issue