{"id":132,"date":"2013-08-06T11:43:15","date_gmt":"2013-08-06T15:43:15","guid":{"rendered":"http:\/\/jonesling.us\/blog\/?p=132"},"modified":"2015-02-02T13:22:05","modified_gmt":"2015-02-02T18:22:05","slug":"vim-and-tabs","status":"publish","type":"post","link":"https:\/\/blog.jonesling.us\/?p=132","title":{"rendered":"Vim and tabs"},"content":{"rendered":"<p>At work, we use <a title=\"Vim\" href=\"http:\/\/www.vim.org\/\" target=\"_blank\">vim<\/a> for our editing needs &#8211; which, as programmers, means we spend our day in vim.<\/p>\n<p>We have a lot of mixed-format code &#8211; sometimes it has tabs, sometimes it has spaces.\u00a0 Personally, I prefer spaces for my indenting, but I&#8217;m a convert to the church of make-your-code-match-the-existing-code.\u00a0 As opposed to reformatting the existing code, which is soooo irresistible until you&#8217;re faced with a mountain.<\/p>\n<p>So, I have to switch back and forth a lot.\u00a0 Here, for the sake of posterity, is how to switch from spaces to tabs on-the-fly in vim:<\/p>\n<blockquote><p>:set noexpandtab<br \/>\n:set copyindent<br \/>\n:set preserveindent<br \/>\n:set softtabstop=0<br \/>\n:set shiftwidth=4<br \/>\n:set tabstop=4<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>At work, we use vim for our editing needs &#8211; which, as programmers, means we spend our day in vim. We have a lot of mixed-format code &#8211; sometimes it has tabs, sometimes it has spaces.\u00a0 Personally, I prefer spaces for my indenting, but I&#8217;m a convert to the church of make-your-code-match-the-existing-code.\u00a0 As opposed to &hellip; <a href=\"https:\/\/blog.jonesling.us\/?p=132\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Vim and tabs&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","wprm-recipe-roundup-name":"","wprm-recipe-roundup-description":"","advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[94],"class_list":["post-132","post","type-post","status-publish","format-standard","hentry","category-linux","tag-vim"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4o3FW-28","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.jonesling.us\/index.php?rest_route=\/wp\/v2\/posts\/132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jonesling.us\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jonesling.us\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jonesling.us\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jonesling.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=132"}],"version-history":[{"count":3,"href":"https:\/\/blog.jonesling.us\/index.php?rest_route=\/wp\/v2\/posts\/132\/revisions"}],"predecessor-version":[{"id":692,"href":"https:\/\/blog.jonesling.us\/index.php?rest_route=\/wp\/v2\/posts\/132\/revisions\/692"}],"wp:attachment":[{"href":"https:\/\/blog.jonesling.us\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jonesling.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jonesling.us\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}