diff options
Diffstat (limited to '.config/nvim/plugin')
| -rw-r--r-- | .config/nvim/plugin/50-autocompletion.lua | 13 | ||||
| -rw-r--r-- | .config/nvim/plugin/50-autopairs.lua | 2 | ||||
| -rw-r--r-- | .config/nvim/plugin/50-format.lua | 6 | ||||
| -rw-r--r-- | .config/nvim/plugin/50-spell.lua | 10 |
4 files changed, 18 insertions, 13 deletions
diff --git a/.config/nvim/plugin/50-autocompletion.lua b/.config/nvim/plugin/50-autocompletion.lua index dbc5dee..853a528 100644 --- a/.config/nvim/plugin/50-autocompletion.lua +++ b/.config/nvim/plugin/50-autocompletion.lua @@ -1,7 +1,7 @@ -- -- 50-autocompletion.lua -- --- * Configures insert-mode/command-mode autocompletion. +-- * Configures autocompletion for insert mode and command-line mode. -- In both modes: -- * The list of completions shows up automatically -- * Tab/Shift+Tab selects (and inserts) the next/previous item @@ -79,7 +79,7 @@ vim.api.nvim_create_autocmd({ "CmdLineChanged", "CmdlineEnter" }, { }) vim.opt.wildmenu = true -- Show completions in a menu -vim.opt.wildchar = 9 -- Char code (`<Tab>`) assigned to command line wildcard expansion +vim.opt.wildchar = 9 -- Char code (`<Tab>`) assigned to command-line wildcard expansion vim.opt.wildoptions = { "exacttext", -- Discard regex artifacts when performing search pattern completion "pum", -- Show completions in a popup menu @@ -89,15 +89,10 @@ vim.opt.wildoptions = { -- Completion modes triggered in order by `wildtrigger()` or 'wildchar' vim.opt.wildmode = { "noselect", -- List matches without inserting - "full", -- List matches and inserts first full match + "full", -- List matches and insert first full match } -- Converts `vim.opt.wildchar` char code into a key string that can be used by `vim.keymap.set()`. local wildchar_key = string.format("%c", vim.o.wildchar) -vim.keymap.set( - "c", - wildchar_key, - c_insert_unique_or_wildtrigger, - { expr = true, desc = "Command line wildcard expansion" } -) +vim.keymap.set("c", wildchar_key, c_insert_unique_or_wildtrigger, { expr = true }) vim.keymap.set("c", "<C-y>", c_accept_selection_or_dismiss, { expr = true }) diff --git a/.config/nvim/plugin/50-autopairs.lua b/.config/nvim/plugin/50-autopairs.lua index 25dd8f7..afa4e3b 100644 --- a/.config/nvim/plugin/50-autopairs.lua +++ b/.config/nvim/plugin/50-autopairs.lua @@ -1,7 +1,7 @@ -- -- 50-autopairs.lua -- --- * Add autopairs for markdown (`**` and `~~`) +-- * Adds autopairs for markdown (`**` and `~~`) -- local Rule = require("nvim-autopairs.rule") diff --git a/.config/nvim/plugin/50-format.lua b/.config/nvim/plugin/50-format.lua index e021227..d77f1fd 100644 --- a/.config/nvim/plugin/50-format.lua +++ b/.config/nvim/plugin/50-format.lua @@ -39,7 +39,7 @@ formatters.bash = formatters.sh --- Format the buffer `ev.buf` with the formatter for its filetype. --- This function is meant to be an event handler for `vim.api.nvim_create_autocmd()` --- @param ev table `ev` argument passed from `vim.api.nvim_create_autocmd()` -local function on_format(ev) +local function format_buffer(ev) if vim.b[ev.buf].format ~= true then return end @@ -59,10 +59,12 @@ local function on_format(ev) vim.fn.winrestview(view) end +---------------------------------------------------------------------------------------------------- + vim.api.nvim_create_autocmd("BufWritePre", { desc = "Format buffer", group = vim.g.dotfiles.augroup, - callback = on_format, + callback = format_buffer, }) vim.api.nvim_create_user_command("FormatToggle", toggle_format, { desc = "Toggle format on save" }) diff --git a/.config/nvim/plugin/50-spell.lua b/.config/nvim/plugin/50-spell.lua index a25bcff..89898c8 100644 --- a/.config/nvim/plugin/50-spell.lua +++ b/.config/nvim/plugin/50-spell.lua @@ -1,5 +1,11 @@ -- --- Spell check plugin +-- 50-spell.lua +-- +-- User commands: +-- `SpellToggle`: Toggle spell checking +-- `SpellSetEn`: Set spell language to English +-- `SpellSetFr`: Set spell language to French +-- `SpellSetEnFr`: Set spell languages to both English and French -- local function toggle_spell() @@ -18,6 +24,8 @@ local function set_spell_en_fr() vim.opt.spelllang = { "en_us", "fr" } end +---------------------------------------------------------------------------------------------------- + vim.opt.spelllang = "en_us" -- Initial spell language vim.opt.spellfile = { -- Spellfiles for zg, zw, z=, etc vim.fn.stdpath("config") .. "/spell/en.utf-8.add", |
