require "nvchad.mappings" -- add yours here local map = vim.keymap.set map("n", ";", ":", { desc = "CMD enter command mode" }) map("i", "jk", "") -- map({ "n", "i", "v" }, "", " w ") -- spell add word local word_collection_file = vim.fn.getcwd() .. "/.ltexwords" local function add_current_word_to_collection() local word = vim.fn.expand("") -- Get the word under the cursor if word == "" or word == nil then vim.notify("No word under cursor.", vim.log.levels.WARN) return end local escaped_word = vim.fn.shellescape(word) local escaped_filepath = vim.fn.shellescape(word_collection_file) local cmd = string.format("echo %s >> %s", escaped_word, escaped_filepath) vim.fn.system(cmd) if vim.v.shell_error == 0 then vim.notify(string.format("'%s' added to %s", word, word_collection_file), vim.log.levels.INFO) else vim.notify( string.format("Error adding '%s' to %s. Shell error: %d", word, word_collection_file, vim.v.shell_error), vim.log.levels.ERROR ) end end -- Vérifie si le fichier existe if vim.fn.filereadable(word_collection_file) == 1 then map("n", "aw", add_current_word_to_collection) end