From 7b558822a41e0ffa7daa6650b42b7ade3274c57e Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Mon, 14 Feb 2011 16:28:56 +1300 Subject: [PATCH] Ignore '~' prefix for C++ destructors when sorting --- plugin/tagbar.vim | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index 5e171dc..9b39f1b 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -1308,7 +1308,20 @@ function! s:CompareByKind(tag1, tag2) \ typeinfo.kinddict[a:tag2.fields.kind] return 1 else - if a:tag1.name <= a:tag2.name + " Ignore '~' prefix for C++ destructors to sort them directly under + " the constructors + if a:tag1.name[0] == '~' + let name1 = a:tag1.name[1:] + else + let name1 = a:tag1.name + endif + if a:tag2.name[0] == '~' + let name2 = a:tag2.name[1:] + else + let name2 = a:tag2.name + endif + + if name1 <= name2 return -1 else return 1