3 days / 40+ speakers
12 workshops

May 17-19, 2017 | Vilnius, Lithuania
http://devdays.lt/wp-content/uploads/2017/02/Andrew-Radev-320x320.jpg
Freelancer, Bulgaria

Andrew Radev


Andrew discovered Ruby in his second year of university and fell in love with the language. He’s been working with Ruby and Rails ever since — recently, with some Ember.js on top. He does, however, have “Vim plugin-writer” on his business card, in the hopes that, someday, someone will actually pay him to write Vimscript.


Topic

Tricky Testing (with Ruby)

If you’re a Ruby developer, you probably have some excellent testing tools to choose from. Ruby is a language that has developed an amazing testing culture, and the infrastructure for it. Heck, I personally know a team that writes Java code, and tests it using Capybara on JRuby, simply because it’s the most convenient option they found.

But how do you test weirder stuff? Like, say, how would you test a program that’s supposed to play a music clip, and then stop it once something specific happens? Have you ever tried writing tests for your text editor plugins? How do you test something that’s supposed to generate random output?

In this talk, I’ll try to demonstrate some unconventional testing scenarios, and give you ideas on how to approach them. Some of it will be my own projects, some from libraries and examples I’ve found elsewhere. I’ll also talk about some higher-level stuff — when to test, what to test, and why test at all. Most examples will be in Ruby, but I’m hoping that the ideas will be useful to you regardless of the language you prefer.



Make

Connection

Follow


Workshop

Working with Vim

Overview

This three-part workshop aims to build a solid foundation for working with Vim as a main text editor. We’ll start with the basics of movement and editing, move on to building a workflow and using plugins, and finish with a crash-course in writing Vimscript. In the end, participants should have all the tools they need to keep using Vim full-time, slowly building it up to fit their own workflows.

Target Audience

Complete Vim beginners are more than welcome, since the workshop will start from the very basics. For them, the second and third parts will provide useful information, but the most important part will be the first, which will plant the seed for their future work with the editor.

For people who already use Vim casually (possibly reluctantly, by necessity), the first and second parts will organize what they might already know and get them to see the underlying patterns, making it much easier to work with the editor full-time.

People who already use Vim as a full-time editor might choose to skip the first, introductory part. The second will suggest ideas to improve their workflows and the third will set them on the path of writing their own scripts, mappings, and plugins.

Course Prerequisites

  • Experience with any programming language: Vim is a programmer-targeted text editor and many of the examples will be programs or parts of programs.
  • Experience with a scripting language: The third part introduces Vimscript, and understanding how it works will be easier for someone who’s already worked with a dynamic language like javascript, ruby, or python.

Technical Requirements
A computer with Vim installed will be perfectly sufficient. The version of Vim should be at least 7, which should be the case for anything that is easily found on the internet.

An internet connection will be useful to download text files to work with. I’ll share all the text files I’ll be using for demonstrations.

Plan

Part 0: Setup and installation (15 mins)

Anyone who needs help installing Vim or related tools can use this time to set things up before we start.

Part 1: The Basics (75 mins)

  • Introduction: starting things up
  • Moving within a file
    • Vertical movements
    • Horizontal movements
    • Moving with precision
  • Big idea: Semantic movement
  • Text motions and text objects
  • Actions Applying actions on motions
  • Big idea: It’s all text
  • Commands
  • Working with the help files
  • External commands
  • Big idea: Extensibility
  • Summary, Q&A

Coffee break (15 mins)

Part 2: Customization, Plugins, Workflows (75 mins)

  • Introduction: Kinds of workflows, broad directions to think about
  • Working with a project
  • Plugins for general text editing
  • Working with individual files of different types
  • Language-specific plugins
  • Debugging tools
  • Speeding up common tasks
  • Big idea: How do you get faster?
  • Examples of powerful plugins, alternatives
  • Discussion and experimentation

Coffee break (15 mins)

Part 3: Scripting (75 mins)

  • Introduction: Practice harness for writing and executing Vimscript
  • Everyday Vimscript: settings, mappings, commands
  • Simple statements: if-clauses, loops, assignment
  • Big idea: Structure of the language
  • Defining commands
  • Variables and functions
  • Writing plugins
    • Open a file with an external tool
    • Start a github pull request from Vim
    • Delete a surrounding function call
    • A simple Grep wrapper
  • Filetype-specific plugins, indentation, syntax highlighting
  • Vim load process
  • Debugging Vimscript
  • Writing automated tests
  • Further learning