Skip to content

eljulians/vimrc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vimrc

My Vimrc with plugins, autocommands, etc for Vim 8.

Table of Contents

Generated with markdown-toc

The vimrcs

There are two versions:

  • Basic: mappings, abbreviations, autocommands, etc. No plugin nor dependency is needed.
  • Extended: built on the basic, with many plugins.

Requirements

Vundle plugin manager (see Quick Start section).

Installation

Basic

The recommended way is to clone the repository and execute scripts/install_basic.sh:

git clone https://github.com/julenpardo/vimrc ~/vimrc # Or wherever you want
~/vimrc/scripts/install_basic.sh

This will just create the ~/.vimrc file as a link pointing to vimrc_basic, allowing its update pulling the repo.

If you don't want to pull it, you can just directly save the file the file as ~/.vimrc:

curl -o ~/.vimrc https://raw.githubusercontent.com/julenpardo/vimrc/master/vimrc_basic

Extended

Apart from cloning the repo, the installation scripts have to be executed:

git clone https://github.com/julenpardo/vimrc ~/vimrc # Or wherever you want
~/vimrc/scripts/install_dependencies.sh
~/vimrc/scripts/install_extended.sh
~/vimrc/scripts/install_powerline_fonts.sh
~/vimrc/scripts/compile_youcompleteme.sh

This will:

  • Install Vundle, for managing the plugins.
  • Create the ~/.vimrc file.
  • Install the plugins and their dependencies.
  • Install the powerline fonts, needed for the Powerline bar.
  • Compile YouCompleteMe, needed for the namesake plugin.

Updating

For both basic and extended, we need to pull:

cd ~/vimrc # Or wherever it was cloned
git pull

This is enough for the basic mode. For the extended mode, keep reading.

Updating extended version

For the extended version, the scripts/install_extended.sh script has to be run again. This script just creates the ~/.vimrc file merging the vimrc_basic and vimrc_extended files, and then runs the Vim command to install/update the plugins with Vundle.

The scripts/install_dependencies.sh should be also run, since there may be new dependencies required by the plugins.

Plugins

General

Language agnostic

Python

HTML, CSS & JavaScript

Yaml/Ansible

Linters and formatting for ALE

For linting and formatting, ALE needs these tools to be installed in the system. The tools installed (with dependencies.sh script) are the following:

Language Linters and formatters
Python
PHP
HTML
JavaScript
CSS
JSON
Markdown

Not used plugins

Here are gathered plugins that are not being used/were used at some time but replaced, but that are interesting.

Custom mappings, autocommands, abbreviations, etc

Mappings

Normal mode

Note: <Leader> is set to space.

Buffer navigation
  • <C-N>/<C-P>: next/previous buffer.
Splits
  • <C-J>: navigate to split below.
  • <C-K>: navigation to split up.
  • <C-L>: navigate to right split.
  • <C-H>: navigate to left split.
  • <Up>: increase current split horizontally.
  • <Down>: decrease current split horizontally.
  • <Left>: increase current split vertically.
  • <Right>: decrease current split vertically.
Buffers
  • <Leader>w: write current buffer.
  • <Leader>W: write all buffers.
  • <Leader>q: quit window.
  • <Leader>Q: quit all windows.
  • <Leader>!: quit all windows without warning about unsaved changes.
  • <Leader>r: reload buffer.
  • <Leader>d: go to previous buffer and delete the next one (this one is thought for NERDTree, otherwise the only window remaining is the one for the tree).
Oders
  • <Leader>sv: source .vimrc.

Insert mode

  • jk: return to normal mode.
  • <C-Space>: insert new line below, useful when we are on if, for, etc. statements, so we don't need to go to the end of the line and insert new one.

Visual mode

  • <Leader>c: copy selection to desktop clipboard.

Abbreviations

The following abbreviations are set as autocommands for each file type.

Python abbreviations

  • i: if :
  • f: for :
  • w: while :
  • d: def ():

PHP abbreviations

  • i: if () {<cr>}
  • f: for () {<cr>}
  • w: while () {<cr>}
  • fu: function () {<cr>}

JavaScript abbreviations

  • i: if () {<cr>}
  • f: for () {<cr>}
  • w: while () {<cr>}
  • fu: function () {<cr>}