add abbreviations

This commit is contained in:
Ray Elliott 2025-12-08 00:06:52 +00:00
parent a57f72f7c7
commit fc250c0be2
7 changed files with 47 additions and 7 deletions

View File

@ -14,6 +14,8 @@ Modern Lua-first Neovim configuration using lazy.nvim, currently in active migra
│ ├── settings.lua # Non-plugin vim options (exrc, secure, spelllang, listchars)
│ ├── keymaps.lua # Non-plugin keymaps
│ ├── autocmds.lua # Non-plugin autocommands
│ ├── abbreviations.lua # Insert-mode abbreviations (typo corrections)
│ ├── netrw-config.lua # Netrw configuration
│ └── plugins/ # One file per plugin/domain (lazy.nvim specs)
│ ├── lsp.lua # LSP via vim.lsp.config + vim.lsp.enable (Neovim 0.11+)
│ ├── cmp.lua # Completion: nvim-cmp + LuaSnip

View File

@ -27,17 +27,18 @@ This repository is being migrated to a modern, minimal Neovim setup driven by Lu
├── settings.lua -- non-plugin options
├── keymaps.lua -- non-plugin keymaps
├── autocmds.lua -- non-plugin autocommands
├── abbreviations.lua -- insert-mode abbreviations
├── netrw-config.lua -- netrw configuration
├── utils.lua -- helpers (only if needed)
└── plugins/ -- one file per plugin or domain
├── neo-tree.lua
├── telescope.lua
├── treesitter.lua
├── cmp.lua
├── lsp.lua
├── copilot.lua
├── oil.lua
├── ufo.lua
├── gitsigns.lua
├── markdown.lua
└── none-ls.lua
```

View File

@ -312,19 +312,27 @@ Source of truth for the step-by-step rebuild. Keep this concise and up to date.
## Phase 10 — Migrate Kept Behaviours
## Phase 10.1 — Confirm scope and priorities
- [ ] Confirm scope and priorities for this phase
- [x] Confirm scope and priorities for this phase
- [x] Decision: Port abbreviations to Lua via vim.cmd.iabbrev
- [x] Decision: Port shell template auto-loading via autocmd + BufReadPost
- [x] Decision: Whitespace highlighting already handled via listchars (Phase 3.2)
- [x] Decision: Skip persistent folds (UFO handles folding, no explicit persistence needed)
## Phase 10.2 — Abbreviations
- [ ] Abbreviations: `adn→and`, `waht→what`, `tehn→then`, `functin→function`, `positin→position`
- [x] Abbreviations: `adn→and`, `waht→what`, `tehn→then`, `functin→function`, `positin→position`
- [x] Created dedicated `lua/abbreviations.lua` for modularity and easier maintenance
## Phase 10.3 — Templates
- [ ] Templates: auto-populate new `.sh` from template
- [x] Templates: auto-populate new `.sh` from template
- [x] Added BufNewFile autocmd for *.sh in lua/autocmds.lua
## Phase 10.4 — Whitespace highlighting
- [ ] Whitespace highlighting (modern approach)
- [x] Whitespace highlighting (modern approach)
- [x] Note: Already handled via listchars in Phase 3.2 (settings.lua)
## Phase 10.5 — Persistent folds
- [ ] Persistent folds (via UFO)
- [x] Persistent folds (via UFO) -- no need, this is no longer required.
- [x] Note: UFO handles folding; no explicit persistence mechanism needed
## Phase 11 — Cleanup & Validation

View File

@ -78,6 +78,11 @@ Record every decision here with a short rationale. Append new entries; do not re
- Markdown: 2 spaces (Prettier)
- Python: 4 spaces (Black/PEP 8)
- **Global defaults**: 4 spaces (reasonable baseline for other filetypes)
- 2025-12-07: Kept Behaviors Phase 10:
- **Abbreviations**: Common typo corrections (`adn→and`, `waht→what`, `tehn→then`, `functin→function`, `positin→position`) in dedicated `lua/abbreviations.lua` file for modularity
- **Templates**: Shell script template (template.sh) auto-loaded via BufNewFile autocmd for `*.sh` files
- **Whitespace highlighting**: Already handled via `listchars` in Phase 3.2 (settings.lua)
- **Persistent folds**: Not needed; UFO handles folding without explicit persistence mechanism
## Project-Local Configuration (design)

View File

@ -7,6 +7,7 @@ require('settings')
require('netrw-config')
require('keymaps')
require('autocmds')
require('abbreviations')
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'

10
lua/abbreviations.lua Normal file
View File

@ -0,0 +1,10 @@
-- Abbreviations (common typo corrections)
-- Phase 10.2: Insert-mode abbreviations for frequent typos
vim.cmd.iabbrev('adn', 'and')
vim.cmd.iabbrev('waht', 'what')
vim.cmd.iabbrev('tehn', 'then')
vim.cmd.iabbrev('functin', 'function')
vim.cmd.iabbrev('positin', 'position')
return {}

View File

@ -1,6 +1,19 @@
-- Non-plugin autocommands (minimal placeholder for bootstrap)
local aug = vim.api.nvim_create_augroup('UserDefaults', { clear = true })
-- Phase 10.3: Templates (auto-populate new files from templates)
local template_aug = vim.api.nvim_create_augroup('Templates', { clear = true })
vim.api.nvim_create_autocmd("BufNewFile", {
group = template_aug,
pattern = "*.sh",
callback = function()
-- Read template at top of file, then move to end
vim.cmd('0read ~/.config/nvim/templates/template.sh')
vim.cmd('normal! G')
end,
})
-- Phase 9.4: Per-filetype indentation settings to match formatters
-- PHP: WordPress coding standards (tabs, displayed as 2 spaces)