Blankman
Blankman

Reputation: 267320

What is this vim custom map doing?

It has something to do with running the a TestUnit file i.e. it switches out of vim and runs the file.

:map ,t :w\|:!ruby test_spec.rb<cr>

Can someone break this command out with some explanation?

Upvotes: 1

Views: 95

Answers (1)

Logan Capaldo
Logan Capaldo

Reputation: 40346

:w

saves the file

|

Let's you input multiple commands, e.g. :foo|:bar, is the same as :foo, hitting return, :bar. The \ is to escape it in the map.

:!

Runs the shell command specified, in this case ruby test_spec.rb.

<CR>

Carriage return (e.g. the enter or return key).

So when you hit ,t, it saves your file, and runs the command ruby test_spec.rb.

Upvotes: 6

Related Questions