Tonight, I wrote an article about Venn diagram, and I attempted to publish it using the Vim editor command
:Gpush|!rake gen_deploy && rake notify
After that, the following error message popped up.
[owner@localhost ~/octopress]$ vi To firstname.lastname@example.org:VincentTam/vincenttam.github.io.git c6c422a..fc8d6b8 source -> source ## Generating Site with Jekyll write source/stylesheets/screen.css Configuration file: /home/owner/octopress/_config.yml Source: source Destination: public Generating... done. Auto-regeneration: disabled. Use --watch to enable. cp -r source/_posts/.2016-02-09-my-venn-diagram-mistake.markdown.swp public/_posts/.2016-02-09-my-venn-diagram-mistake.markdown.swp rake aborted! Errno::ENOENT: No such file or directory @ rb_sysopen - public/_posts/.2016-02-09-my-venn-diagram-mistake.markdown.swp /home/owner/octopress/Rakefile:276:in `block (2 levels) in <top (required)>' /home/owner/octopress/Rakefile:275:in `block in <top (required)>' /home/owner/octopress/Rakefile:265:in `block in <top (required)>' /home/owner/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval' /home/owner/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>' Tasks: TOP => copydot (See full trace by running task with --trace) shell returned 1 Press ENTER or type command to continue
When one sees an error message like above for the first time, one needs not look directly into code, even though one is writing code in an IDE. Instead, one may view the error log to see what’s wrong.
From the command
cp -r ..., I realised that the problem came from
Rakefile, which tried to copy the non-existent
.2016-blablabla.markdown.swp in the
public folder in the local
folder for this blog to the
_deploy folder.2 (There are
_posts folder under the
How can I do the task within Vim?
I googled “rake generate ignore swp”, and clicked on
the first search result, which is Octopress issue #1073. It
provided a link to issue #600. Bradon Mathis said that
has been fixed in 2.1. Unluckily, after hitting that
hyperlink, I found that the version of
Rakefile shown online was
different from mine. Finally, I installed vim-octopress to solve
this problem.3 If this plugin supports background tasks
rake preview, the blogging experience using Octopress within
Vim will be further enhanced.
I’ve learnt to use the HTML cite tag when I directly quote a short phrase from others to avoid being penalised by the Google search engine for lacking originality.
Moreover, I revised the usage of these two Vim plugins.
- Visual Star Search: Select text in visual
mode and search it with an asterisk
- textobj-lastpat: Add the last search pattern as a text object.