CLINK(1)
โจ CLINK(1) โ C/C++/assembly code navigator โจ
General Commands Manual
๐ NAME ๐
clink - C/C++/assembly code navigator
๐ธ SYNOPSIS ๐ธ
clink options... [paths...]
๐ฆ DESCRIPTION ๐ฆ
Okay so bestie, picture this: Clink is a replacement for Cscope that uses libclang, features syntax highlighting, multicore support, and more. It's giving glow-up for code navigation, no cap. โจ
๐ OPTIONS ๐
--animation=[on|off]โ turns text animations on or off. By default, Clink will show an animated spinner when performing some long running applications like on-demand Vim syntax highlighting. You can useoffto disable this and use a static character instead. ๐-b,--build-onlyโ exits after constructing or updating the symbol database. That is, it does not load a user interface. Just build and bounce. ๐จ--colour=when,--color=whenโ enables or disables the use of ANSI colour codes. Possible values of when arealways(enable),never(disable), andauto(decide based on whether stdout is a TTY). Pick your vibe. ๐--compile-commands=DIR,--compile-commands-dir=DIRโ sets a location to a directory containing a compile commands database, as used by clangd. When using libclang to parse either C or C++ (--parse-c=clang,--parse-cxx=clang), this database will be used to determine the flags your sources were built with. If this option is not given, a compile commands database will be looked for adjacent to your Clink database or in an adjacent build subdirectory. ๐-f FILE,--database=FILEโ opens or creates the symbol database at path FILE. Without this option, Clink will default to opening the file.clink.dbin the current directory or any parent thereof if it exists. It will stop its search when it reaches the root of a Git, Mercurial, or Subversion checkout, under the assumption that you do not wish to index beyond the boundary of a repository you are in.
If no repository root is found, the search will stop when reaching the root directory of the file system, at which point Clink will fallback to .clink.db in the current directory. ๐๏ธ
--debugโ enables Clink debugging mode. This is intended for debugging problems within Clink itself. ๐-h,--helpโ displays this help information. You know the drill. ๐-i namefileโ parses a list of source paths to index from the given file. Paths can be separated by spaces, tabs, or newlines. Paths that contain any of these characters need to be enclosed in double quotes. Within a quoted path, double quote and backslash characters must be escaped with a leading backslash. namefile can be given as-to accept paths on standard input.
Unlike the corresponding Cscope option, other paths passed to Clink on the command line are not ignored when using this option. Additionally the paths specified in namefile can be either files or directories. ๐
-j NUM,--jobs=NUMโ uses the given number of threads when performing multithreaded operations. You can also pass the special valueauto(the default) which uses the number of processors in your system. Go parallel, bestie. โก-d,--no-buildโ does not update the database. Skipping the build step, iconic. ๐ซ
Okay so the parse options are a whole mood: they control which source code formats are considered for parsing and how they're parsed. The modes and defaults go like this, bestie:
--parse-asm=MODEโ controls assembly code; modes:off,generic; default:generic. ๐ ๏ธ--parse-bison=MODEโ alias for--parse-yacc; controls Yacc/Bison files; modes:auto,off,cscope,generic; default:auto. ๐--parse-c=MODEโ controls C source code (.c,.hfiles); modes:auto,off,clang,cscope,generic; default:auto. ๐จ--parse-cxx=MODEโ controls C++ source code (.c++,.cpp,.cxx,.cc,.h,.hh,.hppfiles); modes:auto,off,clang,cscope,generic; default:auto. โโ--parse-def=MODEโ controls MSVC DEF files; modes:off,generic; default:generic. ๐--parse-flex=MODEโ alias for--parse-lex; controls Lex/Flex files; modes:auto,off,cscope,generic; default:auto. ๐ช--parse-lex=MODEโ controls Lex/Flex files; modes:auto,off,cscope,generic; default:auto. ๐ค--parse-python=MODEโ controls Python source code; modes:off,generic; default:generic. ๐--parse-tablegen=MODEโ controls LLVM TableGen files; modes:off,generic; default:generic. ๐--parse-yacc=MODEโ controls Yacc/Bison files; modes:auto,off,cscope,generic; default:auto. ๐งฑ
For C and C++, the auto mode picks between clang and cscope based on whether compile_commands.json exists and whether Cscope is around. If a compile_commands.json is there (either handed over with --compile-commands or found by the inferred search) or Cscope isn't installed โ clang gets picked. Otherwise? cscope, bestie. ๐
For Lex/Flex and Yacc/Bison, auto goes with cscope if it's available, and generic if it's not. ๐
The generic mode picks a parser with limited semantic understanding โ it literally cannot infer things like complex definitions. But it's lowkey a lifesaver when you don't have full compiler flags for your sources and Clang therefore can't effectively parse them. ๐
The cscope mode runs Cscope to parse C, C++, Lex/Flex, or Yacc/Bison. This is giving foreign code base energy, because Cscope sometimes does a better job than Clang at parsing a file with unknown flags. โจ
Heads up though ๐ โ the definitions of C and C++ files overlap in the table above..hfiles count as both C and C++! So if--parse-cand--parse-cxxare both set to non-off modes, the--parse-cxxmode is the one that applies to.hfiles. No cap.
-c TEXT,--script=TEXTโ treatsTEXTas if you'd typed it straight into the UI on start up. ๐ซถ You can pass this option multiple times, andTEXTaccumulates in the order the parameters appear. Cannot be combined with--build-onlyโ that pairing is a no. ๐
This is the automation glow-up: it lets you script your Clink invocations to do particular searches, or even go on to open a particular result if you can predict the result list in advance. ๐ฎ The C escape sequences \b, \n, \r, \t, \\, \', and \" are interpreted โ and so are the escape sequences for control keys like the arrow keys. So when you're entering a Clink command at the terminal, for example, you can pass --script= and press Ctrl+V followed by down arrow, and on start up Clink will move down to the second field. Iconic. ๐
-s MODE,--syntax-highlighting=MODEโ controls when Vim syntax highlighting gets performed. ๐MODEcan be:autoโ picks one of the other two modes below based on how many files need to be scanned. rn there's a hard coded limit: if there are100or more files to scan,lazygets picked. Otherwiseeager. ๐eagerโ does the highlighting during database construction. So building the database will be slower ๐, but once it's built, searching it will be faster. โกlazyโ does the highlighting during searching. So building the database will be faster, but searching may take longer since it's syntax highlighting the results. ๐ธ
Default is auto. โจ Note that if a search needs to perform highlighting, it saves the results to the database โ so future searches that return results in the same file(s) will be fast. ๐ง
This is a per-run setting, not a per-database setting. So like, for example, it's totally possible to pick lazy when first building the database and then use eager on future runs, where only files that have changed (most likely the ones you're actively working on) will be eagerly highlighted. ๐ฆ
-V,--versionโ prints the current version and exits. that's it, that's the whole vibe ๐
๐ฟ ENVIRONMENT ๐ฟ
The behaviour of clink is affected by these environment variables, bestie. ๐ซถ
EDITOR,VISUALโ when you open a result from the search screen, the editor is chosen by consulting theVISUALenvironment variable first, and then โ if that's unset โ theEDITORenvironment variable. If neither one is set,vimis used as the fallback. ๐
Whether the located editor looks like Vim or not changes what command actually runs to open the result. If the editor is a relative or absolute path to a name that's a common alias of Vim, the result gets opened at a specific line and column number, with the Clink database connected. ๐ฅ If the editor isn't recognised? The result filename just gets opened with no further command line options to the editor. Simple as that. โจ
๐ AUTHOR ๐
All comments, questions and complaints should be directed to Matthew Fernandez <matthew.fernandez@gmail.com>. be nice to him, he made this ๐ซถ
๐ LICENSE ๐
This is free and unencumbered software released into the public domain. ๐ฆ
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. no cap, go off ๐
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. ๐โจ
THE SOFTWARE IS PROVIDED โAS ISโ, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ๐ (translation: it's free, but if it breaks your stuff that's on you, bestie ๐ญ)
For more information, please refer to <http://unlicense.org> ๐
and that's the whole CLINK(1) page, bestie โ the version and date live in that cute little footer down at the bottom, so go check the source/version stamp there if you need the receipts. ๐
โจ ๐
๐ฆ where this page comes from
- nixpkgs unstable: clink 2024.12.07-unstable-2026-10-18
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms