Skip to content

Commit

Permalink
Vim — Hello World
Browse files Browse the repository at this point in the history
This is originally meant to be easy, but I ran into a few problems
setting this up.

1. Vader. I've seen it used before, but I just hadn't gotten into it as
   a testing framework. It's basically like RSPec but for Vimscript. I
   had to get this installed, no problem. Once that was up, I could run
   Vader tests.
2. For some reason, after I changed the text in the function, it did not
   reload the function in Vim even after I re-sourced the file. I don't
   know if it's cos I was recording the session through a streaming
   software while I tried to code, or something was just wrong with my
   setup. I had to quit Vim altogether and return; then I could source
   the right function into the Vim runtime, and pass my Vader tests.
3. I had originally thought to stream this… but I am quickly realizing
   my choice of using a Macbook Air was because I didn't plan to be
   heavy on audiovisuals. If there's some Vim Teletype-type plugin, that
   would be ideal. Until I am doing this on a more powerful computer,
   there'll be no streaming
  • Loading branch information
igbanam committed Jan 20, 2023
1 parent 2677d6a commit c3dc351
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 0 deletions.
51 changes: 51 additions & 0 deletions vimscript/hello-world/HELP.md
@@ -0,0 +1,51 @@
# Help

## Running the tests

Open your solution:

```bash
$ vim <exercise>.vim
```

Source the current file to make its global functions available to Vim:

```
:source %
```

Run the tests:

```
:Vader <exercise>.vader
```

Replace `<exercise>` with your exercise's name.

## Submitting your solution

You can submit your solution using the `exercism submit hello_world.vim` command.
This command will upload your solution to the Exercism website and print the solution page's URL.

It's possible to submit an incomplete solution which allows you to:

- See how others have completed the exercise
- Request help from a mentor

## Need to get help?

If you'd like help solving the exercise, check the following pages:

- The [Vim script track's documentation](https://exercism.org/docs/tracks/vimscript)
- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5)
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs)

Should those resources not suffice, you could submit your (incomplete) solution to request mentoring.

To get help if you're having trouble, you can use one of the following resources:

- [Learn Vimscript the Hard Way](http://learnvimscriptthehardway.stevelosh.com)
- [IBM DeveloperWorks: Scripting the Vim
editor](http://www.ibm.com/developerworks/views/linux/libraryview.jsp?sort_order=asc&sort_by=Title&search_by=scripting+the+vim+editor)
- [/r/vimscript](https://www.reddit.com/r/vimscript) is the Vimscript subreddit.
- [StackOverflow](http://stackoverflow.com/) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions.
35 changes: 35 additions & 0 deletions vimscript/hello-world/README.md
@@ -0,0 +1,35 @@
# Hello World

Welcome to Hello World on Exercism's Vim script Track.
If you need help running the tests or submitting your code, check out `HELP.md`.

## Instructions

The classical introductory exercise. Just say "Hello, World!".

["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is
the traditional first program for beginning programming in a new language
or environment.

The objectives are simple:

- Write a function that returns the string "Hello, World!".
- Run the test suite and make sure that it succeeds.
- Submit your solution and check it at the website.

If everything goes well, you will be ready to fetch your first real exercise.

## Source

### Created by

- @mhinz

### Contributed to by

- @kotp
- @kytrinyx

### Based on

This is an exercise to introduce users to using Exercism - http://en.wikipedia.org/wiki/%22Hello,_world!%22_program
7 changes: 7 additions & 0 deletions vimscript/hello-world/hello_world.vader
@@ -0,0 +1,7 @@
"
" Version: 1.1.0
"

Execute (Say Hi!):
let g:expected = "Hello, World!"
AssertEqual g:expected, Hello()
3 changes: 3 additions & 0 deletions vimscript/hello-world/hello_world.vim
@@ -0,0 +1,3 @@
function! Hello() abort
return "Hello, World!"
endfunction

0 comments on commit c3dc351

Please sign in to comment.