<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Daniel Duan's Articles About Vim</title>
        <link>https://duan.ca/tag/vim/</link>
        <atom:link href="https://duan.ca/tag/vim/feed.xml" rel="self" type="application/rss+xml" />
            <item>
                <title>Git Commit Message, Vim, and Markdown</title>
                <description>&#60;p&#62;It&#39;s been bothering me for years.&#60;/p&#62;
&#60;p&#62;That is, &#60;code&#62;#&#60;/code&#62; is both the start of a comment in a git commit message, but also
the syntax for headings in Markdown.&#60;/p&#62;
&#60;p&#62;Personally, I prefer using commit messages to populate pull request descriptions
whenever possible. On GitHub, This happens automatically when the pull request
contains a single commit. But I can&#39;t type, say an H3 as &#60;code&#62;### Heading&#60;/code&#62; in the
commit message (in Vim, most of the time) because it gets treated as a comment!&#60;/p&#62;
&#60;p&#62;But thanks to this twitter interaction with &#60;a href=&#34;https://twitter.com/dmartincy&#34;&#62;@dmartincy&#60;/a&#62;, I finally solved
this problem:&#60;/p&#62;
&#60;blockquote class=&#34;twitter-tweet&#34;&#62;&#60;p lang=&#34;en&#34; dir=&#34;ltr&#34;&#62;I haven&#38;#39;t found myself in that situation, but maybe you could do &#38;#39;git config core.commentChar &#38;quot;;&#38;quot;&#38;#39; before creating the commits? That will change the default git commit marker (#) to something that won&#38;#39;t conflict with Markdown titles.&#60;/p&#62;&#38;mdash; Daniel Martín (@dmartincy) &#60;a href=&#34;https://twitter.com/dmartincy/status/1247271508420026368?ref_src=twsrc%5Etfw&#34;&#62;April 6, 2020&#60;/a&#62;&#60;/blockquote&#62; &#60;script async src=&#34;https://platform.twitter.com/widgets.js&#34; charset=&#34;utf-8&#34;&#62;&#60;/script&#62;
&#60;p&#62;As mentioned by Daniel, Git has introduced a setting called &#60;code&#62;core.commentChar&#60;/code&#62;,
documented &#60;a href=&#34;https://git-scm.com/docs/git-config#Documentation/git-config.txt-corecommentChar&#34;&#62;here&#60;/a&#62;, which lets us control which character
becomes the start of a comment line. Let&#39;s say we want to replace the default
&#60;code&#62;#&#60;/code&#62; with &#60;code&#62;;&#60;/code&#62;, we can edit &#60;code&#62;~/.gitconfig&#60;/code&#62; to include this preference:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[core]
	commentChar = &#38;quot;;&#38;quot;
&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;… and this will affect every Git repository on this computer.&#60;/p&#62;
&#60;p&#62;For me, though, this broke git commit syntax highlighting in Vim: the comments,
beginning with &#60;code&#62;;&#60;/code&#62;, are no longer recognized as comments. To fix this, I updated
Vim&#39;s syntax for file type &#60;code&#62;gitcommit&#60;/code&#62;. In your Vim setting directory
(&#60;code&#62;~/.config/nvim/&#60;/code&#62; for me), create a file &#60;code&#62;syntax/gitcommit.vim&#60;/code&#62; file (unless
you already have one), add the following line:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;syn match gitcommitComment	&#38;quot;^;.*&#38;quot;
&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Note &#60;code&#62;;&#60;/code&#62; matches my preferred &#60;code&#62;core.commentChar&#60;/code&#62; for Git.&#60;/p&#62;
&#60;p&#62;Et voilà! Git commit message looks tippy-top in Vim again!&#60;/p&#62;
&#60;p&#62;&#60;img src=&#34;/assets/2020/04/gitcommit.png&#34; alt=&#34;editing git commit in vim, with alternative character being the beginning of a comment&#34; /&#62;&#60;/p&#62;
</description>
                <pubDate>Mon, 13 Apr 2020 13:41:02 -0700</pubDate>
                <link>https://duan.ca/2020/04/13/git-commit-comment/</link>
                <guid isPermaLink="true">https://duan.ca/2020/04/13/git-commit-comment/</guid>
            </item>
            <item>
                <title>NeoVim, Swift and Make</title>
                <description>&#60;p&#62;When it comes to Swift source code editing, nothing beats Xcode 6.3! That
includes Xcode 6.2, which drove me to good&#39;O Vim for a while.&#60;/p&#62;
&#60;p&#62;Except it&#39;s not the old Vim, I&#39;m trying out &#60;a href=&#34;http://neovim.org&#34;&#62;NeoVim&#60;/a&#62;. The
most noticable difference in NeoVim compared to Vim is its recent
addition of a built-in terminal.&#60;/p&#62;
&#60;p&#62;With the help of syntax highlighting and a Makefile, working with Swift this
way turns out to be a fine alternative.&#60;/p&#62;
&#60;p&#62;(As a side benefit, I&#39;m forced to use only local-context autocompletion. Now
I can actually spell out full UIKit APIs 😉.)&#60;/p&#62;
&#60;p&#62;Here&#39;s a gif:&#60;/p&#62;
&#60;p&#62;&#60;img src=&#34;/assets/2015/04/demo.gif&#34; alt=&#34;Make Swift NeoVim Demo&#34; /&#62;&#60;/p&#62;
&#60;p&#62;Some details are easy to miss. I pressed &#60;code&#62;,m&#60;/code&#62;, &#60;code&#62;,&#60;/code&#62; being my binding for
&#60;code&#62;&#38;lt;leader&#38;gt;&#60;/code&#62;. A terminal session launched with the &#60;code&#62;make&#60;/code&#62; command running. When
that&#39;s done, I could press any key and the terminal pane was dismissed. Since
&#60;code&#62;test&#60;/code&#62; is the default target in my &#60;code&#62;Makefile&#60;/code&#62;, the test suit for my Swift
codes actually ran.&#60;/p&#62;
&#60;p&#62;Here&#39;s how the shortcut is set in &#60;code&#62;.nvimrc&#60;/code&#62;:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;if has(&#39;nvim&#39;)
    nnoremap &#38;lt;leader&#38;gt;m :rightbelow vertical split &#38;lt;bar&#38;gt; :term make&#38;lt;cr&#38;gt;
endif
&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;The makefile is pretty straightforword if you&#39;ve worked with &#60;code&#62;xcodebuild&#60;/code&#62;.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;test :
    @xcodebuild test -project ProjectName.xcodeproj -scheme SchemeName -destination &#39;platform=iOS Simulator,name=iPhone 6&#39; | xcpretty

clean :
    @xcodebuild clean
&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/supermarin/xcpretty&#34;&#62;xcpretty&#60;/a&#62; is a nifty script that
makes &#60;code&#62;xcodebuild&#60;/code&#62;s output much more readable.&#60;/p&#62;
&#60;p&#62;Happy vimming, Swifties :)&#60;/p&#62;
</description>
                <pubDate>Wed, 22 Apr 2015 11:46:17 -0700</pubDate>
                <link>https://duan.ca/2015/04/22/neovim-swift-and-make/</link>
                <guid isPermaLink="true">https://duan.ca/2015/04/22/neovim-swift-and-make/</guid>
            </item>
            <item>
                <title>One Weird Trick To Make Vim Go Faster On Your Mac</title>
                <description>&#60;p&#62;I noticed something strange today.&#60;/p&#62;
&#60;p&#62;While playing with Ubuntu on a VirtualBox hosted by OS X Mavericks, Vim
&#60;em&#62;seems&#60;/em&#62; much faster than it being in iTerms2. How could that be? So I took the
following steps to test things out:&#60;/p&#62;
&#60;ul&#62;
&#60;li&#62;Installed exact configurations with Vundle on the VM.&#60;/li&#62;
&#60;li&#62;Vim in Terminal.app&#60;/li&#62;
&#60;li&#62;MacVim with GUI.&#60;/li&#62;
&#60;/ul&#62;
&#60;p&#62;Nope, Vim is still more responsive on Ubuntu. In fact, text input seem more
responsive on this VM than the host OS in general! I thought I came to the
light switching to OS X after using Linux as desktop for years, and now this?
&#60;em&#62;&#60;a href=&#34;http://developer.android.com/reference/android/util/Log.html#wtf(java.lang.String,%20java.lang.Throwable)&#34;&#62;WTF&#60;/a&#62;?&#60;/em&#62;&#60;/p&#62;
&#60;p&#62;Defeat and confused, I went to the Internet, and found &#60;a href=&#34;http://stackoverflow.com/questions/4489885/how-can-i-increase-cursor-speed-in-terminal&#34;&#62;something close to an
answer&#60;/a&#62;. Under &#60;em&#62;System Preferences-Keyboard&#60;/em&#62;, drag the two slide
widget (&#38;quot;Key Repeat&#38;quot; and &#38;quot;Deley Until Repeat&#38;quot;) to the right most. Suddenly,
Vim become faster!&#60;/p&#62;
&#60;p&#62;Turns out, key repeating is very important for Vim users.&#60;/p&#62;
</description>
                <pubDate>Fri, 02 May 2014 10:25:00 -0600</pubDate>
                <link>https://duan.ca/2014/05/02/one-weird-trick-to-make-vim-go-faster-on-your-mac/</link>
                <guid isPermaLink="true">https://duan.ca/2014/05/02/one-weird-trick-to-make-vim-go-faster-on-your-mac/</guid>
            </item>
    </channel>
</rss>