mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 13:50:05 +08:00
Add tags support for zig lang (#3357)
This commit is contained in:
parent
e3344fa308
commit
acddd6d688
@ -6,6 +6,11 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
if exists('s:ztagsbin')
|
||||
finish
|
||||
endif
|
||||
let s:ztagsbin = 'ztags'
|
||||
|
||||
function! SpaceVim#layers#lang#zig#plugins() abort
|
||||
let plugins = []
|
||||
call add(plugins, ['ziglang/zig.vim', { 'merged' : 0}])
|
||||
@ -15,8 +20,41 @@ endfunction
|
||||
function! SpaceVim#layers#lang#zig#config() abort
|
||||
call SpaceVim#plugins#runner#reg_runner('zig', 'zig run %s')
|
||||
call SpaceVim#mapping#space#regesit_lang_mappings('zig', function('s:language_specified_mappings'))
|
||||
if executable(s:ztagsbin) && !exists('g:tagbar_type_zig')
|
||||
let g:tagbar_type_zig = {
|
||||
\ 'ctagstype' : 'zig',
|
||||
\ 'kinds' : [
|
||||
\ 's:structs',
|
||||
\ 'u:unions',
|
||||
\ 'e:enums',
|
||||
\ 'v:variables',
|
||||
\ 'm:members',
|
||||
\ 'f:functions',
|
||||
\ 'r:errors'
|
||||
\ ],
|
||||
\ 'sro' : '.',
|
||||
\ 'kind2scope' : {
|
||||
\ 'e' : 'enum',
|
||||
\ 'u' : 'union',
|
||||
\ 's' : 'struct',
|
||||
\ 'r' : 'error'
|
||||
\ },
|
||||
\ 'scope2kind' : {
|
||||
\ 'enum' : 'e',
|
||||
\ 'union' : 'u',
|
||||
\ 'struct' : 's',
|
||||
\ 'error' : 'r'
|
||||
\ },
|
||||
\ 'ctagsbin' : s:ztagsbin,
|
||||
\ 'ctagsargs' : ''
|
||||
\ }
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:language_specified_mappings() abort
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','r'], 'call SpaceVim#plugins#runner#open()', 'execute current file', 1)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#zig#set_variable(opt) abort
|
||||
let s:ztagsbin = get(a:opt, 'ztagsbin', s:ztagsbin)
|
||||
endfunction
|
||||
|
@ -10,6 +10,7 @@ lang: zh
|
||||
|
||||
- [模块简介](#模块简介)
|
||||
- [启用模块](#启用模块)
|
||||
- [模块选项](#模块选项)
|
||||
- [快捷键](#快捷键)
|
||||
- [运行当前脚本](#运行当前脚本)
|
||||
|
||||
@ -28,6 +29,10 @@ lang: zh
|
||||
name = "lang#zig"
|
||||
```
|
||||
|
||||
## 模块选项
|
||||
|
||||
- `ztagsbin`:制定 ztags 命令的路径。
|
||||
|
||||
## 快捷键
|
||||
|
||||
### 运行当前脚本
|
||||
|
@ -9,6 +9,7 @@ description: "This layer is for zig development, provide code runner support for
|
||||
|
||||
- [Description](#description)
|
||||
- [Install](#install)
|
||||
- [Options](#options)
|
||||
- [Key bindings](#key-bindings)
|
||||
- [Running current script](#running-current-script)
|
||||
|
||||
@ -27,6 +28,10 @@ To use this configuration layer, update custom configuration file with:
|
||||
name = "lang#zig"
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `ztagsbin`: specific the path of ztags.
|
||||
|
||||
## Key bindings
|
||||
|
||||
### Running current script
|
||||
|
Loading…
Reference in New Issue
Block a user