Compare commits

...

2 Commits

Author SHA1 Message Date
Marcin Woźniak
d735c8b0ed Added yaml-language-server, ansible-language-server 2022-04-22 12:37:17 +02:00
Marcin Woźniak
fdadc20917 Added cmp-buffer, cmp-path, cmp-cmdline 2022-04-22 12:36:10 +02:00
2 changed files with 39 additions and 3 deletions

View File

@ -137,13 +137,19 @@ call plug#begin('~/.config/nvim/plugged')
" LSP " LSP
Plug 'neovim/nvim-lspconfig' Plug 'neovim/nvim-lspconfig'
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/nvim-cmp' Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/cmp-nvim-lsp' Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'saadparwaiz1/cmp_luasnip' Plug 'saadparwaiz1/cmp_luasnip'
Plug 'L3MON4D3/LuaSnip' Plug 'L3MON4D3/LuaSnip'
Plug 'sbdchd/neoformat' Plug 'sbdchd/neoformat'
Plug 'hrsh7th/cmp-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'
@ -175,7 +181,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' } local servers = { 'pyright', 'bashls', 'yamlls', '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,
@ -195,6 +201,7 @@ 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({
@ -227,9 +234,30 @@ cmp.setup {
sources = { sources = {
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'luasnip' }, { name = 'luasnip' },
{ name = 'vsnip' },
{ name = 'ultisnips' },
{ name = 'snippy' },
{ name = 'path' }
}, },
} }
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
EOF EOF
" Neoformat " Neoformat
@ -237,6 +265,12 @@ let g:neoformat_try_formatprg = 1
let g:neoformat_basic_format_trim = 1 let g:neoformat_basic_format_trim = 1
let g:neoformat_only_msg_on_error = 1 let g:neoformat_only_msg_on_error = 1
autocmd BufWritePre * undojoin | Neoformat autocmd BufWritePre * undojoin | Neoformat
let g:neoformat_python_black = {
\ 'exe': 'black',
\ 'stdin': 1,
\ 'args': ['--line-length', '80', '-q', '-'],
\ }
let g:neoformat_enabled_python = ['black']
" Ebuild " Ebuild
let g:shfmt_opt="-ci" let g:shfmt_opt="-ci"

View File

@ -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