From 63f1e21d67805d352fabd01563dc0b7a3bda9cfb Mon Sep 17 00:00:00 2001 From: anth64 Date: Sun, 25 Oct 2026 13:27:57 +0100 Subject: [PATCH] refactor: move filetype settings to ftplugin/ --- filetypes.lua | 8 -------- ftplugin/csharp.lua | 1 + ftplugin/html.lua | 1 + ftplugin/java.lua | 1 + ftplugin/javascript.lua | 1 + ftplugin/json.lua | 1 + ftplugin/lua.lua | 1 + test.cpp | 7 +++++++ visrc.lua | 7 ++++++- 9 files changed, 19 insertions(+), 9 deletions(-) delete mode 100644 filetypes.lua create mode 100644 ftplugin/csharp.lua create mode 100644 ftplugin/html.lua create mode 100644 ftplugin/java.lua create mode 100644 ftplugin/javascript.lua create mode 100644 ftplugin/json.lua create mode 100644 ftplugin/lua.lua create mode 100644 test.cpp diff --git a/filetypes.lua b/filetypes.lua deleted file mode 100644 index c98d15b..0000000 --- a/filetypes.lua +++ /dev/null @@ -1,8 +0,0 @@ -settings = { - csharp = { "set expandtab on", "set tabwidth 4" }, - html = { "set expandtab on", "set tabwidth 2" }, - java = { "set expandtab on", "set tabwidth 4" }, - javascript = { "set expandtab on", "set tabwidth 2" }, - json = { "set expandtab on", "set tabwidth 4" }, - lua = { "set expandtab on", "set tabwidth 2" }, -} diff --git a/ftplugin/csharp.lua b/ftplugin/csharp.lua new file mode 100644 index 0000000..6606b1d --- /dev/null +++ b/ftplugin/csharp.lua @@ -0,0 +1 @@ +return { "set expandtab on", "set tabwidth 4" } diff --git a/ftplugin/html.lua b/ftplugin/html.lua new file mode 100644 index 0000000..473066c --- /dev/null +++ b/ftplugin/html.lua @@ -0,0 +1 @@ +return { "set expandtab on", "set tabwidth 2" } diff --git a/ftplugin/java.lua b/ftplugin/java.lua new file mode 100644 index 0000000..6606b1d --- /dev/null +++ b/ftplugin/java.lua @@ -0,0 +1 @@ +return { "set expandtab on", "set tabwidth 4" } diff --git a/ftplugin/javascript.lua b/ftplugin/javascript.lua new file mode 100644 index 0000000..473066c --- /dev/null +++ b/ftplugin/javascript.lua @@ -0,0 +1 @@ +return { "set expandtab on", "set tabwidth 2" } diff --git a/ftplugin/json.lua b/ftplugin/json.lua new file mode 100644 index 0000000..6606b1d --- /dev/null +++ b/ftplugin/json.lua @@ -0,0 +1 @@ +return { "set expandtab on", "set tabwidth 4" } diff --git a/ftplugin/lua.lua b/ftplugin/lua.lua new file mode 100644 index 0000000..473066c --- /dev/null +++ b/ftplugin/lua.lua @@ -0,0 +1 @@ +return { "set expandtab on", "set tabwidth 2" } diff --git a/test.cpp b/test.cpp new file mode 100644 index 0000000..8fe2613 --- /dev/null +++ b/test.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + std::cout << "hello, world" << std::endl; + return 0; +} diff --git a/visrc.lua b/visrc.lua index 3b29405..3b161b9 100644 --- a/visrc.lua +++ b/visrc.lua @@ -17,7 +17,12 @@ plug.plugins.lspc.message_level = 2 require("set") require("remap") -require("filetypes") + +local filetypes = { "csharp", "html", "java", "javascript", "json", "lua" } +settings = {} +for _, syntax in ipairs(filetypes) do + settings[syntax] = require("ftplugin/" .. syntax) +end local servers = { "csharp",