1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:20:05 +08:00

feat(verilog): add code runner for verilog

This commit is contained in:
wsdjeg 2022-05-20 11:26:05 +08:00
parent 847fd81ae0
commit 1bc0ad8377

View File

@ -22,9 +22,42 @@ function! SpaceVim#layers#lang#verilog#plugins() abort
return plugins
endfunction
" ref
" https://zhuanlan.zhihu.com/p/95081329
function! SpaceVim#layers#lang#verilog#config() abort
call SpaceVim#plugins#runner#reg_runner('verilog', ['iverilog -o #TEMP# %s', '#TEMP#'])
call SpaceVim#mapping#space#regesit_lang_mappings('verilog', function('s:language_specified_mappings'))
endfunction
function! s:language_specified_mappings() abort
call SpaceVim#mapping#space#langSPC('nmap', ['l','r'],
\ 'call SpaceVim#plugins#runner#open()',
\ 'execute current file', 1)
if SpaceVim#layers#lsp#check_filetype('verilog')
" \ || SpaceVim#layers#lsp#check_server('clangd')
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
\ 'call SpaceVim#lsp#show_doc()', 'show_document', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'],
\ 'call SpaceVim#lsp#rename()', 'rename symbol', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'x'],
\ 'call SpaceVim#lsp#references()', 'show-references', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'i'],
\ 'call SpaceVim#lsp#go_to_impl()', 'implementation', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'h'],
\ 'call SpaceVim#lsp#show_line_diagnostics()', 'show-line-diagnostics', 1)
let g:_spacevim_mappings_space.l.w = {'name' : '+Workspace'}
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'l'],
\ 'call SpaceVim#lsp#list_workspace_folder()', 'list-workspace-folder', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'a'],
\ 'call SpaceVim#lsp#add_workspace_folder()', 'add-workspace-folder', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'r'],
\ 'call SpaceVim#lsp#remove_workspace_folder()', 'remove-workspace-folder', 1)
endif
endfunction