A lightweight, optimized Vim configuration specifically designed for DevOps engineers with intelligent code completion, syntax highlighting, and essential tools for infrastructure management.
- LSP Integration: Advanced code completion via CoC.nvim
- DevOps Focused: Built-in support for Docker, Kubernetes, Terraform, Ansible
- Code Quality: Automatic linting and formatting with ALE
- Performance Optimized: Lazy loading for faster startup
- Git Integration: Seamless version control workflow
- Modern UI: Clean interface with file icons and status line
Install Vim and required dependencies:
macOS:
brew install vim
Ubuntu/Debian:
sudo apt update && sudo apt install vim -y
- Clone the repository:
git clone https://github.com/maateen/vim-for-devops.git
cd vim-for-devops
- Install the configuration:
cp vimrc ~/.vimrc
- Install vim-plug (plugin manager):
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
- Install plugins: Open Vim and run:
:PlugInstall
Technology | Features |
---|---|
Docker | Syntax highlighting, linting with hadolint |
Kubernetes | YAML support, Helm charts |
Terraform | HCL syntax, auto-formatting, tflint integration |
Ansible | Playbook syntax, ansible-lint support |
Python | Black formatting, mypy type checking |
Go | Full language support via vim-go |
YAML/JSON | Advanced parsing and validation |
Shell Scripts | Shellcheck integration |
Nginx | Configuration file syntax |
Vagrant | Vagrantfile support |
Key | Action |
---|---|
Ctrl+s |
Save file |
Ctrl+w |
Close buffer |
Ctrl+z |
Undo |
Ctrl+r |
Redo |
Key | Action |
---|---|
Ctrl+t |
Toggle file explorer |
Ctrl+e |
Find current file in explorer |
Key | Action |
---|---|
Ctrl+i |
Enable IDE mode (Git gutter + file explorer) |
Ctrl+g |
Toggle Git gutter |
Ctrl+f |
Toggle distraction-free mode |
Ctrl+d |
Open terminal below |
Key | Action |
---|---|
gd |
Go to definition |
gy |
Go to type definition |
gi |
Go to implementation |
gr |
Find references |
K |
Show documentation |
<leader>rn |
Rename symbol |
<leader>ca |
Code actions |
Key | Action |
---|---|
<leader>gs |
Git status |
<leader>gd |
Git diff split |
<leader>gl |
Git commit log |
Key | Action |
---|---|
<leader>t |
New tab |
<leader>n |
Next buffer |
<leader>p |
Previous buffer |
Key | Action |
---|---|
<leader>i |
Toggle indent lines |
Key | Action |
---|---|
,cc |
Comment line/selection |
,cu |
Uncomment line/selection |
Leader key is comma (,
)
- onedark.vim: Modern dark theme
- vim-airline: Enhanced status line
- vim-devicons: File type icons
- nerdtree: File explorer with Git integration
- nerdtree-git-plugin: Git integration for NERDTree
- vim-nerdtree-syntax-highlight: Syntax highlighting for NERDTree
- coc.nvim: Language Server Protocol support
- ale: Asynchronous linting and fixing
- auto-pairs: Smart bracket/quote pairing
- nerdcommenter: Intelligent commenting
- vim-fugitive: Git integration
- vim-gitgutter: Git change indicators
- ansible-vim: Ansible syntax support
- vim-terraform: Terraform/HCL support
- vim-kubernetes: Kubernetes YAML support
- Dockerfile.vim: Docker syntax
- vim-helm: Helm chart support
- vim-go: Go development
- vim-markdown: Enhanced Markdown
- JSON.vim: JSON syntax
- vim-yaml: YAML enhancements
- nginx.vim: Nginx configuration
- vim-toml: TOML support
- vim-vagrant: Vagrantfile support
- goyo.vim: Distraction-free writing
- indentLine: Visual indent guides
- trim.nvim: Automatic whitespace cleanup
- webapi-vim: Web API functionality for other plugins
The configuration is modular and well-documented. Key areas for customization:
- Theme: Change
colorscheme onedark
in the theme section - Key mappings: Modify the "Key Mappings" section
- Plugin settings: Adjust in the "Plugin Configs" section
- Linters/Formatters: Update ALE configuration for your tools
- Plugins not loading: Run
:PlugInstall
in Vim - CoC.nvim errors: Install Node.js and run
:CocInstall
for language servers - Linting not working: Ensure tools like
black
,shellcheck
,hadolint
are installed - Icons not showing: Install a Nerd Font and configure your terminal
The configuration uses lazy loading to maintain fast startup times. Plugins load only when needed:
- File type specific plugins load for relevant files
- UI plugins load on command
- Heavy plugins are deferred until first use
Made with ❤️ for DevOps Engineers