 <p>You can put <code>ftplugin</code> directory with filetype-specific settings inside <code>.vim</code> directory</p> <pre><code>.vim └── ftplugin └── ruby.vim └── markdown.vim </code></pre> <p>And keep your settings there. The are applied when file with corresponding filetype is opened.</p> <p>Also, you might need to have filetype detection(if not detected properly). You can put this to your <code>.vimrc</code></p> <pre><code>autocmd BufNewFile,BufRead *.markdown,*.md,*.mdown,*.mkd,*.mkdn set ft=markdown </code></pre> <p>Or, put it into <code>ftdetect</code> directory</p> <pre><code>.vim └── ftdetect └── markdown.vim </code></pre>