<?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: Konstantin</title>
    <description>The latest articles on DEV Community by Konstantin (@konstantin).</description>
    <link>https://dev.to/konstantin</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%2F49942%2F2dceed70-4328-465c-827a-9255a0c545ef.png</url>
      <title>DEV Community: Konstantin</title>
      <link>https://dev.to/konstantin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/konstantin"/>
    <language>en</language>
    <item>
      <title>Handling multiple branches in AI projects with git worktree</title>
      <dc:creator>Konstantin</dc:creator>
      <pubDate>Sun, 28 Dec 2025 21:01:21 +0000</pubDate>
      <link>https://dev.to/konstantin/handling-multiple-branches-in-ai-projects-with-git-worktree-40pn</link>
      <guid>https://dev.to/konstantin/handling-multiple-branches-in-ai-projects-with-git-worktree-40pn</guid>
      <description>&lt;p&gt;One of the most important features of git in terms of AI is &lt;code&gt;git worktree&lt;/code&gt;. It allows you to checkout different branches at the same time in different folders like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git worktree add &amp;lt;branch&amp;gt; path
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And all worktrees share the common stash list between them. This is crucial for AI use in projects where you might be running a long training job in one worktree, while simultaneously preprocessing data in another, and fixing a bug in code in a third—all without conflicts or context switching.&lt;/p&gt;

&lt;p&gt;One of the big drawbacks of &lt;code&gt;git worktree&lt;/code&gt; in my opinion was always unintuitive syntax, where I always would have to look up how to do a specific thing.&lt;/p&gt;

&lt;h2&gt;
  
  
  My solution: gwt
&lt;/h2&gt;

&lt;p&gt;To fix this, I created &lt;a href="https://github.com/gko/gwt" rel="noopener noreferrer"&gt;gwt&lt;/a&gt;, a simple helper that makes git worktree intuitive.&lt;/p&gt;

&lt;p&gt;Once &lt;a href="https://github.com/gko/gwt?tab=readme-ov-file#installation" rel="noopener noreferrer"&gt;installed&lt;/a&gt; you can simply type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gwt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To list all available worktrees.&lt;/p&gt;

&lt;h3&gt;
  
  
  Before gwt
&lt;/h3&gt;

&lt;p&gt;You would have to &lt;code&gt;git worktree list&lt;/code&gt; → copy the path → &lt;code&gt;cd ../../path/to/the-other-feature&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  With gwt
&lt;/h3&gt;

&lt;p&gt;Just run &lt;code&gt;gwt&lt;/code&gt; and choose the branch and you're there.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gwt add &amp;lt;branch&amp;gt;&lt;/code&gt; would automatically create a new worktree with checked out branch.&lt;/p&gt;

&lt;p&gt;If you already know the branch's worktree you want to jump into you can simply type &lt;code&gt;gwt &amp;lt;branch&amp;gt;&lt;/code&gt;. Gwt supports autocomplete for branch names.&lt;/p&gt;

&lt;p&gt;And finally &lt;code&gt;gwt remove&lt;/code&gt; interactively prompts you to choose which worktree to delete.&lt;/p&gt;

</description>
      <category>git</category>
      <category>productivity</category>
      <category>ai</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Bundle frontend into axum binary using include_dir</title>
      <dc:creator>Konstantin</dc:creator>
      <pubDate>Sun, 14 Apr 2024 01:45:34 +0000</pubDate>
      <link>https://dev.to/konstantin/bundle-frontend-with-axum-build-using-includedir-g8i</link>
      <guid>https://dev.to/konstantin/bundle-frontend-with-axum-build-using-includedir-g8i</guid>
      <description>&lt;p&gt;If you have a frontend client that is tightly coupled with backend it might make sense to bake the frontend files inside backend binary. This way you can deploy only backend and be sure that frontend will be deployed as well.&lt;/p&gt;

&lt;p&gt;There are some proposals on how to do it already such as &lt;a href="https://github.com/tokio-rs/axum/issues/1698" rel="noopener noreferrer"&gt;https://github.com/tokio-rs/axum/issues/1698&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But we'll be using &lt;a href="https://docs.rs/include_dir/latest/include_dir/" rel="noopener noreferrer"&gt;&lt;code&gt;include_dir&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;Our project will have the following structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;├── src/ -&amp;gt; server source code
│   ├── routes/
│   │   ├── mod.rs
│   │   ├── healthcheck.rs
│   │   └── frontend.rs
│   └── main.rs
├── frontend/
│   ├── dist/ -&amp;gt; folder that we'll be baking into binary
│   ...
├── Cargo.toml
└── build.rs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First, let's prepare the &lt;code&gt;Cargo.toml&lt;/code&gt; and specify all dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="nn"&gt;[package]&lt;/span&gt;
&lt;span class="py"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"axum_include_dir"&lt;/span&gt;
&lt;span class="py"&gt;version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"0.1.0"&lt;/span&gt;
&lt;span class="py"&gt;edition&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"2021"&lt;/span&gt;

&lt;span class="nn"&gt;[dependencies]&lt;/span&gt;
&lt;span class="py"&gt;axum&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"0.7.5"&lt;/span&gt;
&lt;span class="py"&gt;tokio&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="py"&gt;version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="py"&gt;features&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"full"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="py"&gt;mime_guess&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"2.0.4"&lt;/span&gt;
&lt;span class="py"&gt;include_dir&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"0.7.3"&lt;/span&gt;
&lt;span class="py"&gt;time&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"0.3.36"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Healthcheck route
&lt;/h2&gt;

&lt;p&gt;Now we can start implementing our routes. We need &lt;code&gt;health&lt;/code&gt; route for two reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;it's a good idea in general to have a &lt;code&gt;health&lt;/code&gt; in order to determine whether backend is up and running&lt;/li&gt;
&lt;li&gt;in our case we want to make sure that our solution won't rewrite backend routes (in case if we have files with the same name as routes)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here's our simple route(&lt;code&gt;src/routes/healthcheck.rs&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;axum&lt;/span&gt;&lt;span class="p"&gt;::{&lt;/span&gt;&lt;span class="n"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;routing&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;pub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;crate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;router&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Router&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nn"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="nf"&gt;.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/health"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(||&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s"&gt;"ok"&lt;/span&gt; &lt;span class="p"&gt;}))&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Frontend
&lt;/h2&gt;

&lt;p&gt;We can easily generate the frontend with &lt;a href="https://vitejs.dev/guide/" rel="noopener noreferrer"&gt;vite&lt;/a&gt;:&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="nv"&gt;$ &lt;/span&gt;npm create vite@latest frontend &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;--template&lt;/span&gt; react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The only other thing that we need to do is to install frontend dependencies:&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="nv"&gt;$ &lt;/span&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Frontend router
&lt;/h3&gt;

&lt;p&gt;Frontend router would be responsible for multiple things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;calling &lt;code&gt;include_dir&lt;/code&gt; in order to bake the &lt;code&gt;frontend/dist&lt;/code&gt; folder into the server binary&lt;/li&gt;
&lt;li&gt;serving static files that were bundled&lt;/li&gt;
&lt;li&gt;handling default files, like &lt;code&gt;index.html&lt;/code&gt; if we called a route that points to a folder&lt;/li&gt;
&lt;li&gt;handling not found errors &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the full &lt;code&gt;src/routes/frontend.rs&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;std&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;path&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;PathBuf&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;axum&lt;/span&gt;&lt;span class="p"&gt;::{&lt;/span&gt;
    &lt;span class="nn"&gt;http&lt;/span&gt;&lt;span class="p"&gt;::{&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="nn"&gt;response&lt;/span&gt;&lt;span class="p"&gt;::{&lt;/span&gt;&lt;span class="n"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;IntoResponse&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="n"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nn"&gt;routing&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nn"&gt;extract&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nn"&gt;body&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Body&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;include_dir&lt;/span&gt;&lt;span class="p"&gt;::{&lt;/span&gt;&lt;span class="n"&gt;include_dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;File&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;mime_guess&lt;/span&gt;&lt;span class="p"&gt;::{&lt;/span&gt;&lt;span class="n"&gt;Mime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mime&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;time&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;ROOT&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;DEFAULT_FILES&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"index.html"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"index.htm"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;NOT_FOUND&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"404.html"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="n"&gt;FRONTEND_DIR&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Dir&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;'_&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nd"&gt;include_dir!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"$CARGO_MANIFEST_DIR/frontend/dist"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;serve_asset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Option&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Path&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;impl&lt;/span&gt; &lt;span class="n"&gt;IntoResponse&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;serve_file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;File&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mime_type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Option&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Mime&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Option&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nn"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="nf"&gt;.status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="nf"&gt;.unwrap_or&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;StatusCode&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;OK&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="nf"&gt;.header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;header&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;CONTENT_TYPE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mime_type&lt;/span&gt;&lt;span class="nf"&gt;.unwrap_or&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;mime&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;TEXT_HTML&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nf"&gt;.to_string&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
            &lt;span class="nf"&gt;.header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;header&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;CACHE_CONTROL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nd"&gt;format!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"max-age={}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cache&lt;/span&gt;&lt;span class="nf"&gt;.as_seconds_f32&lt;/span&gt;&lt;span class="p"&gt;()))&lt;/span&gt;
            &lt;span class="nf"&gt;.body&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="nf"&gt;.contents&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="nf"&gt;.to_owned&lt;/span&gt;&lt;span class="p"&gt;()))&lt;/span&gt;
            &lt;span class="nf"&gt;.unwrap&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;serve_not_found&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;||&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;match&lt;/span&gt; &lt;span class="n"&gt;FRONTEND_DIR&lt;/span&gt;&lt;span class="nf"&gt;.get_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;NOT_FOUND&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nf"&gt;Some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;serve_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;ZERO&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;Some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;StatusCode&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;NOT_FOUND&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
            &lt;span class="nb"&gt;None&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nn"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                &lt;span class="nf"&gt;.status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;StatusCode&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;NOT_FOUND&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="nf"&gt;.body&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"File Not Found"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
                &lt;span class="nf"&gt;.unwrap&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;serve_default&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;default_file&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;DEFAULT_FILES&lt;/span&gt;&lt;span class="nf"&gt;.iter&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;default_file_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;PathBuf&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nf"&gt;.join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;default_file&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;FRONTEND_DIR&lt;/span&gt;&lt;span class="nf"&gt;.get_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;default_file_path&lt;/span&gt;&lt;span class="nf"&gt;.clone&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;&lt;span class="nf"&gt;.is_some&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;serve_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;FRONTEND_DIR&lt;/span&gt;&lt;span class="nf"&gt;.get_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;default_file_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nf"&gt;.unwrap&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
                    &lt;span class="nb"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="nn"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;ZERO&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="nb"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="nf"&gt;serve_not_found&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="k"&gt;match&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;Some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;ROOT&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;serve_default&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;

            &lt;span class="n"&gt;FRONTEND_DIR&lt;/span&gt;&lt;span class="nf"&gt;.get_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nf"&gt;.map_or_else&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="p"&gt;||&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="k"&gt;match&lt;/span&gt; &lt;span class="n"&gt;FRONTEND_DIR&lt;/span&gt;&lt;span class="nf"&gt;.get_dir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                        &lt;span class="nf"&gt;Some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;serve_default&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                        &lt;span class="nb"&gt;None&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;serve_not_found&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                    &lt;span class="p"&gt;}&lt;/span&gt;
                &lt;span class="p"&gt;},&lt;/span&gt;
                &lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;mime_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;mime_guess&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;from_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;PathBuf&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="nf"&gt;.clone&lt;/span&gt;&lt;span class="p"&gt;()))&lt;/span&gt;&lt;span class="nf"&gt;.first_or_octet_stream&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
                    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;cache&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;mime_type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nn"&gt;mime&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;TEXT_HTML&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                        &lt;span class="nn"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;ZERO&lt;/span&gt;
                    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                        &lt;span class="nn"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;days&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;365&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                    &lt;span class="p"&gt;};&lt;/span&gt;

                    &lt;span class="nf"&gt;serve_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;Some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mime_type&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;},&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nb"&gt;None&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;serve_not_found&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;pub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;crate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;router&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Router&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nn"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="nf"&gt;.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(||&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nf"&gt;serve_asset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;Some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;String&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ROOT&lt;/span&gt;&lt;span class="p"&gt;))))&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt; &lt;span class="p"&gt;}))&lt;/span&gt;
        &lt;span class="nf"&gt;.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/*path"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(|&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nf"&gt;serve_asset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;Some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt; &lt;span class="p"&gt;}))&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we bundle &lt;code&gt;frontend/dist&lt;/code&gt; with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="n"&gt;FRONTEND_DIR&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Dir&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;'_&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nd"&gt;include_dir!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"$CARGO_MANIFEST_DIR/frontend/dist"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On each request we try to get the file first by using &lt;code&gt;FRONTEND_DIR.get_file(&amp;amp;path)&lt;/code&gt; and if &lt;code&gt;None&lt;/code&gt; is returned we check if the &lt;code&gt;path&lt;/code&gt; is a folder with &lt;code&gt;FRONTEND_DIR.get_dir(&amp;amp;path)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In case of the folder we try to find one of the &lt;code&gt;DEFAULT_FILES&lt;/code&gt; array inside it and serve them. If we can't find neither a file nor a folder we try to return &lt;code&gt;404.html&lt;/code&gt; file if it exists in the &lt;code&gt;FRONTEND_DIR&lt;/code&gt; or a simple &lt;code&gt;File Not Found&lt;/code&gt; message with &lt;code&gt;404&lt;/code&gt; code. In order to add &lt;code&gt;404.html&lt;/code&gt; in a frontend generated by &lt;code&gt;vite&lt;/code&gt; you need to simply create that file in &lt;code&gt;frontend/public&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;We also try to guess the mime type with the help of &lt;a href="https://docs.rs/mime_guess/" rel="noopener noreferrer"&gt;&lt;code&gt;mime_guess&lt;/code&gt; crate&lt;/a&gt; and cache duration based on file type.&lt;/p&gt;

&lt;h3&gt;
  
  
  Building frontend
&lt;/h3&gt;

&lt;p&gt;In order to trigger the frontend build we need to create &lt;code&gt;build.rs&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;std&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;process&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"npm"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;.args&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"run"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="nf"&gt;.current_dir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"frontend"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;.output&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="nf"&gt;.expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Failed to execute command"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="py"&gt;.status&lt;/span&gt;&lt;span class="nf"&gt;.success&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nd"&gt;panic!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Command executed with failing error code"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each time we'll run &lt;code&gt;cargo run&lt;/code&gt; the frontend will be built as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Merging routes
&lt;/h2&gt;

&lt;p&gt;Now that we have all routes ready we can merge them in &lt;code&gt;main.rs&lt;/code&gt; file and launch &lt;code&gt;axum&lt;/code&gt; server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;mod&lt;/span&gt; &lt;span class="n"&gt;routes&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;axum&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="k"&gt;crate&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;routes&lt;/span&gt;&lt;span class="p"&gt;::{&lt;/span&gt;&lt;span class="n"&gt;healthcheck&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;frontend&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nd"&gt;#[tokio::main]&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="nf"&gt;.merge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;healthcheck&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;router&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
        &lt;span class="nf"&gt;.merge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;frontend&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;router&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;listener&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;tokio&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;net&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;TcpListener&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"0.0.0.0:3000"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="nf"&gt;.unwrap&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nn"&gt;axum&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;serve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;listener&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="nf"&gt;.unwrap&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Running the server
&lt;/h2&gt;

&lt;p&gt;To run server we can either run&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="nv"&gt;$ &lt;/span&gt;cargo run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or we can install &lt;a href="https://watchexec.github.io/#cargo-watch" rel="noopener noreferrer"&gt;cargo-watch&lt;/a&gt; and run it like so:&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="nv"&gt;$ RUST_BACKTRACE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 cargo watch &lt;span class="nt"&gt;-x&lt;/span&gt; run &lt;span class="nt"&gt;-w&lt;/span&gt; src &lt;span class="nt"&gt;-w&lt;/span&gt; frontend/src
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way every time that you change either server source code or frontend source code cargo will rebuild both.&lt;/p&gt;

&lt;p&gt;And there it is on &lt;code&gt;localhost:3000&lt;/code&gt;:&lt;br&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%2Fuploads%2Farticles%2Fprvdsed97x4nr5ia2nyf.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%2Fuploads%2Farticles%2Fprvdsed97x4nr5ia2nyf.png" alt=" " width="800" height="660"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The frontend that is served right from inside of server binary.&lt;/p&gt;

</description>
      <category>rust</category>
      <category>axum</category>
      <category>frontend</category>
      <category>bundle</category>
    </item>
    <item>
      <title>Is this a good code?</title>
      <dc:creator>Konstantin</dc:creator>
      <pubDate>Sat, 21 Jan 2023 19:05:55 +0000</pubDate>
      <link>https://dev.to/konstantin/is-this-a-good-code-3fec</link>
      <guid>https://dev.to/konstantin/is-this-a-good-code-3fec</guid>
      <description>&lt;h2&gt;
  
  
  Disclaimers
&lt;/h2&gt;

&lt;p&gt;First let me make two disclaimers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I'm not trying to tell here that the developer that wrote this code is a bad developer. For all I know he/she might be a much better developer than me.&lt;/li&gt;
&lt;li&gt;I write a bad code all the time, so this post is nor to try compare my work to their's.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The code
&lt;/h2&gt;

&lt;p&gt;You probably noticed this famous tweet:&lt;br&gt;
&lt;iframe class="tweet-embed" id="tweet-1615204074588180481-1" src="https://platform.twitter.com/embed/Tweet.html?id=1615204074588180481"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1615204074588180481-1');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1615204074588180481&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;You can find the code in question here:&lt;br&gt;
&lt;a href="https://github.com/MinBZK/woo-besluit-broncode-digid-app/blob/ad2737c4a039d5ca76633b81e9d4f3f9370549e4/Source/DigiD.iOS/Services/NFCService.cs#L182-L206" rel="noopener noreferrer"&gt;https://github.com/MinBZK/woo-besluit-broncode-digid-app/blob/ad2737c4a039d5ca76633b81e9d4f3f9370549e4/Source/DigiD.iOS/Services/NFCService.cs#L182-L206&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The internet became split between two types of developers. There were some developers saying that this is a bad code and providing an interesting one-liners that can do the same thing, and there were others that were praising it for its readability and simplicity.&lt;/p&gt;

&lt;p&gt;I don't think that this code is really bad, but I don't agree with those that say that this is an amazing code either. Although, I completely agree that it's highly readable and you clearly understand what the author was trying to do, I do think it has some flaws. But first, let me share my solutions to the same problem.&lt;/p&gt;
&lt;h2&gt;
  
  
  My version
&lt;/h2&gt;

&lt;p&gt;The first thing I asked myself is how I would solve this problem. I came up with initial version:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;which was criticised fairly for being less optimised than the original:&lt;br&gt;
&lt;iframe class="tweet-embed" id="tweet-1616224674903658496-978" src="https://platform.twitter.com/embed/Tweet.html?id=1616224674903658496"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1616224674903658496-978');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1616224674903658496&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;So I went on and made a second version:&lt;br&gt;
&lt;iframe class="tweet-embed" id="tweet-1616430404327870468-501" src="https://platform.twitter.com/embed/Tweet.html?id=1616430404327870468"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1616430404327870468-501');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1616430404327870468&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;that seems to be as readable and as efficient as original one:&lt;br&gt;
&lt;iframe class="tweet-embed" id="tweet-1616520533092495361-548" src="https://platform.twitter.com/embed/Tweet.html?id=1616520533092495361"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1616520533092495361-548');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1616520533092495361&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;h2&gt;
  
  
  So what is wrong with the original code?
&lt;/h2&gt;

&lt;p&gt;For me a part from readability and efficiency there is another important criteria for a good code: &lt;strong&gt;maintainability&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Imagine a scenario where you've shipped the initial solution and you received right away the new product requirements that change its behaviour.&lt;/p&gt;

&lt;p&gt;In this scenario, the less effort you have to make to adapt to these requirements, the more &lt;strong&gt;maintainable&lt;/strong&gt; your solution will be.&lt;/p&gt;

&lt;p&gt;And I can think of at least two potential changes to product requirements:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;making the scale bigger / smaller (instead of 10 slots show 5 or 20)&lt;/li&gt;
&lt;li&gt;change the symbol from blue dot to let's say a star.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The first case would require making the original code twice as long / short. Or in the worst case it might be a complete rewrite. And the second case would require a search and replace through the whole function body. (it might not be a big deal in this case but it just shows the flaw)&lt;/p&gt;

&lt;p&gt;In my version the modifications for those new requirements would be the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;extract the number of steps into a &lt;code&gt;scale&lt;/code&gt; variable:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nf"&gt;GetPercentageRounds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;percentage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;blueSpotSymbol&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"🔵"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;emptySpotSymbol&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"⚪"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;scale&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// 0 to 10&lt;/span&gt;
  &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;blueSpotsToDraw&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Ceiling&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;percentage&lt;/span&gt; &lt;span class="p"&gt;*&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;*&lt;/span&gt; &lt;span class="n"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;overallProgress&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;++)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;overallProgress&lt;/span&gt; &lt;span class="p"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;blueSpotsToDraw&lt;/span&gt;&lt;span class="p"&gt;--&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt;
      &lt;span class="n"&gt;blueSpotSymbol&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="n"&gt;emptySpotSymbol&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;overallProgress&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;just change the symbols at the top of the function&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even if there is another team that comes to you and asks you to make this code configurable and share it with them it is fairly easy to do. You can simply add &lt;code&gt;scale&lt;/code&gt; and symbols to function parameters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Maintainability is as important as efficiency or readability. The more maintainable we make the system today, the less work and technical debt we will leave to someone else in the future.&lt;/p&gt;

</description>
      <category>code</category>
      <category>review</category>
      <category>codequality</category>
      <category>programming</category>
    </item>
    <item>
      <title>Checking out multiple branches at the same time in git and moving files between them using git worktree</title>
      <dc:creator>Konstantin</dc:creator>
      <pubDate>Tue, 21 Apr 2020 17:52:00 +0000</pubDate>
      <link>https://dev.to/konstantin/checking-out-multiple-branches-at-the-same-time-in-git-and-moving-files-between-them-31hk</link>
      <guid>https://dev.to/konstantin/checking-out-multiple-branches-at-the-same-time-in-git-and-moving-files-between-them-31hk</guid>
      <description>&lt;p&gt;Imagine that you're working on some branch that is out of sync with &lt;code&gt;master&lt;/code&gt; and you have already made a lot of changes. All of the sudden you realise that you want to move some of the files to a new branch that will be sourced from &lt;code&gt;master&lt;/code&gt; (i.e. changes are needed by other members of the team).&lt;/p&gt;

&lt;h2&gt;
  
  
  Git Worktrees
&lt;/h2&gt;

&lt;p&gt;To do that, you first need to create a &lt;code&gt;git&lt;/code&gt; &lt;code&gt;worktree&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git worktree add &amp;lt;folder&amp;gt; master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will basically create a folder with a repository and checkout &lt;code&gt;master&lt;/code&gt; branch. It also creates a link between the new and the "original" repository folder.&lt;/p&gt;

&lt;p&gt;You can use &lt;code&gt;git worktree list&lt;/code&gt; to list worktrees and &lt;code&gt;git worktree remove&lt;/code&gt; to remove them. For more information about &lt;code&gt;git worktree&lt;/code&gt; please refer to the &lt;a href="https://git-scm.com/docs/git-worktree" rel="noopener noreferrer"&gt;official documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Moving files
&lt;/h2&gt;

&lt;p&gt;As mentioned earlier, &lt;code&gt;git worktree&lt;/code&gt; creates a link between local folders. That means that your stashes are the same between them. So you can just stash interactively necessary hunks with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git stash -p
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or you can &lt;code&gt;git add&lt;/code&gt; unwanted changes, and &lt;code&gt;git stash -k&lt;/code&gt; to stash the unstaged files. &lt;/p&gt;

&lt;p&gt;Now you need to switch to the new worktree with &lt;code&gt;master&lt;/code&gt; and create a new branch:&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="nb"&gt;cd&lt;/span&gt; &amp;lt;folder&amp;gt;
git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; new_branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and do &lt;code&gt;git stash apply&lt;/code&gt;. It's better to use &lt;code&gt;apply&lt;/code&gt; most of the time and not &lt;code&gt;pop&lt;/code&gt; since if you have some conflicts you can always abort without losing stashed changes.&lt;/p&gt;

</description>
      <category>git</category>
      <category>branch</category>
      <category>worktree</category>
      <category>stash</category>
    </item>
    <item>
      <title>Generating shorter aliases from .gitconfig file</title>
      <dc:creator>Konstantin</dc:creator>
      <pubDate>Fri, 07 Feb 2020 20:43:40 +0000</pubDate>
      <link>https://dev.to/konstantin/generating-shorter-aliases-from-gitconfig-file-4g5m</link>
      <guid>https://dev.to/konstantin/generating-shorter-aliases-from-gitconfig-file-4g5m</guid>
      <description>&lt;p&gt;In previous articles I showed how to configure &lt;code&gt;aliases&lt;/code&gt; in your &lt;code&gt;~/.gitconfig&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;As you might have noticed you need to type &lt;code&gt;git alias&lt;/code&gt; which might be inconvenient. Even if you make an &lt;code&gt;alias g=git&lt;/code&gt; you have to remember to type space between &lt;code&gt;g&lt;/code&gt; and &lt;code&gt;alias&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To make things easier we can automatically generate shell aliases from the &lt;code&gt;.gitconfig&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;here we grep all the &lt;code&gt;git&lt;/code&gt; config values from &lt;code&gt;alias&lt;/code&gt; section and get the &lt;code&gt;alias&lt;/code&gt; name with &lt;code&gt;sed&lt;/code&gt;. Then we check that alias &lt;code&gt;g&lt;/code&gt; + alias name doesn't already exist and set it.&lt;/p&gt;

&lt;p&gt;Now, if you had for instance alias &lt;code&gt;a = add&lt;/code&gt; you can type both &lt;code&gt;g a&lt;/code&gt; and &lt;code&gt;ga&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That's it.&lt;/p&gt;

</description>
      <category>git</category>
      <category>alias</category>
      <category>bash</category>
      <category>zsh</category>
    </item>
    <item>
      <title>Write everything down</title>
      <dc:creator>Konstantin</dc:creator>
      <pubDate>Mon, 06 Jan 2020 13:08:37 +0000</pubDate>
      <link>https://dev.to/konstantin/write-everything-down-3ej8</link>
      <guid>https://dev.to/konstantin/write-everything-down-3ej8</guid>
      <description>&lt;p&gt;If you have any thought, even if it doesn't appear to be interesting at first, try to write it down. This way you can keep a history of your discoveries.&lt;/p&gt;

&lt;p&gt;Otherwise, if you have a brilliant idea and it's in the way of something else (i.e. current work) , writing it down can eliberate the burden that you had and you actually will be able to focus on the tasks at hand, knowing that your idea is safely stored and that you can come back to it later.&lt;/p&gt;

&lt;p&gt;Once you gain an experience of quickly writing down something you'll find that your ideas become much better formed and more polished. You'll also be able to communicate them to other people in a more clear manner.&lt;/p&gt;

&lt;p&gt;Make sure that you have at all times something to write on, or that your writing app is one tap away, that it will open a note right away and the only thing that is left for you is to write down your thought. It also should provide an easy way to categorize, tag and find your notes.&lt;/p&gt;

&lt;p&gt;There is only one disadvantage—it takes time. But this disadvantage is still easily beaten by a potential regret of a missed thought (that could have transformed to something interesting).&lt;/p&gt;

&lt;p&gt;Write everything down!&lt;/p&gt;

</description>
      <category>writing</category>
      <category>notes</category>
      <category>thoughts</category>
      <category>ideas</category>
    </item>
    <item>
      <title>Managing your projects</title>
      <dc:creator>Konstantin</dc:creator>
      <pubDate>Mon, 23 Dec 2019 19:54:26 +0000</pubDate>
      <link>https://dev.to/konstantin/managing-your-projects-31p1</link>
      <guid>https://dev.to/konstantin/managing-your-projects-31p1</guid>
      <description>&lt;p&gt;As most of developers I have &lt;code&gt;~/projects&lt;/code&gt; folder where I stock all my projects.&lt;/p&gt;

&lt;p&gt;To jump from one project to another I normally use either a &lt;code&gt;cd&lt;/code&gt; with &lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/zsh-users" rel="noopener noreferrer"&gt;
        zsh-users
      &lt;/a&gt; / &lt;a href="https://github.com/zsh-users/zsh-autosuggestions" rel="noopener noreferrer"&gt;
        zsh-autosuggestions
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Fish-like autosuggestions for zsh
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;
 or &lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/rupa" rel="noopener noreferrer"&gt;
        rupa
      &lt;/a&gt; / &lt;a href="https://github.com/rupa/z" rel="noopener noreferrer"&gt;
        z
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      z - jump around
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;But sometimes I get to a wrong folder (&lt;code&gt;z&lt;/code&gt; sometimes jumps to parent folder) and if I want to create a project I have to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create folder&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;cd&lt;/code&gt; to it&lt;/li&gt;
&lt;li&gt;do &lt;code&gt;git init&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;do &lt;code&gt;npm init&lt;/code&gt; or &lt;code&gt;cargo init&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;do &lt;code&gt;hub create&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A lot of stuff, just to create a project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter &lt;code&gt;gko/project&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Some time ago I created a small &lt;code&gt;zsh&lt;/code&gt; plugin (it works in &lt;code&gt;bash&lt;/code&gt; as well):&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/gko" rel="noopener noreferrer"&gt;
        gko
      &lt;/a&gt; / &lt;a href="https://github.com/gko/project" rel="noopener noreferrer"&gt;
        project
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      ☕️ Create node, rust, python or ruby project locally and on github (private or public)
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Project&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;Create &lt;code&gt;npm&lt;/code&gt;, &lt;code&gt;cargo&lt;/code&gt;, &lt;code&gt;gem&lt;/code&gt; or &lt;code&gt;pip&lt;/code&gt; project locally and on &lt;code&gt;github&lt;/code&gt; or just &lt;code&gt;cd&lt;/code&gt; into existing.&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/demo.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdemo.png" alt="demo"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;After project init you will be prompted to create a &lt;code&gt;github&lt;/code&gt; repo (private or public).&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/github.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fgithub.png" alt="github"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can read more about it in the «&lt;a href="https://dev.to/konstantin/managing-your-projects-31p1" rel="nofollow"&gt;Managing your projects&lt;/a&gt;» article.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Installation&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;You will need to install &lt;a href="https://cli.github.com/" rel="noopener noreferrer"&gt;github cli&lt;/a&gt; (see this &lt;a href="https://github.com/cli/cli#installation" rel="noopener noreferrer"&gt;installation instructions&lt;/a&gt;) in order to create project repository on &lt;code&gt;github&lt;/code&gt;.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;With &lt;a href="https://github.com/zsh-users/antigen" rel="noopener noreferrer"&gt;antigen&lt;/a&gt;
&lt;/h3&gt;
&lt;/div&gt;
&lt;p&gt;In your .zshrc&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;antigen bundle gko/project&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Manually&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;You need to clone repo:&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;git clone --recursive --depth 1 https://github.com/gko/project&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;then add it to .bashrc or .zshrc:&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-c1"&gt;source&lt;/span&gt; ./project/project.sh&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Usage&lt;/h2&gt;

&lt;/div&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;Usage: project [options]
Example:
  project -p test
Options:
  -h, --help      help
  -p, --private   create private github repository
  -f, --folder    your projects folder(defaults to ~/projects)
  -n, --no-init   avoid initializing package
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;then to create public repo:&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;project &lt;span class="pl-c1"&gt;test&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;create private repo:&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;project -p &lt;span class="pl-c1"&gt;test&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;If the project exist you will just &lt;code&gt;cd&lt;/code&gt;…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/gko/project" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;It allows you to just type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;project &amp;lt;project name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and it will prompt you to create &lt;code&gt;npm&lt;/code&gt;, &lt;code&gt;cargo&lt;/code&gt;, &lt;code&gt;gem&lt;/code&gt; or &lt;code&gt;pip&lt;/code&gt; package&lt;/p&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%2Fuploads%2Farticles%2Fsrv7fnmw6pef0d7cg4us.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%2Fuploads%2Farticles%2Fsrv7fnmw6pef0d7cg4us.png" alt="Create package" width="800" height="624"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;as well as a private or public &lt;code&gt;github&lt;/code&gt; repo (you need to install and configure &lt;a href="https://github.com/github/hub" rel="noopener noreferrer"&gt;hub&lt;/a&gt; for that) and jump into it:&lt;/p&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%2Fuploads%2Farticles%2Fifeg7xxirik8yz02e0ek.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%2Fuploads%2Farticles%2Fifeg7xxirik8yz02e0ek.png" alt="Create repository" width="800" height="624"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the project exists you will just &lt;code&gt;cd&lt;/code&gt; to the project folder.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project folder
&lt;/h2&gt;

&lt;p&gt;By default project folder is &lt;code&gt;~/projects&lt;/code&gt; but you can either specify another folder when running &lt;code&gt;project&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;project &lt;span class="nt"&gt;-f&lt;/span&gt; /projects_path
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or use &lt;code&gt;PROJECTS_HOME&lt;/code&gt; variable&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="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PROJECTS_HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/projects_path
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;code&gt;ZSH&lt;/code&gt; autocomplete
&lt;/h2&gt;

&lt;p&gt;It supports &lt;code&gt;zsh-autocomplete&lt;/code&gt;. On Tab will show the list of available projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Alias it
&lt;/h2&gt;

&lt;p&gt;You can also alias it (in &lt;code&gt;~/.zshrc&lt;/code&gt; or &lt;code&gt;~/.bashrc&lt;/code&gt;):&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="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;p&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'project'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;p test-project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>project</category>
      <category>npm</category>
      <category>rust</category>
      <category>github</category>
    </item>
    <item>
      <title>Preview replace results in Neovim</title>
      <dc:creator>Konstantin</dc:creator>
      <pubDate>Tue, 17 Dec 2019 06:24:39 +0000</pubDate>
      <link>https://dev.to/konstantin/preview-replace-results-in-neovim-3old</link>
      <guid>https://dev.to/konstantin/preview-replace-results-in-neovim-3old</guid>
      <description>&lt;p&gt;There is an interesting option in Neovim called &lt;code&gt;inccommand&lt;/code&gt;. It allows you see the live preview of your buffer after some command (i.e. replace).&lt;/p&gt;

&lt;p&gt;To configure it add following to your &lt;code&gt;~/.config/nvim/init.vim&lt;/code&gt;:&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;set&lt;/span&gt; inccommand&lt;span class="p"&gt;=&lt;/span&gt;nosplit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or if you're using &lt;code&gt;~/.vimrc&lt;/code&gt; to configure both &lt;code&gt;vim&lt;/code&gt; and &lt;code&gt;neovim&lt;/code&gt;:&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="nb"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"nvim"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
  &lt;span class="k"&gt;set&lt;/span&gt; inccommand&lt;span class="p"&gt;=&lt;/span&gt;nosplit
&lt;span class="k"&gt;endif&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, as you type &lt;code&gt;%s/text/replace/&lt;/code&gt;before you hit Enter you'll see the live result of your command so you can cancel it by hitting Esc. &lt;/p&gt;

&lt;p&gt;You can also set &lt;code&gt;inccommand&lt;/code&gt; to &lt;code&gt;split&lt;/code&gt;. In that case the result will be shown in a separate split pane. &lt;/p&gt;

</description>
      <category>vim</category>
      <category>neovim</category>
      <category>replace</category>
      <category>preview</category>
    </item>
    <item>
      <title>Find and replace text in project files with vim</title>
      <dc:creator>Konstantin</dc:creator>
      <pubDate>Mon, 16 Dec 2019 00:37:58 +0000</pubDate>
      <link>https://dev.to/konstantin/find-and-replace-text-in-project-files-with-vim-jga</link>
      <guid>https://dev.to/konstantin/find-and-replace-text-in-project-files-with-vim-jga</guid>
      <description>&lt;p&gt;I've seen a lot of articles describing how to replace text with the &lt;code&gt;cfdo&lt;/code&gt; command and others that describe how to find files with &lt;code&gt;FZF&lt;/code&gt;, but I couldn't find one that «puts it all together», so I decided to make a short instruction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;First you need to install &lt;a href="https://github.com/junegunn/fzf" rel="noopener noreferrer"&gt;fzf&lt;/a&gt; via &lt;a href="https://github.com/junegunn/vim-plug" rel="noopener noreferrer"&gt;vim-plug&lt;/a&gt;:&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;call&lt;/span&gt; plug#begin&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c"&gt;" if you have fzf installed via brew&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;isdirectory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/usr/local/opt/fzf'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    Plug &lt;span class="s1"&gt;'/usr/local/opt/fzf'&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
    Plug &lt;span class="s1"&gt;'junegunn/fzf'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s1"&gt;'dir'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'~/.fzf'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'do'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'./install --all'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;endif&lt;/span&gt;
Plug &lt;span class="s1"&gt;'junegunn/fzf.vim'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="se"&gt;        \&lt;/span&gt; &lt;span class="s1"&gt;'on'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;span class="se"&gt;            \&lt;/span&gt; &lt;span class="s1"&gt;'Ag'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;            \&lt;/span&gt; &lt;span class="s1"&gt;'Rg'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;            \&lt;/span&gt; &lt;span class="s1"&gt;'FZF'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;            \&lt;/span&gt; &lt;span class="s1"&gt;'Files'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;            \&lt;/span&gt; &lt;span class="s1"&gt;'Buffers'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;            \&lt;/span&gt; &lt;span class="s1"&gt;'Commits'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;            \&lt;/span&gt; &lt;span class="s1"&gt;'BCommits'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;            \&lt;/span&gt; &lt;span class="s1"&gt;'Tags'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;            \&lt;/span&gt; &lt;span class="s1"&gt;'BTags'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;            \&lt;/span&gt; &lt;span class="s1"&gt;'History'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;            \&lt;/span&gt; &lt;span class="s1"&gt;'Lines'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;            \&lt;/span&gt; &lt;span class="s1"&gt;'BLines'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;            \&lt;/span&gt; &lt;span class="s1"&gt;'Marks'&lt;/span&gt;
&lt;span class="se"&gt;        \&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;call&lt;/span&gt; plug#end&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;and then &lt;a href="https://github.com/BurntSushi/ripgrep#installation" rel="noopener noreferrer"&gt;ripgrep&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Configuring &lt;code&gt;Meta key&lt;/code&gt; (⌥) in &lt;code&gt;macOS&lt;/code&gt; terminal
&lt;/h3&gt;

&lt;p&gt;Some shortcuts use &lt;code&gt;Meta&lt;/code&gt; key. To make it work properly in &lt;code&gt;macOS&lt;/code&gt; terminal check the «Use option as meta key»:&lt;/p&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%2Fuploads%2Farticles%2Fz34z83367t46c5mltxua.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%2Fuploads%2Farticles%2Fz34z83367t46c5mltxua.png" alt="terminal" width="800" height="719"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or «Esc+» option in &lt;code&gt;iterm2&lt;/code&gt;: &lt;/p&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%2Fuploads%2Farticles%2Fkma9i57ck524ukapf4in.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%2Fuploads%2Farticles%2Fkma9i57ck524ukapf4in.png" alt="iterm2" width="800" height="482"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Finding and replacing text
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;To search text within project files simply type &lt;code&gt;:Rg &amp;lt;text&amp;gt;&lt;/code&gt;. This will open up a FZF buffer with a list of files.&lt;/li&gt;
&lt;li&gt;Then with a Tab key you can select/deselect files that you want to pass to &lt;code&gt;quickfix&lt;/code&gt; window. To select all files tap Alt/⌥-a and to deselect Alt/⌥-d.&lt;/li&gt;
&lt;li&gt;Once your selection is ready hit Enter to pass selected files to &lt;code&gt;quickfix&lt;/code&gt; buffer.&lt;/li&gt;
&lt;li&gt;Now you can replace text in all files within &lt;code&gt;quickfix&lt;/code&gt; buffer with &lt;code&gt;:cfdo %s/&amp;lt;text to search&amp;gt;/&amp;lt;text to replace with&amp;gt;/g | update&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;code&gt;cfdo&lt;/code&gt; command simply executes command on every file in the list, and the &lt;code&gt;update&lt;/code&gt; command after the pipe saves the results to the disk.&lt;/p&gt;

&lt;p&gt;I've used here some of the snippets from my vim setup. You can find it here:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/gko" rel="noopener noreferrer"&gt;
        gko
      &lt;/a&gt; / &lt;a href="https://github.com/gko/vimio" rel="noopener noreferrer"&gt;
        vimio
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      🎩 easy to install/use vim settings
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Vim Settings&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/screenshot.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fscreenshot.png" alt="screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An &lt;a href="https://dev.to/konstantin/configuring-a-perfect-editor-for-frontend-development-1pe5" rel="nofollow"&gt;article&lt;/a&gt; describing key features of this config.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Prerequisites&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;In order to get all features you might want to install following packages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/junegunn/fzf#installation" rel="noopener noreferrer"&gt;fzf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/BurntSushi/ripgrep#installation" rel="noopener noreferrer"&gt;ripgrep&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm" rel="nofollow noopener noreferrer"&gt;npm&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Installation&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;On unix and windows(with bash which can be installed with &lt;a href="http://msysgit.github.io/" rel="nofollow noopener noreferrer"&gt;git&lt;/a&gt;):&lt;/p&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;curl -L https://raw.github.com/gko/vimio/main/install.sh &lt;span class="pl-k"&gt;|&lt;/span&gt; bash&lt;/pre&gt;

&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;macOS&lt;/h3&gt;

&lt;/div&gt;

&lt;p&gt;In macOS terminal.app don't forget to check the «Use option as meta key»:&lt;/p&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/terminal.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fterminal.png" alt="terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And «Esc+» option in iterm2:&lt;/p&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/iterm2.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fiterm2.png" alt="iterm2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Shortcuts&lt;/h2&gt;

&lt;/div&gt;

&lt;p&gt;Some of shortcuts(Leader key is comma):&lt;/p&gt;


&lt;ul&gt;

&lt;li&gt;

Ctrl + s saves current file&lt;/li&gt;

&lt;li&gt;

Leader + s in both &lt;code&gt;select&lt;/code&gt; and &lt;code&gt;normal&lt;/code&gt; mode initiates search and replace&lt;/li&gt;

&lt;li&gt;

Alt + Up/Down moves line or selection above
or below current line(see &lt;a href="https://github.com/gko/upside-down" rel="noopener noreferrer"&gt;upside-down&lt;/a&gt; for more info)&lt;/li&gt;

&lt;li&gt;

Alt + Left/Right moves character or
selection to left or to the right&lt;/li&gt;

&lt;li&gt;

Leader + n toggles NERDTree&lt;/li&gt;

&lt;li&gt;

Leader + m shows current file in NERDTree&lt;/li&gt;

&lt;li&gt;when in select mode ', ", ( wraps selection accordingly&lt;/li&gt;

&lt;li&gt;

y…&lt;/li&gt;

&lt;/ul&gt;
&lt;/div&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/gko/vimio" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


</description>
      <category>vim</category>
      <category>fzf</category>
      <category>replace</category>
      <category>text</category>
    </item>
    <item>
      <title>Configuring a perfect editor for frontend development</title>
      <dc:creator>Konstantin</dc:creator>
      <pubDate>Mon, 21 Oct 2019 06:12:04 +0000</pubDate>
      <link>https://dev.to/konstantin/configuring-a-perfect-editor-for-frontend-development-1pe5</link>
      <guid>https://dev.to/konstantin/configuring-a-perfect-editor-for-frontend-development-1pe5</guid>
      <description>&lt;p&gt;I've seen a lot of tweets recently that basically state that &lt;code&gt;vim&lt;/code&gt; is not suitable for frontend development. So I decided to do a small overview of my setup(I'm mostly a frontend developer although I do some backend and devops stuff as well).&lt;/p&gt;

&lt;h2&gt;
  
  
  My setup
&lt;/h2&gt;

&lt;p&gt;You can find all configuration and instructions on how to install it in my github repo:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/gko" rel="noopener noreferrer"&gt;
        gko
      &lt;/a&gt; / &lt;a href="https://github.com/gko/vimio" rel="noopener noreferrer"&gt;
        vimio
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      🎩 easy to install/use vim settings
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Vim Settings&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/screenshot.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fscreenshot.png" alt="screenshot"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;An &lt;a href="https://dev.to/konstantin/configuring-a-perfect-editor-for-frontend-development-1pe5" rel="nofollow"&gt;article&lt;/a&gt; describing key features of this config.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Prerequisites&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;In order to get all features you might want to install following packages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/junegunn/fzf#installation" rel="noopener noreferrer"&gt;fzf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/BurntSushi/ripgrep#installation" rel="noopener noreferrer"&gt;ripgrep&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm" rel="nofollow noopener noreferrer"&gt;npm&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Installation&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;On unix and windows(with bash which can be installed with &lt;a href="http://msysgit.github.io/" rel="nofollow noopener noreferrer"&gt;git&lt;/a&gt;):&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;curl -L https://raw.github.com/gko/vimio/main/install.sh &lt;span class="pl-k"&gt;|&lt;/span&gt; bash&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;macOS&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;In macOS terminal.app don't forget to check the «Use option as meta key»:&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/terminal.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fterminal.png" alt="terminal"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And «Esc+» option in iterm2:&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/iterm2.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fiterm2.png" alt="iterm2"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Shortcuts&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Some of shortcuts(Leader key is comma):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Ctrl + s saves current file&lt;/li&gt;
&lt;li&gt;
Leader + s in both &lt;code&gt;select&lt;/code&gt; and &lt;code&gt;normal&lt;/code&gt; mode initiates search and replace&lt;/li&gt;
&lt;li&gt;
Alt + Up/Down moves line or selection above
or below current line(see &lt;a href="https://github.com/gko/upside-down" rel="noopener noreferrer"&gt;upside-down&lt;/a&gt; for more info)&lt;/li&gt;
&lt;li&gt;
Alt + Left/Right moves character or
selection to left or to the right&lt;/li&gt;
&lt;li&gt;
Leader + n toggles NERDTree&lt;/li&gt;
&lt;li&gt;
Leader + m shows current file in NERDTree&lt;/li&gt;
&lt;li&gt;when in select mode ', ", ( wraps selection accordingly&lt;/li&gt;
&lt;li&gt;
y…&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/gko/vimio" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  File structure
&lt;/h3&gt;

&lt;p&gt;The main file is &lt;code&gt;init.vim&lt;/code&gt; that is symlinked to &lt;code&gt;.vimrc&lt;/code&gt; during the installation. All the configuration scripts are stored in &lt;code&gt;after/plugin/*.vim&lt;/code&gt;. This way I can just add another script to that folder(with a name of a plugin for instance) and it will be automatically loaded during vim startup. It also helps me to keep things modular. &lt;/p&gt;

&lt;h2&gt;
  
  
  Spoiler
&lt;/h2&gt;

&lt;p&gt;I should point out right away that perfect editor doesn't exist or at least it's different for everyone.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why vim
&lt;/h3&gt;

&lt;p&gt;I think there are many great  editors and IDEs out there but there is one thing among others that stands out if you're using vim: you don't switch environment. So if you're in terminal and you've cloned a project, once you open it you're still in terminal. Even if you quit vim you're  still in the same environment. For me, that's the most important thing about using vim(beside many other things, obviously).&lt;/p&gt;

&lt;p&gt;With that out of the way let's take a look at some key features of my config.&lt;/p&gt;

&lt;h2&gt;
  
  
  Opening a project
&lt;/h2&gt;

&lt;p&gt;In my mind any project is strongly linked with a repository(except monorepos of course), so when I open any file in a repository I want my editor to go to the root of the project(i.e. where the .git folder is located). There is a plugin for that:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/airblade" rel="noopener noreferrer"&gt;
        airblade
      &lt;/a&gt; / &lt;a href="https://github.com/airblade/vim-rooter" rel="noopener noreferrer"&gt;
        vim-rooter
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Changes Vim working directory to project root.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;It goes through parent folders until it finds a repo, or your custom file or folder pattern that you can configure.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/mhinz" rel="noopener noreferrer"&gt;
        mhinz
      &lt;/a&gt; / &lt;a href="https://github.com/mhinz/vim-startify" rel="noopener noreferrer"&gt;
        vim-startify
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      🔗 The fancy start screen for Vim.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;will help me quickly go back to recent projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Opening a file
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Locally
&lt;/h4&gt;

&lt;p&gt;I use &lt;code&gt;fzf&lt;/code&gt; and &lt;code&gt;ctrlp&lt;/code&gt; extensions. &lt;br&gt;
The second one has also a ctrlb shortcut to switch between buffers.&lt;/p&gt;

&lt;p&gt;In future &lt;a href="https://github.com/gko/vimio/issues/14" rel="noopener noreferrer"&gt;I would like to use only fzf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also with this plugin:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/wsdjeg" rel="noopener noreferrer"&gt;
        wsdjeg
      &lt;/a&gt; / &lt;a href="https://github.com/wsdjeg/vim-fetch" rel="noopener noreferrer"&gt;
        vim-fetch
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Make Vim handle line and column numbers in file names with a minimum of fuss
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
I can open a certain line, for instance:&lt;br&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vim ~/.vimrc:123
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;will open line 123 of &lt;code&gt;.vimrc&lt;/code&gt; file.&lt;/p&gt;
&lt;h4&gt;
  
  
  Opening file in the browser
&lt;/h4&gt;

&lt;p&gt;Sometimes when you have a file opened you want to quickly jump to a Web version(for instance to leave a comment). For this I use the following plugin:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/ruanyl" rel="noopener noreferrer"&gt;
        ruanyl
      &lt;/a&gt; / &lt;a href="https://github.com/ruanyl/vim-gh-line" rel="noopener noreferrer"&gt;
        vim-gh-line
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      vim plugin that open the link of current line on github
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;The main shortcuts are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Leadergh — open file in the browser(current revision) &lt;/li&gt;
&lt;li&gt;
Leadergb — open blame view for current file&lt;/li&gt;
&lt;li&gt;
Leadergo — open repository in the browser&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Please note, that if you use it in visual mode, it will automatically highlight selected line(s). &lt;/p&gt;

&lt;h3&gt;
  
  
  Sharing code via Carbon
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://carbon.now.sh/about" rel="noopener noreferrer"&gt;Carbon&lt;/a&gt; is a code sharing website, that adds swag to it. To share selection(if you're in visual mode) or the whole file I use following vim extension:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/kristijanhusak" rel="noopener noreferrer"&gt;
        kristijanhusak
      &lt;/a&gt; / &lt;a href="https://github.com/kristijanhusak/vim-carbon-now-sh" rel="noopener noreferrer"&gt;
        vim-carbon-now-sh
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Open selected text in https://carbon.now.sh
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Here's my &lt;code&gt;Carbon&lt;/code&gt; 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;let&lt;/span&gt; &lt;span class="nv"&gt;g:carbon_now_sh_options&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'ln'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'true'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'bg'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'rgba(74,144,226,1)'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'t'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'night-owl'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'wt'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'none'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'ds'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'true'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'dsyoff'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'20px'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'dsblur'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'68px'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'wc'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'true'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'wa'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'true'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'pv'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'56px'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'ph'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'56px'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'fm'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Fira Code'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'fs'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'14.5px'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'lh'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'141%'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'si'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'false'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'es'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'2x'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;  &lt;span class="s1"&gt;'wm'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'false'&lt;/span&gt;
&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Miscellaneous
&lt;/h3&gt;

&lt;p&gt;To configure &lt;code&gt;vim&lt;/code&gt; to change indentation rules per project I use:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/editorconfig" rel="noopener noreferrer"&gt;
        editorconfig
      &lt;/a&gt; / &lt;a href="https://github.com/editorconfig/editorconfig-vim" rel="noopener noreferrer"&gt;
        editorconfig-vim
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      EditorConfig plugin for Vim
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;To search text within all files and replace it I use &lt;a href="https://github.com/BurntSushi/ripgrep" rel="noopener noreferrer"&gt;ripgrep&lt;/a&gt; that is supported natively in &lt;code&gt;fzf&lt;/code&gt; extension(&lt;code&gt;Rg&lt;/code&gt; command):&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/junegunn" rel="noopener noreferrer"&gt;
        junegunn
      &lt;/a&gt; / &lt;a href="https://github.com/junegunn/fzf.vim" rel="noopener noreferrer"&gt;
        fzf.vim
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      fzf ❤️ vim
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Taking notes with vim
&lt;/h2&gt;

&lt;p&gt;I recently wrote a post about how to configure vim to quickly take notes:&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/konstantin" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuploads%2Fuser%2Fprofile_image%2F49942%2F2dceed70-4328-465c-827a-9255a0c545ef.png" alt="konstantin"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/konstantin/taking-notes-in-vim-revisited-558k" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Taking notes in vim revisited&lt;/h2&gt;
      &lt;h3&gt;Konstantin ・ Sep 12 '19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#neovim&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#vim&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#notes&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#vimwiki&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;I can add following plugin to that article:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/MattesGroeger" rel="noopener noreferrer"&gt;
        MattesGroeger
      &lt;/a&gt; / &lt;a href="https://github.com/MattesGroeger/vim-bookmarks" rel="noopener noreferrer"&gt;
        vim-bookmarks
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Vim bookmark plugin
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;It allows you to bookmark anything anywhere(even in NERDTree).&lt;/p&gt;

&lt;h2&gt;
  
  
  Color themes
&lt;/h2&gt;

&lt;p&gt;By default I use:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/cormacrelf" rel="noopener noreferrer"&gt;
        cormacrelf
      &lt;/a&gt; / &lt;a href="https://github.com/cormacrelf/vim-colors-github" rel="noopener noreferrer"&gt;
        vim-colors-github
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A Vim colorscheme based on Github's syntax highlighting as of 2018.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;But I also installed the &lt;a href="https://dev.todanielwe/base16-vim"&gt;base16&lt;/a&gt;(this is a fork, due to some problems with the original repo) themes and configured vim so that it looks into &lt;code&gt;~/.vimrc_background&lt;/code&gt; file and takes current &lt;code&gt;base16&lt;/code&gt; theme from there:&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="c"&gt;" set colorscheme&lt;/span&gt;
&lt;span class="c"&gt;" if you have base16 installed take that colorscheme&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;filereadable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;expand&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"~/.vimrc_background"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="k"&gt;let&lt;/span&gt; base16colorspace&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="m"&gt;256&lt;/span&gt;
        &lt;span class="k"&gt;source&lt;/span&gt; &lt;span class="p"&gt;~&lt;/span&gt;/&lt;span class="p"&gt;.&lt;/span&gt;vimrc_background
        &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;g:airline_theme&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'base16'&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;
        &lt;span class="k"&gt;colorscheme&lt;/span&gt; github

        &lt;span class="c"&gt;" https://github.com/cormacrelf/vim-colors-github/pull/5&lt;/span&gt;
        &lt;span class="k"&gt;hi&lt;/span&gt;&lt;span class="p"&gt;!&lt;/span&gt; link SignColumn LineNr

        &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;g:airline_theme&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"github"&lt;/span&gt;
    &lt;span class="k"&gt;endif&lt;/span&gt;
&lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="sr"&gt;/^Vim\%((\a\+)\)\=:E185/&lt;/span&gt;
    &lt;span class="k"&gt;colorscheme&lt;/span&gt; default
&lt;span class="k"&gt;endtry&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This way vim stays consistent with terminal theme.&lt;/p&gt;
&lt;h2&gt;
  
  
  Autocompletion
&lt;/h2&gt;

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

&lt;p&gt;It's based on the same language server as &lt;code&gt;vscode&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Javascript
&lt;/h3&gt;

&lt;p&gt;By default you won't have an autocompletion in javascript. To enforce typescript to enable autocompletion within javascript you have to add:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// @ts-check&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;At the top of the file. In my setup I have &lt;br&gt;
a &lt;a href="https://github.com/gko/vimio/blob/master/templates" rel="noopener noreferrer"&gt;templates&lt;/a&gt; folder that contains predefined templates for new files(config can be found in &lt;a href="https://github.com/gko/vimio/blob/master/after/plugin/templates.vim" rel="noopener noreferrer"&gt;templates.vim&lt;/a&gt;). So once I create new js file it already contains that comment.&lt;/p&gt;
&lt;h3&gt;
  
  
  Jumping between files
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Coc&lt;/code&gt; already provides different shortcuts to jump to function definition and what not:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;nmap &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="nb"&gt;gd&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;Plug&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;coc&lt;span class="p"&gt;-&lt;/span&gt;definition&lt;span class="p"&gt;)&lt;/span&gt;
nmap &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; gy &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;Plug&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;coc&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="p"&gt;-&lt;/span&gt;definition&lt;span class="p"&gt;)&lt;/span&gt;
nmap &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; gi &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;Plug&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;coc&lt;span class="p"&gt;-&lt;/span&gt;implementation&lt;span class="p"&gt;)&lt;/span&gt;
nmap &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="k"&gt;gr&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;Plug&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;coc&lt;span class="p"&gt;-&lt;/span&gt;references&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;However &lt;code&gt;vim&lt;/code&gt; provides a magic shortcut &lt;code&gt;gf&lt;/code&gt; that allows you to jump to a file under cursor. The magic is that you can alter it's behavior per file type. For instance, in javascript we want to use the following algorithm to resolve the file:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check file locally&lt;/li&gt;
&lt;li&gt;If it doesn't exist check file in node_modules&lt;/li&gt;
&lt;li&gt;If it exists and it is a folder check the &lt;code&gt;package.json&lt;/code&gt; for &lt;code&gt;main&lt;/code&gt; field. If it is present open it. &lt;/li&gt;
&lt;li&gt;If the main field is not there check for &lt;code&gt;index.js&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can find the implementation in the &lt;a href="https://github.com/gko/vimio/blob/master/after/ftplugin/javascript.vim" rel="noopener noreferrer"&gt;after/ftplugin/javascript.vim&lt;/a&gt; file.&lt;/p&gt;
&lt;h2&gt;
  
  
  Linters
&lt;/h2&gt;

&lt;p&gt;For linting I use &lt;code&gt;Ale&lt;/code&gt;(config — &lt;a href="https://github.com/gko/vimio/blob/master/after/plugin/ale.vim" rel="noopener noreferrer"&gt;ale.vim&lt;/a&gt;):&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/dense-analysis" rel="noopener noreferrer"&gt;
        dense-analysis
      &lt;/a&gt; / &lt;a href="https://github.com/dense-analysis/ale" rel="noopener noreferrer"&gt;
        ale
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;and prettier to autoformat:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/prettier" rel="noopener noreferrer"&gt;
        prettier
      &lt;/a&gt; / &lt;a href="https://github.com/prettier/vim-prettier" rel="noopener noreferrer"&gt;
        vim-prettier
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A Vim plugin for Prettier
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Here I highlighted key features of my configuration. I encourage you to go check the full list of extensions that I use in the &lt;a href="https://github.com/gko/vimio/blob/master/init.vim" rel="noopener noreferrer"&gt;init.vim&lt;/a&gt; file and the configuration scripts in the &lt;a href="https://github.com/gko/vimio/blob/master/after/plugin" rel="noopener noreferrer"&gt;after/plugin/&lt;/a&gt; folder. I listed all the file types and commands for every extension explicitly so that there is nothing that fires up randomly.&lt;/p&gt;

</description>
      <category>vim</category>
      <category>config</category>
      <category>javascript</category>
      <category>development</category>
    </item>
    <item>
      <title>Taking notes in vim revisited</title>
      <dc:creator>Konstantin</dc:creator>
      <pubDate>Thu, 12 Sep 2019 20:38:46 +0000</pubDate>
      <link>https://dev.to/konstantin/taking-notes-in-vim-revisited-558k</link>
      <guid>https://dev.to/konstantin/taking-notes-in-vim-revisited-558k</guid>
      <description>&lt;p&gt;In my previous post I talked about a &lt;code&gt;vimwiki&lt;/code&gt; plugin for taking notes:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="/konstantin" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuploads%2Fuser%2Fprofile_image%2F49942%2F2dceed70-4328-465c-827a-9255a0c545ef.png" alt="konstantin"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/konstantin/taking-notes-with-vim-3619" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Taking notes with vim&lt;/h2&gt;
      &lt;h3&gt;Konstantin ・ May 31 '19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#vim&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#notes&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#vimwiki&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#markdown&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;I was still unsatisfied with the results, such as redefining markdown behavior and losing some of the essential shortcuts. Then I stumbled across an article «&lt;a href="http://joereynoldsaudio.com/2018/07/07/you-dont-need-vimwiki.html" rel="noopener noreferrer"&gt;You (probably) don’t need Vimwiki&lt;/a&gt;» by Joe Reynolds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Replacing &lt;code&gt;vimwiki&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;So to replace &lt;code&gt;vimwiki&lt;/code&gt; we need to configure following features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open/create new file under cursor.&lt;/li&gt;
&lt;li&gt;open notes from any location(with Leaderww)&lt;/li&gt;
&lt;li&gt;shortcut for toggling checkboxes to make TODO lists&lt;/li&gt;
&lt;li&gt;align tables in markdown&lt;/li&gt;
&lt;li&gt;previewing html&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Create new file under cursor.
&lt;/h3&gt;

&lt;p&gt;The article that I mentioned above did say that you can replace the &lt;code&gt;vimwiki's&lt;/code&gt; enter shortcut that creates new markdown files and opens them with gf(open file under cursor). Unfortunately, it works only when the file actually exists. We want to be able to quickly create and open a new note once we typed its name. However, there is an alternative shortcut in &lt;a href="https://github.com/plasticboy/vim-markdown" rel="noopener noreferrer"&gt;markdown plugin by plasticboy&lt;/a&gt; –– ge that allows you to open file under cursor(if it is a markdown link) even if it doesn’t exist... unless it's in a subfolder(s) that doesn't exist. Lucky for us, there is a plugin that creates all subfolders in the path of the file(&lt;code&gt;mkdir -p&lt;/code&gt; for vim):&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/pbrisbin" rel="noopener noreferrer"&gt;
        pbrisbin
      &lt;/a&gt; / &lt;a href="https://github.com/pbrisbin/vim-mkdir" rel="noopener noreferrer"&gt;
        vim-mkdir
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Automatically create any non-existent directories before writing the buffer.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-alert markdown-alert-note"&gt;
&lt;p class="markdown-alert-title"&gt;Note&lt;/p&gt;
&lt;p&gt;All of my GitHub repositories have been &lt;strong&gt;archived&lt;/strong&gt; and will be migrated to
Codeberg as I next work on them. This repository either now lives, or will
live, at:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://codeberg.org/pbrisbin/vim-mkdir" rel="nofollow noopener noreferrer"&gt;https://codeberg.org/pbrisbin/vim-mkdir&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you need to report an Issue or raise a PR, and this migration hasn't
happened yet, send an email to &lt;a href="https://github.com/pbrisbin/vim-mkdir/mailto:me@pbrisbin.com" rel="noopener noreferrer"&gt;me@pbrisbin.com&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Mkdir&lt;/h1&gt;

&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;Maggie! Don't even ask. Just bring it. Come on.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;-- Hot Rod&lt;/em&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Installation&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Add &lt;code&gt;pbrisbin/vim-mkdir&lt;/code&gt; to your preferred &lt;a href="https://linuxhandbook.com/install-vim-plugins/" rel="nofollow noopener noreferrer"&gt;vim plugin management plugin&lt;/a&gt; list.&lt;/p&gt;
&lt;p&gt;I happen to use lua configuration and &lt;a href="https://github.com/k-takata/minpac" rel="noopener noreferrer"&gt;minpac&lt;/a&gt;, so my &lt;code&gt;~/.config/nvim/init.lua&lt;/code&gt; contains,&lt;/p&gt;
&lt;div class="highlight highlight-source-lua notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-smi"&gt;vim&lt;/span&gt;.&lt;span class="pl-c1"&gt;cmd&lt;/span&gt; &lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;[[&lt;/span&gt; packadd minpac &lt;span class="pl-pds"&gt;]]&lt;/span&gt;&lt;/span&gt;

&lt;span class="pl-smi"&gt;vim&lt;/span&gt;.&lt;span class="pl-c1"&gt;call&lt;/span&gt;(&lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;'&lt;/span&gt;minpac#init&lt;span class="pl-pds"&gt;'&lt;/span&gt;&lt;/span&gt;)
&lt;span class="pl-smi"&gt;vim&lt;/span&gt;.&lt;span class="pl-c1"&gt;call&lt;/span&gt;(&lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;'&lt;/span&gt;minpac#add&lt;span class="pl-pds"&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;'&lt;/span&gt;pbrisbin/vim-mkdir&lt;span class="pl-pds"&gt;'&lt;/span&gt;&lt;/span&gt;)&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Usage&lt;/h2&gt;

&lt;/div&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;:e this/does/not/exist/file.txt
:w
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Smile when you are not presented with an error. Instead, notice that
vim has automatically created the non-existent directory for you.&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/pbrisbin/vim-mkdir" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;so if you add to your &lt;code&gt;.vimrc&lt;/code&gt; or &lt;code&gt;init.vim&lt;/code&gt; following plugins:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;Plug &lt;span class="s1"&gt;'pbrisbin/vim-mkdir'&lt;/span&gt;
Plug &lt;span class="s1"&gt;'plasticboy/vim-markdown'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s1"&gt;'for'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'markdown'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;provided that you're using &lt;a href="https://github.com/junegunn/vim-plug" rel="noopener noreferrer"&gt;vim-plug&lt;/a&gt; as a plugin manager, you should be able to type ge in &lt;code&gt;md&lt;/code&gt; file(on a markdown link) and vim would create the file under cursor, as well as all subfolders and open this file for editing. &lt;/p&gt;

&lt;p&gt;You can find more information about markdown plugin mappings in &lt;a href="https://github.com/plasticboy/vim-markdown#mappings" rel="noopener noreferrer"&gt;README&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Open notes from any location
&lt;/h3&gt;

&lt;p&gt;I store all my notes in &lt;code&gt;~/Documents/notes&lt;/code&gt; folder(and in MacOS all files are automatically synced with &lt;code&gt;iCloud&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Our shortcut should essentially open the &lt;code&gt;~/Documents/notes/index.md&lt;/code&gt; file:&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="c"&gt;" open ~/Documents/notes/index.md&lt;/span&gt;
nnoremap &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;Leader&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;ww&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;e&lt;/span&gt; &lt;span class="p"&gt;~&lt;/span&gt;&lt;span class="sr"&gt;/Documents/&lt;/span&gt;notes/&lt;span class="nb"&gt;index&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;md&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;since we've configured plugin that creates subfolders it should automatically create &lt;code&gt;notes&lt;/code&gt; folder as well.&lt;/p&gt;
&lt;h3&gt;
  
  
  Toggling checkboxes to make TODO lists
&lt;/h3&gt;

&lt;p&gt;For this I found a nice plugin:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/jkramer" rel="noopener noreferrer"&gt;
        jkramer
      &lt;/a&gt; / &lt;a href="https://github.com/jkramer/vim-checkbox" rel="noopener noreferrer"&gt;
        vim-checkbox
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Vim plugin for toggling checkboxes.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="markdown"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Vim Checkbox&lt;/h1&gt;
&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Description&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;Simple plugin that toggles text checkboxes in Vim. Works great if you're using
a markdown file for notes and todo lists.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Requirements&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;The action provided by this plugin can be repeated with the native
action &lt;code&gt;.&lt;/code&gt;.
This is provided by &lt;code&gt;tpope/vim-repeat&lt;/code&gt;. Please be sure to install it
before installing this plugin.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Installation&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Just copy the script into your plugin folder, e.g. &lt;code&gt;~/.vim/plugin/&lt;/code&gt;. If you're
using pathogen, just clone this repository in &lt;code&gt;~/.vim/bundle&lt;/code&gt;.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Custom mappings&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;If you do not want to use &lt;code&gt;&amp;lt;leader&amp;gt;tt&lt;/code&gt; you can set it via e.g.:&lt;/p&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;augroup checkbox_mappings
    nnoremap &amp;lt;leader&amp;gt;oo &amp;lt;plug&amp;gt;ToggleCheckbox
augroup END
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Hint: In this case the default mapping &lt;code&gt;&amp;lt;leader&amp;gt;tt&lt;/code&gt; will not be configured.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Usage&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Press &lt;code&gt;&amp;lt;leader&amp;gt;tt&lt;/code&gt; to toggle the (first) checkbox on the current
line, if any. That means, &lt;code&gt;[ ]&lt;/code&gt; will be replaced with &lt;code&gt;[x]&lt;/code&gt; and &lt;code&gt;[x]&lt;/code&gt; with
&lt;code&gt;[ ]&lt;/code&gt;. If you want more or different checkbox…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/jkramer/vim-checkbox" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;the shortcut that interests us is Leadertt that searches and toggles the checkbox on the cursor line. In visual mode it will toggle all checkboxes on selected lines.&lt;/p&gt;

&lt;h3&gt;
  
  
  Align tables in markdown
&lt;/h3&gt;

&lt;p&gt;The previously mentioned markdown plugin already contains this feature in form of a command: &lt;code&gt;:TableFormat&lt;/code&gt;. It will align a table under cursor.&lt;/p&gt;

&lt;h3&gt;
  
  
  Previewing html
&lt;/h3&gt;

&lt;p&gt;To preview markdown in a browser I'm using this amazing plugin:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/iamcco" rel="noopener noreferrer"&gt;
        iamcco
      &lt;/a&gt; / &lt;a href="https://github.com/iamcco/markdown-preview.nvim" rel="noopener noreferrer"&gt;
        markdown-preview.nvim
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      markdown preview plugin for (neo)vim
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt; ✨ Markdown Preview for (Neo)vim ✨ &lt;/h1&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;Powered by ❤️&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Introduction&lt;/h3&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;It only works on Vim &amp;gt;= 8.1 and Neovim&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Preview Markdown in your modern browser with synchronised scrolling and flexible configuration.&lt;/p&gt;
&lt;p&gt;Main features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Cross platform (MacOS/Linux/Windows)&lt;/li&gt;
&lt;li&gt;Synchronised scrolling&lt;/li&gt;
&lt;li&gt;Fast asynchronous updates&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/Khan/KaTeX" rel="noopener noreferrer"&gt;KaTeX&lt;/a&gt; for typesetting of math&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/plantuml/plantuml" rel="noopener noreferrer"&gt;PlantUML&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/knsv/mermaid" rel="noopener noreferrer"&gt;Mermaid&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/chartjs/Chart.js" rel="noopener noreferrer"&gt;Chart.js&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/bramp/js-sequence-diagrams" rel="noopener noreferrer"&gt;js-sequence-diagrams&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/adrai/flowchart.js" rel="noopener noreferrer"&gt;Flowchart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/mdaines/viz.js" rel="noopener noreferrer"&gt;dot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nagaozen/markdown-it-toc-done-right" rel="noopener noreferrer"&gt;Table of contents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Emojis&lt;/li&gt;
&lt;li&gt;Task lists&lt;/li&gt;
&lt;li&gt;Local images&lt;/li&gt;
&lt;li&gt;Flexible configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; the plugin &lt;code&gt;mathjax-support-for-mkdp&lt;/code&gt; is not needed for typesetting math.&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/5492542/47603494-28e90000-da1f-11e8-9079-30646e551e7a.gif"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F5492542%2F47603494-28e90000-da1f-11e8-9079-30646e551e7a.gif" alt="animation of Markdown Preview with its own README.md"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Installation &amp;amp; Usage&lt;/h3&gt;
&lt;/div&gt;
&lt;p&gt;Install with &lt;a href="https://github.com/junegunn/vim-plug" rel="noopener noreferrer"&gt;vim-plug&lt;/a&gt;:&lt;/p&gt;
&lt;div class="highlight highlight-source-viml notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;"&lt;/span&gt; If you don't have nodejs and yarn&lt;/span&gt;
&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;"&lt;/span&gt; use pre build, add 'vim-plug' to the filetype list so vim-plug can update this plugin&lt;/span&gt;
&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;"&lt;/span&gt; see: https://github.com/iamcco/markdown-preview.nvim/issues/50&lt;/span&gt;
Plug &lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;'&lt;/span&gt;iamcco/markdown-preview.nvim&lt;span class="pl-pds"&gt;'&lt;/span&gt;&lt;/span&gt;, { &lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;'&lt;/span&gt;do&lt;span class="pl-pds"&gt;'&lt;/span&gt;&lt;/span&gt;: { &lt;span class="pl-k"&gt;-&lt;/span&gt;&amp;gt; &lt;span class="pl-en"&gt;mkdp#util#install&lt;/span&gt;() }, &lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;'&lt;/span&gt;for&lt;span class="pl-pds"&gt;'&lt;/span&gt;&lt;/span&gt;: [&lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;'&lt;/span&gt;markdown&lt;span class="pl-pds"&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;'&lt;/span&gt;vim-plug&lt;span class="pl-pds"&gt;'&lt;/span&gt;&lt;/span&gt;]}
&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;"&lt;/span&gt; If you have nodejs&lt;/span&gt;
Plug &lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;'&lt;/span&gt;iamcco/markdown-preview.nvim&lt;span class="pl-pds"&gt;'&lt;/span&gt;&lt;/span&gt;, { &lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;'&lt;/span&gt;do&lt;span class="pl-pds"&gt;'&lt;/span&gt;&lt;/span&gt;: &lt;/pre&gt;…
&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/iamcco/markdown-preview.nvim" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;to start a preview you simply need to type &lt;code&gt;:MarkdownPreview&lt;/code&gt; and it will open up a browser and sync all your modifications. To stop the preview you can type &lt;code&gt;:MarkdownPreviewStop&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So in the end your &lt;code&gt;.vimrc&lt;/code&gt; file should look something like this:&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;call&lt;/span&gt; plug#begin&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'~/.vim/plugged'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

Plug &lt;span class="s1"&gt;'pbrisbin/vim-mkdir'&lt;/span&gt;

Plug &lt;span class="s1"&gt;'jkramer/vim-checkbox'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s1"&gt;'for'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'markdown'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
Plug &lt;span class="s1"&gt;'plasticboy/vim-markdown'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s1"&gt;'for'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'markdown'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;executable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'npm'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    Plug &lt;span class="s1"&gt;'iamcco/markdown-preview.nvim'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s1"&gt;'do'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'cd app &amp;amp; npm install'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;endif&lt;/span&gt;

&lt;span class="c"&gt;" Initialize plugin system&lt;/span&gt;
&lt;span class="k"&gt;call&lt;/span&gt; plug#begin&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'~/.vim/plugged'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;" open ~/Documents/notes/index.md&lt;/span&gt;
nnoremap &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;Leader&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;ww&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;e&lt;/span&gt; &lt;span class="p"&gt;~&lt;/span&gt;&lt;span class="sr"&gt;/Documents/&lt;/span&gt;notes/&lt;span class="nb"&gt;index&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;md&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;You can find these configs and more in my vim config repo:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/gko" rel="noopener noreferrer"&gt;
        gko
      &lt;/a&gt; / &lt;a href="https://github.com/gko/vimio" rel="noopener noreferrer"&gt;
        vimio
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      🎩 easy to install/use vim settings
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Vim Settings&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/screenshot.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fscreenshot.png" alt="screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An &lt;a href="https://dev.to/konstantin/configuring-a-perfect-editor-for-frontend-development-1pe5" rel="nofollow"&gt;article&lt;/a&gt; describing key features of this config.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Prerequisites&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;In order to get all features you might want to install following packages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/junegunn/fzf#installation" rel="noopener noreferrer"&gt;fzf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/BurntSushi/ripgrep#installation" rel="noopener noreferrer"&gt;ripgrep&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm" rel="nofollow noopener noreferrer"&gt;npm&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Installation&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;On unix and windows(with bash which can be installed with &lt;a href="http://msysgit.github.io/" rel="nofollow noopener noreferrer"&gt;git&lt;/a&gt;):&lt;/p&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;curl -L https://raw.github.com/gko/vimio/main/install.sh &lt;span class="pl-k"&gt;|&lt;/span&gt; bash&lt;/pre&gt;

&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;macOS&lt;/h3&gt;

&lt;/div&gt;

&lt;p&gt;In macOS terminal.app don't forget to check the «Use option as meta key»:&lt;/p&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/terminal.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fterminal.png" alt="terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And «Esc+» option in iterm2:&lt;/p&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/iterm2.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fiterm2.png" alt="iterm2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Shortcuts&lt;/h2&gt;

&lt;/div&gt;

&lt;p&gt;Some of shortcuts(Leader key is comma):&lt;/p&gt;


&lt;ul&gt;

&lt;li&gt;

Ctrl + s saves current file&lt;/li&gt;

&lt;li&gt;

Leader + s in both &lt;code&gt;select&lt;/code&gt; and &lt;code&gt;normal&lt;/code&gt; mode initiates search and replace&lt;/li&gt;

&lt;li&gt;

Alt + Up/Down moves line or selection above
or below current line(see &lt;a href="https://github.com/gko/upside-down" rel="noopener noreferrer"&gt;upside-down&lt;/a&gt; for more info)&lt;/li&gt;

&lt;li&gt;

Alt + Left/Right moves character or
selection to left or to the right&lt;/li&gt;

&lt;li&gt;

Leader + n toggles NERDTree&lt;/li&gt;

&lt;li&gt;

Leader + m shows current file in NERDTree&lt;/li&gt;

&lt;li&gt;when in select mode ', ", ( wraps selection accordingly&lt;/li&gt;

&lt;li&gt;

y…&lt;/li&gt;

&lt;/ul&gt;
&lt;/div&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/gko/vimio" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;You can also find me on twitter: &lt;a href="https://twitter.com/konstantin" rel="noopener noreferrer"&gt;https://twitter.com/konstantin&lt;/a&gt; &lt;/p&gt;

</description>
      <category>neovim</category>
      <category>vim</category>
      <category>notes</category>
      <category>vimwiki</category>
    </item>
    <item>
      <title>Taking notes with vim</title>
      <dc:creator>Konstantin</dc:creator>
      <pubDate>Fri, 31 May 2019 18:38:53 +0000</pubDate>
      <link>https://dev.to/konstantin/taking-notes-with-vim-3619</link>
      <guid>https://dev.to/konstantin/taking-notes-with-vim-3619</guid>
      <description>&lt;p&gt;For some time I've been searching for a plugin that would allow me to take notes without any hassle. I enjoy using &lt;code&gt;markdown&lt;/code&gt;, so naturally this &lt;code&gt;plugin&lt;/code&gt; had to support that format.&lt;/p&gt;

&lt;p&gt;Recently I came across &lt;a href="https://github.com/vimwiki/vimwiki" rel="noopener noreferrer"&gt;vimwiki&lt;/a&gt;. It has almost everything that I wanted, although there are a couple of flaws. But since it's &lt;code&gt;vim&lt;/code&gt; it is very easy to fix them yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing &lt;code&gt;vimwiki&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;If you're using &lt;a href="https://github.com/junegunn/vim-plug" rel="noopener noreferrer"&gt;vim-plug&lt;/a&gt;, you can install it simply by adding following in your &lt;code&gt;~/.vimrc&lt;/code&gt; file:&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;call&lt;/span&gt; plug#begin&lt;span class="p"&gt;()&lt;/span&gt;

Plug &lt;span class="s1"&gt;'vimwiki/vimwiki'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s1"&gt;'branch'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'dev'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;call&lt;/span&gt; plug#end&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;I recommend using &lt;code&gt;dev&lt;/code&gt; branch as I found it to be pretty stable, with a lot of bugfixes.&lt;/p&gt;
&lt;h2&gt;
  
  
  Using &lt;code&gt;vimwiki&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;vimwiki&lt;/code&gt; supports &lt;code&gt;wiki&lt;/code&gt; format as well as &lt;code&gt;markdown&lt;/code&gt; but since our task is to use the latter we need to add following to &lt;code&gt;~/.vimrc&lt;/code&gt;:&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;let&lt;/span&gt; &lt;span class="nv"&gt;g:vimwiki_list&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="s1"&gt;'path'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'~/Documents/notes/'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="se"&gt;       \&lt;/span&gt; &lt;span class="s1"&gt;'syntax'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s1"&gt;'markdown'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'ext'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'.md'&lt;/span&gt; &lt;span class="p"&gt;}]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This will tell the plugin that all notes must be stored in &lt;code&gt;~/Documents/notes/&lt;/code&gt;, which is compatible with most OS and you will profit automatically of &lt;code&gt;iCloud&lt;/code&gt; sync in &lt;code&gt;MacOS&lt;/code&gt;. It also tells that we are using &lt;code&gt;markdown&lt;/code&gt; format by default and our default &lt;code&gt;root&lt;/code&gt; note will be called &lt;code&gt;index.md&lt;/code&gt;. To access this note you need to hit Leader + w + w from any vim buffer.&lt;/p&gt;

&lt;p&gt;After you've opened any &lt;code&gt;note&lt;/code&gt; you can hit Enter on any word or selection and &lt;code&gt;vimwiki&lt;/code&gt; will create a link to a child note(with that word or selection as a name) and the note file itself. Once the link is created you can simply navigate to a child note by hitting Enter once again. Magic!&lt;/p&gt;
&lt;h2&gt;
  
  
  The flaws and how to fix them
&lt;/h2&gt;

&lt;p&gt;The main flaw is that &lt;code&gt;vimwiki&lt;/code&gt; replaces itself as syntax highlighter for &lt;code&gt;markdown&lt;/code&gt; files. Compare:&lt;br&gt;
&lt;code&gt;vimwiki&lt;/code&gt; highlight&lt;br&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%2Fuploads%2Farticles%2Fhr8frbcou0wusvcsloah.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%2Fuploads%2Farticles%2Fhr8frbcou0wusvcsloah.png" alt="vimwiki highlight" width="800" height="634"&gt;&lt;/a&gt;&lt;br&gt;
to &lt;a href="https://github.com/plasticboy/vim-markdown" rel="noopener noreferrer"&gt;vim-markdown&lt;/a&gt; highlight&lt;br&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%2Fuploads%2Farticles%2F3jhgovbrqg9l28ozxune.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%2Fuploads%2Farticles%2F3jhgovbrqg9l28ozxune.png" alt="vim-markdown hightlight" width="800" height="634"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I know that it depends on colorscheme, but I saw same result on multiple variants.&lt;/p&gt;

&lt;p&gt;The second flaw is it changes &lt;code&gt;filetype&lt;/code&gt; to &lt;code&gt;vimwiki&lt;/code&gt; so that you lose all your snippets and other good stuff that was linked to &lt;code&gt;markdown&lt;/code&gt; filetype.&lt;/p&gt;

&lt;p&gt;To fix both you need to add following line to &lt;code&gt;~/.vimrc&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;autocmd &lt;span class="nb"&gt;FileType&lt;/span&gt; vimwiki &lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="nb"&gt;ft&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;markdown
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;That way we reset the &lt;code&gt;vimwiki&lt;/code&gt; file type to markdown, all the magic functionality that I talked about earlier will remain.&lt;/p&gt;

&lt;p&gt;You can find all the configuration in my vim settings repo:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/gko" rel="noopener noreferrer"&gt;
        gko
      &lt;/a&gt; / &lt;a href="https://github.com/gko/vimio" rel="noopener noreferrer"&gt;
        vimio
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      🎩 easy to install/use vim settings
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Vim Settings&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/screenshot.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fscreenshot.png" alt="screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An &lt;a href="https://dev.to/konstantin/configuring-a-perfect-editor-for-frontend-development-1pe5" rel="nofollow"&gt;article&lt;/a&gt; describing key features of this config.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Prerequisites&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;In order to get all features you might want to install following packages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/junegunn/fzf#installation" rel="noopener noreferrer"&gt;fzf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/BurntSushi/ripgrep#installation" rel="noopener noreferrer"&gt;ripgrep&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm" rel="nofollow noopener noreferrer"&gt;npm&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Installation&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;On unix and windows(with bash which can be installed with &lt;a href="http://msysgit.github.io/" rel="nofollow noopener noreferrer"&gt;git&lt;/a&gt;):&lt;/p&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;curl -L https://raw.github.com/gko/vimio/main/install.sh &lt;span class="pl-k"&gt;|&lt;/span&gt; bash&lt;/pre&gt;

&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;macOS&lt;/h3&gt;

&lt;/div&gt;

&lt;p&gt;In macOS terminal.app don't forget to check the «Use option as meta key»:&lt;/p&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/terminal.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fterminal.png" alt="terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And «Esc+» option in iterm2:&lt;/p&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/iterm2.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fiterm2.png" alt="iterm2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Shortcuts&lt;/h2&gt;

&lt;/div&gt;

&lt;p&gt;Some of shortcuts(Leader key is comma):&lt;/p&gt;


&lt;ul&gt;

&lt;li&gt;

Ctrl + s saves current file&lt;/li&gt;

&lt;li&gt;

Leader + s in both &lt;code&gt;select&lt;/code&gt; and &lt;code&gt;normal&lt;/code&gt; mode initiates search and replace&lt;/li&gt;

&lt;li&gt;

Alt + Up/Down moves line or selection above
or below current line(see &lt;a href="https://github.com/gko/upside-down" rel="noopener noreferrer"&gt;upside-down&lt;/a&gt; for more info)&lt;/li&gt;

&lt;li&gt;

Alt + Left/Right moves character or
selection to left or to the right&lt;/li&gt;

&lt;li&gt;

Leader + n toggles NERDTree&lt;/li&gt;

&lt;li&gt;

Leader + m shows current file in NERDTree&lt;/li&gt;

&lt;li&gt;when in select mode ', ", ( wraps selection accordingly&lt;/li&gt;

&lt;li&gt;

y…&lt;/li&gt;

&lt;/ul&gt;
&lt;/div&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/gko/vimio" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;I'm also on twitter as &lt;a href="http://twitter.com/konstantin" rel="noopener noreferrer"&gt;konstantin&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vim</category>
      <category>notes</category>
      <category>vimwiki</category>
      <category>markdown</category>
    </item>
  </channel>
</rss>
