import{_ as a,c as i,a3 as s,o as t}from"./chunks/framework.D67F_Jff.js";const g=JSON.parse('{"title":"The Neovintageous vimrc file","description":"","frontmatter":{"post":true,"prev":false,"next":false,"editLink":false,"sidebar":false,"aside":false,"tags":"vim sublime-text neovintageous","title":"The Neovintageous vimrc file","lastUpdated":false,"head":[["meta",{"property":"og:url","content":"https://blog.gerardroche.com/2022/11/21/vimrc-and-neovintageousrc/"}],["meta",{"property":"og:title","content":"The Neovintageous vimrc file"}],["meta",{"property":"og:description","content":"a blog by Gerard Roche on programming and software development"}]]},"headers":[],"relativePath":"2022/11/21/vimrc-and-neovintageousrc/index.md","filePath":"2022/11/21/vimrc-and-neovintageousrc/index.md"}'),o={name:"2022/11/21/vimrc-and-neovintageousrc/index.md"};function n(l,e,p,d,h,r){return t(),i("div",null,e[0]||(e[0]=[s(`<h1 id="the-neovintageous-vimrc-file" tabindex="-1">The Neovintageous vimrc file <a class="header-anchor" href="#the-neovintageous-vimrc-file" aria-label="Permalink to &quot;The Neovintageous vimrc file&quot;">​</a></h1><p>In NeoVintageous, the equivalent of a vimrc file is called a &quot;neovintageousrc&quot; file. This file contains initialization commands and is loaded every time Sublime Text starts.</p><p>To edit the neovintageousrc file, follow these steps:</p><ol><li><p>Open the Command Palette: <code>Command Palette → NeoVintageous: Open neovintageousrc file</code>.</p></li><li><p>Make the necessary changes to the file.</p></li><li><p>To apply the changes, reload the neovintageousrc from the Command Palette: <code>Command Palette → NeoVintageous: Reload neovintageousrc file</code>.</p></li></ol><h2 id="options" tabindex="-1">Options <a class="header-anchor" href="#options" aria-label="Permalink to &quot;Options&quot;">​</a></h2><p>Here are some of the options supported in the NeoVintageous: <code>autoindent</code>, <code>belloff</code>, <code>expandtab</code>, <code>hlsearch</code>, <code>ignorecase</code>, <code>incsearch</code>, <code>list</code>, <code>magic</code>, <code>menu</code>, <code>minimap</code>, <code>modeline</code>, <code>modelines</code>, <code>number</code>, <code>relativenumber</code>, <code>shell</code>, <code>sidebar</code>, <code>smartcase</code>, <code>spell</code>, <code>statusbar</code>, <code>tabstop</code>, <code>textwidth</code>, <code>winaltkeys</code>, <code>wrap</code>, <code>wrapscan</code>.</p><p>For a full list of supported options, please refer to our <a href="https://github.com/NeoVintageous/NeoVintageous/blob/master/ROADMAP.md?ref=blog.gerardroche.com" target="_blank" rel="noreferrer">roadmap</a>.</p><p>You can set these options using the <code>:set {option}</code> command. Here are two examples that you might find useful:</p><div class="language-vim vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">vim</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> ignorecase</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> smartcase</span></span></code></pre></div><p>If you need help with individual options, you can run <code>:help &#39;{option}&#39;</code> and read <a href="/2023/06/05/neovintageous-options/">more about each individual option</a>.</p><h2 id="leader-key" tabindex="-1">Leader Key <a class="header-anchor" href="#leader-key" aria-label="Permalink to &quot;Leader Key&quot;">​</a></h2><p>To define a mapping which uses the &quot;mapleader&quot; variable, the special string &quot;<code>&lt;Leader&gt;</code>&quot; can be used. It is replaced with the string value of &quot;mapleader&quot;. If &quot;mapleader&quot; is not set or empty, a backslash is used instead. Example:</p><div class="language-vim vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">vim</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">noremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Leader</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;A  oanother line&lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Esc</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><p>Works like:</p><div class="language-vim vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">vim</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">noremap</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> \\</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">A  oanother line&lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Esc</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><p>But after:</p><div class="language-vim vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">vim</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">let</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> mapleader</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span></code></pre></div><p>It works like:</p><div class="language-vim vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">vim</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">noremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ,A  oanother line&lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Esc</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><p>Note that the value of &quot;mapleader&quot; is used at the moment the mapping is defined. Changing &quot;mapleader&quot; after that has no effect for already defined mappings.</p><h2 id="key-mapping" tabindex="-1">Key Mapping <a class="header-anchor" href="#key-mapping" aria-label="Permalink to &quot;Key Mapping&quot;">​</a></h2><p>NeoVintageous supports various key mapping commands, including <code>:noremap</code>, <code>:nnoremap</code>, <code>:onoremap</code>, <code>:snoremap</code>, and <code>:vnoremap</code>.</p><p>For instance, if you want to map <code>&lt;C-l&gt;</code> to the ex command <code>:nohlsearch</code>, you can do it like this:</p><div class="language-vim vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">vim</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">noremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">C-l</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt; :</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">nohlsearch</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><p>You can also map directly to Sublime Text commands by converting the command name to mixed case. For example, to map <code>&lt;D-i&gt;</code> to the <code>goto_symbol_in_project</code> command:</p><div class="language-vim vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">vim</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">noremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">D-i</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt; :GotoSymbolInProject&lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><p>Note that you might need to <a href="/2022/09/22/neovintageous-super-keys/">enable super keys</a> for the <code>&lt;D-i&gt;</code> super key to work in this example.</p><p><strong>Where do these commands come from?</strong></p><p>When you run a command in Sublime Text, you can inspect the console log to discover the command and arguments needed to map it.</p><ol><li><p>Console Logging: View console logging by navigating to <code>Menu → View → Show Console</code>.</p></li><li><p>Command and Input Logging: Enable command and input logging by running the following commands in the console:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>sublime.log_commands(True)</span></span>
<span class="line"><span>sublime.log_input(True)</span></span></code></pre></div></li></ol><p>For example, let&#39;s say you want to map &quot;Goto Symbol&quot; command above. Run the command, e.g., &quot;Menu → Goto → Goto Symbol&quot; command and Sublime Text will print the following in the console:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>command: show_overlay {&quot;overlay&quot;: &quot;goto&quot;, &quot;text&quot;: &quot;@&quot;}</span></span></code></pre></div><h3 id="key-mapping-command-arguments" tabindex="-1">Key Mapping Command Arguments <a class="header-anchor" href="#key-mapping-command-arguments" aria-label="Permalink to &quot;Key Mapping Command Arguments&quot;">​</a></h3><p>NeoVintageous allows you to pass arguments to commands as space-separated parameters in the format <code>arg=value</code>. For instance, to map <code>&lt;C-f&gt;</code> to the <code>show_overlay</code> command with the arguments <code>overlay=goto</code> and <code>text=@</code>:</p><div class="language-vim vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">vim</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">C-f</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt; :ShowOverlay overlay</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">goto text</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">@&lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><h3 id="key-mapping-shell-commands" tabindex="-1">Key Mapping Shell Commands <a class="header-anchor" href="#key-mapping-shell-commands" aria-label="Permalink to &quot;Key Mapping Shell Commands&quot;">​</a></h3><p>You can also map to shell commands using the ex command <code>:!</code>. For example, to map <code>&lt;leader&gt;gs</code> to execute <code>git status</code>:</p><div class="language-vim vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">vim</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">leader</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;gs :</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">!</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">git status&lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><p>If you want to ignore any output from the command, you can prefix the right-hand side (rhs) with <code>:silent</code>. For example, to map <code>&lt;leader&gt;ga</code> to <code>git add {current-file}</code> and ignore any output:</p><div class="language-vim vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">vim</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">leader</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;ga :</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">silent</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> !</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">git add %&lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><p>It&#39;s quite versatile and can be very powerful.</p><h2 id="further-reading" tabindex="-1">Further Reading <a class="header-anchor" href="#further-reading" aria-label="Permalink to &quot;Further Reading&quot;">​</a></h2><ul><li><a href="https://neovintageous.github.io/?ref=blog.gerardroche.com" target="_blank" rel="noreferrer">NeoVintageous documentation</a></li></ul>`,43)]))}const k=a(o,[["render",n]]);export{g as __pageData,k as default};
