27
2
Today I realised that I often like to define sections in my code like so:
####################
# Helper Functions #
####################
But that it's tedious to do. Assuming I have a line such as this:
# Helper Functions #
What is the shortest set of vim
keystrokes to wrap it in a #
? Shift does not count as a keystroke in this challenge.
Test cases:
Input: "#test test test#"
Output:
################
#test test test#
################
Input: "#this is a nice block comment#"
Output:
##############################
#this is a nice block comment#
##############################
Input: "# s p a c e s must be supported a l s o#"
Output:
########################################
# s p a c e s must be supported a l s o#
########################################
3I'm voting to close this question as off-topic because "vim keystrokes" basically means running commands of an IDE, like Ctrl - C, or Ctrl - R in ST2. This is not coding in any form. – Optimizer – 2015-02-23T19:37:59.123
3@Optimizer Vim is a turing complete language (e.g. by using macros) with several different constructs coding and the primary method for editing is based on verbs (actions) an objects (movements). There is already a popular web page for vim golfing: www.vimgolf.com. (But I agree that this particular question is pretty boring) – Hjulle – 2015-02-24T10:16:14.920
1@Optimizer: is there a more suitable S.E. site the question could be moved to? Given vim's extensive scripting/macro language, some people might consider it a language in itself. – shearn89 – 2015-02-24T10:16:31.883
Supposedly most other PPCG big shots also think the same as you do. But both the above comments/arguments hold true for any good IDE, like ST2 or IntelliJ or Atom – Optimizer – 2015-02-24T10:18:16.833
@Optimizer I have no idea what PPCG means, but your response sounds surprisingly hostile for what I thought was a reasonable reply to your comment. – shearn89 – 2015-02-24T10:21:49.697
@Optimizer So there is a www.IntelliJgolf.com as well? :P – Hjulle – 2015-02-24T10:22:27.930
1@shearn89 Hostile ? What are you talking about ? PPCG is this site. – Optimizer – 2015-02-24T10:23:10.200
@Hjulle so treat a random webpage as a proof :D – Optimizer – 2015-02-24T10:23:59.333
@Optimizer - ahhh that makes more sense! I interpreted it as you calling myself a "PPCG bigshot", and assumed the PPCG was derogatory. My bad! – shearn89 – 2015-02-24T10:24:21.873
2Why wouldn't other IDE's be allowed as well if you can write programs in their macro system? What is it that makes it "not programming"? – Hjulle – 2015-02-24T10:28:32.967
I like this question, because I also do this =D – justhalf – 2016-04-27T01:39:58.440