How can I prevent AutoHotkey hotstrings after an underscore character? - autohotkey

If I was Bill Gates, I would use this AutoHotkey script to convert my initials into my full name:
::bg::Bill Gates
I would be happy that typing Regards, bg would actually print "Regards, Bill Gates", but I could still successfully type hobgoblin without having "hoBill Gatesoblin" appear. Nice!
Now, when revising an MS Word (of course!) document, I would probably still not like to use OneDrive, so I would create a copy of the document and suffix the filename with _BG. I would that to remain a short "_BG", and I would go crazy if that would always turn out to be converted into "_Bill Gates", because spaces in filenames are still something to avoid.
What could I do, except type awkward walkarounds such as _B(arrowleft)(arrowright)G or _BG(arrowleft)(return)?

The best solution I can find that is working is something like this. Downfall is you have to duplicate your hotstrings.
:?:_bg::_bg
::bg::Bill Gates

Related

Only autocomplete on an exact match in Sublime Text 2

I'm making a custom .tmLanguage file to highlight the syntax I'm using correctly and generally make coding with it easier. I'm almost done, and I got the autocompletion working using a .sublime-completions file.
There's just one minor flaw I'd like to change. I have a pretty long list of functions, and almost all of them contain an abbreviation of the word 'parameter', PAR. When I start typing that word, the following are all in the list of completions:
PAR command
DEFPAR command
JDATA command (because the description contains PAR)
SPAA command (because there's a P in the command and an A and an R in the description)
What I want is only for the commands that begin with PAR to show up, so from the list above, only the first item.
So, like this:
In other words, I want the completions to show up based on the literal string I'm typing, and only from the trigger part of my completions file, before the \t only.
That completions file looks like this:
Highlighted in orange is what I want my completions list to be based on.
I hope this is understandable. Any help is greatly appreciated.
This is not possible. By design Sublime's autocomplete feature uses fuzzy matching, so if there are a number of options that all contain the same pattern, but you don't quite remember which one you want, you can type the pattern and have all of the options available. The more you type, the smaller the list of possible options becomes. This is a good thing®, otherwise you'd have to remember the exact command you're looking for, which kind of defeats the purpose of autocomplete and code hinting.

How to find literals in source code of Smartforms and in SAPScripts (or reports, if the others can't be done)

I'd like to check hardcoded values in (a lot of) Smartforms and SAPScript forms.
I have found a way to read the source code of both of these, but it seems that i will have to go through a lot of parsing before I get anything reliable.
I've come across function module GET_LITERAL but that doesn't seem to help me much since i have to specify the offset of the value, if i got right what the function is doing in the first place.
I also found RS_LITERAL_LIST but that also doesn't do what i expect.
I also tried searching for reports and methods, but haven't found anything that seemed to help.
A backup plan would be to get some good parsing tool, so do you know of anything like that.
Anyway, any hints would be helpful and appreciated.
[EDIT]
Forgot to mention, the version of my system is 4.6C
If you have a fairly recent version of ABAP, you can use a regex.
Follow the pattern of this example, but use your source as the text and create your own regex. Have it look for any single quotes on the end of a word separated by spaces or any integers with spaces on either side. That's just a start, you might need to work on a better pattern.
String functions count, find, and match

String trigger IRC script

I need a script for IRC client (using KVirc) that will play a sound located somewhere on my hard drive whenever a certain piece of string is mentioned on the main channel. I assume such a thing is possible, but after some time of learning about scripting, I haven't found a way to do this on my own, and would be very grateful to anyone who would either write the piece of code or guide me how to do it myself.
Just a side note, this certain string I have in mind is not an exact string where all the characters are defined, but just first few letters, I assume the $ character is a substitute for all the text after the defined string.
Here it is, I hope I'm not too late xD
Open up KVIrc, hold ALT and press ENTER, it will bring up small console.
In there just copy this:
/event(OnChannelMessage,sounds) { %match_string = "abccc";
%music_file = "C:\\YouTubeMp3\\Selo\ Gori\\Céline\ Dion\ -\ My\ Heart\ Will\ Go\ On-WNIPqafd4As.flv";
if($str.match(%match_string*,$3)) snd.play %music_file;
}
Of course, you should change %match_string and %music_file path, if you have spaces in path just escape them with backslash (), just like I did it.
If you have any questions or you need something else for KVIrc feel free to contact me on Rizon IRC network, nickname is DonVitoCorleone.

Text editor with autocomplete while typing normal text

There's a lot of Text editors which support autocomplete during programming, but I want one which can autocomplete while typing normal text as I see a lot of repetition of words I type. Any emacs fans who have implemented this ?
Try the builtin dabbrev-expand; it's bound to M-/.
Also see Predictive Mode if you fancy the more flashy stuff.
pabbrev-mode (predictive abbreviation) works by examining previously written text. Unlike dynamic abbreviation, the text is analyzed during idle time (which enables quick lookup of potential abbreviations). Pabbrev looks at word frequency to suggest the most common expression.
From the documentation, this is what it might look like as you typed the keys pred.
p[oint]
pr[ogn]
pre[-command-hook]
pred[ictive]
I love hippie-expand!
The Zeus editor has a non-programming auto complete feature (i.e. Alt + Space) that takes the current user input, searches the current file for words starting with that input and displays them in a drop down list.
vim has such a feature http://vim.wikia.com/wiki/VimTip4
i think ultra edit has a simmilar feature
You could set up auto-complete mode with a dictionary as your source. I have been very tempted to do this myself.
predictive-mode auto-completes from a dictionary of words. It learns which words you use most often, and can also automatically learn new words as you type if desired.
It's very fast, fast enough that turning on auto-completion doesn't cause any noticeable lag when typing, even with a large dictionary.
(Disclaimer: I'm the author of predictive-mode)

What is a good method for inventing a command name?

We're struggling to come up with a command name for our all purpose "developer helper" tool, which we are using on our project. It's like a wrapper for our existing tools like cmake and hg. The purpose of the command is really just to make our lives easier by combining multiple commands into one (for example, publishing packages). For example, we have commands like:
do conf
do build
do install
do publish
We've considered a few ambiguous names like do (as above) and run, but obviously, do is a Linux bash command and run is pretty ambiguous.
We'd like our command to be 2 chars short, preferably - but who thinks we're asking the impossible? Is there a practical way to check the availability of command names (other than just typing them into your terminal), or is it just a case of choose one and hope nobody else will use it? Are we worrying about nothing?
Since it's a "developer helper" tool why not use hm [run|build|port|deploy|test], Help Me ...
Give it a verbose name, then let everyone alias it to whatever they want. Make sure you use the verbose name in other scripts so that it removes ambiguity.
This way, each user gets to use whatever makes sense to him/her, and the scripts are more readable and more easily searchable (for example, grepping four "our_cool_tool" will usually yield better results than grepping for "run").
How many 2-character words are useful in this context? I think you need four. With that in mind, here are some suggestions.
omni
torq
fluf
mega
spif
crnk
splt
argh
quat
drul
scud
prun
sqat
zoom
sizl
I have more if you need them.
Pick one: http://en.wikipedia.org/wiki/List_of_all_two-letter_combinations
To check the availability of command names, I suggest looking for all two-letter filenames that are in the directories in your path. You can use a script like this
for item in `echo $PATH | sed 's/:/ /g'` ; do
ls -1d $item/??
done
It won't show builtins in your shell (like "do" as you mentioned) but it's a good start.
Change ?? to ??? for three-letter files, etc.
I'm going to vote for qp (quick package?) since it's easy to pronounce, easy to type, and easy to remember where the keys are on the keyboard.
I use "asd". it's short and most developers type it without thinking
(oh, and you can always claim later that it stands for some "Advanced Script for Developers" if you need to justify yourself a few years from now)
How about fu? As in Kung Fu. It's a special purpose tool. And it's really easy to type.
I think that run is a good name, at least anybody that will download your project will know what to do. Calling it without parameters should reveal your options.
Even 'do' will do, I think you can use backquotes to run it from bash scripts.
Also remember that running the tools without parameters will tell you what options you have.
Use makefiles to do everything for you.
How about calling it something descriptive, like 'build_runner', and then just aliasing it to 'br' (or preferred acronym) in your .bashrc?
There is a really crappy tool called cleartool (part of clearcase), and people will alias it on their machine to "ct". Perhaps you can have a longer command and suggest users alias it.
It would probably be best to do something like ire_and_curses suggested, name it descriptively then alias it to a 2 letter command. If I was choosing, I would name it dev_help and alias it to dh.
I think you're worrying about nothing. Install the program as 'the-command-to-do-evertyhing-and-if-you-dont-make-your-own-alias-for-it-you-should'. I don't think that will be too long for any modern filesystems, but you might need to shorten it to 'tctdeaiydmyoafiys'. See what common aliases are used, and then change the program's name to that. In other words: don't decide, let natural selection decide for you. If you are working with a team of < 10, this should not even remotely cause any problems.
Call it devtool alias to dt
Custom tools like that I like to start with the prefix 'jj-'. I can type (with big index-finger power) 'jj ' and see all my personal commands. Also, they group together in alphabetical lists. 'J' is not a very common character for built-inc commands, but you can pick your own.
Since you want two characters, you can use just 'zz', or something starting with 'z'.
Are you sure you want to put all your functionality in one command? That might be simultaneously over-constraining and over-loading the interface a little.
do conf
do build
do install
do publish