Programming question
-
How about writing an add-in that completes the braces, so that you only have to type the left brace. That'd save you 50% typing, and you won't have to change keyboards or anything. -- Nicola
-
Yeah I remember that one. A classic example of macro abuse.
Jeremy Falcon The mind is like a parachute. It works best when it is open. - Colin Angus Mackay (2006-08-18)
-
Greeeg wrote:
What are your solutions to this problem?
It's obvious that most people that have replied have been in living in .NET land too long. :laugh: It's simple, use a macro. For instance...
#define BO {
#define BC }int main(int argc, char *argv[])
BO
return 0;
BCJeremy Falcon The mind is like a parachute. It works best when it is open. - Colin Angus Mackay (2006-08-18)
Now THAT's using your knoggin!
-------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
-
Use
??<
and??>
instead? ;)--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
:doh:
---- Scripts i’ve known... CPhog 1.8.2 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums
-
Now THAT's using your knoggin!
-------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
Yeah, I still think macros are great as long as they aren't abused.
Jeremy Falcon The mind is like a parachute. It works best when it is open. - Colin Angus Mackay (2006-08-18)
-
Use VB.net. ;)
E=mc2 -> BOOM
"Doctor, doctor! I keep getting these awful headaches!" "First, stop pointing that gun at your head and pulling the trigger..."
Software Zen:
delete this;
-
The long term solution is to program in VB.Net - enjoy.;)
'--8<------------------------ Ex Datis: Duncan Jones Merrion Computing Ltd
-
Greeeg wrote:
What are your solutions to this problem?
I carefully avoid ever programming while using a german keyboard layout. You might think this would be fairly trivial, considering i'm not living in Germany, nor do i work with any german-language programmers. You'd be right.
---- Scripts i’ve known... CPhog 1.8.2 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums
Shog9 wrote:
I carefully avoid ever programming while using a german keyboard layout. You might think this would be fairly trivial, considering i'm not living in Germany, nor do i work with any german-language programmers. You'd be right.
Yes, thankyou for that remarkable insight :rolleyes:
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
Yeah, I still think macros are great as long as they aren't abused.
Jeremy Falcon The mind is like a parachute. It works best when it is open. - Colin Angus Mackay (2006-08-18)
Jeremy Falcon wrote:
Yeah, I still think macros are great as long as they aren't abused.
You don't consider your example macro abuse? :omg:
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
Jeremy Falcon wrote:
Yeah, I still think macros are great as long as they aren't abused.
You don't consider your example macro abuse? :omg:
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
Ryan Binns wrote:
You don't consider your example macro abuse?
No I don't. It's not so much what you do with them that's abusive, but more so how much you rely on them and the intent that is. If there's no clean/quick/portable way to achieve the bracket replacement that he's trying to do so he can program more effeciently, but yet macros offer a simple solution then it's not abusive. OTOH if he's trying to make Pascal syntax out of C/C++ just because it's neato, then that's very abusive (and I've seen people attempt this).
Jeremy Falcon The mind is like a parachute. It works best when it is open. - Colin Angus Mackay (2006-08-18)
-
My idea is to press
Shift+Space
and then"{ \newline }"
would be insterted at the cursor position. How could I do that, via Snippet, Macro, Addin?Greeeg wrote:
Macro
Thats pretty easy,
Sub CurlyBrackets() Dim sCurly As String sCurly = "{ " & vbNewLine & vbNewLine & " }" ActiveDocument.Selection.Text = sCurly End Sub
Just map that to a key combo and away you go.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
-
Ryan Binns wrote:
You don't consider your example macro abuse?
No I don't. It's not so much what you do with them that's abusive, but more so how much you rely on them and the intent that is. If there's no clean/quick/portable way to achieve the bracket replacement that he's trying to do so he can program more effeciently, but yet macros offer a simple solution then it's not abusive. OTOH if he's trying to make Pascal syntax out of C/C++ just because it's neato, then that's very abusive (and I've seen people attempt this).
Jeremy Falcon The mind is like a parachute. It works best when it is open. - Colin Angus Mackay (2006-08-18)
Jeremy Falcon wrote:
If there's no clean/quick/portable way to achieve the bracket replacement that he's trying to do so he can program more effeciently, but yet macros offer a simple solution then it's not abusive.
There is a way, use a VS macro, they are easy to create (heck VS has a macro recorder) and assign it to a key combo. Done, no worries about someone else looking at your code wondering WTF is BO & BC for.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
-
Jeremy Falcon wrote:
If there's no clean/quick/portable way to achieve the bracket replacement that he's trying to do so he can program more effeciently, but yet macros offer a simple solution then it's not abusive.
There is a way, use a VS macro, they are easy to create (heck VS has a macro recorder) and assign it to a key combo. Done, no worries about someone else looking at your code wondering WTF is BO & BC for.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
S Douglas wrote:
There is a way, use a VS macro
If VS is your only environment then yeah I totally agree. Go with that instead.
Jeremy Falcon The mind is like a parachute. It works best when it is open. - Colin Angus Mackay (2006-08-18)
-
Yeah, this is really a programming question, sort of :~ What I really hate is typing curly braces in languages like C#/C++ etc. I use a german keyboard layout and typing { and } involes using a weird combination, Alt+Gr+7 for { and Alt+Gr+0 for } Not only does this disturb the typing flow, but the combination is also really unhandy and error prone, especially when switching keybords often (laptop, desktop, work etc). What are your solutions to this problem? :) regards
I use a Danish keyboard and kinda have the same problem. I solved it by making a simple macro in VS, so when I press ctrl-æ VS change the line, insert a { change the line again and insert a } and move the caret to be right after the {. Works great :)
- Anders My new photo website[^]
-
S Douglas wrote:
There is a way, use a VS macro
If VS is your only environment then yeah I totally agree. Go with that instead.
Jeremy Falcon The mind is like a parachute. It works best when it is open. - Colin Angus Mackay (2006-08-18)
Jeremy Falcon wrote:
If VS is your only environment
Now that you mention it, he didn't specify what enviroment he was working in, much less which version. Kinda important. :shrugs: all yea can do is offer a suggestion.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
-
Greeeg wrote:
Macro
Thats pretty easy,
Sub CurlyBrackets() Dim sCurly As String sCurly = "{ " & vbNewLine & vbNewLine & " }" ActiveDocument.Selection.Text = sCurly End Sub
Just map that to a key combo and away you go.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
-
I use a Danish keyboard and kinda have the same problem. I solved it by making a simple macro in VS, so when I press ctrl-æ VS change the line, insert a { change the line again and insert a } and move the caret to be right after the {. Works great :)
- Anders My new photo website[^]
Yeah, I from now on use this solution, and it works perfectly :) regards
-
Yeah, this is really a programming question, sort of :~ What I really hate is typing curly braces in languages like C#/C++ etc. I use a german keyboard layout and typing { and } involes using a weird combination, Alt+Gr+7 for { and Alt+Gr+0 for } Not only does this disturb the typing flow, but the combination is also really unhandy and error prone, especially when switching keybords often (laptop, desktop, work etc). What are your solutions to this problem? :) regards