delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/07/02/20:56:11

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:content-type:mime-version:subject:from
:in-reply-to:date:content-transfer-encoding:message-id
:references:to; q=dns; s=default; b=QXSwSCSfMWwdm1rR7vDbYMpkS88l
5rv0zLAw6JSXaZjFCqUOuNBbnk8RNjoJmfFuK20WQ7EDbKwPf7PLwXHWU94FU0f3
vmnrfRX3xxUIHKavKYYZ5oN0QrTtdLe8Dn7M+oKwwszylxdyWZGZkC7WIZoS6P2E
Zpowrlvts19WHPk=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:content-type:mime-version:subject:from
:in-reply-to:date:content-transfer-encoding:message-id
:references:to; s=default; bh=whhZWZ+KWeHHlW9obDs2dz92DLo=; b=Wn
EHCFIiKi7WT+m9a5pTwbHj5p4qhhpTVPwz/dgUU4HHaFNgRO+UR8ouMl6tOXsu2H
gNt69JiyYU5TbCcDB7cD+3Pz6CstOrp5Hesx+Eilrm4PzDOM6EsuwatMb5KBbRML
dq9b9AF4fDY58UEUeZMkGw3LhQaml4fC82/sAkNmY=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=0.5 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2
X-HELO: etr-usa.com
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\))
Subject: Re: How to expand tabs? Where is expand program.
From: Warren Young <wyml AT etr-usa DOT com>
In-Reply-To: <DC315DD3-D309-4473-BF93-743721D42082@etr-usa.com>
Date: Thu, 2 Jul 2015 18:55:54 -0600
Message-Id: <5846E9A5-C9D0-4DE9-9681-FF66488E56CE@etr-usa.com>
References: <701185250 DOT 1353195 DOT 1435878843444 DOT JavaMail DOT yahoo AT mail DOT yahoo DOT com> <DC315DD3-D309-4473-BF93-743721D42082 AT etr-usa DOT com>
To: The Cygwin Mailing List <cygwin AT cygwin DOT com>
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id t630u858001963

On Jul 2, 2015, at 6:46 PM, Warren Young <wyml AT etr-usa DOT com> wrote:
> 
> Say :set expandtab.  Now you don’t need expand(1) at all. :)

Ooops, Ernie’s answer made me look deeper, and it’s a bit more complicated.  I forget because I’ve wrapped it up into a couple of macros which I keep in my ~/.vimrc file:

function SpaceTabs(spaces)
    exe "set sw=" . a:spaces
    exe "set ts=" . a:spaces
    exe "set expandtab"
    exe "set smarttab"
    exe "retab"
endfunction

function TabTabs(stops)
    exe "set ts=" . a:stops
    exe "set sw=" . a:stops
    exe "set noexpandtab"
    exe "set nosmarttab”
endfunction

So, “:call SpaceTabs(4)” is roughly equivalent to “expand -t4 < old > new”, except it works in-place.
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019