From 1b6f9eda72b749b39bf04b9a2cb32d31c1137415 Mon Sep 17 00:00:00 2001 From: Maciej Lebiest Date: Tue, 6 May 2025 18:58:16 +0200 Subject: [PATCH] add mc functions --- README.md | 5 +++++ init.lua | 1 + lua/mc-functions.lua | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 lua/mc-functions.lua diff --git a/README.md b/README.md index 34d3660..d45a0dc 100644 --- a/README.md +++ b/README.md @@ -258,6 +258,11 @@ All that is saved in image, so that is why image is so heavy. ### Commands and keys +#### Vim functions for activating different modes + +- `MCModeAnsible` +- `MCModeHelm` + #### General |keys|action| diff --git a/init.lua b/init.lua index 278f489..492beb3 100644 --- a/init.lua +++ b/init.lua @@ -20,3 +20,4 @@ vim.opt.termguicolors = true require("lazy-load") -- load general config require("general") +require("mc-functions") diff --git a/lua/mc-functions.lua b/lua/mc-functions.lua new file mode 100644 index 0000000..6f93804 --- /dev/null +++ b/lua/mc-functions.lua @@ -0,0 +1,35 @@ +function mc_mode_ansible() + vim.filetype.add({ + extension = { + yml = "yaml.ansible", + yaml = "yaml.ansible", + }, + }) + vim.cmd [[ +LspStart ansiblels +]] +end + +function mc_mode_helm() + vim.filetype.add({ + extension = { + yml = "helm", + yaml = "helm", + }, + }) + vim.cmd [[ +LspStart helm_ls +LspStop yamlls +]] +end + +vim.api.nvim_create_user_command( + 'MCModeAnsible', + mc_mode_ansible, + {} +) +vim.api.nvim_create_user_command( + 'MCModeHelm', + mc_mode_helm, + {} +)