From d73fe2cc6d4037ce9923fb0e6506e52def4faea4 Mon Sep 17 00:00:00 2001 From: Jimmy Thrasher Date: Tue, 2 Dec 2014 09:39:57 -0500 Subject: [PATCH 1/3] Add some missing obj-c highlight patterns to the new c-family.kak --- rc/c-family.kak | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rc/c-family.kak b/rc/c-family.kak index 81cb4f5d..45fd0333 100644 --- a/rc/c-family.kak +++ b/rc/c-family.kak @@ -72,6 +72,9 @@ addhl -group /objc/code regex %{\<(self|nil|id|super|TRUE|FALSE|YES|NO|NULL)\>|\ addhl -group /objc/code regex "\<(void|int|char|unsigned|float|bool|size_t|instancetype|BOOL|NSInteger|NSUInteger|CGFloat|NSString)\>" 0:type addhl -group /objc/code regex "\<(while|for|if|else|do|switch|case|default|goto|break|continue|return)\>" 0:keyword addhl -group /objc/code regex "\<(const|auto|inline|static|volatile|struct|enum|union|typedef|extern|__block|@\w+)\>" 0:attribute +addhl -group /objc/code regex "\<(nonatomic|assign|copy|strong|retain|weak|readonly)\>" 0:attribute +addhl -group /objc/code regex "@(property|synthesize|interface|implementation|protocol|end|selector|autoreleasepool|try|catch|class|synchronized)\>" 0:attribute +addhl -group /objc/code regex "\<(IBAction|IBOutlet)\>" 0:attribute hook global WinSetOption filetype=(cpp|objc) %[ # cleanup trailing whitespaces when exiting insert mode From e540dc7f9ec419503ff63c3b489178c2444222d7 Mon Sep 17 00:00:00 2001 From: Jimmy Thrasher Date: Tue, 2 Dec 2014 11:15:53 -0500 Subject: [PATCH 2/3] Add mime-type check for Obj-C in case the user's file cmd supports it --- rc/c-family.kak | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rc/c-family.kak b/rc/c-family.kak index 45fd0333..25f84833 100644 --- a/rc/c-family.kak +++ b/rc/c-family.kak @@ -10,6 +10,10 @@ hook global BufCreate .*\.m %{ set buffer filetype objc } +hook global BufSetOption mimetype=text/x-objc %{ + set buffer filetype objc +} + def -hidden _c-family-indent-on-new-line %~ eval -draft -itersel %_ # preserve previous line indent From eddad899157294dc1a7fdd4d333ff9f71b6b361a Mon Sep 17 00:00:00 2001 From: Jimmy Thrasher Date: Tue, 2 Dec 2014 11:44:02 -0500 Subject: [PATCH 3/3] Support @"" style strings for Obj-C syntax highlighting --- rc/c-family.kak | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rc/c-family.kak b/rc/c-family.kak index 25f84833..27240a86 100644 --- a/rc/c-family.kak +++ b/rc/c-family.kak @@ -50,9 +50,15 @@ def -hidden _c-family-indent-on-closing-curly-brace %[ # Regions definition are the same between c++ and objective-c %sh{ for ft in cpp objc; do + if [ "${ft}" = "objc" ]; then + maybe_at='@?' + else + maybe_at='' + fi + printf '%s' ' addhl -group / regions -default code FT \ - string %{(?