summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ftplugin/c.lua10
-rw-r--r--lua/default-config.lua3
-rw-r--r--utils/installer/lv-config.example.lua6
3 files changed, 18 insertions, 1 deletions
diff --git a/ftplugin/c.lua b/ftplugin/c.lua
index 8a7ef9fd..d5436315 100644
--- a/ftplugin/c.lua
+++ b/ftplugin/c.lua
@@ -19,3 +19,13 @@ require'lspconfig'.clangd.setup {
})
}
}
+
+if O.lang.clang.autoformat then
+ require('lv-utils').define_augroups({
+ _clang_autoformat = {
+ {
+ 'BufWritePre *.cpp lua vim.lsp.buf.formatting_sync(nil,1000)'
+
+ }
+ } })
+end
diff --git a/lua/default-config.lua b/lua/default-config.lua
index 83ff1cc2..7a26f242 100644
--- a/lua/default-config.lua
+++ b/lua/default-config.lua
@@ -150,7 +150,8 @@ O = {
underline = true,
},
cross_file_rename = true,
- header_insertion = 'never'
+ header_insertion = 'never',
+ autoformat = false -- update this to true for enabling autoformat
},
ruby = {
diagnostics = {
diff --git a/utils/installer/lv-config.example.lua b/utils/installer/lv-config.example.lua
index c90d4876..f71ad561 100644
--- a/utils/installer/lv-config.example.lua
+++ b/utils/installer/lv-config.example.lua
@@ -83,6 +83,12 @@ O.lang.go.autoformat = true
-- rust
O.lang.rust.autoformat = true
+
+-- clang
+O.lang.clang.autoformat = false -- Set to true to enable auto-format in C/C++ files.
+
+
+
-- create custom autocommand field (This would be easy with lua)
-- Turn off relative_numbers