My Vimrc with plugins, autocommands, etc for Vim 8.
Generated with markdown-toc
There are two versions:
- Basic: mappings, abbreviations, autocommands, etc. No plugin nor dependency is needed.
- Extended: built on the basic, with many plugins.
Vundle plugin manager (see Quick Start section).
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
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.
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.
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.
- gruvbox: color scheme.
- fzf.vim: wrapper for fzf.
- NERDTree: file browsing.
- nerdtree-git-plugin: git plugin for NERDTree.
- Powerline: cool status bar.
- vim-buftabline: easy buffer navigation in tabs.
- vim-markdown: Markdown syntax and preview.
- rename.vim: Rename files (need a plugin for this?).
- vim-ripgrep: ripgrep for Vim.
- vim-gitgutter: Git diff in gutter.
- vim-obsession: continuously update session files.
- ale: asynchronous linting.
- nerdcommenter: code commenting.
- vim-surround: bracket, quote, etc. wrapping.
- YouCompleteMe: code completion.
- vim-pydocstring: docstring generator.
- indentpython: PEP8 indentation.
- vim-closetag: HTML tag autoclose.
- MatchTagAlways: highlight enclosing tags.
- vim-javascript: JavaScript syntax (works for inline js!).
- vim-vue: Vue syntax highlighting.
- ansible-vim: Ansible syntax.
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 |
Here are gathered plugins that are not being used/were used at some time but replaced, but that are interesting.
- vim-colors-pencil: color scheme.
Note: <Leader>
is set to space.
<C-N>
/<C-P>
: next/previous buffer.
<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.
<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).
<Leader>sv
: source .vimrc.
jk
: return to normal mode.<C-Space>
: insert new line below, useful when we are onif
,for
, etc. statements, so we don't need to go to the end of the line and insert new one.
<Leader>c
: copy selection to desktop clipboard.
The following abbreviations are set as autocommands for each file type.
i
:if :
f
:for :
w
:while :
d
:def ():
i
:if () {<cr>}
f
:for () {<cr>}
w
:while () {<cr>}
fu
:function () {<cr>}
i
:if () {<cr>}
f
:for () {<cr>}
w
:while () {<cr>}
fu
:function () {<cr>}