Sublime Text line wrap and commit messages

試著忘記壹切 提交于 2019-12-24 05:56:24

问题


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?


回答1:


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 and auto_wrap_width lines work perfectly with the plugin and I can keep or remove the rulers as need be.



来源:https://stackoverflow.com/questions/30786496/sublime-text-line-wrap-and-commit-messages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!