Blog 1

Random Talk on Random Thoughts

Git for Windows, Curl, Gist.vim With Vundle (3)

| Comments |

Background

A VIMRC is important for efficient text editing. It can be over one hundred lines. It’s good to have the changes tracked. One entire folder .git for one single text file will be too much. Since my VIMRCs don’t have anything secret, I upload them to Gist like many other users, and read others’ configuration files so as to learn from them.

Nonetheless, my workflow of uploading Gists on M$ Win* was not quite efficient. Therefore, I re-read the installation instructions for Gist.vim. Since curl.cmd has already been set up during the installation of Vundle.vim, I used Vundle to install Gist.vim.

Due to the problem mentioned in the previos post in this series, I opened GVim from Command Prompt instead of Git Bash.

Problem

I have already configure github.user to my GitHub user name, but Gist.vim still complained that no GitHub user name was found.

You have not configured a Github account. Read ":help gist-vim-setup".

Git for Windows, Curl, Gist.vim With Vundle (2)

| Comments |

Background

I had been using pathogen.vim to manage plugin. When it comes to keeping the plugins up-to-date, I used a for-loop.

Problem

I would like to change it to Vundle since I didn’t know how to update the helptags after merging the commits from GitHub. Therefore, I followed the installation guide of Vundle. However, when I started updating, I got the following error.

Processing 'tpope/vim-fugitive'
Error detected while processing function vundle#installer#new..<SNR>96_process..
vundle#installer#run..vundle#installer#install..<SNR>96_sync..<SNR>96_make_sync_
command..<SNR>96_get_current_origin_url..<SNR>96_system:
line    1:
E484: Can't open file C:/Temp/PortableApps/gVimPortable/Data/Temp/VIo985B.tmp
Error detected while processing function vundle#installer#new..<SNR>96_process..
vundle#installer#run..vundle#installer#install..<SNR>96_sync:
-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit

How can I get the Vim plugin updates?

Rake Deploy Fatal Error

| Comments |

Background

I had finished writing my previous post. In rake preview, I got the desired output. Then, the next step is to commit the changes and to deploy the generated contents to GitHub Pages.

Problem

A large block of red text appeared after I ran rake deploy. The commit on the master branch was unsuccessful.

$ rake deploy
(in C:/github/vincenttam.github.io)
cp -r source/fancybox/.gitattributes public/fancybox/.gitattributes
cd _deploy
Already up-to-date.
cd -
rm -rf _deploy/404.html
...
rm -rf _deploy/stylesheets
cp -r public/. _deploy
cd _deploy
fatal: CRLF would be replaced by LF in fancybox/README.md.
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
        modified:   404.html
        modified:   about/index.html
        ...

Untracked files:
        blog/2016/02/21/
        blog/2016/02/22/
        downloads/code/miktex-update2/
        images/posts/MikTeXUpdate2/
        posts/31/

no changes added to commit
Everything up-to-date
cd -
## Set the codepage to 65001 for Windows machines
## Deploying branch to Github Pages
## Pulling any updates from Github Pages

## Copying public to _deploy

## Committing: Site updated at 2016-02-22 03:37:22 UTC

## Pushing generated _deploy website

## Github Pages deploy complete

Even though the system said that the deploy was “complete”, in fact, it had never been carried out.

How can I update my blog on GitHub Pages?

Git for Windows, Curl, Gist.vim With Vundle (1)

| Comments |

Background

I installed msysgit 1.9.0, and added its bash utilities to PATH.

Problem

I attempted to open an HTML file with curl. However, I got the following error.

C:\Windows\system32\cmd.exe /c (curl 'http://www.vim.org/index.html' -o 'C:/Temp
/PortableApps/gVimPortable/Data/Temp/VIA1ED5.html')
curl: (1) Protocol "'http" not supported or disabled in libcurl
shell returned 1
Hit any key to close this window...

Discussion

In the first line of the code block, cmd.exe with option /c ran the command in the parenthesis (). I copied the command inside () and ran it in cmd.exe, and the error was reproduced.

It’s easy to find the cause of the problem. I typed “curl protocol” on the Google search web page, and the rest of the error message appeared in the list of suggestions. In the first search result, which was a Stack Overflow question, I learnt why this error occurred from the first answer—in the Command Prompt, one needs to use double quotes "" instead of single quotes ''. In Git Bash, this doesn’t matter.

Since curl was bundled with msysgit, I suspected that the installed version of Git was too old. I then upgraded it.

Lessons learnt

  1. For a shell program (e.g. Command Prompt, bash), the option -c (or /c) stands for “command”, and what’s left is the command to be run.
  2. curl will grab content from the input URL and display it as standard output. To save the downloaded content in a file, the flag -o, which means “output”, can be used.

Testing Octopress and Ruby 2.0 on Windows 7 (3)

| Comments |

Background

I was writing my previous post, which was about my recent Mik$\rm \TeX$ update.

Problem

After having finished it, I tried rake generate, and got results similar to the first picture of the first post in this series.

Last time, I solved this problem by creating the batch file python2.bat in the folder where Python had been installed (i.e. C:\Python27). This time, the BAT file is already there. In (Git) CMD, both which python and which python2 are fine. However, in Git bash, I run into trouble.

Owner@Owner-PC MINGW64 /c/github/vincenttam.github.io (source)
$ which python
/c/Python27/python

Owner@Owner-PC MINGW64 /c/github/vincenttam.github.io (source)
$ which python2
which: no python2 in (/c/Users/Owner/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/b
in:/mingw64/bin:/usr/bin:/c/Users/Owner/bin:/c/ProgramData/Oracle/Java/javapath:
/c/Perl/site/bin:/c/Perl/bin:/c/Program Files (x86)/Intel/iCLS Client:/c/Program
 Files/Intel/iCLS Client:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem
:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/Intel/OpenCL 
SDK/2.0/bin/x86:/c/Program Files (x86)/Intel/OpenCL SDK/2.0/bin/x64:/c/Program F
iles (x86)/Common Files/Roxio Shared/DLLShared:/c/Program Files (x86)/Common Fil
es/Roxio Shared/OEM/DLLShared:/c/Program Files (x86)/Common Files/Roxio Shared/O
EM/DLLShared:/c/Program Files (x86)/Common Files/Roxio Shared/OEM/12.0/DLLShared
:/c/Program Files (x86)/Roxio 2010/OEM/AudioCore:/c/Program Files/Intel/Intel(R)
 Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Eng
ine Components/IPT:/c/Program Files (x86)/Intel/Intel(R) Management Engine Compo
nents/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT
:/c/Temp/MikTeXPortable/miktex/bin:/c/MinGW/bin:/c/Temp/gnuwin32/bin:/c/ctags58:
/c/Temp/PortableApps/gVimPortable:/c/cscope-15.8a-win32rev1-static:/c/Python27:/
c/Ruby200-x64/bin:/c/Temp/pdf2svg-0.2.2:/c/Program Files (x86)/Skype/Phone:/cmd:
/usr/bin/vendor_perl:/usr/bin/core_perl)

Owner@Owner-PC MINGW64 /c/github/vincenttam.github.io (source)
$ cd /c/Python27/

Owner@Owner-PC MINGW64 /c/Python27
$ ls
DLLs/     Lib/         NEWS.txt     pythonw.exe*  Tools/
Doc/      libs/        python.exe*  README.txt    w9xpopen.exe*
include/  LICENSE.txt  python2.bat  tcl/

Even though the generated contents can still be locally previewed, how can I get rid of this error message?

Mik$\rm \TeX$ Update (2)

| Comments |

Background

I need to write something in $\rm \LaTeX$.

Problem

I can’t get any update by clicking “Update Mik$\rm \TeX$” in the icon triggered by miktex-portable.cmd. I faced the same problem as rantrave’s.

Fixed Jekyll-Bootstrap Asset Path

| Comments |

Background

As I’ve said in Jekyll Blog Page Build Warning, GitHub Pages have upgraded to 3.0.

Problem

The Twitter theme for every post in Blog 2 was gone, but the home page and the archive page still looked good.

I viewed Jekyll-Bootstrap’s issue list. The “{{ ASSET_PATH }}” in the title of issue #295 caught my eyes. Feeling that changing _config.yml is too troublesome and prone to error, I clicked some links for related web pages, such as a relevant page in Jekyll’s documentation, but I didn’t know what to do.

Hyperlinks in Ordered Lists in Markdown in Vim

| Comments |

Background

Same as the one in my previous post.

I usually write hyperlinks for software names using only one pair of square brackets, like [Vim] instead of [Vim][Vim]. Even though this isn’t standard, this is more convenient.

Problem

I want to start the second item of the following ordered list with a hyperlink to textobj-lastpat written in a short but non-standard way.

Markdown source code of the ordered list (test-post.mkd) download
1
2
3
4
5
6
7
8
9
10
11
12
Lessons learnt
---

Moreover, I revised the usage of these two [Vim] plugins.

1. [Visual Star Search][visual-star-search]: Select text in visual
   mode and search it with an asterisk `*`.
2. [textobj-lastpat]: Add the last search pattern as a text object.

[Vim]: http://www.vim.org
[visual-star-search]: https://github.com/bronson/vim-visual-star-search
[textobj-lastpat]: https://github.com/kana/vim-textobj-lastpat

Unluckily, as I typed this Vim Ex command to see whether my Markdown syntax was correct, I quickly received an error from kramdown.

:!kramdown % > %<.html

You may click “donwload” at the top right hand corner of the codeblock below to see the effect of the result generated by ihe Markdown parser.

Generated HTML code of the ordered list (test-post.html) download
1
2
3
4
5
6
7
8
9
<h2 id="lessons-learnt">Lessons learnt</h2>

<p>Moreover, I revised the usage of these two <a href="http://www.vim.org">Vim</a> plugins.</p>

<ol>
  <li><a href="https://github.com/bronson/vim-visual-star-search">Visual Star Search</a>: Select text in visual
mode and search it with an asterisk <code>*</code>.</li>
  <li></li>
</ol>
Warning: Duplicate link ID 'textobj-lastpat' on line 13 - overwriting

Press ENTER or type command to continue

Solution

This time, I won’t find out what’s wrong from the error message because writing that hyperlink in the standard way is the quickest solution that I know.

Indentation of Titles in Markdown Files in Vim

| Comments |

Background

While I was writing a post about a technical problem encountered while writing another post about Venn diagram, I encountered another technical problem.

Problem

I tried including the error message into the previous post by the Vim editor command :r ~/lang:text temp-swp.mkd. To have it surrounded with <pre><code> in HTML, one needs to indent it by four spaces.

A section of the error message (temp-swp.mkd) download
1
2
3
4
5
6
7
8
## 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.

I usally do this by applying the right-shift operator > to the text selected in visual line mode. However, the line starting with # wasn’t indented like the others.

A failed indentation (temp-swp1.mkd) download
1
2
3
4
5
6
7
8
## 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.