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

feat(lang#nix): Add additional LSP command bindings

This commit is contained in:
Sven Tennie 2022-01-25 14:23:31 +01:00 committed by GitHub
parent 29c10f0b3b
commit 0fdf5c8c07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

View File

@ -10,8 +10,8 @@
" @section lang#nix, layers-lang-nix
" @parentsection layers
" @subsection Intro
" The lang#nix layer provides syntax highlighting for the Nix
" expression language.
" The lang#nix layer provides syntax highlighting and basic LSP support for
" the Nix expression language.
function! SpaceVim#layers#lang#nix#plugins() abort
let plugins = []
@ -20,11 +20,27 @@ function! SpaceVim#layers#lang#nix#plugins() abort
endfunction
function! SpaceVim#layers#lang#nix#config() abort
call SpaceVim#mapping#space#regesit_lang_mappings('nix', function('s:language_specified_mappings'))
endfunction
function! s:language_specified_mappings() abort
if SpaceVim#layers#lsp#check_filetype('nix')
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'r'],
\ 'call SpaceVim#lsp#rename()', 'rename', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 's'],
\ 'call SpaceVim#lsp#show_line_diagnostics()', 'show-line-diagnostics', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
\ 'call SpaceVim#lsp#go_to_def()', 'go-to-definition', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'n'],
\ 'call SpaceVim#lsp#diagnostic_goto_next()', 'next-diagnostic', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'p'],
\ 'call SpaceVim#lsp#diagnostic_goto_prev()', 'previous-diagnostic', 1)
endif
endfunction
function! SpaceVim#layers#lang#nix#health() abort
call SpaceVim#layers#lang#nix#plugins()
call SpaceVim#layers#lang#nix#config()
return 1
endfunction

View File

@ -10,7 +10,6 @@ description: "This layer adds Nix language support to SpaceVim."
- [Description](#description)
- [Features](#features)
- [Install](#install)
- [Key bindings](#key-bindings)
<!-- vim-markdown-toc -->
@ -21,6 +20,9 @@ This layer adds [Nix](https://nixos.org/nix/manual/) language support to SpaceVi
## Features
- syntax highlighting
- symbol renaming (LSP)
- go to definition (LSP)
- syntax checking (LSP)
## Install