haelle.vimrc
Ansible vimrc
This is an Ansible role that installs NeoVim along with a few plugins.
To use it, you need to install the Ansible community tasks:
ansible-galaxy collection install community.general
Dependencies
- ⚠ Warning: This will install NodeJS & npm using the package manager. ⚠
- Install Fzf and Ag for searching
Objectives
It provides complete support for the following languages/syntax:
- Ruby/RoR
- HTML
- Javascript
- VueJS
- React
- Ansible
- JSON
- YAML
- Markdown
- C#
The goal is to have zero bugs.
Theme & Font
The current theme is slate (you can also use desert or industry); change it using :colorscheme xxx, and see available themes with Tab.
The current font is MesloLGS NF Regular (supports emojis) set for Zsh.
Plugins
To install plugins, use: :PlugInstall (they are already installed by Ansible).
Navigation
To help you navigate, use :help keycodes for vim keycode names.
You can also navigate using splits, tabs, and Tmux:
<C-w f>: open in a split<C-w gf>: open in a tab<C-⬅,⬆,⬇,➡>: move between panels<C-w-⬅,⬆,⬇,➡>: move the panelgt: switch between vim tabs<C-b>: trigger Tmux navigation
Active Functionalities
gd: go to definitiongi: go to implementationgr: navigate through referencesgf: go to file (only for Ruby/Rails)gg=G: reformat the codeF2: rename variable/method/class<C-k>: show method definitionqf: run linter fix (might not work well...)fr: run formatter on the current line (may not work for Solargraph/Ruby)fa: run formatter on the whole file<C-o>: go back<C-s>: save<C-space>: trigger autocompletion<tab>: navigate through completion suggestions<C-c>: comment/uncomment (line or selection)bufdo!: use!to avoid saving files (this setting is necessary...)
For Ruby & Rails:
<C-q>: switch between Ruby spec and file<C-w>t/s/l/a: run test/spec (file, nearest, last, all)
Other:
- Suspend vim with
Ctrl+zand return withfg.
Automatic / Passive Functionalities
- Spell-checking
- Syntax highlighting
- Auto lint in gutter & float window
- Use 2 spaces for tabs everywhere
- Remember cursor position between sessions
- Remove trailing lines on save
- Trim whitespaces
- Show all invisible characters
- Highlight 'TODO/FIXME/XXX' keywords
- Improve vim resizing
- Add pairs for () [] tags...
- Add Ruby pairs (def/end, do/end)
- Show Git info in the gutter
- Show linter info in the gutter or with underline
- Display method definition when available (use
<C-a>and<C-b>to scroll back and forth)
Search
Active:
<C-f>: search in the current file (basic vim)<Shift-f>: search all files (using fzf.vim / ag)- Warning: You might need to disable terminal search for it to work.
<Esc>: cancel search (remove highlighting)<C-p>: search for a file by name (using fzf.vim)Enter: open the file<C-t>: open in a new tab<C-x>: open in a horizontal split<C-v>: open in a vertical split
Passive:
- Highlight results in DarkGreen
- Highlight current selection with a blinking cursor
Sidebar (NerdTree)
Active
<C-n>: open/close NerdTreeEnter: open the filei: open in a horizontal splits: open in a vertical split- ... see NerdTree documentation
Passive
- Icons for files
- Symbols based on Git status
- Ignore certain folders (
node_modules,.gitignore)
Ruby - Seeing is Believing
Use F4/F5/F6/F7 to mark/run/mark&run/clear marks in the code.
Conquer of Completion
Plugins will install the first time you start.
For Solargraph, you need to install it for each Ruby version you are using:
:InstallGems
Useful commands:
:CocInfo:CocList commands:checkhealth:CocList extensions:call CocAction('format'):CocList marketplace python
Check the available extensions:
- javascriptreact
- typescript
- typescriptreact
- typescript.tsx
- graphql
Role Variables
There are no mandatory parameters; all parameters are in defaults/main.yml.
Example Playbook
- hosts: localhost
roles:
- role: vimrc
vim_user: foo
Development Usage
To run it locally, create a symlink: cd /etc/ansible/roles & sudo ln -s /path/to/vimrc .
License
BSD
ansible-galaxy install haelle.vimrc