Is there a way to Include underscores when using word movements (<e>, <b>, <w>) VSCode VIM? - visual-studio-code

I am always frustrated when using move keys such as e, b or w in python variables or strings that are separated with underscores, due to the fact, that instead of stopping in the last/next underscore, it stops and the start/end of the string/variable
Is there a way to Include underscores when using word movements (e, b, w)?

Related

How to add a vector notation above a variable name composed of multiple characters?

In Julia it is possible to add Unicode characters with LaTeX like syntax. All allowed unicode characters can be found here. For example, it is possible to add a right arrow over a character with this simple code
F\vec[TAB]
and it produces the following character
But I couldn't find a syntax to add the same right arrow over a whole word as \vec seems to always add the arrow over the previous character and does not allow to group them. For example
force\vec[TAB]
produces
Does the syntax for this feature exists ?

How to insert breakpoint using symbols include "<>" (angle brackets)

I want to insert a breakpoint in windbg, using symbols named "TSmartPointer::TSmartPointer".
bp TSmartPointer<class CDataMemberMgr>::TSmartPointer<class CDataMemberMgr>
WinDbg noticed me that no symbols were found.
I use command x to search symbol, but also no symbols are found:
x TSmartPointer<class CDataMemberMgr>::TSmartPointer<class CDataMemberMgr>
When I replace "<" and ">" to "*", WinDbg can find symbols:
x TSmartPointer*class CDataMemberMgr*::TSmartPointer*class CDataMemberMgr*
Am I wrong? How can I insert this breakpoint?
I could not find this in WinDbg's internal help, but in Microsoft documentation, which makes me wonder a bit about the spaces as well
To set a breakpoint on complicated functions, including functions that contain spaces, as well as a member of a C++ public class, enclose the expression in parentheses. For example, use bp (??MyPublic) or bp (operator new).
Furthermore, it explicitly talks about angle brackets:
You must start with the three symbols #!" and end with a quotation mark ("). Without this syntax, you cannot use spaces, angle brackets (<, >), or other special characters in symbol names in the MASM evaluator.
(emphasis mine)
So, in your case, the following should work:
bp #!"TSmartPointer<class CDataMemberMgr>::TSmartPointer<class CDataMemberMgr>"
The quotation marks should care about the spaces as well.
And to make a comment of #Kurt Hutchinson persistent:
For template classes, it's important to use the exact spacing and angle bracket placement that Windbg wants. Sometimes there will be an extra space in there that is significant. You can tell what it should be by doing a symbol lookup first like x MSHTML!TSmartPointer*CDataMemberMgr*. Windbg should do a wildcard match and print out a bunch of symbol names. Then you should copy and paste the correct name from that list, using the #!"..." quoting. Don't try to retype the symbol name yourself because spaces matter and if you miss one, Windbg won't match it correctly.

How to use a multiset? (guava)

Is it possible to use a Multiset for the purpose of counting letter frequencies of the first letter in a word. Those words exist in a list.
example. [the, quick, brown, fox, jumped, over, the, lazy, dog]
Output: most common first character: [t, q, b, f, j, o, l, d]
Output: Most common first character ignoring word frequency: [t]
I just started researching how to use guava solutions.
You'd just need to create a Multiset<Character>, then iterate over the words and add their first character to your multiset (note: there are i18n issues with this, as a general thing). You could either keep track of the most common character as you go or iterate over the multiset later to get it.

Weird characters in a Microsoft Word document won't export/can't be searched

I have a document which has been sloppily authored. It's a dictionary that contains cyrillic characters. Most of the dictionary is manageable, but I'm stuck with one thing I need help with. Words have accented letters in them and they're mostly formatted properly as a letter with a unicode accent (thus forming a single letter). However there are some very peculiar letters that look similar for example to: a;´ (where "a" is any arbitrary cyrillic letter). You'd expect á in its place. However it wouldn't be a problem per se if only this thing could be exported to, say HTML and manipulated in a text editor. The problem is that Word treats this "thing" as a single character/entity and
when exporting it is COMPLETELY omitted
when copied it can only be pasted into Notepad (which translates it into three separate characters), when being pasted into WordPad it just won't appear at all.
when a search is run in Word it won't find the letter, neither the actual character nor the exactly copied/pasted combination.
the letter will disappear when the document is opened in any other software, such as Libre Office
At this point I'm trying to:
understand what this combination is exactly
run a search/replace operation to find and weed out all of those errors
Here's a sample Word file.
Here's a screenshot of the word/letter in question:
which when typed correctly should appear like "скре́пка".
The 'character' appears to be a Word field of type 'eq' (equation). Here is the field with toggled field codes:
If it is a large document you could try to create a VBA routine that removes the fields and replaces them with corresponding characters.
Assuming that #Anonimista’s analysis is correct, as I think it is, you could fix the file by running some search and replace operations in Word, replacing e.g. ^19eq \o(е;´)^21 by е́ (the latter is Cyrillic letter е followed by combining acute accent U+0301). This is dull because you would need to do this for each vowel separately (and for uppercase vowels too). But I cannot find a way to use wildcards in this context; the codes ^19 and ^21 for start and end of field work only when wildcards are not enabled.

Is it possible to change an emacs syntax table based on context?

I'm working on improving an emacs major mode for UnrealScript. One of the (many) quirks is that it allows syntax like this for specifying tooltips in the Unreal editor:
var() int MyEditorVar <Foo=Bar|Tooltip=My tooltip text isn't quoted>;
The angle brackets after the variable declaration denote a pipe-separated list of Key=Value metadata pairs, and the metadata is not quoted but can contain quote marks -- a pipe (|) or right angle bracket (>) denotes the end.
Is there a way I can get the emacs syntax table to recognize this context-dependent syntax in a useful way? I'd like everything except for pipes and right angle brackets to be highlighted in some way inside of these variable metadata declarations, but otherwise retain their normal highlighting.
Right now, the single quote character is set up to be a quote delimiter (syntax designator "), so font-lock-mode interprets such a quote as starting a quoted string, which it's not in this very specific instance, so it mishighlights everything until it finds another supposedly matching single quote.
You'll need to setup a syntax-propertize-function which lets you apply different syntax designators to different characters in the buffer, depending on their context.
Grep for syntax-propertize-function in Emacs's lisp directory to see various examples (from simple to pretty complex ones).
You'll probably want to mark the "=" chars after your "Foo" and after your "Tooltip" as "generic string delimiter", then do the same with the corresponding terminating "|" and ">". An alternative could be to mark the char before the ">" as a (closing) generic string delimiter, so that you can then mark the "<" and ">" as open&close parens.