如何在Visual Studio中定义即时自动更正宏? [英] How can I define instant AutoCorrect macros in Visual Studio?

查看:121
本文介绍了如何在Visual Studio中定义即时自动更正宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过即时自动更正宏,我的意思是像我所做的常见拼写错误列表以及用其替换的内容.例如,每次我尝试键入Layer时,它都会显示为"LAyer".我不使用任何名称为"LAyer"的东西,因此我希望它在键入后将Layer的每个实例自动替换为Layer.

By instant AutoCorrect macros, I mean like a list of common typos I do and what to replace them with. For instance, every time I try to type Layer it comes out "LAyer". I'm not using anything by the name of "LAyer", so I'd like it to just automatically replace every instance of LAyer with Layer after I type it.

(作为我的意思的示例,进入Word并输入"Recomend"之类的字样.它将立即用"Recommend"替换它,而不会提示您在自动更正选项"下可以找到的常见拼写错误列表中进行匹配)

(As an example of what I mean, go into Word and type something like "Recomend". It will instantly replace it with "Recommend" without prompting by matching it on a list of common mispellings that can be found under AutoCorrect Options.)

推荐答案

我遇到了完全相同的问题(除了我通常会打错整个单词).最近,我一直在输入"chnage",而不是大量更改. (在我现在正在使用的代码中,我有一个名为ChangedRecord和ChangedDatum的类,而我正在输入的错别字数量已经不再是有趣的了)

I have exactly the same problem (except I commonly mistype a whole bunch of words). Recently I have been typing "chnage" instead of change a lot. (In the code I am working on right now I have classes called ChangedRecord and ChangedDatum and the number of typos I am making is just not funny anymore)

AutoHotkey 的链接.

In another thread someone posted a link to AutoHotkey.

我想我会尝试一下,我必须说我认为这是一个很棒的小应用程序(它可以做的比我们想要的要多得多.

I thought I would give it a go and I must say I think it is a great little application (it can do a whole lot more than what we want it to do.

下面是一个AutoHotKey脚本文件,键入后应立即将"hotstring""LAyer"替换为"Layer".我已经定义了它,以便仅在完全匹配大小写的情况下才可以纠正-这样它将保留"layer"和"LaYeR"等.

Below is a AutoHotKey script file that should replace the "hotstring" "LAyer" with "Layer" as soon as you type it. I have defined it so that it will only correct if you match case exactly - so it will leave "layer" and "LaYeR" etc.

脚本中还包含热字符串"chnage".对其进行定义,使其与键入单词的大小写匹配-即"Chnage"变为"Change","ChnagedRecord"变为"ChangedRecord"(请注意,它将"CHnaGe"更改为"Change").

Also in the script is the hotstring "chnage". This is defined so that it matches the case of the typed word - i.e. "Chnage" becomes "Change" and "ChnagedRecord" becomes "ChangedRecord" (Note that it will change "CHnaGe" to "Change").

(大多数情况下,请参见下面的评论)另一个好处是,这些替换操作可以在所有应用程序中进行,而不仅仅是在Visual Studio中进行.

An added benefit (most of the time - see comment below) is that these replacements are made in all applications and not just in Visual Studio.

;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;   Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

:*:chnage::change
:c1*:LAyer::Layer

这篇关于如何在Visual Studio中定义即时自动更正宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆