Vim中高亮不需要的空白符
本文提到的不需要的空白符有两类:
-
附在行尾的空白。行尾空白通常是由于不小心添加到的,在编辑器下也不可见,但它会对版本控制造成不必要的影响。这里有个需要注意的地方,标准 Markdown 语法里,行尾添加 2个以上空格表示段落内强制换行。
-
缩进中混用制表符和空白符。在代码缩进中混用制表符和空格不是个好习惯,会造成在不同编辑器、不同制表符设置下代码显示格式错乱,更别说 Python 这样对格式要求苛刻的语言了。
在 .vimrc
文件中添加如下代码
highlight ExtraWhitespace ctermbg=red guibg=red
autocmd BufWinEnter * match ExtraWhitespace /\s\+$\| \+\ze\t\+\|\t\+\zs \+/
就可以高亮提到的两类空白符,这里稍作解释。
- 会将行尾空白符和制表空格混排中的空格都高亮为红色
-
使用
autocmd BufWinEnter *
是因为match
只能对当前窗口有效,具体可以查看:help match
-
用于匹配的正则表达式分3个多选组,
/\s\+$/
用于匹配行尾空白符,/ \+\ze\t\+/
用于匹配紧邻制表符前的空格,/\t\+\zs \+/
用于匹配紧跟制表符后的空格。当然,也可以选择高亮混排中的制表符而不是空格,这样写,/ \+\zs\t\+/
和/\t\+\ze \+/
参考资料
Sep 07, 2022 12:59:12 AM
Bangladesh All Education Board has announced PSC Scholarship Result 2022 on last week of December 2022 for all divisional educational boards under DPE, and they have going to issue Primary Britti 2022 to all qualified student, and the DPE is going to announce likely on March or April 2022 with school wise selection list for Talent Pool Scholarship and General Grade Scholarship to all eligible student under Prathomik Somaponi Result 2022. Every year the All Education Board Bangladesh has announced a selected candidate list school wise and district wise to all divisional boards of Dhaka, Chittagong, Comilla, Rajshahi, Sylhet, Barisal, Jessore, Talent Pool Scholarship Dinajpur, and Madrasah Board working under DPE and this year also going to declare PSC Scholarship Result 2022 with selection list and type of scholarship through PSC Britty 2022.
Nov 14, 2022 03:55:41 PM
Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging.. All video downloader
Dec 22, 2022 02:02:03 PM
I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work... Instagram followers count
Jan 08, 2023 07:44:07 AM
I recently came across your article and have been reading along. I want to express my admiration of your writing skill and ability to make readers read from the beginning to the end. I would like to read newer posts and to share my thoughts with you. starvegas game
Jan 19, 2023 01:28:00 AM
I have express a few of the articles on your website now, and I really like your style of blogging. I added it to my favorite’s blog site list and will be checking back soon… Panenpoker
Jan 19, 2023 11:05:15 PM
Feb 10, 2023 01:52:22 PM
Hi there, I found your web site via Google while looking for a relevant subject, your web site turned up, it looks excellent. I have actually bookmarked it in my google bookmarks.
villa design in dubai
interior design companies in dubai
Feb 10, 2023 01:55:04 PM
Very useful blog post! There is a great deal of info below that can assist any organization begin with a successful social networking project.
engineering consultants dubai
mep consultants in uae
Feb 10, 2023 01:57:07 PM
This article was written by a genuine thinking author certainly. I settle on most of them with the solid factors made by the author. I'll be back day in and also day for additional new updates.
dubai civil defense approval
abu dhabi municipality approval
Apr 23, 2023 03:24:14 PM
crediblebh
May 12, 2023 02:50:56 AM I invite you to the page where you can read with interesting information on similar topics. 메이저놀이터
May 21, 2023 04:22:57 PM
On that website page, you'll see your description, why not read through this. 수원출장마사지
Jun 02, 2023 01:26:26 AM Interestingly you write, I will address you'll find exciting and interesting things on similar topics. 인천출장마사지
Jun 04, 2023 05:58:50 PM Hello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work. 펀초이스
Jul 01, 2023 09:37:40 PM
I found Hubwit as a transparent s ite, a social hub which is a conglomerate of Buyers and Sellers who are ready to offer online digital consultancy at decent cost. phuket weed delivery
Jul 10, 2023 07:19:28 AM
เสื้อลายดอก เสื้อฮาวาย เสื้อสงกรานต์ เสื้อเที่ยวทะเล เสื้อใส่ทำบุญ เสื้อคู่ เสื้อทีม เสื้อบริษัท เสื้อปาร์ตี้ ใส่ได้ทั้งผู้ชาย และ ผู้หญิง สีสันสดใส ใส่สบาย มีหลากหลาย สไตล์ สี และ ลวดลายให้เลือกสรร ใส่ได้หลากหลายโอกาส เช่น เที่ยวทะเล ทำบุญ สรงน้ำพระพุทธรูปที่บ้าน รดน้ำดำหัวผู้ใหญ่ในบ้าน อีกทั้งเป็น เสื้อรุ่น เสื้อกิจกรรม เสื้อกลุ่ม เสื้อรับน้อง เสื้อใส่เที่ยวทะเล เสื้อใส่ทำบุญ เสื้อฮาวายลายดอก เสื้อฮาวายวินเทจ เสื้อลายดอกพิมพ์ลายดอกไม้เรโทรสไตล์วินเทจ ดีไซน์ทันสมัย เนื้อผ้าเบาบางพร้อมกับให้ความรู้สึกเย็นขณะสวมใส่เหมาะสำหรับการ ทุกฤดูกาล ichs amazon
Jul 10, 2023 10:17:45 PM
I have express a few of the articles on your website now, and I really like your style of blogging. I added it to my favorite’s blog site list and will be checking back soon… IKARIA LEAN BELLY JUICE
Jul 19, 2023 05:00:41 PM
Thank you very much for this useful article. I like it. 천안출장마사지
Aug 31, 2023 12:48:02 PM
Very informative post! There is a lot of information here that can help any business get started with a successful social networking campaign. familie vakantie naar middellandse zee kust israel
Sep 09, 2023 10:38:46 AM
Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. https://178.128.212.87
Oct 22, 2023 12:25:18 AM
I was surfing the Internet for information and came across your blog. I am impressed by the information you have on this blog. It shows how well you understand this subject. ufabetทางเข้าเล่น
Feb 21, 2024 08:53:27 PM
There is so much in this article that I would never have thought of on my own. Your content gives readers things to think about in an interesting way. Thank you for your clear information
Mar 05, 2024 06:30:48 AM
From the clothes we wear to the accessories we choose, fashion is a reflection of our personality, our mood, and our aspirations, helping us to express ourselves authentically and confidently. 10 deep hoodie
Jul 03, 2024 05:31:52 PM
Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks OK Win login
Aug 08, 2024 06:43:10 PM
I would like to thank the developers of this remarkable website and to provide us the comfortability for earning after using it! I am feeling much more relaxed than before! Messipoker
Aug 10, 2024 09:22:43 PM
I became very much attached to them because they have done some miracles for my problems! Thanks to them for making that possible! They are suggested to all. <a href="https://178.128.230.42/">alexistogel</a>
Aug 10, 2024 09:23:01 PM
These are some great points and loads of information about my desired issue and I liked them because they have proved themselves really helpful by getting me the result I wanted! alexistogel
Sep 01, 2024 11:38:59 PM
Go88 là Huyền Thoại game đổi thưởng Online số 1 tại Việt Nam năm 2024. Được thành lập vào 08/08/2008 tại Việt Nam, Go 88 nổi bật với Game bài đổi thưởng, Tài Xỉu online, Nổ Hũ online, Bắn Cá online,… và hơn 888 sản phẩm game đổi thưởng trực tuyến khác. https://maxborn.net/
Sep 03, 2024 08:06:51 PM
They have a very welcoming and a gracious staff! Including the best customer service I have ever received, they are surely one of the best! Suggested to all! <a href="https://www.turkish-visa.org/bn/turkey-visa-status-enquiry">তুরস্কের ভিসার অবস্থা তদন্ত</a>
Sep 19, 2024 05:10:09 PM
A powerful share, I simply given this onto a colleague who was doing slightly evaluation on this. And he actually purchased me breakfast as a result of I found it for him.. smile. So let me reword that: Thnx for the deal with! But yeah Thnkx for spending the time to debate this, I feel strongly about it and love studying more on this topic. If attainable, as you become experience, would you mind updating your blog with extra particulars? It is extremely useful for me. Massive thumb up for this weblog put up! <a href="https://www.cambodian-visa.org/es/cambodia-visa-for-moroccan-citizens">visa de camboya para ciudadanos marroquíes</a>
Sep 24, 2024 12:25:35 PM
DinoGame.app offers an exceptional platform for both new and veteran gamers. Whether you’re looking to relive fond memories or discover the Dino Game for the first time, DinoGame.app provides a captivating and accessible experience that’s bound to delight. Dive in today and experience the thrill of the Dino Game like never before!https://dinogame121.amebaownd.com