我使用CSS& PHP和常规是用CSS中的短划线分隔(例如,'this-is-a-class-name')。我添加了
set iskeyword+=-
到我的vimrc加速导航和替换,这在CSS中很有用,但是现在'cw'/'dw'会在PHP中对属性/函数调用的任何调用中终止破折号。
EG,如果我在下面的'object'上输入cw:
$object->property;
当我希望删除'object'时它会删除'object-'。显然,这是从VIM的角度出发的,所以问题是:
是否有正则表达式会导致 iskeyword 包含破折号,除非它们后跟大于号(>)?
答案 0 :(得分:0)
您可以为CSS文件设置关键字,而不是全局设置。
<!--Test Route Index -->
<html>
<head>
<script src="test.js"></script>
</head>
<h1>Test Route</h1>
</html>
在上面的示例中,它会将短划线添加为.css,.less和.scss文件的关键字。您可以根据需要添加和删除文件。请注意,您必须使用Private Sub AddButtons()
Const MyControl As String = "Applications..."
Const MyControlCaption As String = "Manage Applications"
Dim AddinTitle As String, Mybar As Object
AddinTitle = Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4)
Call RemoveButtons
On Error GoTo ErrHandler
Set Mybar = Application.CommandBars("Worksheet Menu Bar") _
.Controls("Tools").Controls _
.Add(Type:=msoControlPopup, before:=13)
With Mybar
.BeginGroup = True
.Caption = MyControl
'-------------------------------------------------------------
.Controls.Add.Caption = MyControlCaption
.Controls(MyControlCaption).OnAction = "ShowStartupForm"
'-------------------------------------------------------------
With .Controls.Add(Type:=msoControlButton)
.BeginGroup = True
.Caption = "About " & AddinTitle
End With
.Controls("About " & AddinTitle).OnAction = "ShowAboutForm"
'-------------------------------------------------------------
.Controls.Add.Caption = "Remove " & AddinTitle
.Controls("Remove " & AddinTitle).OnAction = "RemoveAddIn"
.Controls.Add.Caption = "Edit " & AddinTitle
.Controls("Edit " & AddinTitle).OnAction = "EditSheets"
'-------------------------------------------------------------
End With
Exit Sub
ErrHandler:
Set Mybar = Nothing
Set Mybar = Application.CommandBars("Tools") _
.Controls.Add(Type:=msoControlPopup, before:=13)
Resume Next
End Sub
Private Sub RemoveButtons()
Const MyControl As String = "Applications..."
On Error Resume Next
With Application
.CommandBars("Tools").Controls(MyControl).Delete
.CommandBars("Worksheet Menu Bar") _
.Controls("Tools").Controls(MyControl).Delete
End With
End Sub
代替autocmd FileType css,less,scss setlocal iskeyword+=-
。
如果您希望特定设置仅适用于.php文件,请使用以下内容。
setlocal