Added yaml-language-server, ansible-language-server
This commit is contained in:
parent
27de46fe5d
commit
ae1d8fd399
@ -149,7 +149,6 @@ call plug#begin('~/.config/nvim/plugged')
|
|||||||
Plug 'hrsh7th/cmp-vsnip'
|
Plug 'hrsh7th/cmp-vsnip'
|
||||||
Plug 'hrsh7th/nvim-vsnip'
|
Plug 'hrsh7th/nvim-vsnip'
|
||||||
|
|
||||||
|
|
||||||
" Telescope
|
" Telescope
|
||||||
Plug 'nvim-lua/plenary.nvim'
|
Plug 'nvim-lua/plenary.nvim'
|
||||||
Plug 'nvim-telescope/telescope.nvim'
|
Plug 'nvim-telescope/telescope.nvim'
|
||||||
@ -181,7 +180,7 @@ end
|
|||||||
|
|
||||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||||
-- map buffer local keybindings when the language server attaches
|
-- map buffer local keybindings when the language server attaches
|
||||||
local servers = { 'pyright', 'bashls', 'yamlls', 'ansiblels' }
|
local servers = { 'pyright', 'bashls', 'ansiblels' }
|
||||||
for _, lsp in pairs(servers) do
|
for _, lsp in pairs(servers) do
|
||||||
require('lspconfig')[lsp].setup {
|
require('lspconfig')[lsp].setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
@ -192,6 +191,17 @@ for _, lsp in pairs(servers) do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require'lspconfig'.yamlls.setup{
|
||||||
|
settings = {
|
||||||
|
json = {
|
||||||
|
schemas = {
|
||||||
|
ansible = 'https://github.com/ansible/schemas/blob/main/f/ansible.json',
|
||||||
|
kubernetes = 'https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.1-standalone/all.json'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
-- luasnip setup
|
-- luasnip setup
|
||||||
local luasnip = require 'luasnip'
|
local luasnip = require 'luasnip'
|
||||||
|
|
||||||
@ -201,7 +211,6 @@ cmp.setup {
|
|||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
luasnip.lsp_expand(args.body)
|
luasnip.lsp_expand(args.body)
|
||||||
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
@ -368,6 +377,7 @@ vnoremap <S-Tab> <
|
|||||||
nmap <Leader>e <cmd>Telescope buffers<cr>
|
nmap <Leader>e <cmd>Telescope buffers<cr>
|
||||||
nmap <Leader>w <cmd>Telescope find_files<cr>
|
nmap <Leader>w <cmd>Telescope find_files<cr>
|
||||||
nmap <Leader>q <cmd>Telescope live_grep<cr>
|
nmap <Leader>q <cmd>Telescope live_grep<cr>
|
||||||
|
nmap <Leader>g <cmd>Telescope git_branches<cr>
|
||||||
|
|
||||||
" Resize window
|
" Resize window
|
||||||
nnoremap <C-L> :vertical resize +5<CR>
|
nnoremap <C-L> :vertical resize +5<CR>
|
||||||
@ -452,8 +462,8 @@ map <F4> :setlocal spell! spelllang=pl<CR>
|
|||||||
""""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
" Ansible
|
" Ansible
|
||||||
au BufRead,BufNewFile *.yml set filetype=yaml.ansible
|
au BufRead,BufNewFile *.yaml,*.yml if search('hosts:\|tasks:', 'nw') | set ft=yaml.ansible | endif
|
||||||
autocmd BufWritePre *.yml :Prettier <CR>
|
autocmd BufWritePre *.yaml,*.yml :Prettier <CR>
|
||||||
|
|
||||||
" Bash
|
" Bash
|
||||||
autocmd FileType sh
|
autocmd FileType sh
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
npm -g i pyright bash-language-server
|
npm -g i pyright bash-language-server --force
|
||||||
|
npm -g i yaml-language-server --force
|
||||||
|
npm -g i @ansible/ansible-language-server --force
|
||||||
GO111MODULE=on go install mvdan.cc/sh/v3/cmd/shfmt@latest
|
GO111MODULE=on go install mvdan.cc/sh/v3/cmd/shfmt@latest
|
||||||
pip install black
|
pip install black
|
||||||
pip3 install black
|
pip3 install black
|
||||||
|
Loading…
x
Reference in New Issue
Block a user