<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bartosz Czerwiński on Medium]]></title>
        <description><![CDATA[Stories by Bartosz Czerwiński on Medium]]></description>
        <link>https://medium.com/@czerwinb?source=rss-6119a29f62f9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xzG_U2Y6F97DI3kn4NKeUw.jpeg</url>
            <title>Stories by Bartosz Czerwiński on Medium</title>
            <link>https://medium.com/@czerwinb?source=rss-6119a29f62f9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 14:09:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@czerwinb/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Vim: simple yet powerful templates]]></title>
            <link>https://medium.com/@czerwinb/vim-simple-yet-powerful-templates-55f196a09da6?source=rss-6119a29f62f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/55f196a09da6</guid>
            <category><![CDATA[template]]></category>
            <category><![CDATA[vim]]></category>
            <dc:creator><![CDATA[Bartosz Czerwiński]]></dc:creator>
            <pubDate>Wed, 03 May 2017 23:24:29 GMT</pubDate>
            <atom:updated>2017-05-26T06:30:23.978Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3qu1jdj88BBGavMtOrTSAw.png" /></figure><p>There are quite a few ways to achieve file or text templates in vim, but I am going to discuss just two and mention some alternatives. Feel free to leave a comment if you know better way of achieving same result, as described in this post.</p><h3>Vimscript Functions</h3><p>The text templating mechanism I have found most useful is based on <a href="http://learnvimscriptthehardway.stevelosh.com/chapters/23.html">Vimscript functions</a>. Basically, just define a Vimscript function inside your ~/.vimrcfile that reads a predefined template straight into your editor.</p><p>First create a template file that contains a desired input (text template) inside ~/.vim/templates directory. For instance, create MyTemplate.sh file with the following content:</p><pre># This is a text template that will be inserted into your editor<br>function no_magic_here()<br>  ...<br>end</pre><p>Then add a new properly named function to ~/.vimrc file that reads your template:</p><pre>function MyTemplate()<br>  :read ~/.vim/templates/MyTemplate.sh<br>endfunction</pre><p>No, functions’ names must not start with lowercase letter unless they are scoped, unfortunately. Yes, that’s it! Now to use your template just use the :call MyTemplate() command in Vim.</p><h3>Key maps</h3><p>Another a bit more powerfull option, as it enables you to use placeholders, is based on <a href="http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_(Part_1)">Vim key maps</a>. This solution, however, works well for small templates like short code excerpts, as templates are one-liners to be put directly inside ~/.vimrc file.</p><p>Let’s assume you would like to create a template for Bash <a href="http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_09_02.html">while loop</a> with two placeholders, so after template is called Vim will point you at the predefined placeholder and then let you jump to the next one. The template could look like this:</p><pre>while [ PLACEHOLDER ]; do<br>  PLACEHOLDER<br>done</pre><p>If PLACEHOLDER is substituted with something more concise (e.g. $$$) then to make it work just add the following command to your ~/.vimrc file.</p><pre>:imap &lt;buffer&gt; ;bwh &lt;C-O&gt;mzwhile [ $$$ ]; do&lt;CR&gt;  $$$&lt;CR&gt;done&lt;CR&gt;&lt;C-O&gt;&#39;z;;</pre><p>To activate the skip to next placeholder functionality add the following commands to your ~/.vimrc file:</p><pre>:imap &lt;buffer&gt; ;; &lt;C-O&gt;/$$$&lt;CR&gt;&lt;C-O&gt;c3l<br>:nmap &lt;buffer&gt; ;; /$$$&lt;CR&gt;c3l</pre><p>Now, when you want to use newly defined template type ;bwh command to insert it into editor. The cursor will be placed at first occurrence of $$$. In order to jump to the next location of $$$ just type ;; command. Done!</p><h3>Alternatives</h3><p>If solutions described above do not suit your needs and you require more powerful template processing system, then you should definitely try out the Perl-based <a href="http://www.vim.org/scripts/script.php?script_id=1311">vimplate plugin</a>. It ships with many features such as dynamic user input as well as sample templates for C++, LaTeX, Perl, and Makefile.</p><p>Another option for creating new files from predefined templates is <a href="http://vimawesome.com/plugin/vim-templates-are-made-of">vim-templates plugin</a>. This one is purely dedicated for <strong>file templates</strong> rather than text or excerpt templates, but you may find it useful.</p><p>Yet another alternative for creating new files from templates in an automated fashion based on file extension was described by George Ornbo inside <a href="https://shapeshed.com/vim-templates/">Using template files in Vim</a> blog post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55f196a09da6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to install a specific Gradle version on your Mac?]]></title>
            <link>https://medium.com/@czerwinb/how-to-install-a-specific-gradle-version-on-your-mac-beab35051ee8?source=rss-6119a29f62f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/beab35051ee8</guid>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[sdkman]]></category>
            <category><![CDATA[how-to]]></category>
            <category><![CDATA[homebrew]]></category>
            <dc:creator><![CDATA[Bartosz Czerwiński]]></dc:creator>
            <pubDate>Wed, 15 Feb 2017 21:30:52 GMT</pubDate>
            <atom:updated>2017-02-15T21:32:07.602Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve recently had to install Gradle on a fresh Mac and decided to use Homebrew, as this is the package manager I use most of the time. By quickly typing <em>brew install gradle</em> the latest Gradle version got installed immediately, as expected. I’ve quickly realised this is not what I needed, though. What I wanted was a specific version of Gradle installed. This should be easy with Homebrew… Well, let’s go through some options we have.</p><h3>Homebrew</h3><p>Homebrew offers a capability of installing a package (aka <a href="http://brewformulas.org/">formula</a>) of a custom version, however in the past it required tapping <a href="http://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula"><em>homebrew/boneyard</em></a>. All you have to do is to search for a package .The biggest issue is that not many packages provide formulas for older versions in the <a href="https://github.com/Homebrew/homebrew-versions">versions repository</a>, like Gradle.</p><pre>$ brew search gradle<br>gradle homebrew/versions/gradle214</pre><p>If you are lucky enough and find a version of a formula you were looking for then you can install it by typing the entire string:</p><pre>$ brew install homebrew/versions/gradle214</pre><p>You will probably notice that Brew will automatically tap <em>homebrew/versions</em> tap. To check, which version of a formula is currently active just use the info command. You can switch between multiple versions easily as well, if necessary.</p><pre>$ brew info gradle  <br> gradle: stable 3.3  <br> ...  <br> $ brew switch gradle {version}</pre><p>Unfortunately, the Gradle version I was looking for was not available within the versions repository as outlined above, so I had to look for other options.</p><h3>SDKMAN!</h3><p>I decided to try out <a href="http://sdkman.io/">SDKMAN!</a> out, which looked very promising. I wasn’t disappointed. SDKMAN! gave me access to even more Gradle versions than I needed.</p><pre>$ sdk list gradle  <br> ===========================================  <br> Available Gradle Versions  <br> ===========================================  <br>  3.4-rc-3     2.2.1      2.7  <br> ...</pre><p>Installation of all required package versions and switchover between them was even simpler.</p><pre>$ sdk install gradle 2.7<br>$ sdk install gradle 3.3<br>$ sdk use gradle 2.7 </pre><p>Please note that the use command does switch between candidates in the current shell. If you want to make the change permanent you must use default command instead.</p><pre>$ sdk default gradle 2.7</pre><p>And you are done. For more examples please refer to the <a href="http://sdkman.io/usage.html">SDKMAN! usage page</a>.</p><p>I guess the conclusion is we should never stick blindly to tools we love as there are many interesting alternative to explore out there. Even though you may prefer to stay with your tool in the end you shouldn’t give up a chance of learning something new and widening your experience.</p><blockquote>“Nothing is pleasanter to me than exploring in a library.”<br>—Walter Savage Landor</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=beab35051ee8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>