This commit is contained in:
anon 2023-10-01 15:44:26 +02:00
commit 8b21549db8
18 changed files with 1388 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
hitags.tar
**/*tags
**/*.i
object/*
*.out
build/gcc-*

42
Makefile Normal file
View File

@ -0,0 +1,42 @@
#TARGET.featch = $$(find '/var/db/repos/gentoo/sys-devel/gcc/' -iname '*.ebuild' ! -regex '.*\.9999\.eobject' | head -1)
#TARGET.untar = $$(find ./ -iname '*.tar.*' ! -regex '.*patch.*' ! -regex '.*lockfile.*' | head -1)
#
#CTAGS.flags := --recurse --extras=+F #--output-format=json
#
#tags: clean cxxtags
# ctags_to_vim_hi.py -i object/cxx.tags
#
#cxxtags:
# gcc -E builder/include_std.c > object/include_std.i
# ctags ${CTAGS.flags} --language-force=C -o object/cxx.tags object/include_std.i
#
#clean: clean_object_source clean_cxx
# -rm object/*.tags
#
#clean_cxx:
# -rm -frfr object/include_std.i
# -rm -frfr object/cxx.tags
#
#clean_object_source:
# -rm -frfr object/gcc-*
#
#update_object_source: clean_object_source
# cd object/; \
# export DISTDIR="$$(realpath .)"; \
# eobject ${TARGET.featch} fetch
# cd object/; \
# tar -x -f ${TARGET.untar}
bundle: clean
-mkdir object/.vim/
-mkdir object/.vim/plugin/
cp hitags.vim object/.vim/plugin/
-mkdir object/.vim/plugin/HiTags/
cp hitags.py object/.vim/plugin/HiTags/
tar -C object/ -c .vim/ -f hitags.tar
install:
tar -x -f hitags.tar -C ~/
clean:
-rm -frfr object/* object/.vim/

34
README.md Normal file
View File

@ -0,0 +1,34 @@
# HiTags
Hitags is a Vim plugin which harnesses the power of ctags
to provide dynamic symbol (e.g. varriable, function) name highlightings.
# Before/After
/* NOTE: TODO */
# Dependencies
+ [mimetype](https://packages.gentoo.org/packages/dev-perl/File-MimeInfo) (sadly, `file -i` does not suffice)
+ python3 (system installation, not Vim compile flag)
+ ctags (tested with Universal ctags)
+ gcc/clang (to preprocess C/C++ files)
# Installation
1. Clone the source
2. Run:
```Bash
$ make; make install
```
Note: if you dont have (GNU) Make installed for some reason,
opening `Makefile` with vim and copy pasting the commands (whats indented)
to your shell should also suffice
3. Configure Vim to actually invoke the plugin.
Achive this by appending / overriding the following definition in your .vimrc.
```VimScript
let g:hitags_events = ["BufWrite"] " trigger a symbol update on writes
```
4. **_(Optional)_** Further configure HiTags by editing ~/.vim/plugin/hitags.vim.
All reguired details are commented right there in the script.
5. Enjoy

72
builder/include_std.c Normal file
View File

@ -0,0 +1,72 @@
#include <aio.h>
#include <arpa/inet.h>
#include <assert.h>
#include <complex.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <fenv.h>
#include <float.h>
#include <fnmatch.h>
#include <glob.h>
#include <grp.h>
#include <iconv.h>
#include <ifaddrs.h>
#include <inttypes.h>
#include <iso646.h>
#include <langinfo.h>
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <mqueue.h>
#include <netdb.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <nl_types.h>
#include <poll.h>
#include <pthread.h>
#include <pwd.h>
#include <regex.h>
#include <sched.h>
#include <semaphore.h>
#include <setjmp.h>
#include <signal.h>
#include <spawn.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ipc.h>
#include <syslog.h>
#include <sys/mman.h>
#include <sys/msg.h>
#include <sys/resource.h>
#include <sys/select.h>
#include <sys/sem.h>
#include <sys/shm.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <sys/time.h>
#include <sys/times.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include <tar.h>
#include <termios.h>
#include <tgmath.h>
#include <time.h>
#include <uchar.h>
#include <ulimit.h>
#include <unistd.h>
#include <utime.h>
#include <utmpx.h>
#include <wchar.h>
#include <wctype.h>

2
debug/Makefile Normal file
View File

@ -0,0 +1,2 @@
main:
ctags -R --languages=c++ --c++-kinds=+p --fields=+iaS --extra=+q .

2
debug/test_c_hw/Makefile Normal file
View File

@ -0,0 +1,2 @@
main:
gcc main.c helper.c

11
debug/test_c_hw/helper.c Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
#include "helper.h"
struct Msg{
const char* m;
} msg;
void helper() {
msg.m = "Helper function called!";
puts(msg.m);
}

6
debug/test_c_hw/helper.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef HELPER_H
#define HELPER_H
void helper();
#endif

16
debug/test_c_hw/main.c Normal file
View File

@ -0,0 +1,16 @@
#include <stdio.h>
#include "helper.h"
typedef int myint;
// Global variables
int global_var = 10;
myint main() {
puts("Hello, world!");
// Call helper function
helper();
return 0;
}

110
debug/test_c_hw/tags.vim Normal file
View File

@ -0,0 +1,110 @@
syn match Constant "\<BUFSIZ\>"
syn match Constant "\<EOF\>"
syn match Constant "\<FILENAME_MAX\>"
syn match Constant "\<FOPEN_MAX\>"
syn match Constant "\<HELPER_H\>"
syn match Constant "\<L_ctermid\>"
syn match Constant "\<L_tmpnam\>"
syn match Constant "\<NULL\>"
syn match Constant "\<P_tmpdir\>"
syn match Constant "\<SEEK_CUR\>"
syn match Constant "\<SEEK_END\>"
syn match Constant "\<SEEK_SET\>"
syn match Constant "\<TMP_MAX\>"
syn match Constant "\<stderr\>"
syn match Constant "\<stdin\>"
syn match Constant "\<stdout\>"
syn match Function "\<clearerr\>"
syn match Function "\<clearerr_unlocked\>"
syn match Function "\<ctermid\>"
syn match Function "\<dprintf\>"
syn match Function "\<fclose\>"
syn match Function "\<fdopen\>"
syn match Function "\<feof\>"
syn match Function "\<feof_unlocked\>"
syn match Function "\<ferror\>"
syn match Function "\<ferror_unlocked\>"
syn match Function "\<fflush\>"
syn match Function "\<fflush_unlocked\>"
syn match Function "\<fgetc\>"
syn match Function "\<fgetc_unlocked\>"
syn match Function "\<fgetpos\>"
syn match Function "\<fgets\>"
syn match Function "\<fileno\>"
syn match Function "\<fileno_unlocked\>"
syn match Function "\<flockfile\>"
syn match Function "\<fmemopen\>"
syn match Function "\<fopen\>"
syn match Function "\<fprintf\>"
syn match Function "\<fputc\>"
syn match Function "\<fputc_unlocked\>"
syn match Function "\<fputs\>"
syn match Function "\<fread\>"
syn match Function "\<fread_unlocked\>"
syn match Function "\<freopen\>"
syn match Function "\<fscanf\>"
syn match Function "\<fseek\>"
syn match Function "\<fseeko\>"
syn match Function "\<fsetpos\>"
syn match Function "\<ftell\>"
syn match Function "\<ftello\>"
syn match Function "\<ftrylockfile\>"
syn match Function "\<funlockfile\>"
syn match Function "\<fwrite\>"
syn match Function "\<fwrite_unlocked\>"
syn match Function "\<getc\>"
syn match Function "\<getc_unlocked\>"
syn match Function "\<getchar\>"
syn match Function "\<getchar_unlocked\>"
syn match Function "\<getdelim\>"
syn match Function "\<getline\>"
syn match Function "\<getw\>"
syn match Function "\<helper\>"
syn match Function "\<main\>"
syn match Function "\<open_memstream\>"
syn match Function "\<pclose\>"
syn match Function "\<perror\>"
syn match Function "\<popen\>"
syn match Function "\<printf\>"
syn match Function "\<putc\>"
syn match Function "\<putc_unlocked\>"
syn match Function "\<putchar\>"
syn match Function "\<putchar_unlocked\>"
syn match Function "\<puts\>"
syn match Function "\<putw\>"
syn match Function "\<remove\>"
syn match Function "\<rename\>"
syn match Function "\<renameat\>"
syn match Function "\<rewind\>"
syn match Function "\<scanf\>"
syn match Function "\<setbuf\>"
syn match Function "\<setbuffer\>"
syn match Function "\<setlinebuf\>"
syn match Function "\<setvbuf\>"
syn match Function "\<snprintf\>"
syn match Function "\<sprintf\>"
syn match Function "\<sscanf\>"
syn match Function "\<tempnam\>"
syn match Function "\<tmpfile\>"
syn match Function "\<tmpnam\>"
syn match Function "\<tmpnam_r\>"
syn match Function "\<ungetc\>"
syn match Function "\<vdprintf\>"
syn match Function "\<vfprintf\>"
syn match Function "\<vfscanf\>"
syn match Function "\<vprintf\>"
syn match Function "\<vscanf\>"
syn match Function "\<vsnprintf\>"
syn match Function "\<vsprintf\>"
syn match Function "\<vsscanf\>"
syn match Identifier "\<stderr\>"
syn match Identifier "\<stdin\>"
syn match Identifier "\<stdout\>"
syn match Special "\<global_var\>"
syn match Type "\<FILE\>"
syn match Type "\<fpos_t\>"
syn match Type "\<myint\>"
syn match Type "\<off_t\>"
syn match Type "\<size_t\>"
syn match Type "\<ssize_t\>"
syn match Type "\<va_list\>"

View File

@ -0,0 +1,2 @@
main:
g++ main.cpp helper.cpp

View File

@ -0,0 +1,10 @@
#include <iostream>
#include "helper.h"
struct Msg{
const char* m = "Helper function called!";
} msg;
void helper() {
std::cout << msg.m << std::endl;
}

View File

@ -0,0 +1,6 @@
#ifndef HELPER_H
#define HELPER_H
void helper();
#endif

View File

@ -0,0 +1,16 @@
#include <iostream>
#include "helper.h"
typedef int myint;
// Global variables
int global_var = 10;
myint main() {
std::cout << "Hello, world!" << std::endl;
// Call helper function
helper();
return 0;
}

833
debug/test_cpp_hw/tags.vim Normal file
View File

@ -0,0 +1,833 @@
syn match Function "\<hash_code\>"
syn match Type "\<is_function\>"
syn match Function "\<do_falsename\>"
syn match Function "\<base\>"
syn match Type "\<fpos_t\>"
syn match Function "\<write\>"
syn match Type "\<conditional\>"
syn match Function "\<grouping\>"
syn match Type "\<is_lvalue_reference\>"
syn match Special "\<is_move_assignable_v\>"
syn match Function "\<use_facet\>"
syn match Type "\<is_pod\>"
syn match Function "\<\~basic_string\>"
syn match Type "\<forward_iterator_tag\>"
syn match Special "\<is_trivially_copyable_v\>"
syn match Type "\<remove_reference_t\>"
syn match Function "\<address\>"
syn match Type "\<remove_extent_t\>"
syn match Type "\<logical_and\>"
syn match Type "\<is_error_condition_enum\>"
syn match Type "\<pthread_t\>"
syn match Function "\<init\>"
syn match Special "\<has_unique_object_representations_v\>"
syn match Type "\<add_rvalue_reference_t\>"
syn match Function "\<in_avail\>"
syn match Type "\<is_abstract\>"
syn match Type "\<streambuf\>"
syn match Type "\<first_type\>"
syn match Function "\<isgraph\>"
syn match Special "\<is_trivially_copy_assignable_v\>"
syn match Type "\<unary_function\>"
syn match Type "\<wfstream\>"
syn match Function "\<swap\>"
syn match Type "\<modulus\>"
syn match Type "\<wios\>"
syn match Type "\<false_type\>"
syn match Type "\<less_equal\>"
syn match Function "\<fill\>"
syn match Type "\<ofstream\>"
syn match Function "\<ignore\>"
syn match Type "\<int_fast8_t\>"
syn match Type "\<bit_not\>"
syn match Type "\<pthread_spinlock_t\>"
syn match Type "\<new_handler\>"
syn match Function "\<bind1st\>"
syn match Function "\<basic_string\>"
syn match Function "\<showmanyc\>"
syn match Function "\<\~allocator\>"
syn match Function "\<isdigit\>"
syn match Function "\<name\>"
syn match Function "\<epptr\>"
syn match Function "\<ctype\>"
syn match Function "\<showpos\>"
syn match Type "\<ios\>"
syn match Type "\<is_default_constructible\>"
syn match Type "\<mask\>"
syn match Function "\<iscntrl\>"
syn match Type "\<iter_type\>"
syn match Function "\<unary_negate\>"
syn match Type "\<tuple_element_t\>"
syn match Function "\<reference_wrapper\>"
syn match Type "\<has_virtual_destructor\>"
syn match Type "\<pthread_key_t\>"
syn match Function "\<stold\>"
syn match Type "\<is_copy_constructible\>"
syn match Function "\<tellp\>"
syn match Function "\<end\>"
syn match Special "\<alignment_of_v\>"
syn match Type "\<pointer_traits\>"
syn match Type "\<register_t\>"
syn match Function "\<ptr_fun\>"
syn match Function "\<front\>"
syn match Type "\<is_error_code_enum\>"
syn match Special "\<is_literal_type_v\>"
syn match Function "\<\~sentry\>"
syn match Type "\<size_type\>"
syn match Function "\<sputbackc\>"
syn match Function "\<capacity\>"
syn match Type "\<int_least64_t\>"
syn match Special "\<is_invocable_r_v\>"
syn match Type "\<integral_constant\>"
syn match Function "\<seekg\>"
syn match Special "\<is_aggregate_v\>"
syn match Function "\<numpunct\>"
syn match Type "\<suseconds_t\>"
syn match Type "\<invoke_result\>"
syn match Special "\<is_copy_constructible_v\>"
syn match Type "\<ostringstream\>"
syn match Function "\<max_size\>"
syn match Type "\<is_trivial\>"
syn match Type "\<is_nothrow_constructible\>"
syn match Special "\<is_enum_v\>"
syn match Function "\<bad_alloc\>"
syn match Function "\<fpos\>"
syn match Function "\<not1\>"
syn match Function "\<collate_byname\>"
syn match Function "\<do_compare\>"
syn match Type "\<stringbuf\>"
syn match Function "\<seekpos\>"
syn match Function "\<mem_fun\>"
syn match Function "\<lower_bound\>"
syn match Function "\<pbackfail\>"
syn match Special "\<is_object_v\>"
syn match Type "\<is_array\>"
syn match Function "\<nested_ptr\>"
syn match Type "\<is_swappable\>"
syn match Function "\<destroy_n\>"
syn match Function "\<rethrow_if_nested\>"
syn match Type "\<u32streampos\>"
syn match Type "\<void_pointer\>"
syn match Special "\<is_null_pointer_v\>"
syn match Function "\<pbase\>"
syn match Type "\<divides\>"
syn match Function "\<rdstate\>"
syn match Function "\<endl\>"
syn match Special "\<is_rvalue_reference_v\>"
syn match Type "\<is_nothrow_destructible\>"
syn match Type "\<add_volatile_t\>"
syn match Function "\<eof\>"
syn match Type "\<ushort\>"
syn match Function "\<stoul\>"
syn match Function "\<sgetn\>"
syn match Type "\<propagate_on_container_copy_assignment\>"
syn match Function "\<rdbuf\>"
syn match Type "\<div_t\>"
syn match Function "\<seekoff\>"
syn match Type "\<wstreampos\>"
syn match Type "\<u_int64_t\>"
syn match Function "\<toupper\>"
syn match Function "\<const_mem_fun_t\>"
syn match Function "\<noshowpos\>"
syn match Type "\<aligned_storage\>"
syn match Function "\<forward\>"
syn match Function "\<type_info\>"
syn match Type "\<const_reference\>"
syn match Function "\<exception\>"
syn match Function "\<system_error\>"
syn match Function "\<unsetf\>"
syn match Function "\<\~basic_iostream\>"
syn match Function "\<copy\>"
syn match Function "\<sync\>"
syn match Function "\<binder1st\>"
syn match Type "\<underlying_type\>"
syn match Function "\<to_int_type\>"
syn match Type "\<wiostream\>"
syn match Type "\<uint8_t\>"
syn match Function "\<isspace\>"
syn match Function "\<pubsync\>"
syn match Function "\<destroy\>"
syn match Function "\<noshowpoint\>"
syn match Function "\<unitbuf\>"
syn match Type "\<input_iterator_tag\>"
syn match Function "\<lexicographical_compare\>"
syn match Type "\<common_type\>"
syn match Type "\<is_constructible\>"
syn match Function "\<lt\>"
syn match Type "\<wctrans_t\>"
syn match Function "\<snextc\>"
syn match Function "\<back_inserter\>"
syn match Special "\<is_pointer_v\>"
syn match Type "\<error_t\>"
syn match Function "\<putback\>"
syn match Function "\<\~ctype_byname\>"
syn match Function "\<const_mem_fun1_t\>"
syn match Type "\<u16string\>"
syn match Type "\<locale_t\>"
syn match Function "\<get_allocator\>"
syn match Function "\<rfind\>"
syn match Type "\<wofstream\>"
syn match Function "\<c_str\>"
syn match Type "\<add_volatile\>"
syn match Function "\<tie\>"
syn match Type "\<u_long\>"
syn match Type "\<add_const_t\>"
syn match Function "\<mem_fun1_t\>"
syn match Special "\<is_default_constructible_v\>"
syn match Function "\<destroy_at\>"
syn match Type "\<fsfilcnt_t\>"
syn match Special "\<in_place_index\>"
syn match Special "\<is_member_object_pointer_v\>"
syn match Function "\<num_put\>"
syn match Special "\<is_nothrow_swappable_v\>"
syn match Type "\<propagate_on_container_swap\>"
syn match Type "\<integer_sequence\>"
syn match Type "\<is_aggregate\>"
syn match Type "\<pthread_barrier_t\>"
syn match Type "\<remove_pointer_t\>"
syn match Special "\<is_nothrow_assignable_v\>"
syn match Type "\<cookie_io_functions_t\>"
syn match Type "\<FILE\>"
syn match Type "\<add_pointer_t\>"
syn match Function "\<bad_array_new_length\>"
syn match Special "\<is_compound_v\>"
syn match Function "\<rbegin\>"
syn match Function "\<setstate\>"
syn match Type "\<ifstream\>"
syn match Type "\<is_nothrow_copy_assignable\>"
syn match Type "\<make_unsigned\>"
syn match Type "\<plus\>"
syn match Function "\<fail\>"
syn match Function "\<deallocate\>"
syn match Type "\<int32_t\>"
syn match Function "\<istreambuf_iterator\>"
syn match Special "\<is_assignable_v\>"
syn match Function "\<make_error_code\>"
syn match Function "\<locale\>"
syn match Function "\<append\>"
syn match Special "\<is_trivially_default_constructible_v\>"
syn match Type "\<max_align_t\>"
syn match Type "\<is_assignable\>"
syn match Type "\<va_list\>"
syn match Special "\<is_fundamental_v\>"
syn match Function "\<remove_suffix\>"
syn match Type "\<stringstream\>"
syn match Type "\<greater_equal\>"
syn match Type "\<itimerspec\>"
syn match Type "\<greater\>"
syn match Type "\<void_t\>"
syn match Type "\<is_nothrow_default_constructible\>"
syn match Type "\<rank\>"
syn match Function "\<do_thousands_sep\>"
syn match Type "\<pthread_once_t\>"
syn match Type "\<blkcnt_t\>"
syn match Function "\<basic_streambuf\>"
syn match Function "\<\~__new_allocator\>"
syn match Function "\<table\>"
syn match Type "\<uintmax_t\>"
syn match Type "\<not_equal_to\>"
syn match Function "\<find_last_not_of\>"
syn match Function "\<\~collate_byname\>"
syn match Function "\<construct\>"
syn match Type "\<openmode\>"
syn match Function "\<assign\>"
syn match Type "\<add_cv\>"
syn match Function "\<equal\>"
syn match Function "\<width\>"
syn match Type "\<type\>"
syn match Type "\<char_type\>"
syn match Function "\<skipws\>"
syn match Type "\<multiplies\>"
syn match Type "\<ostream\>"
syn match Type "\<id_t\>"
syn match Type "\<wistringstream\>"
syn match Type "\<const_pointer\>"
syn match Type "\<int16_t\>"
syn match Function "\<pubsetbuf\>"
syn match Type "\<myint\>"
syn match Type "\<timer_t\>"
syn match Type "\<wstring_view\>"
syn match Type "\<is_rvalue_reference\>"
syn match Type "\<is_move_constructible\>"
syn match Function "\<\~collate\>"
syn match Type "\<make_signed_t\>"
syn match Type "\<is_nothrow_swappable\>"
syn match Type "\<is_same\>"
syn match Function "\<shrink_to_fit\>"
syn match Type "\<value_t\>"
syn match Function "\<stoull\>"
syn match Type "\<iterator_type\>"
syn match Type "\<is_pointer\>"
syn match Type "\<key_t\>"
syn match Type "\<hash\>"
syn match Type "\<wstringstream\>"
syn match Type "\<terminate_handler\>"
syn match Function "\<\~__pthread_cleanup_class\>"
syn match Function "\<is\>"
syn match Function "\<ispunct\>"
syn match Function "\<data\>"
syn match Type "\<fsfilcnt64_t\>"
syn match Function "\<push_back\>"
syn match Function "\<find_last_of\>"
syn match Function "\<mem_fun_ref_t\>"
syn match Function "\<rend\>"
syn match Type "\<is_union\>"
syn match Type "\<int_fast32_t\>"
syn match Special "\<piecewise_construct\>"
syn match Function "\<hex\>"
syn match Type "\<is_const\>"
syn match Function "\<\~__numpunct_cache\>"
syn match Type "\<make_unsigned_t\>"
syn match Type "\<state_type\>"
syn match Type "\<const_iterator\>"
syn match Type "\<u_quad_t\>"
syn match Function "\<eback\>"
syn match Type "\<is_trivially_move_assignable\>"
syn match Type "\<ostream_type\>"
syn match Function "\<mem_fun_t\>"
syn match Function "\<basic_string_view\>"
syn match Function "\<bad\>"
syn match Type "\<istream\>"
syn match Type "\<pthread_condattr_t\>"
syn match Type "\<true_type\>"
syn match Function "\<addressof\>"
syn match Function "\<set_rdbuf\>"
syn match Type "\<pthread_cond_t\>"
syn match Type "\<disjunction\>"
syn match Type "\<u32string_view\>"
syn match Function "\<has_facet\>"
syn match Function "\<at\>"
syn match Type "\<uint_least16_t\>"
syn match Special "\<is_union_v\>"
syn match Function "\<pptr\>"
syn match Special "\<is_function_v\>"
syn match Special "\<is_base_of_v\>"
syn match Function "\<mem_fun_ref\>"
syn match Type "\<ctype_base\>"
syn match Type "\<reverse_iterator\>"
syn match Type "\<int_fast16_t\>"
syn match Special "\<is_trivially_constructible_v\>"
syn match Special "\<is_same_v\>"
syn match Function "\<make_reverse_iterator\>"
syn match Function "\<\~basic_ios\>"
syn match Type "\<decay_t\>"
syn match Type "\<int_least32_t\>"
syn match Type "\<timeval\>"
syn match Function "\<setp\>"
syn match Type "\<wostream\>"
syn match Function "\<basic_istream\>"
syn match Type "\<rebind_traits\>"
syn match Function "\<ref\>"
syn match Function "\<\~num_get\>"
syn match Type "\<fd_mask\>"
syn match Type "\<fmtflags\>"
syn match Type "\<nlink_t\>"
syn match Function "\<exceptions\>"
syn match Function "\<failed\>"
syn match Type "\<wostringstream\>"
syn match Function "\<binary_negate\>"
syn match Function "\<make_pair\>"
syn match Function "\<wcsstr\>"
syn match Special "\<is_swappable_with_v\>"
syn match Special "\<is_trivial_v\>"
syn match Type "\<enable_if_t\>"
syn match Type "\<event_callback\>"
syn match Type "\<drand48_data\>"
syn match Function "\<facet\>"
syn match Function "\<gbump\>"
syn match Special "\<is_swappable_v\>"
syn match Type "\<underlying_type_t\>"
syn match Function "\<\~_Save_errno\>"
syn match Function "\<wmemchr\>"
syn match Function "\<boolalpha\>"
syn match Function "\<\~basic_streambuf\>"
syn match Special "\<is_nothrow_copy_constructible_v\>"
syn match Type "\<ldiv_t\>"
syn match Type "\<pid_t\>"
syn match Special "\<is_array_v\>"
syn match Type "\<result_of_t\>"
syn match Function "\<uflow\>"
syn match Special "\<is_unsigned_v\>"
syn match Type "\<fd_set\>"
syn match Function "\<\~exception_ptr\>"
syn match Type "\<make_integer_sequence\>"
syn match Function "\<bad_cast\>"
syn match Type "\<ptrdiff_t\>"
syn match Type "\<streampos\>"
syn match Type "\<cpu_set_t\>"
syn match Function "\<stod\>"
syn match Type "\<blksize_t\>"
syn match Function "\<do_narrow\>"
syn match Type "\<remove_const_t\>"
syn match Function "\<pointer_to_unary_function\>"
syn match Type "\<wctype_t\>"
syn match Function "\<showpoint\>"
syn match Function "\<\~numpunct_byname\>"
syn match Special "\<is_invocable_v\>"
syn match Type "\<allocator_type\>"
syn match Special "\<is_final_v\>"
syn match Function "\<xsgetn\>"
syn match Type "\<is_destructible\>"
syn match Type "\<fsid_t\>"
syn match Function "\<stoll\>"
syn match Function "\<initializer_list\>"
syn match Type "\<iostate\>"
syn match Type "\<add_lvalue_reference\>"
syn match Special "\<is_error_condition_enum_v\>"
syn match Function "\<isupper\>"
syn match Function "\<unget\>"
syn match Type "\<logical_or\>"
syn match Type "\<u16string_view\>"
syn match Function "\<front_inserter\>"
syn match Type "\<streamsize\>"
syn match Function "\<thousands_sep\>"
syn match Function "\<allocator\>"
syn match Type "\<make_signed\>"
syn match Function "\<const_mem_fun_ref_t\>"
syn match Function "\<underflow\>"
syn match Function "\<stof\>"
syn match Type "\<is_nothrow_assignable\>"
syn match Type "\<pointer\>"
syn match Type "\<less\>"
syn match Function "\<bad_exception\>"
syn match Function "\<pword\>"
syn match Type "\<add_pointer\>"
syn match Type "\<intptr_t\>"
syn match Type "\<u_int16_t\>"
syn match Special "\<is_const_v\>"
syn match Type "\<uintptr_t\>"
syn match Function "\<declval\>"
syn match Function "\<const_mem_fun1_ref_t\>"
syn match Type "\<timex\>"
syn match Function "\<left\>"
syn match Type "\<wstringbuf\>"
syn match Type "\<remove_all_extents\>"
syn match Type "\<first_argument_type\>"
syn match Function "\<ends\>"
syn match Function "\<imbue\>"
syn match Type "\<streambuf_type\>"
syn match Function "\<exception_ptr\>"
syn match Type "\<filebuf\>"
syn match Type "\<conjunction\>"
syn match Type "\<random_access_iterator_tag\>"
syn match Type "\<uint16_t\>"
syn match Function "\<do_widen\>"
syn match Special "\<is_trivially_move_assignable_v\>"
syn match Type "\<result_of\>"
syn match Type "\<alignment_of\>"
syn match Type "\<is_standard_layout\>"
syn match Type "\<negate\>"
syn match Type "\<is_reference\>"
syn match Function "\<tellg\>"
syn match Function "\<iword\>"
syn match Type "\<istringstream\>"
syn match Function "\<basic_iostream\>"
syn match Type "\<sigset_t\>"
syn match Function "\<throw_with_nested\>"
syn match Type "\<result_type\>"
syn match Type "\<in_place_type_t\>"
syn match Function "\<next\>"
syn match Type "\<remove_cv_t\>"
syn match Function "\<insert_iterator\>"
syn match Type "\<is_scalar\>"
syn match Function "\<mem_fun1_ref_t\>"
syn match Function "\<min\>"
syn match Type "\<add_cv_t\>"
syn match Function "\<error_condition\>"
syn match Function "\<copyfmt\>"
syn match Type "\<is_literal_type\>"
syn match Type "\<is_nothrow_move_assignable\>"
syn match Special "\<is_void_v\>"
syn match Type "\<mode_t\>"
syn match Type "\<string\>"
syn match Type "\<tuple_element\>"
syn match Type "\<u_int\>"
syn match Type "\<off64_t\>"
syn match Type "\<bit_or\>"
syn match Type "\<sched_param\>"
syn match Function "\<flush\>"
syn match Function "\<rethrow_nested\>"
syn match Type "\<second_argument_type\>"
syn match Function "\<cref\>"
syn match Special "\<is_nothrow_constructible_v\>"
syn match Special "\<is_error_code_enum_v\>"
syn match Type "\<blkcnt64_t\>"
syn match Function "\<compare\>"
syn match Function "\<erase\>"
syn match Function "\<bind2nd\>"
syn match Type "\<aligned_storage_t\>"
syn match Function "\<internal\>"
syn match Function "\<move_if_noexcept\>"
syn match Function "\<clear\>"
syn match Type "\<allocator_traits\>"
syn match Function "\<insert\>"
syn match Function "\<pubseekpos\>"
syn match Type "\<wifstream\>"
syn match Type "\<reference\>"
syn match Function "\<back\>"
syn match Type "\<is_final\>"
syn match Type "\<in_place_t\>"
syn match Function "\<gptr\>"
syn match Function "\<not_eof\>"
syn match Function "\<eq\>"
syn match Type "\<is_always_equal\>"
syn match Type "\<wstring\>"
syn match Type "\<quad_t\>"
syn match Function "\<pubimbue\>"
syn match Type "\<uint_fast8_t\>"
syn match Type "\<wfilebuf\>"
syn match Type "\<is_void\>"
syn match Special "\<is_abstract_v\>"
syn match Type "\<ino64_t\>"
syn match Type "\<bool_constant\>"
syn match Type "\<lconv\>"
syn match Type "\<second_type\>"
syn match Function "\<sputc\>"
syn match Special "\<is_trivially_assignable_v\>"
syn match Special "\<in_place\>"
syn match Function "\<scan_is\>"
syn match Special "\<is_integral_v\>"
syn match Function "\<to_string\>"
syn match Function "\<move\>"
syn match Type "\<gid_t\>"
syn match Type "\<minus\>"
syn match Type "\<int_least16_t\>"
syn match Type "\<logical_not\>"
syn match Type "\<uint_least64_t\>"
syn match Type "\<is_member_pointer\>"
syn match Type "\<uint_least8_t\>"
syn match Type "\<ulong\>"
syn match Function "\<nounitbuf\>"
syn match Type "\<output_iterator_tag\>"
syn match Type "\<argument_type\>"
syn match Function "\<do_grouping\>"
syn match Type "\<remove_extent\>"
syn match Type "\<u16streampos\>"
syn match Special "\<is_reference_v\>"
syn match Special "\<is_empty_v\>"
syn match Function "\<size\>"
syn match Type "\<uint64_t\>"
syn match Type "\<remove_cv\>"
syn match Function "\<error_code\>"
syn match Special "\<is_floating_point_v\>"
syn match Type "\<is_null_pointer\>"
syn match Function "\<not2\>"
syn match Type "\<is_nothrow_invocable\>"
syn match Type "\<iterator\>"
syn match Type "\<intmax_t\>"
syn match Type "\<propagate_on_container_move_assignment\>"
syn match Function "\<isalnum\>"
syn match Type "\<wint_t\>"
syn match Special "\<is_nothrow_move_assignable_v\>"
syn match Function "\<replace\>"
syn match Type "\<pair\>"
syn match Function "\<narrow\>"
syn match Type "\<is_unsigned\>"
syn match Function "\<fill_n\>"
syn match Function "\<oct\>"
syn match Type "\<istream_type\>"
syn match Type "\<equal_to\>"
syn match Function "\<dec\>"
syn match Type "\<pthread_attr_t\>"
syn match Type "\<element_type\>"
syn match Function "\<length\>"
syn match Function "\<eq_int_type\>"
syn match Special "\<is_nothrow_default_constructible_v\>"
syn match Function "\<move_backward\>"
syn match Type "\<timespec\>"
syn match Function "\<get\>"
syn match Special "\<rank_v\>"
syn match Function "\<nested_exception\>"
syn match Function "\<noboolalpha\>"
syn match Type "\<iterator_category\>"
syn match Function "\<\~basic_istream\>"
syn match Type "\<is_fundamental\>"
syn match Special "\<is_nothrow_move_constructible_v\>"
syn match Function "\<reverse_iterator\>"
syn match Function "\<cend\>"
syn match Type "\<char_traits\>"
syn match Type "\<useconds_t\>"
syn match Function "\<falsename\>"
syn match Type "\<uint_fast16_t\>"
syn match Function "\<to_char_type\>"
syn match Function "\<getline\>"
syn match Type "\<fsblkcnt64_t\>"
syn match Special "\<in_place_type\>"
syn match Function "\<\~basic_ostream\>"
syn match Function "\<readsome\>"
syn match Type "\<is_transparent\>"
syn match Function "\<isprint\>"
syn match Type "\<int_least8_t\>"
syn match Function "\<do_get\>"
syn match Type "\<common_type_t\>"
syn match Function "\<gcount\>"
syn match Type "\<u_char\>"
syn match Type "\<is_trivially_copyable\>"
syn match Type "\<remove_pointer\>"
syn match Special "\<is_convertible_v\>"
syn match Function "\<num_get\>"
syn match Special "\<is_constructible_v\>"
syn match Type "\<string_view\>"
syn match Type "\<is_trivially_destructible\>"
syn match Type "\<loff_t\>"
syn match Function "\<transform\>"
syn match Type "\<traits_type\>"
syn match Function "\<ws\>"
syn match Type "\<is_integral\>"
syn match Type "\<invoke_result_t\>"
syn match Function "\<empty\>"
syn match Function "\<div\>"
syn match Function "\<showbase\>"
syn match Function "\<bad_typeid\>"
syn match Function "\<value\>"
syn match Function "\<begin\>"
syn match Function "\<copy_backward\>"
syn match Function "\<move_iterator\>"
syn match Type "\<is_invocable\>"
syn match Function "\<pair\>"
syn match Function "\<find\>"
syn match Function "\<isblank\>"
syn match Special "\<negation_v\>"
syn match Function "\<islower\>"
syn match Function "\<find_first_not_of\>"
syn match Special "\<global_var\>"
syn match Special "\<is_nothrow_invocable_r_v\>"
syn match Function "\<is_permutation\>"
syn match Type "\<negation\>"
syn match Type "\<other\>"
syn match Type "\<streamoff\>"
syn match Function "\<numpunct_byname\>"
syn match Function "\<put\>"
syn match Type "\<pthread_mutex_t\>"
syn match Type "\<comparison_fn_t\>"
syn match Type "\<bit_xor\>"
syn match Type "\<is_nothrow_move_constructible\>"
syn match Type "\<remove_reference\>"
syn match Function "\<pointer_to_binary_function\>"
syn match Type "\<clockid_t\>"
syn match Type "\<fsblkcnt_t\>"
syn match Special "\<is_move_constructible_v\>"
syn match Type "\<make_index_sequence\>"
syn match Type "\<ssize_t\>"
syn match Type "\<pthread_rwlock_t\>"
syn match Type "\<uint_fast32_t\>"
syn match Type "\<tuple_size\>"
syn match Function "\<do_truename\>"
syn match Type "\<mbstate_t\>"
syn match Type "\<size_t\>"
syn match Special "\<is_polymorphic_v\>"
syn match Function "\<sputn\>"
syn match Function "\<prev\>"
syn match Function "\<decimal_point\>"
syn match Function "\<id\>"
syn match Special "\<is_signed_v\>"
syn match Function "\<scientific\>"
syn match Special "\<is_member_function_pointer_v\>"
syn match Function "\<pointer_to\>"
syn match Type "\<wstreambuf\>"
syn match Function "\<do_hash\>"
syn match Type "\<caddr_t\>"
syn match Special "\<is_nothrow_copy_assignable_v\>"
syn match Function "\<read\>"
syn match Function "\<\~__ctype_abstract_base\>"
syn match Function "\<\~_Guard\>"
syn match Special "\<is_nothrow_destructible_v\>"
syn match Function "\<category\>"
syn match Type "\<u_int32_t\>"
syn match Type "\<fpos64_t\>"
syn match Type "\<u_int8_t\>"
syn match Function "\<setf\>"
syn match Function "\<iter_swap\>"
syn match Type "\<is_arithmetic\>"
syn match Type "\<category\>"
syn match Function "\<state\>"
syn match Function "\<flags\>"
syn match Type "\<basic_string\>"
syn match Type "\<is_trivially_copy_assignable\>"
syn match Function "\<nouppercase\>"
syn match Type "\<is_trivially_constructible\>"
syn match Type "\<is_object\>"
syn match Type "\<is_enum\>"
syn match Function "\<noskipws\>"
syn match Type "\<bidirectional_iterator_tag\>"
syn match Type "\<cookie_write_function_t\>"
syn match Type "\<remove_all_extents_t\>"
syn match Type "\<is_nothrow_invocable_r\>"
syn match Function "\<noshowbase\>"
syn match Type "\<is_member_function_pointer\>"
syn match Function "\<pubseekoff\>"
syn match Type "\<has_unique_object_representations\>"
syn match Type "\<is_trivially_default_constructible\>"
syn match Function "\<defaultfloat\>"
syn match Type "\<int_type\>"
syn match Type "\<off_type\>"
syn match Function "\<basic_ios\>"
syn match Function "\<precision\>"
syn match Function "\<binder2nd\>"
syn match Function "\<pop_back\>"
syn match Function "\<sungetc\>"
syn match Type "\<is_empty\>"
syn match Function "\<overflow\>"
syn match Type "\<pthread_mutexattr_t\>"
syn match Function "\<advance\>"
syn match Type "\<remove_volatile\>"
syn match Function "\<wcsrchr\>"
syn match Type "\<int64_t\>"
syn match Function "\<inserter\>"
syn match Type "\<extent\>"
syn match Function "\<good\>"
syn match Function "\<distance\>"
syn match Function "\<main\>"
syn match Function "\<isalpha\>"
syn match Type "\<piecewise_construct_t\>"
syn match Type "\<fstream\>"
syn match Type "\<iterator_traits\>"
syn match Function "\<allocate\>"
syn match Type "\<pthread_rwlockattr_t\>"
syn match Function "\<isxdigit\>"
syn match Type "\<container_type\>"
syn match Type "\<is_member_object_pointer\>"
syn match Special "\<is_nothrow_swappable_with_v\>"
syn match Function "\<front_insert_iterator\>"
syn match Function "\<hexfloat\>"
syn match Type "\<is_trivially_copy_constructible\>"
syn match Type "\<is_convertible\>"
syn match Type "\<nothrow_t\>"
syn match Function "\<mismatch\>"
syn match Special "\<conjunction_v\>"
syn match Type "\<add_rvalue_reference\>"
syn match Function "\<crend\>"
syn match Function "\<abs\>"
syn match Type "\<rebind_alloc\>"
syn match Function "\<crbegin\>"
syn match Function "\<find_first_of\>"
syn match Type "\<iostream\>"
syn match Type "\<random_data\>"
syn match Function "\<code\>"
syn match Type "\<cookie_read_function_t\>"
syn match Type "\<enable_if\>"
syn match Function "\<uppercase\>"
syn match Type "\<wistream\>"
syn match Type "\<is_nothrow_swappable_with\>"
syn match Type "\<is_trivially_move_constructible\>"
syn match Function "\<scan_not\>"
syn match Function "\<getloc\>"
syn match Type "\<is_floating_point\>"
syn match Special "\<tuple_size_v\>"
syn match Function "\<launder\>"
syn match Type "\<is_copy_assignable\>"
syn match Function "\<hash\>"
syn match Function "\<fixed\>"
syn match Type "\<string_type\>"
syn match Type "\<difference_type\>"
syn match Type "\<uint\>"
syn match Special "\<is_destructible_v\>"
syn match Function "\<make_error_condition\>"
syn match Function "\<setg\>"
syn match Function "\<stoi\>"
syn match Type "\<const_void_pointer\>"
syn match Function "\<xsputn\>"
syn match Type "\<aligned_union_t\>"
syn match Type "\<clock_t\>"
syn match Type "\<conditional_t\>"
syn match Special "\<has_virtual_destructor_v\>"
syn match Special "\<extent_v\>"
syn match Special "\<is_arithmetic_v\>"
syn match Type "\<lldiv_t\>"
syn match Type "\<const_reverse_iterator\>"
syn match Function "\<ostreambuf_iterator\>"
syn match Function "\<sbumpc\>"
syn match Type "\<int_fast64_t\>"
syn match Function "\<reserve\>"
syn match Function "\<basic_ostream\>"
syn match Type "\<is_base_of\>"
syn match Type "\<is_polymorphic\>"
syn match Type "\<uint_fast64_t\>"
syn match Type "\<bit_and\>"
syn match Function "\<do_transform\>"
syn match Type "\<nullptr_t\>"
syn match Special "\<is_nothrow_invocable_v\>"
syn match Type "\<add_lvalue_reference_t\>"
syn match Function "\<truename\>"
syn match Function "\<right\>"
syn match Function "\<egptr\>"
syn match Function "\<max\>"
syn match Function "\<select_on_container_copy_construction\>"
syn match Type "\<tm\>"
syn match Function "\<make_move_iterator\>"
syn match Special "\<is_scalar_v\>"
syn match Type "\<u_short\>"
syn match Type "\<int8_t\>"
syn match Type "\<value_type\>"
syn match Function "\<to_wstring\>"
syn match Type "\<is_volatile\>"
syn match Type "\<is_invocable_r\>"
syn match Type "\<is_move_assignable\>"
syn match Type "\<aligned_union\>"
syn match Type "\<is_signed\>"
syn match Function "\<cbegin\>"
syn match Function "\<peek\>"
syn match Function "\<substr\>"
syn match Function "\<wcschr\>"
syn match Special "\<is_member_pointer_v\>"
syn match Type "\<unexpected_handler\>"
syn match Type "\<daddr_t\>"
syn match Type "\<cookie_seek_function_t\>"
syn match Special "\<is_standard_layout_v\>"
syn match Type "\<remove_volatile_t\>"
syn match Function "\<combine\>"
syn match Type "\<time_t\>"
syn match Special "\<is_trivially_move_constructible_v\>"
syn match Function "\<seekp\>"
syn match Type "\<is_compound\>"
syn match Type "\<dev_t\>"
syn match Type "\<in_place_index_t\>"
syn match Type "\<remove_const\>"
syn match Function "\<tolower\>"
syn match Function "\<\~num_put\>"
syn match Type "\<is_nothrow_copy_constructible\>"
syn match Type "\<is_trivially_assignable\>"
syn match Type "\<is_swappable_with\>"
syn match Special "\<is_volatile_v\>"
syn match Function "\<\~__ptr_guard\>"
syn match Type "\<uint32_t\>"
syn match Type "\<add_const\>"
syn match Function "\<before\>"
syn match Function "\<pbump\>"
syn match Type "\<u32string\>"
syn match Special "\<disjunction_v\>"
syn match Special "\<is_trivially_copy_constructible_v\>"
syn match Type "\<index_sequence\>"
syn match Function "\<back_insert_iterator\>"
syn match Type "\<ino_t\>"
syn match Type "\<rebind\>"
syn match Function "\<do_decimal_point\>"
syn match Function "\<collate\>"
syn match Special "\<is_copy_assignable_v\>"
syn match Special "\<is_pod_v\>"
syn match Special "\<is_trivially_destructible_v\>"
syn match Type "\<index_sequence_for\>"
syn match Type "\<uid_t\>"
syn match Type "\<is_class\>"
syn match Type "\<off_t\>"
syn match Function "\<do_put\>"
syn match Type "\<pthread_barrierattr_t\>"
syn match Function "\<sentry\>"
syn match Function "\<swap_ranges\>"
syn match Function "\<resize\>"
syn match Function "\<make_exception_ptr\>"
syn match Function "\<message\>"
syn match Function "\<remove_prefix\>"
syn match Function "\<wcspbrk\>"
syn match Function "\<ctype_byname\>"
syn match Function "\<sgetc\>"
syn match Type "\<uint_least32_t\>"
syn match Function "\<widen\>"
syn match Type "\<seekdir\>"
syn match Function "\<setbuf\>"
syn match Type "\<cookie_close_function_t\>"
syn match Special "\<is_lvalue_reference_v\>"
syn match Special "\<is_class_v\>"
syn match Type "\<binary_function\>"
syn match Type "\<pos_type\>"
syn match Function "\<stol\>"

155
hitags.py Executable file
View File

@ -0,0 +1,155 @@
#!/bin/env python3
import sys
import re
import csv
from subprocess import run, PIPE
input_filename = ''
preprocessor='clang -fdirectives-only -E {input_} -o {output}'
tags_filename = 'vim.tags'
polution_directory = '.'
def print2(s):
print(s, file=sys.stderr)
def usage(name, x):
print2("Usage: {0} <options>".format(name))
print2("\t-h")
print2("\t-i <file>")
print2("\t-p <cmd>")
print2("\t-t <path>")
exit(x)
def opts(args):
global input_filename, preprocessor
try:
i = args.index("--help") if "--help" in args else -1
if i != -1:
usage(args[0], 1)
else:
for idx, arg in enumerate(args[1:]):
if arg in ("-h", "--help"):
usage(args[0], 0)
elif arg == "-i":
input_filename = args[idx + 2]
elif arg == "-p":
preprocessor = args[idx + 2]
elif arg == "-t":
polution_directory = args[idx + 2]
except IndexError:
usage(args[0], 1)
if input_filename == '':
usage(args[0], 1)
def hi(group):
return 'syn match\t\t{group} \"\<{{kw}}\>\"'.format(group=group)
targets = [
{
'type': 'v',
'out': hi('Special')
},
{
'type': 'f',
'out': hi('Function')
},
{
'type': 'p',
'out': hi('Function')
},
{
'type': 't',
'out': hi('Type')
},
{
'type': 's',
'out': hi('Type')
},
{
'type': 'd',
'out': hi('Constant')
},
{
'type': 'x',
'out': hi('Identifier')
},
]
PATTERN_INDEX = 1 - 1
TYPE_INDEX = 4 - 1
def do_ignore(row):
IGNORE_IF_BEGINS_WITH = '!_'
for i in IGNORE_IF_BEGINS_WITH:
if row[0][0] == i:
return True
if row[PATTERN_INDEX].find('operator') != -1:
return True
return False
def render(target, pattern):
return target['out'].format(kw=pattern)
def mimetype(filename):
# Totally broken, it's left here as a reminder to not do this:
# cmd = "file -i {input_}".format(input_=filename)
cmd = "mimetype {input_}".format(input_=filename)
r = run(cmd, shell=True, stdout=PIPE)
r = r.stdout.decode('ascii').split(' ')[1].strip()
return r
def preprocessfile(filename):
global preprocessor
output = polution_directory + "/" + "tags.i"
run(preprocessor.format(input_=filename, output=output), shell=True)
return out
def file2tags(filename, flags):
global tags_filename, polution_directory
ctags_command = "ctags --recurse --extras=+F --kinds-C=+px {extras} -o {output} {input_}"
output = polution_directory + "/" + tags_filename
cmd = ctags_command.format(extras=flags, output=output, input_=filename)
print2(cmd)
run(cmd, shell=True)
return tags_filename
def tags2hi(filename):
output = set()
try:
with open(filename) as f:
csv_reader = csv.reader(f, delimiter='\t')
for row in csv_reader:
if do_ignore(row):
continue
for t in targets:
try:
if t['type'] == row[TYPE_INDEX]:
output.add(render(t, re.escape(row[PATTERN_INDEX])))
except:
print2(row)
except FileNotFoundError as e:
print2("No such file or directory.")
exit(1)
return output
def main(argv):
global input_filename
opts(argv)
mime = mimetype(input_filename)
language = ''
flags = ''
if mime == 'text/x-csrc' or mime == 'text/x-chdr':
language = 'C'
elif mime == 'text/x-c++src' or mime == 'text/x-c++hdr':
language = 'C++'
if language != '':
input_filename = preprocessfile(input_filename)
flags += ' --language-force={0} '.format(language)
output = tags2hi(file2tags(input_filename, flags))
output = sorted(output)
output = '\n'.join(output)
print(output)
if __name__ == '__main__':
raise SystemExit(main(sys.argv))

65
hitags.vim Normal file
View File

@ -0,0 +1,65 @@
" --- ------ ----
" --- Config ----
" --- ------ ----
" Folder to store all dynamically generated files in
" + tags files
" + highlighting scripts
" I do not recommend using '.' especially if you don't auto cd with vim
" ~/.vim/plugin/HiTags/ is guaranteed to exist after installation,
" thats why it's the default
" otherwise you are responsible for creating your own
let s:polution_directory = '~/.vim/plugin/HiTags/'
" Compiler to use for preprocessing C/C++, so headers are respected
" Either use "clang" or "gcc" or something compatible,
" alternatively you will have to edit s:preprocessor
let s:preprocessor_executable = "clang"
" --- --------------------------- ---
" --- Don't Touch ---
" --- Unless ---
" --- You know What You Are Doing ---
" --- --------------------------- ---
let s:preprocessor = s:preprocessor_executable . ' -fdirectives-only -E {input_} -o {output}'
let s:tags_filename = 'tags'
let s:tags_file = expand(s:polution_directory) . s:tags_filename
let s:tags_scriptname = 'tags.vim'
let s:tags_script = expand(s:polution_directory) . 'tags.vim'
"
let s:generator_script = '~/.vim/plugin/HiTags/hitags.py'
let s:generation_command = 'python ' . s:generator_script .
\ ' -i ' . expand('%:p') .
\ ' -p ' . s:preprocessor .
\ ' -t ' . s:polution_directory .
\ ' > ' . s:polution_directory . s:tags_script
function! HiTagsUpdate()
let pid = system(s:generation_command)
if v:shell_error != 0
echohl ErrorMsg
echomsg "error: " . s:generator_script . " failed."
echohl NONE
return 1
endif
endfunction
function! HiTagsHighlight()
execute 'source ' . s:tags_script
endfunction
function! HiTagsDo()
call HiTagsUpdate()
call HiTagsHighlight()
endfunction
" --- Hook up everything ---
if exists('g:hitags_events')
for e in g:hitags_events
execute "autocmd " . e . " * HiTagsDo"
endfor
endif
command! HiTagsUpdate :call HiTagsUpdate()
command! HiTagsHighlight :call HiTagsHighlight()
command! HiTagsDo :call HiTagsDo()

0
object/.gitkeep Normal file
View File