From patchwork Mon Feb 3 23:26:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1233053 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-518815-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=LzbN7vRT; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=K+nq/9ef; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48BP9R3lt4z9sTl for ; Tue, 4 Feb 2020 10:26:49 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=tBIdyVAARhmu9FpZ DD+7XrmUbI0515FBFu+uVavNb/uUHPFOSEqbc9ZFpfo2TbJax2PjfuryrLHdbegk 1sty10ISoGXRnkZO/Fta6NqkOXESGpntztVCejJOBLHEMJiwPcpwfghbDLHL4HI3 oeoBWpnBjbGaoslKVz9kTN5hV6c= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=9V9hC6n/TSD9SxSY2yiEuL JSxp0=; b=LzbN7vRTm0AeA0FQ1sPkchq9L4evVn0wE7VtrtUJIyXLCHhkjQxypB yX+odlAzTL+iaKcVvIYo+8NZDWl5oVUVCVrx1UQ2dEwutqimH7nfUZ5GyRyH4kwn wrma8KAy/HHe4ggKStXmolOu56HklhWl9DA+cv8qI0RFGzDt7zkEA= Received: (qmail 23053 invoked by alias); 3 Feb 2020 23:26:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 23043 invoked by uid 89); 3 Feb 2020 23:26:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Feb 2020 23:26:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580772397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Z9BoCvehlXjeFbDTRLOztpXKCLkcsD2eExfkp/89buk=; b=K+nq/9efWZ05uld41NL1t/O1mgcsrknOpXy4paAzcJ7F5oJk/G1ZS0zt8YZ2lzRqbt+FpD f9oUnGXVaSnGR8S3eLPmOc/kPVPylemXHDNoMIzCdzgMGrCS+iBH0rIdwNzj4sSxqOQCpa dfo33fdjyUuqgcgFf6iCmfAAG34JvSU= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-394-KlJ37Y1yM9KhGZPWpBbdEA-1; Mon, 03 Feb 2020 18:26:33 -0500 Received: by mail-qt1-f197.google.com with SMTP id e8so11129493qtg.9 for ; Mon, 03 Feb 2020 15:26:33 -0800 (PST) Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id t2sm9906780qkc.31.2020.02.03.15.26.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2020 15:26:32 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: Patrick Palka Subject: [PATCH] contrib/vimrc: detect more C-like files Date: Mon, 3 Feb 2020 18:26:28 -0500 Message-Id: <20200203232628.72799-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-IsSubscribed: yes Currently this script doesn't set the indentation style for the standard library headers under libstdc++/ because they lack a file extension. But they do have a modeline, so the file type is still set appropriately by Vim. So by inspecting &filetype, we can also detect these standard library headers as C-like files. contrib/ChangeLog: * vimrc (SetStyle): Also look at &filetype to determine whether to a file is C-like. --- contrib/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/vimrc b/contrib/vimrc index bbbe1dd449b..e2ccbe0fd10 100644 --- a/contrib/vimrc +++ b/contrib/vimrc @@ -39,7 +39,7 @@ function! SetStyle() setlocal formatoptions-=ro formatoptions+=cqlt let l:ext = fnamemodify(l:fname, ":e") let l:c_exts = ['c', 'h', 'cpp', 'cc', 'C', 'H', 'def', 'java'] - if index(l:c_exts, l:ext) != -1 + if index(l:c_exts, l:ext) != -1 || &filetype == "cpp" || &filetype == "c" setlocal cindent setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,f0,h2,p4,t0,+2,(0,u0,w1,m0 endif