last day (1812 days later) » 

4:24 AM
Woah.
Does this mean V is like, official now?
 
Yes
 
@DrGreenEggsandHamDJ I'd advice you to put links in the description
 
Good idea.
room topic changed to V: Discussion about the V golfing language github.com/DJMcMayhem/V (no tags)
 
Better to link to both
 
4:26 AM
So, what can I do as an owner of this room? Can I pin things?
 
@DrGreenEggsandHamDJ Not really?
 
room topic changed to V: Discussion about the V golfing language github.com/DJMcMayhem/V v.tryitonline.net (no tags)
 
But you can:
schedule events
control access
manage feeds
move messages
 
That works, but it's much better to use i instead of o.
o (o)pens a new line.
 
I'm still finding where all the commands are
 
4:33 AM
You got it. :)
 
so I basically just experimented in the tryitonline
 
Unfortunately, the docs aren't that great right now.
 
without even knowing where the commands are
Not about the docs
 
An interesting thing to see in V is empty program + input.
 
None of the files here seem to contain the commands
 
4:34 AM
They're in keys.py
But that's only a tiny fraction of them.
The others are built in to neovim.
 
M_d_quote = chr(162)
M_at = chr(192)
M_D = chr(196)
M_M = chr(205)
M_S = chr(211)
M_a = chr(225)
M_d = chr(228)
M_l = chr(236)
M_m = chr(237)
M_q = chr(241)
M_r = chr(242)
M_s = chr(243)
Why this?
 
M stands for meta.
Do you have vim installed?
 
not really
 
It's highly recommended if you want to use V.
 
4:36 AM
Right now, important characters are unprintable.
I'm looking to fix this with a custom codepage.
What OS are you on?
 
Windows
 
Linux: neovim, mac: macvim, windows: Gvim
 
oh ok
Any example program?
 
for V
 
4:39 AM
Oh. For learning or for showing off?
 
for learning
 
Uhm...
IDK, I have to think of one.
How about, let's count to 10.
Which, will take way more bytes then a golfing language should.
So first, you need to insert a 1. You can do this with i1
From there, you need to insert a literal escape character, which unfortunately is unprintable.
First, let me teach you how to enter the program into vim.
open vim and press i
Now, type the program, which is i1<Ctrl+v><esc>
Then hit <esc> again to return to normal mode.
You know, It would probably be better to start with vimtutor, which you can run from the command prompt.
 
Which one should I install?
 
The top link here: vim.org/download.php#pc
Sorry if this is confusing. Vim is famous for being hard to learn. It's not too bad if you learn it slowly and stick with it.
 
but..
Ctrl+V pastes something there
the something being what is in my clipboard currently
 
4:52 AM
Oh, that's weird. Try ctrl+q instead,
 
Done
what next
 
So one of the quirks of vim is that it's modal. In a normal text editor, you hit a key and that key is entered.
You'll usually be in "normal" or "insert" mode.
 
I mean
it doesn't count to 10 for me
what does Ctrl+q and esc do?
 
Ctrl+q let's you enter a literal "escape" character.
You know what, vimtutor could explain this much better than I can.
If you open cmd, and type vimtutor it'll give you a 20 minute lesson on how to use vim that makes it much less confusing.
 
ok
 
4:58 AM
The other thing that would help is if you could just copy and paste characters into your browser, but that doesn't work super well with unprintable characters.
So to count to 10 in V is i1<esc>9<M_q>Yp<C-a> The problem is, that's really hard to enter in the browser, which is why I recommend learning vim first.
Then you can just copy.
 
ok
 
As you can see there ^ <esc> and <C-a> (Ctrl+ a) are both invisible.
 
oh ok
I'll use a unicode converter then
 
You could do that too.
esc is a hex 1b, and <C-a> is a hex 01.
 
thanks
 
5:05 AM
Now I can actually teach you V, lol.
Sorry about that sidetrack
 
ok
 
So the way that works is i enters "insert" mode. Everything up until the next <esc> is entered into the buffer literally. i1<esc> enters a 1, and then returns to normal mode. (where keys are commands)
9<M_q> means "9 times, repeat the following:"
Yp means "Yank a line, then paste that line"
and <C-a> means increment the number.
 
Yes, there are.
V is a superset of vim, so it has even more. (the ones in 'keys.py')
 
Anonymous
5:43 AM
Wait why did I join this room
 
@DrGreenEggsandHamDJ are you here?
7
A: Shortest way to reverse a number

Eric FortisVim 17 chars :se ri<CR>C<C-R>"

What is CR and C-R?
 
@LeakyNun <CR> stands for "Carriage Return", e.g. enter. <C-R> is standard vim notation for ctrl+r.
 
I see
doesn't work for me...
 
Yeah, it isn't working for me either.
 
How would you do it?
 
5:56 AM
Well, reverse is a pretty useful function (especially for a language that prides itself on string manipulation), so it should be a builtin. Right now however, this is the only way to do it.
Even though it isn't working.
I'm gonna fire up the debugger, see if I can figure it out.
Part of it is clearly working. v.tryitonline.net/…
Oh doi, I see the problem.
You confused "input" and "arguments"
 
@DrGreenEggsandHamDJ I'm using the official vim to do it
how do I do it?
 
Oh, I see.
How are you inputting the number?
Since Vim is not a typical programming language, input is taken very differently. So save a file with the number in it, then open that file in vim, then type the keystrokes.
 
6:16 AM
so I can't use i?
 
You could use i, although make sure to do <esc>0 afterwards, (since the default for vim golf is to start in normal mode at the beginning of the first line.)
 
and then what to type?
 
Just type each key after that.
 
cool
how does it work?
 
Did you read vimtutor yet?
Changing my explanation based off how much vim you know.
 
6:22 AM
I read this
 
Okay, that's pretty good.
so colon is used for the command line.
:q is quit, :w is write, :s is substitute, etc.
There's a lot of command line functions.
One of them is :set option or :se option for short. ri is an obscure option that reverses everything you type.
C (uppercase) is delete line and enter insert mode.
<C-r> is insert buffer, and " is the buffer that text is deleted into by default.
 
I see
 
6:40 AM
I just finished vimtutor
 
Nice! Vim is really great even beyond golf.
Some good resources: vi.stackexchange.com
 
7:12 AM
@DrGreenEggsandHamDJ Could you help me golf something?
 
7:52 AM
@LeakyNun I'd love to but it's pretty late here. Link to it here, and I'll sleep on it and ping you sometime tomorrow.
 
8:15 AM
0
A: Display "Happy Easter!"

Leaky NunVim, 374 keystrokes a _ _<esc>28a <esc>7a_<esc>27a <esc>a_ | | | |<esc>26a <esc>a(<esc>7a_<esc>a)<esc>10a <esc>a_<esc>14a <esc>a| | | |__ | |<esc>3a ____<esc>bi <esc>ea _ _ _____ ____ ___| |_ ____ ____| | | __)| |/ _ | _ \| _ \<esc>4a| <esc>a | ___) / _ |/___) _)/ _ )/ ...

I think that I should type T to replace |_| and then do :s/T/|_|/g
 

  last day (1812 days later) »