Comments (5)
Fixed in #76. Thanks again!
And regarding your last comment, yes you're right, the context itself could definitely be smarter if it were implemented in a language specific way. But so far I opted for a general purpose approach and I'm hoping that it's going to be good enough 🤞
from context.vim.
Thank you! Do you want to open a PR to remove it?
from context.vim.
You please go ahead and fix this as part of your next planned release. Thank you so much for your great work. I use targets too.
May I know the reason why you wanted to skip the pre-processor directives in C code? IMO they add a lot of value to the context.
from context.vim.
Thanks, will do 👍
May I know the reason why you wanted to skip the pre-processor directives in C code? IMO they add a lot of value to the context.
Sure. The context currently works based on indentation. Because the pre-processor directives often have zero indentation that means that the context will effectively have no more context lines above. A bit hard to explain, here's an example. Consider this code: https://gist.github.com/wellle/981686e250e6bc1851b78fbcc6dc6b3a#file-v-c-L126
Currently the context of the highlighted line is
find_some_match(argvars, rettv, type) ··· {
if (regmatch.regprog != NULL) {
for (;;) {
if (l != NULL) { ··· }
else {
If I update the skip regex to effectively allow the #
lines, then the context looks like this:
#ifdef FEAT_MBYTE
It might be possible to come up with more complex logic to allow both pre-processor directives and retain the full context from above, but that would be a lot of extra work. For now I had just decided to exclude those lines, as in my example above the result seems more useful. Hope that makes sense.
from context.vim.
Got it. I updated the skip regex to allow the # and I see the same behavior as you mentioned. I wasnt aware that the context update is heavily relying upon the indentation. I was thinking more in terms of C code only not in a generic way.
If this was made to work only with C, may be we can rely only on keywords + braces etc regex and not on indentation. Am I right here?
from context.vim.
Related Issues (20)
- remove <context.vim> in the upper right corner HOT 3
- Can't install with Pathogen HOT 2
- 【E28 No highlight group name:Comment】
- Auto commands are not disabled by g:context_filetype_blacklist
- Support getting context of topmost line (regardless of cursor position) HOT 2
- Slow scrolling in perl files HOT 5
- Add name to filetype so it can be ignored by other plugins more easily
- Bug: When in select/selection mode it will jump back into normal mode
- Opens a [Scratch] window when using CtrlP or NerdTree
- [Feature Request] Return the number of lines context.vim would take if the user was to press `zt` HOT 4
- stray background text not painted over in the context window when scrolling with Ctrl+D
- Context doesn't update when switching buffers with fzf.vim HOT 1
- [Question] is there a way to show a "header" when the matched line is a single `{`
- Feature request: syntax highlighting in context lines
- refreshing the file with `:e` raises error in file with modeline
- context.vim doesn't play nice with coc diagnostic window HOT 1
- Conflict with nvim-notify
- C preprocessor handling
- The separator line keep visible when context is toggle off HOT 3
- Cursor moves become laggy when navigating inside massive of comments
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 context.vim.