mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 17:49:57 +08:00
Add tags support for zig lang (#3357)
This commit is contained in:
parent
e3344fa308
commit
acddd6d688
@ -6,6 +6,11 @@
|
|||||||
" License: GPLv3
|
" License: GPLv3
|
||||||
"=============================================================================
|
"=============================================================================
|
||||||
|
|
||||||
|
if exists('s:ztagsbin')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let s:ztagsbin = 'ztags'
|
||||||
|
|
||||||
function! SpaceVim#layers#lang#zig#plugins() abort
|
function! SpaceVim#layers#lang#zig#plugins() abort
|
||||||
let plugins = []
|
let plugins = []
|
||||||
call add(plugins, ['ziglang/zig.vim', { 'merged' : 0}])
|
call add(plugins, ['ziglang/zig.vim', { 'merged' : 0}])
|
||||||
@ -15,8 +20,41 @@ endfunction
|
|||||||
function! SpaceVim#layers#lang#zig#config() abort
|
function! SpaceVim#layers#lang#zig#config() abort
|
||||||
call SpaceVim#plugins#runner#reg_runner('zig', 'zig run %s')
|
call SpaceVim#plugins#runner#reg_runner('zig', 'zig run %s')
|
||||||
call SpaceVim#mapping#space#regesit_lang_mappings('zig', function('s:language_specified_mappings'))
|
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
|
endfunction
|
||||||
|
|
||||||
function! s:language_specified_mappings() abort
|
function! s:language_specified_mappings() abort
|
||||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','r'], 'call SpaceVim#plugins#runner#open()', 'execute current file', 1)
|
call SpaceVim#mapping#space#langSPC('nmap', ['l','r'], 'call SpaceVim#plugins#runner#open()', 'execute current file', 1)
|
||||||
endfunction
|
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"
|
name = "lang#zig"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 模块选项
|
||||||
|
|
||||||
|
- `ztagsbin`:制定 ztags 命令的路径。
|
||||||
|
|
||||||
## 快捷键
|
## 快捷键
|
||||||
|
|
||||||
### 运行当前脚本
|
### 运行当前脚本
|
||||||
|
@ -9,6 +9,7 @@ description: "This layer is for zig development, provide code runner support for
|
|||||||
|
|
||||||
- [Description](#description)
|
- [Description](#description)
|
||||||
- [Install](#install)
|
- [Install](#install)
|
||||||
|
- [Options](#options)
|
||||||
- [Key bindings](#key-bindings)
|
- [Key bindings](#key-bindings)
|
||||||
- [Running current script](#running-current-script)
|
- [Running current script](#running-current-script)
|
||||||
|
|
||||||
@ -27,6 +28,10 @@ To use this configuration layer, update custom configuration file with:
|
|||||||
name = "lang#zig"
|
name = "lang#zig"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
- `ztagsbin`: specific the path of ztags.
|
||||||
|
|
||||||
## Key bindings
|
## Key bindings
|
||||||
|
|
||||||
### Running current script
|
### Running current script
|
||||||
|
Loading…
x
Reference in New Issue
Block a user