Compare commits
5 Commits
897d1e8d7b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a515f65f7d | ||
|
|
7b0cdd0b2d | ||
|
|
abfadff35e | ||
|
|
736a2699b9 | ||
|
|
73bb97ed1d |
57
AGENTS.md
Normal file
57
AGENTS.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# AGENTS.md - Neovim Configuration Guide
|
||||
|
||||
## Overview
|
||||
This is a kickstart.nvim fork - a modular Neovim configuration written in Lua. Code is organized in:
|
||||
- `/init.lua` - Main entry point (kept concise for learning)
|
||||
- `/lua/custom/` - User custom configurations and plugins
|
||||
- `/lua/kickstart/` - Core plugin configurations
|
||||
|
||||
## Code Style Guidelines
|
||||
|
||||
### Lua Formatting
|
||||
- **Formatter**: Stylua (enforced via CI)
|
||||
- **Config**: `.stylua.toml` (column_width=160, indent=2 spaces, auto quote style)
|
||||
- **Command**: `stylua .` to format all files, `stylua --check .` to verify
|
||||
|
||||
### Code Conventions
|
||||
- **Imports**: Use `require()` to load modules; prefer relative paths from `/lua/`
|
||||
- **Comments**: Use `--` for single-line, `--[[` for block comments; include URLs for plugins
|
||||
- **Naming**: snake_case for variables/functions, PascalCase for classes
|
||||
- **Lua tables**: Preferred data structure; use clear key names
|
||||
- **Error handling**: Use `pcall()` for risky operations; fail gracefully with fallbacks
|
||||
|
||||
### Plugin Structure
|
||||
- Each plugin is a separate file returning a table with name, dependencies, config
|
||||
- Use `event`, `cmd`, `ft` keys for lazy-loading optimization
|
||||
- Config functions should be self-contained and well-commented
|
||||
|
||||
## Build/Lint/Test Commands
|
||||
|
||||
### Format & Lint
|
||||
```bash
|
||||
# Format all Lua files
|
||||
stylua .
|
||||
|
||||
# Check formatting without changing files
|
||||
stylua --check .
|
||||
|
||||
# Format specific file
|
||||
stylua path/to/file.lua
|
||||
```
|
||||
|
||||
### No traditional tests
|
||||
This is a configuration repo, not a testable library. Validation is manual:
|
||||
- Start Neovim: `nvim`
|
||||
- Check `:Lazy` status for plugin errors
|
||||
- Review `:checkhealth` for configuration issues
|
||||
- Test manually in editor to verify keymaps/features work
|
||||
|
||||
### Linting
|
||||
- Neovim's built-in Lua LSP provides type checking (integrated via plugin)
|
||||
- The GitHub Actions workflow runs `stylua --check` on PRs
|
||||
|
||||
## Key Notes
|
||||
- **Language**: Lua 5.1+ (Neovim's version)
|
||||
- **No external build process**: Configuration is interpreted at runtime
|
||||
- **Plugin manager**: Lazy.nvim (auto-installs missing plugins on startup)
|
||||
- **Target**: Latest Neovim stable + nightly versions
|
||||
7
init.lua
7
init.lua
@@ -643,6 +643,9 @@ require('lazy').setup({
|
||||
},
|
||||
},
|
||||
},
|
||||
ansiblels = {
|
||||
filetypes = { 'yaml.ansible', 'ansible' },
|
||||
},
|
||||
}
|
||||
|
||||
-- Ensure the servers and tools above are installed
|
||||
@@ -658,6 +661,7 @@ require('lazy').setup({
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
'stylua', -- Used to format Lua code
|
||||
'ansible-language-server', -- Ansible LSP for YAML Ansible files
|
||||
})
|
||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||
|
||||
@@ -896,8 +900,9 @@ require('lazy').setup({
|
||||
},
|
||||
{ -- Highlight, edit, and navigate code
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
lazy = false,
|
||||
build = ':TSUpdate',
|
||||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||
main = 'nvim-treesitter.config', -- Sets main module to use for opts
|
||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||
opts = {
|
||||
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
|
||||
|
||||
21
lua/custom/plugins/ansible.lua
Normal file
21
lua/custom/plugins/ansible.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
-- Ansible configuration for detecting .yml files in roles and playbooks directories
|
||||
return {
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
optional = true,
|
||||
-- This table sets up file type detection for Ansible files
|
||||
init = function()
|
||||
-- Set up autocommand to detect Ansible files and set their filetype
|
||||
local ansible_augroup = vim.api.nvim_create_augroup('ansible-detection', { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||
group = ansible_augroup,
|
||||
pattern = { '*/roles/**/*.yml', '*/roles/**/*.yaml', '*/playbooks/**/*.yml', '*/playbooks/**/*.yaml', '*/hosts/**/*.yml', '*/hosts/**/*.yaml' },
|
||||
callback = function()
|
||||
vim.bo.filetype = 'yaml.ansible'
|
||||
end,
|
||||
desc = 'Set filetype to yaml.ansible for Ansible files',
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -7,6 +7,10 @@ return {
|
||||
require('copilot').setup {
|
||||
suggestion = { enabled = false },
|
||||
panel = { enabled = false },
|
||||
filetypes = {
|
||||
yaml = true,
|
||||
['yaml.ansible'] = true,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
@@ -21,8 +25,12 @@ return {
|
||||
cmd = 'Copilot',
|
||||
config = function()
|
||||
require('copilot').setup {
|
||||
suggestion = { enabled = false },
|
||||
panel = { enabled = false },
|
||||
suggestion = { enabled = true },
|
||||
panel = { enabled = true },
|
||||
filetypes = {
|
||||
yaml = true,
|
||||
['yaml.ansible'] = true,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
@@ -2,4 +2,6 @@
|
||||
-- I promise not to create any merge conflicts in this directory :)
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
return {}
|
||||
return {
|
||||
require 'custom.plugins.ansible',
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ return {
|
||||
'akinsho/toggleterm.nvim',
|
||||
-- [[ cmd = { "toggleterm", "termexec" }, ]]
|
||||
opts = {
|
||||
-- close_on_exit = false,
|
||||
highlights = {
|
||||
normal = { link = 'normal' },
|
||||
normalnc = { link = 'normalnc' },
|
||||
@@ -24,7 +25,7 @@ return {
|
||||
return vim.o.columns * 0.4
|
||||
end
|
||||
end,
|
||||
shell = 'pwsh',
|
||||
shell = 'bash',
|
||||
open_mapping = [[<f12>]],
|
||||
shading_factor = 2,
|
||||
direction = 'float',
|
||||
|
||||
Reference in New Issue
Block a user