From 977bf3d0d04af563e422ae40d0cb9f08aab6d42f Mon Sep 17 00:00:00 2001 From: Zhiyuan Ma <1468728718@qq.com> Date: Tue, 13 Feb 2024 11:02:24 +0000 Subject: [PATCH] feat(gtags): add the shortcut for jumping to a symbol --- autoload/SpaceVim/layers/gtags.vim | 1 + docs/cn/layers/gtags.md | 1 + docs/layers/gtags.md | 15 ++++++++------- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/autoload/SpaceVim/layers/gtags.vim b/autoload/SpaceVim/layers/gtags.vim index 36e22a740..4c45f739f 100644 --- a/autoload/SpaceVim/layers/gtags.vim +++ b/autoload/SpaceVim/layers/gtags.vim @@ -58,6 +58,7 @@ function! SpaceVim#layers#gtags#config() abort call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'r'], 'exe "Gtags -r " . expand("")', 'find-references', 1) call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 's'], 'exe "Gtags -s " . expand("")', 'find-cursor-symbol', 1) call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'g'], 'exe "Gtags -g " . expand("")', 'find-cursor-string', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'j'], 'exe "Gtags -d " . input("Jump to the symbol: ")', 'Input a symbol and find the definitions', 1) call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'f'], 'Gtags -f %', 'list of objects', 1) let g:gtags_gtagslabel = s:gtagslabel call SpaceVim#plugins#projectmanager#reg_callback(function('s:update_ctags_option')) diff --git a/docs/cn/layers/gtags.md b/docs/cn/layers/gtags.md index a358a2a5b..2461bf7ba 100644 --- a/docs/cn/layers/gtags.md +++ b/docs/cn/layers/gtags.md @@ -189,3 +189,4 @@ pygments 后,可以通过 gtags 查询函数和变量的定义以及引用处 | `SPC m g f` | 列出数据库中所涉及到的文件 | | `SPC m g d` | 查找 definitions | | `SPC m g r` | 查找 references | +| `SPC m g j` | 输入符号并查找其定义 | diff --git a/docs/layers/gtags.md b/docs/layers/gtags.md index d47a3dbe2..237c7f01b 100644 --- a/docs/layers/gtags.md +++ b/docs/layers/gtags.md @@ -156,10 +156,11 @@ the following additional languages will have tags created for them: ## Key bindings -| Key Binding | Description | -| ----------- | ------------------------------ | -| `SPC m g c` | create a tag database | -| `SPC m g u` | manually update tag database | -| `SPC m g f` | jump to a file in tag database | -| `SPC m g d` | find definitions | -| `SPC m g r` | find references | +| Key Binding | Description | +| ----------- | ----------------------------------- | +| `SPC m g c` | create a tag database | +| `SPC m g u` | manually update tag database | +| `SPC m g f` | jump to a file in tag database | +| `SPC m g d` | find definitions | +| `SPC m g r` | find references | +| `SPC m g j` | input a symbol and find definitions |