Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何在写 c++ 代码时自动格式化呢? #164

Open
whitelilis opened this issue Aug 15, 2024 · 3 comments
Open

如何在写 c++ 代码时自动格式化呢? #164

whitelilis opened this issue Aug 15, 2024 · 3 comments
Assignees

Comments

@whitelilis
Copy link

whitelilis commented Aug 15, 2024

  • What's your suggestion?
    希望在写 c++ 时可以自动格式化, 而不是每次按快捷键, 或者在保存时自动格式化也行, 最好的时机感觉是在按下回车换行的时候
  • Why is better?
    可以少按好多次键盘
  • How to implement your ideas?
    应该是加个什么配置就好, 不太会
@Martins3
Copy link
Owner

这个功能可以实现的,我研究下

@whitelilis
Copy link
Author

vim.api.nvim_create_autocmd("InsertLeave", {
callback = function()
print("me called")
vim.lsp.buf.format()
end
})

我写了个在从 insert mode 离开地做这个事的. 现在差判断这个事件

@Martins3
Copy link
Owner

研究了下, 似乎不容易,测试了好几种方法,都没有成功。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants