Last active
May 17, 2022 12:13
-
-
Save holmanb/75e0974c759dd6180cdf74da6fd01551 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
# | |
# nvim-cmp only works on >0.6 https://github.com/hrsh7th/nvim-cmp/issues/231#issuecomment-1102917158 | |
# | |
# neovim healthcheck fails on jammy, however this ppa isn't built for kinetic yet | |
# | |
# when a kinetic build exists update apt.sources.neovim-0.8.source with the following (no src/keyid): | |
# | |
# source: 'ppa:neovim-ppa/unstable' | |
# | |
apt: | |
sources: | |
neovim-0.8: | |
source: 'deb https://ppa.launchpadcontent.net/neovim-ppa/unstable/ubuntu/ jammy main' | |
keyid: 55F96FCF8231B6DD | |
keyserver: keyserver.ubuntu.com | |
packages: | |
- npm | |
- curl | |
- neovim | |
package_upgrade: true | |
write_files: | |
- path: /root/.config/nvim/init.vim | |
content: | | |
" Install plugins | |
" =============== | |
call plug#begin() | |
" For language servers | |
Plug 'neovim/nvim-lspconfig' | |
" For nvim-cmp | |
Plug 'hrsh7th/nvim-cmp' | |
Plug 'hrsh7th/cmp-nvim-lsp' | |
call plug#end() | |
lua require'lsp-config' | |
lua require'nvim-cmp' | |
- path: /root/.config/nvim/lua/nvim-cmp.lua | |
content: | | |
-- Setup nvim-cmp. | |
local cmp = require'cmp' | |
cmp.setup({ | |
mapping = { | |
['<C-n>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), | |
['<C-p>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), | |
['<Down>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), | |
['<Up>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), | |
['<C-d>'] = cmp.mapping.scroll_docs(-4), | |
['<C-f>'] = cmp.mapping.scroll_docs(4), | |
['<C-Space>'] = cmp.mapping.complete(), | |
['<C-e>'] = cmp.mapping.close(), | |
['<CR>'] = cmp.mapping.confirm({ | |
behavior = cmp.ConfirmBehavior.Replace, | |
select = true, | |
}) | |
}, | |
sources = { | |
{ name = 'nvim_lsp' }, | |
{ name = 'path' }, | |
{ name = 'buffer' }, | |
} | |
}) | |
- path: /root/.config/nvim/lua/lsp-config.lua | |
content: | | |
-- yamlls config | |
require'lspconfig'.yamlls.setup{ | |
on_attach=on_attach, | |
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()), | |
settings = { | |
yaml = { | |
schemas = { | |
["https://raw.githubusercontent.com/canonical/cloud-init/main/cloudinit/config/schemas/versions.schema.cloud-config.json"]= "user-data.yml", | |
} | |
} | |
} | |
} | |
runcmd: | |
# TODO: These are slow, parallelize | |
- [ 'npm', 'i', '-g', 'yaml-language-server'] | |
- | | |
sh -c 'curl -fLo /root/.local/share/nvim/site/autoload/plug.vim --create-dirs \ | |
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' | |
- [ 'nvim', '--headless', '+PlugInstall', '+qall' ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment