This Neovim setup uses lazy.nvim for plugin management. It's configured for modern development with features like:
- Appearance:
material.nvimtheme,lualinestatusline,barbecuecode context. - Navigation/Finding:
nvim-treefile explorer,telescopefuzzy finder. - Editing:
autopairs,treesitterfor syntax,which-keyhints. - Code Intelligence (PHP/Python focused):
- Uses
nvim-lspconfigfor LSP features (diagnostics, go-to-definition). - Uses
none-lsfor formatting (php-cs-fixer,black,isort) and linting (mypy,flake8). - Uses
nvim-cmpfor autocompletion (LSP, buffer, path, snippets).
- Uses
- Key Feature: Both LSP servers (
phpactor,pyright) andnone-lsformatters/linters are conditionally loaded only if their corresponding external tools are detected on the system, making the configuration robust even if some tools aren't installed. Python formatting is explicitly delegated tonone-ls.
-
Prerequisites:
- Neovim (version 0.11 or later recommended).
- Git.
- (Optional but Recommended) A Nerd Font installed and configured in your terminal for icons.
- (Optional) External tools for enhanced features (e.g.,
phpactor,pyright-langserver,php-cs-fixer,black,isort,mypy,flake8). The configuration will work without them but provide fewer features.
-
Clone the Repository:
- Clone this repository to a location of your choice. A common place is
~/.config/nvim. - If you clone it elsewhere, adjust the path in the next step.
# Example: Clone directly into the standard Neovim config location # Make sure to back up your existing ~/.config/nvim first if you have one! git clone https://github.com/your-username/your-repo-name.git ~/.config/nvim
- Alternatively, if you prefer to keep the repository elsewhere (e.g., in a
~/dotfilesdirectory):(Replace# Clone to a different location git clone https://github.com/your-username/your-repo-name.git ~/dotfiles/nvim # Back up your existing Neovim config (if any) # mv ~/.config/nvim ~/.config/nvim.bak # Create a symbolic link ln -s ~/dotfiles/nvim ~/.config/nvim
your-username/your-repo-namewith the actual repository URL)
- Clone this repository to a location of your choice. A common place is
-
Launch Neovim:
- Open Neovim (
nvim). lazy.nvimwill automatically bootstrap itself and install all the configured plugins on the first run. Wait for this process to complete.
- Open Neovim (
-
Enjoy!
- Your Neovim setup is ready. Explore the features and consider adding your own customizations as described below.
This configuration supports user-specific overrides without modifying the core files tracked by Git.
-
Create the Custom Directory:
- Inside your Neovim configuration directory (
~/.config/nvim/or similar), create alua/custom/directory. - This directory (
lua/custom/) is automatically ignored by Git (as defined in.gitignore).
- Inside your Neovim configuration directory (
-
Override Core Settings:
- To override general Neovim settings (options, autocommands, globals, etc.), create a file named
lua/custom/settings.lua. - Any Lua code placed here will be executed after the base
lua/config/settings.luabut before plugins are loaded. - Example
lua/custom/settings.lua:-- Disable relative line numbers vim.opt.relativenumber = false -- Add a custom global variable vim.g.my_custom_setting = true -- Add a custom autocommand vim.api.nvim_create_autocmd('BufEnter', { pattern = '*.md', command = 'echo "Entering a Markdown file!"', })
- To override general Neovim settings (options, autocommands, globals, etc.), create a file named
-
Add or Override Plugins:
- To add new plugins or modify the configuration of existing ones managed by
lazy.nvim, create.luafiles insidelua/custom/plugins/. - Each
.luafile in this directory should return a standardlazy.nvimplugin specification (a table or a list of tables). - These specifications will be merged with the base plugin configurations. For overrides,
lazy.nvimoften merges options (opts = {...}), allowing you to change specific settings without redefining the entire plugin setup. - Example
lua/custom/plugins/my_extra_plugin.lua(Adding a new plugin):return { "some-author/some-plugin.nvim", config = function() require("some-plugin").setup() end, }
- Example
lua/custom/plugins/telescope_override.lua(Overriding existing plugin options):return { "nvim-telescope/telescope.nvim", -- Only specify the options you want to change or add opts = { defaults = { -- Override the default file ignore patterns file_ignore_patterns = { ".git/", "node_modules/", "__pycache__/" }, }, }, }
- To add new plugins or modify the configuration of existing ones managed by
Any files placed in lua/custom/ will automatically be loaded if they exist, allowing you to tailor the configuration to your specific needs without creating conflicts with future updates from the main repository.