chore: minor changes

This commit is contained in:
Kristofers Solo
2024-03-09 14:57:04 +02:00
parent 61b013792e
commit c9cf36710c
22 changed files with 258 additions and 31 deletions

3
after/ftplugin/c.lua Normal file
View File

@@ -0,0 +1,3 @@
vim.opt_local.tabstop = 4
vim.opt_local.shiftwidth = 4
vim.opt_local.softtabstop = 4

View File

@@ -0,0 +1,3 @@
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2

61
after/plugin/snips/c.lua Normal file
View File

@@ -0,0 +1,61 @@
if not pcall(require, "luasnip") then
return
end
local ls = require("luasnip")
local s = ls.snippet
local i = ls.insert_node
local f = ls.function_node
local fmt = require("luasnip.extras.fmt").fmt
local shared = require("solo.snips")
local same = shared.same
local year = shared.year
local date = shared.date
ls.add_snippets("c", {
s(
"auth",
fmt(
[[
// Copyright {}
// Author - Kristiāns Francis Cagulis, kc22015
// {}
// Created: {}
]],
{
year(),
i(1),
date(),
}
)
),
s(
"fn",
fmt(
[[
// {};
// Funkcija {}({}) -
// {}
{} {{
}}
]],
{
same(1),
f(function(function_name)
if not function_name[1][1] then
function_name[1][1] = ""
end
local words = {}
for word in function_name[1][1]:gmatch("%w+") do
table.insert(words, word)
end
return words[2] or ""
end, { 1 }),
i(2),
i(0),
i(1),
}
)
),
})