Skip to content

Commit

Permalink
added html snippet, and better filedetection
Browse files Browse the repository at this point in the history
  • Loading branch information
nicvagn committed Sep 15, 2024
1 parent e7b0c31 commit d7561f2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
5 changes: 0 additions & 5 deletions ftdetect/html.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,3 @@ vim.api.nvim_create_autocmd("BufWinEnter", {
pattern = "*.html",
command = "setlocal syntax=html tabstop=2 shiftwidth=2 softtabstop=2",
})

vim.api.nvim_create_autocmd("BufNewFile", {
pattern = "*.html",
command = "silent! 1s:.*:<!doctype html>",
})
5 changes: 1 addition & 4 deletions ftdetect/ino.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
vim.api.nvim_create_autocmd("BufNewFile", {
pattern = "*.ino",
callback = function()
vim.cmd([[setlocal shiftwidth=2
"setlocal tabstop=2")]])
end,
command = "setlocal syntax=css tabstop=2 shiftwidth=2 softtabstop=2",
})
5 changes: 1 addition & 4 deletions ftdetect/ts.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
vim.api.nvim_create_autocmd("BufReadPre", {
pattern = "*.ts",
callback = function()
vim.cmd([[setlocal shiftwidth=2
"setlocal tabstop=2")]])
end,
command = "setlocal syntax=css tabstop=2 shiftwidth=2 softtabstop=2",
})
30 changes: 30 additions & 0 deletions snippets/html.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
local env = LUASNIP_ENV -- global variable declared in `lua/plugins/luasnip.lua`
if env == nil then
return
end

return {
env.s(
"html",
env.fmt(
[[<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>HTML5 Boilerplate</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Page Title</h1>
<script src="scripts.js"></script>
</body>
</html>
]],
{}
)
),
}

0 comments on commit d7561f2

Please sign in to comment.