不确定如何通过示例来说明这个...
鉴于...
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'adroit', # Or path to database file if using sqlite3.
'USER': 'root', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
Run Code Online (Sandbox Code Playgroud)
}
我将如何格式化它以便所有注释都正确排列,就像这样
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'adroit', # Or path to database file if using sqlite3.
'USER': 'root', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
Run Code Online (Sandbox Code Playgroud)
}
以上示例来自django设置文件,但我在各种语言中遇到了很多这样的问题,所以理想情况下我会寻找一种方法来执行此操作而不管注释分隔符.
使用表格.使用此插件,您可以直观地选择要对齐的部分,然后键入:
'<,'>Tabularize /#
Run Code Online (Sandbox Code Playgroud)
它工作得很好,看起来像魔术.