Skip to content

superDross/spellbound.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpellBound.nvim ✨

Spelling commands and mappings for Neovim.

Features

  • Automatically turn on spelling for certain file types
  • Add mapping and command for toggling spelling on/off
  • Add mappings for fixing spelling relative to the cursor in both normal and insert mode

Installation and Requirements

Requires Neovim 0.7+

Ensure a dictionary is set in your init.lua file:

vim.o.dictionary = '/usr/share/dict/cracklib-small'

The easiest way to get the above file within your filesystem is to download the Cracktime-Runtime package.

With Packer.nvim:

require('packer').startup(function(use)
  use 'superDross/spellbound.nvim'
end)

Commands

  • :SpellingToggle -- toggle spelling on/off

Configuration & Mappings

  • mapping.toggle_map -- mapping for toggling spelling on/off (default: Ctrl-S)
  • mapping.fix_right -- fix the nearest spelling mistake to the right of the cursor with the first suggestion (default: Ctrl-l)
  • mapping.fix_left -- fix the nearest spelling mistake to the left of the cursor with the first suggestion (default: Ctrl-h)
  • language -- language to check spelling against
  • autospell_filetypes -- filetypes that should have spelling activated when opened
  • autospell_gitfiles -- activate spelling for git commit and rebase buffers
  • number_suggestions -- number of suggestions to display with z=
  • return_to_position -- return to the original cursor position after executing fix_right/fix_left mapping
  • highlight.bg_colour -- background colour of the highlight (default: lightgreen)
  • highlight.fg_colour -- foreground colour of the highlight (default: black)
  • highlight.timer -- number of microseconds in which the highlight will flash for (default: 500)

Defaults

-- default settings
vim.g.spellbound_settings = {
  mappings = {
    toggle_map = '<C-s>',
    fix_right  = '<C-l>',
    fix_left   = '<C-h>',
  },
  language     = 'en_gb',
  autospell_filetypes = { '*.txt', '*.md', '*.rst' },
  autospell_gitfiles = true,
  number_suggestions = 10,
  return_to_position = false,
}

Custom Configuration

To change the language to Spanish and toggle map key, but keep the fix maps defaults, then add the following to your init.lua:

vim.g.spellbound_settings = {
  mappings = {
    toggle_map = '<Leader>s'
  },
  language     = 'es',
}

About

Spelling configurations and mapping for neovim

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages