From 1f48b7d647c9e269df26ac046c3463654cdc37d3 Mon Sep 17 00:00:00 2001 From: hyeyoo <50040414+hygoni@users.noreply.github.com> Date: Thu, 27 May 2021 03:37:03 +0900 Subject: [PATCH] Add git top-level path when adding cscope Can't go to function definition because it's absolute path. So add top-level path of git when loading cscope.out. It assumes that cscope.out is in root of git repository. --- plugin/quickr-cscope.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/quickr-cscope.vim b/plugin/quickr-cscope.vim index da21b40..a8d29cb 100644 --- a/plugin/quickr-cscope.vim +++ b/plugin/quickr-cscope.vim @@ -58,7 +58,8 @@ function! s:autoload_db() call s:debug_echo('Database file found at: ' . db) let &csprg=g:quickr_cscope_program call s:debug_echo('Trying to add the database file for program: ' . g:quickr_cscope_program) - silent! execute "cs add " . db + let root_path = trim(system("git rev-parse --show-toplevel")) + execute "cs add " . db . " " . root_path return 1 else call s:debug_echo('Database file not found.')