/ nvim / README.md
README.md
  1  # nvim
  2  
  3  <a href="https://dotfyle.com/silveiralexf/dotfiles-nvim"><img src="https://dotfyle.com/silveiralexf/dotfiles-nvim/badges/plugins?style=flat" alt="badge-plugins" /></a>
  4  <a href="https://dotfyle.com/silveiralexf/dotfiles-nvim"><img src="https://dotfyle.com/silveiralexf/dotfiles-nvim/badges/plugin-manager?style=flat" alt="badge-plugin-manager-name" /></a>
  5  
  6  My personal Neovim configurations.
  7  
  8  **Pack-native (WIP):** On branch `feat/nvim-pack-native`, plugins are managed by Neovim's built-in **vim.pack** (0.12+) instead of LazyVim. See [.cursor/plans/2026-02-27_silveiralexf_nvim-pack-native.plan.md](../.cursor/plans/2026-02-27_silveiralexf_nvim-pack-native.plan.md). Entry: `init.lua` → `require('pack').setup()`; each `lua/plugins/*.lua` must return `{ specs = { { src = '...', name = '...' } }, config = function() ... end }` for pack to install and load it. **Only files that have a `specs` table with at least one entry containing `src` are installed;** files that still use the old Lazy format (`return { { 'author/name', opts = ... } }` without `specs`) are ignored and not loaded.
  9  
 10  **Plugins with pack specs (installed/loaded):** cloak, colorscheme, conform, cursoragent, devicons, dressing, editor, fzf, formatting, git, go, indent, kcl, kustomize, lazydev, lsp, lualine, luarocks, matchup, mini, modelmate, neotest, noice, nui, nvim-nio, opencode, plenary, quickfix, spectre, sops, treesitter, trouble, tmux, undotree, wakatime, whichkey, yaml-companion, yazi, zig.
 11  
 12  **Plugins without pack specs (intentionally not installed):** disabled.
 13  
 14  ![preview](../images/nvim_screenshot.png)
 15  
 16  Check the reference below on how things are organized:
 17  
 18  ```bash
 19   .
 20  ├──  init.lua               # Entry (pack-native branch: pack; else LazyVim)
 21  ├──  lazy-lock.json
 22  ├──  lazyvim.json
 23  ├──  README.md
 24  ├──  lua
 25  │   ├──  config
 26  │   │   ├──  autocmds.lua    # Autocmds such as file types, LSP attach configs
 27  │   │   ├──  keymaps.lua     # Keybindings
 28  │   │   ├──  lazy.lua
 29  │   │   └──  options.lua     # Neovim global options
 30  │   │
 31  │   ├──  pack.lua            # vim.pack aggregator (pack-native)
 32  │   │
 33  │   ├──  lsp
 34  │   │   ├──  config.lua      # Language server settings
 35  │   │   └──  servers         # Customization per language server
 36  │   │
 37  │   ├──  plugins             # Plugin specs { specs, lazy } (pack-native)
 38  │   │   ├──  colorscheme.lua # Color theme
 39  │   │   ├──  dressing.lua    # Overall aesthetics
 40  │   │   ├──  editor.lua      # Editor settings
 41  │   │   ├──  formatting.lua  # Formatting and visual options in general
 42  │   │   │
 43  │   └──  utils               # Misc utilities
 44  │       └──  luasnip.lua
 45 46  └──  spell                   # Spellchecker dictionary
 47      ├──  en.utf-8.add
 48      └──  en.utf-8.add.spl
 49  ```
 50  
 51  ## Portability (macOS + Linux)
 52  
 53  This config is intended to work the same on **macOS** (work machine), **Omarchy Linux** (desktop), and **Ubuntu** (e.g. VPS). Avoid hardcoded OS paths (`/opt/homebrew`, `/home/...`) and OS-only commands; use `vim.env.HOME` / `vim.fn.expand('~')` for paths and PATH for binaries. Where behavior must differ (e.g. URL opener), use `vim.uv.os_uname().sysname` (e.g. `open` on Darwin, `xdg-open` on Linux).
 54  
 55  ## Optional dependencies (fix :checkhealth warnings)
 56  
 57  **LuaRocks.nvim** (pack spec in `lua/plugins/luarocks.lua`) installs Lua rocks such as **jsregexp** (LuaSnip) and **fzy**. You must run its build once after the plugin is installed:
 58  
 59  ```bash
 60  task nvim:luarocks-build
 61  ```
 62  
 63  Then start Neovim; `luarocks-nvim` will install the rocks listed in its config. Restart Neovim afterward so `package.path` includes them.
 64  
 65  For **tree-sitter-cli** (nvim-treesitter):
 66  
 67  ```bash
 68  task nvim:deps
 69  ```
 70  
 71  Or install manually: `npm install -g tree-sitter-cli@0.26.1` or `brew install tree-sitter`.
 72  
 73  Mason "Composer not available" / "julia not available" are optional language runtimes; install with `brew install composer` or `brew install julia` only if you need PHP or Julia.
 74  
 75  ## Disclaimer
 76  
 77  This setup assumes the following:
 78  
 79  - **macOS or Linux** (same config for both; see Portability above).
 80  - [WezTerm](../wezterm/README.md) as terminal.
 81  - [Yazi](../yazi/README.md) for file navigation, instead of `NerdTree` or `NetRw`.
 82  - [Tmux](../tmux/README.md) as terminal multiplexer.
 83  - [LazyVim](https://www.lazyvim.org/) as package manager,
 84  - [Mason](https://github.com/williamboman/mason.nvim/) and [vhyrro/luarocks.nvim](https://github.com/vhyrro/luarocks.nvim) for installing dependencies.
 85  - [blink-cmp](https://github.com/Saghen/blink.cmp),
 86    [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)
 87    and [tree-sitter](https://github.com/tree-sitter/tree-sitter)
 88    for LSP configurations, code-completion, syntax-highlighting, etc.
 89  - [Prettier](https://prettier.io/docs/configuration/) for code formatting.
 90  
 91  ## How to install?
 92  
 93  ```bash
 94  # Generate timestamp and random string for unique backup names
 95  timestamp=$(date '+%Y%m%d-%H%M%S')
 96  suffix="bak-${timestamp}"
 97  
 98  # backup previously existing settings
 99  [ -d ~/.config/nvim ] && mv ~/.config/nvim{,."${suffix}"}
100  
101  # optional but recommended
102  [ -d ~/.local/share/nvim ] && mv ~/.local/share/nvim{,."${suffix}"}
103  [ -d ~/.local/state/nvim ] && mv ~/.local/state/nvim{,."${suffix}"}
104  [ -d ~/.cache/nvim ] && mv ~/.cache/nvim{,."${suffix}"}
105  
106  # clone the main repo and move nvim configs
107  # to its default location
108  git clone https://github.com/silveiralexf/.dotfiles
109  mv .dotfiles/nvim ~/.config/nvim
110  
111  # To have all plugins installed just go into
112  # the directory and start nvim
113  cd ~/.local/nvim
114  nvim .
115  ```
116  
117  ## Supported LSPs
118  
119  All LSPs listed below are fully configured with syntax-highlighting,
120  auto-completion, formatting, linting and different tweaks:
121  
122  - angularls
123  - bashls
124  - clangd
125  - cmake
126  - docker_compose_language_service
127  - dockerls
128  - eslint
129  - golangci_lint_ls
130  - gopls
131  - groovyls
132  - helm_ls
133  - html
134  - jdtls
135  - jsonls
136  - lua_ls
137  - marksman
138  - pylsp
139  - rust_analyzer
140  - taplo
141  - terraformls
142  - tflint
143  - tsserver
144  - volar
145  - vuels
146  - yamlls
147  - zls
148  
149  ### References & Inspirations
150  
151  A big shout-out to thank the amazing folks, from which I borrowed ideas,
152  and code to use as starting point for my own personal setup:
153  
154  - [github.com/yriveiro/nvim-files](https://github.com/yriveiro/nvim-files/tree/lazyvim)
155  - [hamptonmoore/nvim-glow](https://hamptonmoore.com/posts/nvim-glow/)
156  - [github.com/jpmcb/nvim-llama](https://github.com/jpmcb/nvim-llama)