Unwanted Weird Autoexpansions - autocomplete

A few months ago I started using VimTeX+Ultisnips to write TeX files like in this post. I originally copied the snippet from the author's GitHub page but then made some changes on my own. However I've noticed that sometimes my Vim would trigger autoexpansions whereas the input does not define any snippet. For example, (( triggers \left( \right)<++> (with the <++> at the end), () would trigger ()<++>, EVE would trigger
\begin{verse}
\end{verse}<++>
and EAR would trigger
\left
\begin{array}{<+dimension+>}
<+elements+>
\end{array}
\right<++>
I've checked my snippets file and I don't think any of the existing snippets would trigger these weird things above. Does anyone have once had a similar experience? Sorry I still know literally nothing about Vim besides using it for LaTeX, and I'm trying my best to describe the issue. Any suggestions would be greatly appreciated. Thanks.

Related

Search files by name - Is it possible to define the ignored characters?

In VS-Code you can use cmd + p to quickly open a file.
Very often I copy a ruby class name from a stacktrace or from the code, which usually is something like MonduleName::ClassName (for example Admin::User), which by convention is located under module_name/class_name (in the example, would be admin/user.rb).
The problem is that the separator :: is not in the file path and VS-Code does not find it, so I have to
to delete those :: every time, which turns pretty annoying very quickly.
So the question here is pretty obvious, is there a way to tell VS-Code to ignore the : when performing the file search?
No, it is not possible.
I have added an issue in the VS Code project, which sounded reasonable to some maintainer, but it did not get enough upvotes from the community to be implemented and got closed/discarded.
I still miss this feature, so if somebody decides to reopen it, I would be glad to get a comment here.

How to escape symbols in GitHub-flavored markdown internal links / heading anchors?

Does anybody know how to maintain symbols in markdown internal links?
For example:
[A](#A) works fine
[A and B](#a-and-b) works fine
...whereas:
[A/B](#a-b) does not work
[A-B](#a-b) does not work
Thanks for your help!
I remember running into this problem too.
[A/B](#ab) should work, instead of using [A/B](#a-b).
A / character is considered a non-character in this case, but when it is not part of a word (ex. Movies / Shows / Videos) then it needs to be treated like an empty word:
[Movies / Shows / Videos](#movies--shows--videos)
I'm not sure how [A-B](#a-b) isn't working for you, because it should work?
I recommend checking here, every now and then, for additional information being added to the conversation around Github Markdown Heading Anchors: https://gist.github.com/asabaylus/3071099
This is also known as github-slugging or GitHub-style slugging.
After copying and pasting your code into my markdown editor, Mou, I see no issues with either statement. In fact, I copied the link as well, and it keeps the symbols you want.
Perhaps this is an issue with your version of markdown or your editor. If you are using a different flavor of markdown, like github, I'd be sure to specify that with tags as that may be your issue. Basic markdown should handle escaping characters though unless it's a bracket. If you want some helpful information, please visit this stack overflow thread: Escaping Brackets

Emacs calc minibuffer blank face---how to debug?

When running emacs calc, typing a prefix key, say 'm', followed by '?' is supposed to show all mode-related commands in the minibuffer as a kind of quick help facility.
For several years I have noticed that this quit working for me. When I hit the '?' the minibuffer flashes the help for a small fraction of a second, then goes blank. I can sometimes see parts of the help text rendered but ususally it blanks too fast to see it.
This does not happen when I run emacs -Q to skip my init file, so it is something in the init file that is the cuplprit.
My init file is quite large. I would like to put something like '(exit)' in different places in my init file to stop processing the init file and see if I can pin down what is causing the problem.
(1) What is the right way to do this?
(2) Anybody else see this problem with the minibuffer in calc?
Good question. The answer is simple: recursively bisect your init file.
Do that by commenting out 1/2 of it, then 3/4, then 7/8,... This is a binary search, and it is very quick, even though it might not seem that way at first. It is systematic, and essentially blind (thoughtless).
To comment out a block of text, use command comment-region. To uncomment a block of text, use C-u with the same command.
Trust me - in no time at all, you will have identified the culprit code, no matter how big your init file is. And if you load other libraries from your init file, and doing the exercise above shows that the culprit code is in one of those libraries, then do the same thing with (a copy of) that library code: recursively bisect it.
After several hours of trying to narrow down the problem, I found the culprit.
When key-chord-mode is set on in calc, the key help facility displays the symptoms I mentioned above.
Would like to keep key-chord enabled globally and disable it in calc-mode, but turning it off in the calc-mode-hook turns it off for all modes. Any ideas?
Anyway, I am closer to figuring out this long-term irritant.

Is there a quick way to show the code of a method declared in the Scala Console?

I frequently use the Scala console to evaluate and test code before I actually write it down in my project. If I want to know the contents of a variable, I can just enter it and scala evaluates it. But is there also a way to show the code of methods I entered?
I know there's the UP-key to show single lines, but what I was searching for is to show the whole code at once.
There's a file in your home directory named .scala_history that contains all of your recent REPL history. I regularly copy and paste code from this file into project source files. It's not exactly the same as showing the code for individual methods in the REPL, but it might help you accomplish the same goals.
See the comments by Paul Phillips in this issue for a discussion of some related functionality in the REPL (grouping statements in the history):
At some point I implemented the logic for this, but the real obstacle
is jline. It has enough trouble figuring out where the cursor is under
the simplest conditions. Start throwing big multiline blocks into the
history and it breaks down in tears. Would love to see this and
SI-2547 addressed by the community.
...
I expect to fix this soon too, but it depends on how well the recent
jline work goes. I implemented it long ago, and display issues are the
impediment.
Both of these comments are over two years old, so I wouldn't hold your breath.
I dont know a command to load all the code from command line.
What you can do is to :load path/to/my/file.scala to load some complex code and re- :load it when you changed the code in the file.

How can I compare 2 files and ignore any changes in comments?

I'm using C# and VB.NET.
I often (every days...) add comments to existing source files. When I check-in these files, I would like to have my merge tool to ignore any changes made to comments - I just want to be sure that I did not change the code.
I use WinMerge and Team Foundation Control Server (yes, no chance : Subversion was not an option when I accepted this job :o). Both of them can ignore white spaces but cannot ignore comments. Result : I have to carefully look at all the changes that I have made to each file before checking them in. And this is pretty cumbersome.
(Well, since most of my co-workers do not comment at all -- hey, they use pretty long namespace/class/methods/property/type/constant names that tell it all, guys ! -- it's a lot of work.)
Any suggestions ?
All the best,
Sylvain.
BeyondCompare has a filter for ignoring "unimportant" changes and comments belong to that category by default.
Compare++ has an option "Ignore comment changes" and "Ignore pure formatted changes" which should honor your request.
You said you used WinMerge - well it has the ability to filter out comments.
However it only works for comments that are on a separate line, so for example:
int i; // comment
will be detected as different from
int i;
It sounds like you're using commenting as a tool to understand the code as you work with it. That's an interesting idea, the equivalent of highlighting a book or taking notes. But you need to make sure you strip out all these transient comments before working with others.
Before comparing or promoting, run your source files through a filter program that strips the comment. This could be a one-liner perl script.
To make it easier, use a distinctive pattern for your non-permanent comments, to make them easier to filter out (and to distinguish between these transient comments, and comments you really want to leave in the source). E.g. if you were writing in C++, always comment using
//Sylvain: this is my comment here.
or some other pattern that is even easier to grep for.
If the content of the comments are not something you care about, and do not matter, why not delete them?
If well documented code that is readable and understandable is part of what you create, why not review changes to that meta-data?
Adding comment to your code is smell that your code is hard to read, code should be self describing, like someone has said that , good code is like good joke, it does not need to be explained. It is better to change your variable name, put section of your code into a subroutine. Re factoring is better than commenting. Even you find a tool to solve you commenting problem, it does not solve the real problem that is make you code easy to understand.