From 2e89e0c2050f8e0beaf7ff2177d4793f271801ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Lovren=C4=8Di=C4=87?= Date: Tue, 12 Dec 2023 13:53:04 +0100 Subject: [PATCH] Add object files to ninja completions When working on a C or C++ projects, it is often handy to compile a single file (e.g. large refactoring where many files fail to compile so compiling a single file results in less compiler errors making the compiler output significantly easier to read and navigate). Current completion offers only ninja targets which are usually just top level binaries. This commit makes object files and library files to be offered in the ninja completion. The change is inspired by the zsh ninja completion [1], but aims to reduce noise by only matching for entries ending in ".o", ".so" or ".a". [1] https://github.com/zchee/zsh-completions/blob/c828f06e08ba96c0cf2fc626bb62be932ea112ab/src/zsh/_ninja#L30 --- share/completions/ninja.fish | 1 + 1 file changed, 1 insertion(+) diff --git a/share/completions/ninja.fish b/share/completions/ninja.fish index 8686354db..dcb3f85a4 100644 --- a/share/completions/ninja.fish +++ b/share/completions/ninja.fish @@ -13,6 +13,7 @@ end function __fish_print_ninja_targets __fish_ninja -t targets 2>/dev/null | string replace -r ':.*' '' + __fish_ninja -t targets all 2>/dev/null | string replace -r ':.*' '' | string match -e -r '\.(?:o|so|a)$' end complete -c ninja -f -a '(__fish_print_ninja_targets)' -d target complete -x -c ninja -s t -x -a "(__fish_print_ninja_tools)" -d subtool