You are not logged in.

#1 2019-04-17 13:17:29

Kirill Bugaev
Member
Registered: 2018-08-03
Posts: 173

vim-ctype shows C, C++ types as cmd echo or in statusline

vim-ctype
Plugin uses clang facility to determine type of instance (type of variable, function, etc.) under cursor.
Main part is clang-gettype utility is written on C. It based on client-server architecture using unix domain sockets. Client accepts source code file and location (line number and column) of instance as command line arguments, send request to server and outputs type of specified instance. Vimscript code wraps this functional. By default it shows instance type in Vim command line, but this behavior can be changed. Last received instance type always is available in g:ctype_type variable, so you can direct output to Vim statusline:

set statusline += %{g:ctype_type}
let g:ctype_updatestl = 1

vim-ctype.png

Last edited by Kirill Bugaev (2019-05-31 07:44:03)

Offline

#2 2019-05-29 08:38:25

Kirill Bugaev
Member
Registered: 2018-08-03
Posts: 173

Re: vim-ctype shows C, C++ types as cmd echo or in statusline

Comrades have fixed bugs in libclang. So now plugin can show C code types on fly without generating AST file. Compilation Database support added. If not all types are displayed, then db is needed (can be created easy with CMake). Unfortunately, for C++ code AST file still required. But I hope comrades will fix it soon or later.

Offline

Board footer

Powered by FluxBB