<?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>DEV Community: Robin Gagnon</title>
    <description>The latest articles on DEV Community by Robin Gagnon (@reobin).</description>
    <link>https://dev.to/reobin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F240292%2Fd1d9fb89-6410-4b88-9488-33c904800b42.png</url>
      <title>DEV Community: Robin Gagnon</title>
      <link>https://dev.to/reobin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/reobin"/>
    <language>en</language>
    <item>
      <title>What are your goals for Hacktoberfest?</title>
      <dc:creator>Robin Gagnon</dc:creator>
      <pubDate>Thu, 01 Oct 2020 15:54:16 +0000</pubDate>
      <link>https://dev.to/reobin/what-are-your-hacktoberfest-goals-1jn3</link>
      <guid>https://dev.to/reobin/what-are-your-hacktoberfest-goals-1jn3</guid>
      <description>&lt;p&gt;Hacktoberfest is open starting today 🎉&lt;/p&gt;

&lt;p&gt;What goal do you aim to achieve before October 31st?&lt;/p&gt;

&lt;p&gt;Mine is to contribute and finally give back to at least 2 of the vim plugins I use every day.&lt;/p&gt;

&lt;p&gt;What about you? Share below.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>hacktoberfest</category>
    </item>
    <item>
      <title>Show and tell: Show off your vim setup 🚀</title>
      <dc:creator>Robin Gagnon</dc:creator>
      <pubDate>Fri, 18 Sep 2020 12:28:15 +0000</pubDate>
      <link>https://dev.to/reobin/show-and-tell-show-off-your-vim-setup-2047</link>
      <guid>https://dev.to/reobin/show-and-tell-show-off-your-vim-setup-2047</guid>
      <description>&lt;p&gt;Hey DEV!&lt;/p&gt;

&lt;p&gt;I was inspired by the post about &lt;a href="https://dev.to/danielw/show-and-tell-show-off-your-vs-code-setup-47be"&gt;vscode setups&lt;/a&gt;, so I decided to create this one.&lt;/p&gt;

&lt;p&gt;I would love to see what the vim users of the DEV community use the most from color schemes, plugins, workflows, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Starting with mine:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2wm7hmlak3pn78mg2u36.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2wm7hmlak3pn78mg2u36.png" alt="Alt Text" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check out the &lt;a href="https://github.com/reobin/dotfiles" rel="noopener noreferrer"&gt;dotfiles&lt;/a&gt;. (Use as a reference only, it is not yet documented ☹️)&lt;/p&gt;

&lt;h3&gt;
  
  
  Color scheme
&lt;/h3&gt;

&lt;p&gt;I use &lt;a href="https://github.com/cocopon/iceberg.vim" rel="noopener noreferrer"&gt;iceberg.vim&lt;/a&gt;, made by the great designer &lt;a href="https://cocopon.me/" rel="noopener noreferrer"&gt;cocopon&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Check out cocopon's work!&lt;/p&gt;

&lt;h3&gt;
  
  
  Plugins
&lt;/h3&gt;

&lt;p&gt;I don't use many plugins, but 3 are vital right now to my workflow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/junegunn/fzf" rel="noopener noreferrer"&gt;fzf&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;Fuzzy find a file by its name&lt;/li&gt;
&lt;li&gt;Search for text in all files&lt;/li&gt;
&lt;li&gt;Quickly switch between open vim buffers&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;a href="https://github.com/neoclide/coc.nvim" rel="noopener noreferrer"&gt;coc.nvim&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;autocompletion for many languages through extensions&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;a href="https://github.com/tpope/vim-fugitive" rel="noopener noreferrer"&gt;vim-fugitive&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;Resolve conflicts&lt;/li&gt;
&lt;li&gt;Stage changes line by line&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Outside vim
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/tmux/tmux" rel="noopener noreferrer"&gt;tmux&lt;/a&gt; to manage terminal panes&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/reobin/typewritten" rel="noopener noreferrer"&gt;typewritten&lt;/a&gt;, a minimal async zsh prompt&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Share your own! 🚀&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>beginners</category>
      <category>vim</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Reload init.vim without restarting neovim</title>
      <dc:creator>Robin Gagnon</dc:creator>
      <pubDate>Mon, 14 Sep 2020 13:15:21 +0000</pubDate>
      <link>https://dev.to/reobin/reload-init-vim-without-restarting-neovim-1h82</link>
      <guid>https://dev.to/reobin/reload-init-vim-without-restarting-neovim-1h82</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Note: Most of the information below is also true for vim and its &lt;code&gt;.vimrc&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The road to the perfect vim/nvim configuration is addictive. I have come to accept that the time I spend configuring my setup will always be greater (much greater) than the time I save using nvim over other text editors. I like to think that I don't use neovim for productivity as much as it makes editing text fun for me, so it all evens out in the end.&lt;/p&gt;

&lt;p&gt;It hurts a little to think about it now, but I used to restart nvim every time I made a change to my &lt;code&gt;init.vim&lt;/code&gt;. I recently started using a key mapping to reload my nvim config, and it made everything much smoother.&lt;/p&gt;

&lt;p&gt;Pursuing the &lt;em&gt;inachievable&lt;/em&gt; goal that is to never have to edit my nvim setup again has never been easier.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;$MYVIMRC&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;First of all, the key mapping has to be callable from whatever file you are in, not just from inside &lt;code&gt;init.vim&lt;/code&gt;. This will be useful when quickly editing the config while having a project open in a different nvim instance.&lt;/p&gt;

&lt;p&gt;Comes &lt;code&gt;$MYVIMRC&lt;/code&gt;. Both in vim and nvim, &lt;code&gt;$MYVIMRC&lt;/code&gt; is an environment variable set to the path of your custom configuration file.&lt;/p&gt;

&lt;p&gt;Test it by running &lt;code&gt;:echo $MYVIMRC&lt;/code&gt; inside of vim or nvim.&lt;/p&gt;

&lt;p&gt;The output should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# nvim&lt;/span&gt;
/Users/&amp;lt;user&amp;gt;/.config/nvim/init.vim

&lt;span class="c"&gt;# vim&lt;/span&gt;
/Users/&amp;lt;user&amp;gt;/.vimrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Sourcing &lt;code&gt;$MYVIMRC&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;After editing your &lt;code&gt;init.vim&lt;/code&gt;, you can use the &lt;code&gt;$MYVIMRC&lt;/code&gt; variable to make nvim load the configuration again, instead of quitting and restarting.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;source&lt;/span&gt; $MYVIMRC
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A simple key mapping can be created to run that very command. I set mine to 2 times &lt;code&gt;&amp;lt;Leader&amp;gt;&lt;/code&gt;, which is space in my case.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;nnoremap &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;silent&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;Leader&lt;span class="p"&gt;&amp;gt;&amp;lt;&lt;/span&gt;Leader&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;source&lt;/span&gt; $MYVIMRC&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;cr&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every time I'm done editing my configuration, I can tap space twice in any open nvim instance, and the results can be noticed instantly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other useful key mappings
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Edit &lt;code&gt;$MYVIMRC&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;$MYVIMRC&lt;/code&gt; variable can also be used to quickly open the file in a new buffer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;e&lt;/span&gt; $MYVIMRC
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Personally, I use &lt;code&gt;&amp;lt;Leader&amp;gt;v&lt;/code&gt; as the key mapping to open the file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;nnoremap &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;silent&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;Leader&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="k"&gt;v&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;e&lt;/span&gt; $MYVIMRC&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;cr&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It could also be &lt;code&gt;:split&lt;/code&gt; or &lt;code&gt;:vsplit&lt;/code&gt; instead of &lt;code&gt;:e&lt;/code&gt; to open the file in a split, not closing the currently open file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reload &lt;code&gt;$MYVIMRC&lt;/code&gt; and the autoload directory
&lt;/h3&gt;

&lt;p&gt;I like to separate my nvim configuration into multiple self-contained files. For example, I created a file in the &lt;code&gt;autoload&lt;/code&gt; directory for my customized status line that I call using &lt;code&gt;call statusline#_init()&lt;/code&gt; in my &lt;code&gt;init.vim&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;When editing a file in the &lt;code&gt;autoload&lt;/code&gt; directory, sourcing &lt;code&gt;$MYVIMRC&lt;/code&gt; is not enough to instantly see the changes made to the edited file. Its the file itself that needs to be sourced.&lt;/p&gt;

&lt;p&gt;My solution was to create a &lt;code&gt;SourceConfig&lt;/code&gt; function in my &lt;code&gt;init.vim&lt;/code&gt; file that I can call instead when I want to reload all my config.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(!&lt;/span&gt;&lt;span class="nb"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'*SourceConfig'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="k"&gt;function&lt;/span&gt; SourceConfig&lt;span class="p"&gt;()&lt;/span&gt; abort
    &lt;span class="c"&gt;" Your path will probably be different&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;f&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="k"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'~/.config/nvim/autoload/*'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="s1"&gt;'\n'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      exe &lt;span class="s1"&gt;'source'&lt;/span&gt; &lt;span class="k"&gt;f&lt;/span&gt;
    &lt;span class="k"&gt;endfor&lt;/span&gt;

    &lt;span class="k"&gt;source&lt;/span&gt; $MYVIMRC
  &lt;span class="k"&gt;endfunction&lt;/span&gt;
&lt;span class="k"&gt;endif&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;if&lt;/code&gt; condition checks for an already existing &lt;code&gt;SourceConfig&lt;/code&gt; function. The check is important because otherwise, the function tries to redefine itself (while sourcing &lt;code&gt;$MYVIMRC&lt;/code&gt;) before it is done running.&lt;/p&gt;

&lt;p&gt;The rest is pretty simple. All files inside of the &lt;code&gt;autoload&lt;/code&gt; directory as well as the &lt;code&gt;$MYVIMRC&lt;/code&gt; are sourced. Note that the path to the &lt;code&gt;autoload&lt;/code&gt; directory will be different if using vim.&lt;/p&gt;

&lt;p&gt;I updated my key mapping to call the function instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;nnoremap &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;silent&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;Leader&lt;span class="p"&gt;&amp;gt;&amp;lt;&lt;/span&gt;Leader&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;call&lt;/span&gt; SourceConfig&lt;span class="p"&gt;()&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;cr&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>vim</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
