aboutsummaryrefslogtreecommitdiff
path: root/.nvim.lua
diff options
context:
space:
mode:
authorDenis Chevalier <perso@denischevalier.fr>2026-08-11 01:35:01 +0200
committerDenis Chevalier <perso@denischevalier.fr>2026-08-11 01:35:01 +0200
commitd7621adc4bbbf7f9779f5cf33ee95dbc31d92ecd (patch)
tree47e56e8ca69a970364bdabd89ac4bba8c40d46e9 /.nvim.lua
parent8838b1b39ba61d3359909d0586bfe939bf716be0 (diff)
downloadsame-d7621adc4bbbf7f9779f5cf33ee95dbc31d92ecd.tar.gz
same-d7621adc4bbbf7f9779f5cf33ee95dbc31d92ecd.tar.bz2
same-d7621adc4bbbf7f9779f5cf33ee95dbc31d92ecd.zip
Add a nvim local config to automatically insert relevant license information on new typ files
Diffstat (limited to '.nvim.lua')
-rw-r--r--.nvim.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/.nvim.lua b/.nvim.lua
new file mode 100644
index 0000000..e87b017
--- /dev/null
+++ b/.nvim.lua
@@ -0,0 +1,32 @@
+local spdx_header = {
+ "// SAME Analog Modular Ecosystem",
+ "//",
+ "// / SPDX-FileCopyrightText: 2026 Denis Chevalier <perso@denischevalier.fr>",
+ "// / SPDX-License-Identifier: CC-BY-SA-4.0",
+ "// / SPDX-License-Identifier: CERN-OHL-S-2.0+",
+ "// / SPDX-License-Identifier: GPL-3.0-or-later",
+ "//",
+ "// The prose, explanatory text, rendered figures, tables, and mathematical",
+ "// content of this specification are licensed under CC BY-SA 4.0. If a later",
+ "// version of CC BY-SA is published, the author grants permission to distribute",
+ "// this work under that later version as well.",
+ "//",
+ "// Hardware designs contained herein (schematics, PCB layouts, mechanical",
+ "// drawings, and CAD models) are licensed under CERN-OHL-S-2.0+.",
+ "//",
+ "// All executable code, helper libraries (`lib/*`), metrology assertions, and",
+ "// embedded verification scripts throughout the source documents are licensed",
+ "// under the GNU General Public License v3.0 or later (GPL-3.0-or-later).",
+ "",
+ "",
+}
+
+vim.api.nvim_create_autocmd("BufNewFile", {
+ pattern = "*.typ",
+ callback = function(args)
+ -- Insert header into new file
+ vim.api.nvim_buf_set_lines(args.buf, 0, -1, false, spdx_header)
+ -- Move cursor to the line below the header
+ vim.api.nvim_win_set_cursor(0, { #spdx_header, 0 })
+ end,
+})