Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Setup Auto - Formatting For C++ Files In Neovim On A Mac

Turns out all I had to do was uncomment [TODO: Code shorthand span ] in the [TODO: Code shorthand span ] section of my ~/.config/nvim/init.lua file to turn on the clangd LSP. (I already had clangd installed)

I think the LSP config with the commented out clangd server was from the kickstart.nvim ks config file I'm using.

These are scratchpad notes I took while figuring things out. Leaving them here as reference.

- Installed clang - format with :

[TODO: Code shorthand span ]

- Video with clangd instead of clang - format

https : //www.youtube.com/watch?v=BCuyEdDQ5iA

this vid uses nvim - lspconfig which I already had installed

- clangd installation

https : //clangd.llvm.org/installation.html

(I already had it installed)

Reference Links To Add

- https : //github.com/neovim/nvim - lspconfig

- https : //github.com/neovim/nvim - lspconfig/wiki/Autocompletion

- https : //github.com/neovim/nvim - lspconfig/blob/master/doc/server _ configurations.md#clangd

- https : //github.com/nvim - lua/kickstart.nvim/blob/master/lua/kickstart/plugins/autoformat.lua

- https : //www.youtube.com/watch?v=BCuyEdDQ5iA

- https : //clangd.llvm.org/installation.html

- https : //github.com/sbdchd/neoformat (not what i ended up with but it was referenced a few times)

- https : //jdhao.github.io/2020/04/19/nvim _ cpp _ and _ c _ completion/ - another appraoch with different tools. This is what I was looking at first, but when I figured out I could use the LSP I went that direction

- https : //www.reddit.com/r/vim/comments/s5zjd5/formatter _ for _ c _ code _ in _ neovim/ pointers to some built - in help files for formatting, but not super useful and it doesn't use the LSP

Footnotes And References