4coder»Forums
Jeremiah Goerdt
208 posts / 1 project
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
[Feature Request] - Vim-like Text Objects
Edited by Jeremiah Goerdt on Reason: add link to article for reference
Simple text objects can be characters, words, lines, paragraphs, etc. When it comes to code, things can get a bit more interesting with things like (), [], {}, "", etc. When I learned about how to deal with thise in vim, it completely changed how I worked.

Maybe 4coder can have some baked in text objects, we can define our own in the custom file, or at the least we can have an easy way to detect these "bookends" so that we can modify code inbetween?

As always, lemme know if I'm missing something that we can already do. I've only been poking around with 4coder for a couple days now.

P.S. Skimming this short article can give you a better idea of what I mean by text objects.
Allen Webster
476 posts / 6 projects
Heyo
[Feature Request] - Vim-like Text Objects
I'm not going to build anything like this into the core, but all the tools for creating the concept of text objects are available in the customization API anyway. At some point I will invest a serious amount of time making the provided customization starter code awesome, and at that point I'll not only have text objects but I'll make a vim layer (or I'll probably just use ChronalDragon's).
Jeremiah Goerdt
208 posts / 1 project
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
[Feature Request] - Vim-like Text Objects
While trying to implement something like this myself, I'm struggling to figure out good ways to use the seek functions to get the cursor and marker it the right places.

If I wanted to do something like seek left and right for a '"' or a '(', how would I go about doing that?
Allen Webster
476 posts / 6 projects
Heyo
[Feature Request] - Vim-like Text Objects
In "4coder_default_include.cpp" look for buffer_seek_delimiter_forward/backward functions. They will help with seeking for a specific character. If you read how their streaming code works and understand it you can write more complex seeks of any kind.