<p>In my work I have to copy and paste sample manifest snippet from kubernetes documentation site. After copying many a time I have to correct indent and change some section of the copied content. Many a time challenges comes from the structure of the yaml file, specifically space characters and tab characters. Currently I am using the following setting</p>

<pre><code>set number relativenumber
set tabstop=2
set softtabstop=2
set expandtab
set shiftwidth=2
</code></pre>

<p>Is there any more setting that I am missing?</p>

Arijit Mazumdar
<p>A few things.</p>

<ol>
<li>If you are pasting, make sure you do with <code>paste</code> set. It’s a used as a temporary setting for letting the text be put without changes. You can use <code>pastetoggle</code> for this, and tpope’s unimpaired has useful (relevant) mappings.</li>
<li>Don’t sent filetype-specific things in your vimrc. Just, don’t. See, e.g., <a href="https://vi.stackexchange.com/a/22256">this QA</a>, <a href="https://stackoverflow.com/a/57692489/4400820">this one</a>, or <a href="https://vi.stackexchange.com/a/18493">this one</a> (I have more, just ask). Instead, use a filetype-plugin. If kubernetes are all detected as yaml, you would want to use <code>setlocal</code> &amp;co. inside <code>~/.vim/after/ftplugin/yaml.vim</code>. If they are not given a filetype, you may need to create a filetype-detection script (Google and the Vim help are quite good resources for this).</li>
<li>It’s recommended not to adjust <code>tabstop</code>, since you can’t control how wide a tab is on every display (you can always control spaces, though ;)).</li>
</ol>
