Sublime Text换行和提交消息 [英] Sublime Text line wrap and commit messages

查看:83
本文介绍了Sublime Text换行和提交消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Sublime Text(3)用于默认的Git提交消息编辑器。我尝试遵循Git约定,对每行字符数进行严格限制(第一行50个字符,其余72个字符)。我目前在这些间隔处设置了指南以供视觉参考,但是我不希望手动将换行符放在72个字符的末尾,而是希望ST自动为我插入换行符。本质上,我希望能够不使用换行符来编写,但要使用实际的换行符进行换行,而不仅仅是在编辑器中进行视觉换行。有合理的方法吗?

I use Sublime Text (3) for my default Git commit message editor. I try to follow Git conventions using a hard limit on the number of characters per line (50 for the first line and 72 for the rest). I currently have guides set up at those intervals for visual reference, however rather than manually having to put a line return at the end of 72 characters, I would love to have ST automatically insert a line return for me. Essentially, I want to be able to write without line returns, but have actual returns put in for wrapping instead of just visually wrapping in the editor. Is there a reasonable way to do this?

推荐答案

有一个有用的插件(我在以前的搜索中以某种方式错过了)称为 AutoWrap 。 AutoWrap完全可以实现我想要的功能,并在一定数量的字符后自动换行,并带有换行符,可以通过语法类型来设置激活它的设置和字符数。这是我关联的 Git Commit Message.sublime-settings 文件(来自 Packages / User ):

There is a useful plugin for this (that I somehow missed in prior searches) called AutoWrap. AutoWrap does exactly what I wanted and automatically wraps the line after a certain number of characters with a line return, and the settings for activating it and the number of characters can be set by syntax type. Here is my associated Git Commit Message.sublime-settings file (from Packages/User):

{
  "rulers": [50, 70],
  "spell_check": true,
  "auto_wrap": true,
  "auto_wrap_width": 70
}

The auto_wrap auto_wrap_width 行与插件完美配合,我可以根据需要保留或移除标尺。

The auto_wrap and auto_wrap_width lines work perfectly with the plugin and I can keep or remove the rulers as need be.

这篇关于Sublime Text换行和提交消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆