feat: enable linting for shell/Go/markdown; disable neo-tree netrw hijack; rewrite README
This commit is contained in:
parent
3cc83315b0
commit
d490eb8b7e
76
README.md
76
README.md
|
|
@ -1,52 +1,72 @@
|
||||||
# Neovim Development Environment
|
# Neovim Development Environment
|
||||||
|
|
||||||
A highly opinionated, single-file Neovim configuration built for performance, transparency, and a terminal-native workflow.
|
A single-file Neovim configuration forked from Kickstart.nvim, tuned for infrastructure and backend development.
|
||||||
|
|
||||||
## Philosophy
|
## Philosophy
|
||||||
|
|
||||||
This configuration is intentionally streamlined. It avoids the bloat of heavy distributions in favor of a clear, maintainable `init.lua` that acts as its own documentation.
|
- **Built for DevOps:** Deep integrations for Go, Terraform/HCL, Bicep, PowerShell, Ansible, Jinja, and Bash.
|
||||||
|
- **vim.pack native:** Uses Neovim 0.12+'s built-in `vim.pack` plugin manager — no external plugin manager needed.
|
||||||
* **Built for Infrastructure & Backend:** Tuned specifically for a DevOps engineering workflow, with deep integrations for Go, Terraform, Bicep, and bash scripting.
|
- **Terminal-native:** Keyboard-driven. No GUI fluff.
|
||||||
* **Terminal-Native:** Optimized for fast, keyboard-driven navigation. No unnecessary GUI abstractions.
|
- **Modular:** Each plugin lives in its own file under `lua/kickstart/plugins/`. Enable or disable by commenting a single `require` in Section 10 of `init.lua`.
|
||||||
* **Radical Transparency:** Every line of code is meant to be understood. The configuration is a foundation, ready to be scaled or refactored as tooling requirements evolve.
|
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
This setup expects a modern Unix environment. It is primarily developed and tested on Arch Linux.
|
Arch Linux:
|
||||||
|
|
||||||
Ensure you have the following system dependencies installed so tools like Telescope and Treesitter compile correctly:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo pacman -S --needed neovim gcc make git ripgrep fd tree-sitter-cli unzip xclip
|
sudo pacman -S --needed neovim gcc make git ripgrep fd tree-sitter-cli unzip xclip
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Optional but recommended:
|
||||||
|
```bash
|
||||||
|
sudo pacman -S --needed shellcheck golangci-lint # for linting
|
||||||
|
```
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
**1. Prepare the Environment**
|
|
||||||
Back up any existing configuration and clear the local share directory to avoid plugin conflicts.
|
|
||||||
```bash
|
```bash
|
||||||
|
# Backup existing config
|
||||||
mv ~/.config/nvim ~/.config/nvim.bak
|
mv ~/.config/nvim ~/.config/nvim.bak
|
||||||
rm -rf ~/.local/share/nvim
|
rm -rf ~/.local/share/nvim
|
||||||
|
|
||||||
|
# Clone and bootstrap
|
||||||
|
git clone https://github.com/<your-username>/nvim.git ~/.config/nvim
|
||||||
|
nvim # Plugins auto-install on first run
|
||||||
```
|
```
|
||||||
|
|
||||||
**2. Clone the Repository**
|
## Core Stack
|
||||||
```bash
|
|
||||||
git clone https://github.com/YOUR_GITHUB_USERNAME/kickstart.nvim.git ~/.config/nvim
|
|
||||||
```
|
|
||||||
|
|
||||||
**3. Bootstrap**
|
| Category | Tooling |
|
||||||
Launch Neovim. The package manager will automatically pull and compile all plugins on the first run.
|
|---|---|
|
||||||
```bash
|
| **LSP** | gopls, terraformls, ansiblels, jinja_lsp, powershell_es, pyright, bicep-lsp, lua_ls |
|
||||||
nvim
|
| **Autocomplete** | blink.cmp + LuaSnip |
|
||||||
```
|
| **Fuzzy Finder** | Telescope.nvim (ripgrep + fd + fzf-native) |
|
||||||
|
| **Parsing** | Treesitter (auto-installs parsers on demand) |
|
||||||
|
| **Formatting** | conform.nvim — autoformat on save for go, hcl, ps1, lua; external hclfmt for HCL |
|
||||||
|
| **Linting** | nvim-lint — shellcheck (bash/sh/zsh), golangci-lint (Go), markdownlint (markdown) |
|
||||||
|
| **Git** | gitsigns.nvim — hunk staging, blame, diff, text objects |
|
||||||
|
| **File Tree** | neo-tree.nvim — toggle with `<leader>ff` |
|
||||||
|
| **Debug** | nvim-dap + dap-ui + dap-go (commented out by default) |
|
||||||
|
|
||||||
## Core Stack & Integrations
|
## Custom Keymaps
|
||||||
|
|
||||||
* **LSP & Linting:** Native Neovim LSP setup configured for `gopls`, `terraform-ls`, and `bicep-lsp`.
|
| Key | Action |
|
||||||
* **Fuzzy Finding:** Telescope.nvim powered by `ripgrep` and `fd` for instant project-wide navigation.
|
|---|---|
|
||||||
* **Parsing:** Treesitter for high-performance syntax highlighting and structural code manipulation.
|
| `<C-s>` | Save file (insert + normal mode) |
|
||||||
|
| `<PageUp>` / `<PageDown>` | Scroll up/down |
|
||||||
|
| `<C-h/j/k/l>` | Navigate splits |
|
||||||
|
| `<leader>ff` | Toggle neo-tree file explorer |
|
||||||
|
| `<leader>fb` | Toggle neo-tree buffer explorer |
|
||||||
|
| `<leader>sf` | Telescope find files |
|
||||||
|
| `<leader>sg` | Telescope live grep |
|
||||||
|
| `<leader>f` | Format buffer |
|
||||||
|
| `<leader>hs` | Stage git hunk |
|
||||||
|
| `<leader>hr` | Reset git hunk |
|
||||||
|
| `<leader>tb` | Toggle git blame |
|
||||||
|
|
||||||
## Management & Updates
|
## Management
|
||||||
|
|
||||||
* **Inspect State:** Run `:lua vim.pack.update(nil, { offline = true })`
|
- **Check plugin status:** `:lua vim.pack.update(nil, { offline = true })`
|
||||||
* **Apply Updates:** Run `:lua vim.pack.update()` (`:write` to apply, `:quit` to cancel)
|
- **Update plugins:** `:lua vim.pack.update()` (`:write` to apply, `:quit` to cancel)
|
||||||
|
- **Health check:** `:checkhealth kickstart`
|
||||||
|
- **Add a plugin:** Create `lua/kickstart/plugins/<name>.lua`, add `require 'kickstart.plugins.<name>'` in init.lua Section 10
|
||||||
|
- **Disable a plugin:** Comment its `require` in init.lua Section 10
|
||||||
|
|
|
||||||
|
|
@ -1,53 +1,26 @@
|
||||||
-- Linting
|
-- Linting: static analysis that catches logic bugs, unused vars, security issues.
|
||||||
|
-- Different from formatting: linting finds problems; formatting fixes appearance.
|
||||||
|
-- Runs on BufEnter, BufWritePost, and InsertLeave for modifiable buffers.
|
||||||
|
local gh = require('kickstart.util').gh
|
||||||
|
|
||||||
vim.pack.add { 'https://github.com/mfussenegger/nvim-lint' }
|
vim.pack.add { gh 'mfussenegger/nvim-lint' }
|
||||||
|
|
||||||
local lint = require 'lint'
|
local lint = require 'lint'
|
||||||
|
|
||||||
lint.linters_by_ft = {
|
lint.linters_by_ft = {
|
||||||
markdown = { 'markdownlint' }, -- Make sure to install `markdownlint` via mason / npm
|
markdown = { 'markdownlint' },
|
||||||
|
sh = { 'shellcheck' },
|
||||||
|
bash = { 'shellcheck' },
|
||||||
|
zsh = { 'shellcheck' },
|
||||||
|
go = { 'golangcilint' },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
|
||||||
-- instead set linters_by_ft like this:
|
|
||||||
-- lint.linters_by_ft = lint.linters_by_ft or {}
|
|
||||||
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
|
|
||||||
--
|
|
||||||
-- However, note that this will enable a set of default linters,
|
|
||||||
-- which will cause errors unless these tools are available:
|
|
||||||
-- {
|
|
||||||
-- clojure = { "clj-kondo" },
|
|
||||||
-- dockerfile = { "hadolint" },
|
|
||||||
-- inko = { "inko" },
|
|
||||||
-- janet = { "janet" },
|
|
||||||
-- json = { "jsonlint" },
|
|
||||||
-- markdown = { "vale" },
|
|
||||||
-- rst = { "vale" },
|
|
||||||
-- ruby = { "ruby" },
|
|
||||||
-- terraform = { "tflint" },
|
|
||||||
-- text = { "vale" }
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- You can disable the default linters by setting their filetypes to nil:
|
|
||||||
-- lint.linters_by_ft['clojure'] = nil
|
|
||||||
-- lint.linters_by_ft['dockerfile'] = nil
|
|
||||||
-- lint.linters_by_ft['inko'] = nil
|
|
||||||
-- lint.linters_by_ft['janet'] = nil
|
|
||||||
-- lint.linters_by_ft['json'] = nil
|
|
||||||
-- lint.linters_by_ft['markdown'] = nil
|
|
||||||
-- lint.linters_by_ft['rst'] = nil
|
|
||||||
-- lint.linters_by_ft['ruby'] = nil
|
|
||||||
-- lint.linters_by_ft['terraform'] = nil
|
|
||||||
-- lint.linters_by_ft['text'] = nil
|
|
||||||
|
|
||||||
-- Create autocommand which carries out the actual linting
|
|
||||||
-- on the specified events.
|
|
||||||
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||||
group = lint_augroup,
|
group = lint_augroup,
|
||||||
callback = function()
|
callback = function()
|
||||||
-- Only run the linter in buffers that you can modify in order to
|
if vim.bo.modifiable then
|
||||||
-- avoid superfluous noise, notably within the handy LSP pop-ups that
|
lint.try_lint()
|
||||||
-- describe the hovered symbol using Markdown.
|
end
|
||||||
if vim.bo.modifiable then lint.try_lint() end
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ require('neo-tree').setup {
|
||||||
|
|
||||||
-- Configuration for filesystem source (files, folders)
|
-- Configuration for filesystem source (files, folders)
|
||||||
filesystem = {
|
filesystem = {
|
||||||
|
hijack_netrw_behavior = "disabled", -- Don't auto-open on `nvim .`
|
||||||
filtered_items = {
|
filtered_items = {
|
||||||
visibility = 'all', -- Show: all | visible_filtered | filtered
|
visibility = 'all', -- Show: all | visible_filtered | filtered
|
||||||
hide_dotfiles = false, -- Hide files starting with .
|
hide_dotfiles = false, -- Hide files starting with .
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue