-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(LazyVim): introduce global clang-format config
I use the .clang-format file of the linux kernel repo, and put it directly into home. This affects both clang-format and clangd. It affects the lazyvim lang.clangd extra and my user level lang.opencl extra. Though for OpenCl I explicitly specified the the format file with the --style flag.
- Loading branch information
Botond Kalocsai
committed
May 13, 2024
1 parent
e198d7d
commit f1e90df
Showing
2 changed files
with
48 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
".clang-format": { | ||
"type": "file", | ||
"url": "https://raw.githubusercontent.com/torvalds/linux/master/.clang-format", | ||
"refreshPeriod": "168h" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,47 @@ | ||
return { | ||
{ | ||
"brgmnn/vim-opencl", | ||
}, -- NOTE: Contains OpenCL file detection autocommand | ||
{ | ||
"neovim/nvim-lspconfig", | ||
opts = { | ||
setup = { | ||
opencl_ls = function() | ||
require("lspconfig").opencl_ls.setup({}) | ||
end, | ||
if not vim.g.vscode then | ||
local psep = package.config:sub(1, 1) -- Directory path separator on platform | ||
|
||
return { | ||
{ | ||
"brgmnn/vim-opencl", -- For syntax highlighting | ||
lazy = false, | ||
}, -- NOTE: Contains OpenCL file detection autocommand | ||
{ | ||
"neovim/nvim-lspconfig", | ||
opts = { | ||
setup = { | ||
opencl_ls = function() | ||
require("lspconfig").opencl_ls.setup({}) | ||
end, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
"williamboman/mason.nvim", | ||
opts = function(_, opts) | ||
table.insert(opts.ensure_installed, "clang-format") | ||
end, | ||
}, | ||
{ | ||
"stevearc/conform.nvim", | ||
opts = { | ||
formatters_by_ft = { | ||
["opencl"] = { "clang-format" }, | ||
}, | ||
formatters = { | ||
["clang-format"] = { | ||
args = { | ||
"--style={BasedOnStyle: chromium, IndentWidth: 8}", | ||
{ | ||
"williamboman/mason.nvim", | ||
opts = function(_, opts) | ||
table.insert(opts.ensure_installed, "clang-format") | ||
end, | ||
}, | ||
{ | ||
"stevearc/conform.nvim", | ||
opts = { | ||
formatters_by_ft = { | ||
["opencl"] = { "clang-format" }, | ||
}, | ||
formatters = { | ||
["clang-format"] = { | ||
args = { | ||
"--fallback-style=Chromium", | ||
"--style=file:" | ||
.. vim.env.HOME | ||
.. psep | ||
.. ".clang-format", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
} | ||
else | ||
return {} | ||
end |