Comments (4)
I don't know much lua or nvim plugin writing or ident detect, can we maybe just ignore access modifiers? Let say if a C++ line matches regex "^\s*(private|public|protected)\s*:\s*$", then skip this line.
from guess-indent.nvim.
Thanks for letting me know. I'm not yet sure how to best fix this issue.
I have an idea on how I could modify the heuristic, but I'm worried that it might make it worse overall.
I created a new branch with a modified heuristic which works better with the Google C++ style, though it still tails with the example you provided (it is too short).
from guess-indent.nvim.
Hey @zhongsanming, a fellow C++ Google Style Guide user here. I arrived here because of a different problem (in Neovim 0.8
without editorconfig.nvim plugin, the guess-indent.nvim
failed to respect my EditorConfig -- now solved), but here's a solution we happily use in our codebase:
just add an .editorconfig
to your root directory of the project, with approx the following content:
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
[*.{h,cpp}]
indent_style = space
indent_size = 4
AND in case you are under 0.9
version of Neovim, install gpanders/editorconfig.nvim
so the guess-indent
understands the buffer vim.b.editorconfig
variable here
guess-indent.nvim/lua/guess-indent/init.lua
Line 272 in b8ae749
After that, the guess-indent
should be good! My justification is that Google Style Guide is quite nontrivial in that part and having editorconfig
anyways helps.
from guess-indent.nvim.
@agronskiy Thank you for this nice solution, I'll give it a try.
from guess-indent.nvim.
Related Issues (11)
- Does not apply to elements in jsx or tsx files
- Feature Suggestion: also set `listchars` depending on tabs/spaces
- Turn off Notifications? HOT 5
- non-issue: readme.md: add lazy and retab keymaps
- Not detect tabs with size 4 HOT 1
- Will not automatically start the plugin. HOT 11
- Provide comparison/benchmarks against `indent-o-matic` HOT 4
- How to use GuessIndent plugin and ftplugin files ?
- Silence :GuessIndent command output? HOT 1
- User config is ignored if `auto_cmd` is set to false
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guess-indent.nvim.