/vimrc

My ultimate Vim configuration

Primary LanguageVim ScriptMIT LicenseMIT

Vim configuration

Gerard's Vim & Neovim configuration.

This Vim configuration is purely subjective. The goal of it is to get comfortable while programming.

General settings:

The <Leader> key is ",": it's enabled only in 'Normal mode' to avoid the delay time when typing it from 'Insert mode'. The map <C-c> is used as <Escape> from any mode. Three cursor shapes (block, vertical and horizontal) are defined for Vim and Neovim for the terminals URxvt and XTerm (even into tmux); it also works in the last versions of gnome-terminal, terminator, termite and st. Default encoding is UTF-8. Color support: 256 colors for Vim and Neovim.

Navigate easily: between buffers, tabs, windows and tmux panes; between syntax warnings and errors (it populates location-list); between misspelled words, where you can cycle between Catalan, English and Spanish dictionaries; between highlighted search results, where you can grep the highlight in the current buffer, all files from the current directory and subdirectories, the arglist and even between the old git commits, or use the internal vimgrep (grep and vimgrep populate the Quickfix and display the total matches); between GitGutter hunks; between git history (using the plugins vim-fugitive and FZF); between tags of source code files with tagbar.

Easily highlight the word under the cursor or the current selection. A lot of commands have been defined to work with the highlighted text: the mentioned grep and vimgrep, and replace. Also, you can search and replace into the visual selection only.

Some useful tools have been integrated. Plugins: FZF (navigate between files, open buffers, git commits, git files, lines, history, etc), NERDTree (tree files with filesystem operations), vim-fugitive (git commands), undotree (history visualizer), ALE (async syntax linter), deoplete (autocompletion for Vim and Neovim), neosnippet (code snippets), Vimwiki (organize notes, manage todo-lists...) and manage sessions with vim-session.

Additionally, run scripting code (Bash, Perl, Ruby, Python, Lua, PHP and JavaScript) into a separate tmux window or simply preview the output in the preview window, where you can also preview SQL queries from Sqlite databases and Maxima operations (symbolic maths) from a MAX file. Preview the output of any shell command using the command :Commander.

Instant preview with MuPDF (PNG, HTML and EPUB) and Zathura (PDF) after making the following conversions:

  • MD to PDF, EPUB and HTML using pandoc, with math support.
  • TEX to PDF using pdflatex.
  • UML to PNG using PlantUML (UML diagrams).
  • DOT to PNG using Graphviz (graph drawing tools).
  • EUK to PNG using Eukleides and Convert (elementary plane geometry).
  • ASY to PNG using Asymptote and Convert (vector graphics language).
  • PP3 to PNG using pp3 (Sky charts) and Convert (vector graphics language).
  • PLT to PNG using Gnuplot (2D and 3D graphics).
  • POV to PNG using POV-Ray (3D ray tracer).

This configuration is focused on programming in C/C++, Go, Rust, Haskell, Perl, Python, Ruby, PHP, Bash, JavaScript, Liquid (Jekyll) and web development in general, with HTML5 and CSS3. It's also a good configuration to write technical and academic papers with LaTeX and markdown.

More specific information:

List of plugins:

Read the code directly to know more details.

Screenshot

Screenshot