From 26123d2f83b79e0a41acb78f166eef7a9e3a53fb Mon Sep 17 00:00:00 2001 From: CharlesChiuGit Date: Sun, 7 Jul 2024 23:17:30 +0800 Subject: [PATCH] perf(filetype): update filetype config --- after/ftplugin/c.lua | 16 +++++++++------- after/ftplugin/cpp.lua | 12 +++++++----- after/ftplugin/dockerfile.lua | 12 +++++++----- after/ftplugin/go.lua | 12 +++++++----- after/ftplugin/json.lua | 18 ++++++++++-------- after/ftplugin/jsonc.lua | 18 ++++++++++-------- after/ftplugin/make.lua | 10 ++++++---- after/ftplugin/markdown.lua | 7 +++++++ after/ftplugin/python.lua | 20 +++++++++++--------- after/ftplugin/rust.lua | 16 +++++++++------- lua/core/event.lua | 1 - 11 files changed, 83 insertions(+), 59 deletions(-) create mode 100644 after/ftplugin/markdown.lua diff --git a/after/ftplugin/c.lua b/after/ftplugin/c.lua index 5a2c2256..68e7ae52 100644 --- a/after/ftplugin/c.lua +++ b/after/ftplugin/c.lua @@ -1,7 +1,9 @@ -vim.opt_local.commentstring = "//%s" -vim.opt_local.autoindent = true -vim.opt_local.smartindent = true -vim.opt_local.shiftwidth = 2 -vim.opt_local.softtabstop = 2 -vim.opt_local.tabstop = 2 -vim.opt_local.expandtab = true +local set = vim.opt_local + +set.commentstring = "//%s" +set.autoindent = true +set.smartindent = true +set.shiftwidth = 2 +set.softtabstop = 2 +set.tabstop = 2 +set.expandtab = true diff --git a/after/ftplugin/cpp.lua b/after/ftplugin/cpp.lua index f64b0cb4..e6698c1f 100644 --- a/after/ftplugin/cpp.lua +++ b/after/ftplugin/cpp.lua @@ -1,5 +1,7 @@ -vim.opt_local.commentstring = "//%s" -vim.opt_local.expandtab = true -vim.opt_local.shiftwidth = 2 -vim.opt_local.softtabstop = 2 -vim.opt_local.tabstop = 2 +local set = vim.opt_local + +set.commentstring = "//%s" +set.expandtab = true +set.shiftwidth = 2 +set.softtabstop = 2 +set.tabstop = 2 diff --git a/after/ftplugin/dockerfile.lua b/after/ftplugin/dockerfile.lua index bbe6a03a..d9a4d327 100644 --- a/after/ftplugin/dockerfile.lua +++ b/after/ftplugin/dockerfile.lua @@ -1,5 +1,7 @@ -vim.opt_local.cindent = false -vim.opt_local.expandtab = false -vim.opt_local.shiftwidth = 2 -vim.opt_local.softtabstop = 2 -vim.opt_local.tabstop = 2 +local set = vim.opt_local + +set.cindent = false +set.expandtab = false +set.shiftwidth = 2 +set.softtabstop = 2 +set.tabstop = 2 diff --git a/after/ftplugin/go.lua b/after/ftplugin/go.lua index ab3d1674..70497b49 100644 --- a/after/ftplugin/go.lua +++ b/after/ftplugin/go.lua @@ -1,5 +1,7 @@ -vim.opt_local.commentstring = "//%s" -vim.opt_local.expandtab = false -vim.opt_local.shiftwidth = 4 -vim.opt_local.softtabstop = 4 -vim.opt_local.tabstop = 4 +local set = vim.opt_local + +set.commentstring = "//%s" +set.expandtab = false +set.shiftwidth = 4 +set.softtabstop = 4 +set.tabstop = 4 diff --git a/after/ftplugin/json.lua b/after/ftplugin/json.lua index 3c957d8b..5029e5bb 100644 --- a/after/ftplugin/json.lua +++ b/after/ftplugin/json.lua @@ -1,8 +1,10 @@ -vim.opt_local.autoindent = true -vim.opt_local.conceallevel = 0 -vim.opt_local.expandtab = true -vim.opt_local.foldmethod = "syntax" -vim.opt_local.formatoptions = "tcq2l" -vim.opt_local.shiftwidth = 4 -vim.opt_local.softtabstop = 4 -vim.opt_local.tabstop = 8 +local set = vim.opt_local + +set.autoindent = true +set.conceallevel = 0 +set.expandtab = true +set.foldmethod = "syntax" +set.formatoptions = "tcq2l" +set.shiftwidth = 4 +set.softtabstop = 4 +set.tabstop = 8 diff --git a/after/ftplugin/jsonc.lua b/after/ftplugin/jsonc.lua index 4a27ffc6..f9de9e52 100644 --- a/after/ftplugin/jsonc.lua +++ b/after/ftplugin/jsonc.lua @@ -1,8 +1,10 @@ -vim.opt_local.autoindent = true -vim.opt_local.conceallevel = 0 -vim.opt_local.expandtab = true -vim.opt_local.foldmethod = "syntax" -vim.opt_local.formatoptions = "tcq2l" -vim.opt_local.shiftwidth = 2 -vim.opt_local.softtabstop = 2 -vim.opt_local.tabstop = 4 +local set = vim.opt_local + +set.autoindent = true +set.conceallevel = 0 +set.expandtab = true +set.foldmethod = "syntax" +set.formatoptions = "tcq2l" +set.shiftwidth = 2 +set.softtabstop = 2 +set.tabstop = 4 diff --git a/after/ftplugin/make.lua b/after/ftplugin/make.lua index 0c7aed3c..7f2f2480 100644 --- a/after/ftplugin/make.lua +++ b/after/ftplugin/make.lua @@ -1,4 +1,6 @@ -vim.opt_local.expandtab = false -vim.opt_local.shiftwidth = 2 -vim.opt_local.softtabstop = 2 -vim.opt_local.tabstop = 2 +local set = vim.opt_local + +set.expandtab = false +set.shiftwidth = 2 +set.softtabstop = 2 +set.tabstop = 2 diff --git a/after/ftplugin/markdown.lua b/after/ftplugin/markdown.lua new file mode 100644 index 00000000..2628465f --- /dev/null +++ b/after/ftplugin/markdown.lua @@ -0,0 +1,7 @@ +local set = vim.opt_local + +set.cindent = true +set.expandtab = true +set.shiftwidth = 2 +set.softtabstop = 2 +set.tabstop = 2 diff --git a/after/ftplugin/python.lua b/after/ftplugin/python.lua index 3e5a0282..ffbe42db 100644 --- a/after/ftplugin/python.lua +++ b/after/ftplugin/python.lua @@ -1,9 +1,11 @@ -vim.opt_local.autoindent = true -vim.opt_local.cindent = true -vim.opt_local.copyindent = true -vim.opt_local.expandtab = true -vim.opt_local.smartindent = true -vim.opt_local.shiftwidth = 4 -vim.opt_local.smarttab = true -vim.opt_local.softtabstop = 4 -vim.opt_local.tabstop = 8 +local set = vim.opt_local + +set.autoindent = true +set.cindent = true +set.copyindent = true +set.expandtab = true +set.smartindent = true +set.shiftwidth = 4 +set.smarttab = true +set.softtabstop = 4 +set.tabstop = 8 diff --git a/after/ftplugin/rust.lua b/after/ftplugin/rust.lua index 0cd8403f..df53af33 100644 --- a/after/ftplugin/rust.lua +++ b/after/ftplugin/rust.lua @@ -1,7 +1,9 @@ -vim.opt_local.commentstring = "//%s" -vim.opt_local.shiftwidth = 4 -vim.opt_local.softtabstop = 4 -vim.opt_local.smartindent = true -vim.opt_local.tabstop = 4 -vim.opt_local.cindent = false -vim.opt_local.expandtab = true +local set = vim.opt_local + +set.commentstring = "//%s" +set.shiftwidth = 4 +set.softtabstop = 4 +set.smartindent = true +set.tabstop = 4 +set.cindent = false +set.expandtab = true diff --git a/lua/core/event.lua b/lua/core/event.lua index af3f87f4..d17bdfe8 100644 --- a/lua/core/event.lua +++ b/lua/core/event.lua @@ -133,7 +133,6 @@ function autocmd.load_autocmds() ft = { { "FileType", "*", "setlocal formatoptions-=cro" }, { "FileType", "alpha", "setlocal showtabline=0" }, - { "FileType", "markdown", "setlocal wrap shiftwidth=2 tabstop=2" }, { "FileType", "dap-repl", "lua require('dap.ext.autocompl').attach()" }, { "FileType",