Table of contents
- Introduction (vim_lib)
- Plugin Manager without fatal flaws (vim_lib, vim_plugmanager)
- Project level and file system (vim_prj, nerdtree)
- Snippets and File Templates (UltiSnips, vim_template)
- Compiling and doing anything (vim-quickrun)
- Work with Git (vim_git)
- Deploy (vim_deploy)
- Testing with xUnit (vim_unittest)
- The library on which everything is kept (vim_lib)
- Other useful plugins
How can an editor be called convenient if he cannot run what we program? A feature of the plug-in described by me in this article is the ability to run anything, whether it is the program code, plantUML, LaTeX, Less, and everything else you can write and run. The
vim-quickrun plugin may seem rather confusing and complicated, despite the excellent documentation, so I decided to briefly highlight it in this article so that you can quickly start using it.
Compile and run by editor
Of course, using only one Vim editor will fail to compile and / or run the code that we write in it. To do this, we need third-party utilities, compilers and tools for viewing the result (for example, a browser, a PDF reader, etc.). The vim-quickrun plugin allows you to define a set of tools that will be applied to the current editor file in order to compile it and visualize the result. The plugin is quite flexible, which allows you to work with any languages, if the system has the appropriate utilities installed, of course.
Type definition
The plugin uses the
filetype property of the
Vim editor to determine the type of file being started (processed). In practice, this allows, for example, working with a Web project, to run both a PHP script in the editor and to compile a Less file and see the resulting CSS. Convenient, isn't it?
Configuration
The plugin includes many ready-made solutions for various languages. So, most modern PLs are compiled and run by the “out of the box” plugin (if there are appropriate compilers and interpreters). This allows us to install the plugin and immediately start using it, but the code we are faced with more rare languages, we have to "tinker" a little. For "witchcraft", the
g: quickrun_config editor variable is used, which should be initialized by the configuration. It is important that our configuration will only complement the standard one and we will not have to configure the plugin for all languages.
To configure the plugin you need:
- Define plugin compiler / interpreter using command property
- Define commands that perform pre and post conditions using the exec property
- Determine the command responsible for visualizing the result using the outputter property
Here are some examples:
Markdownlet g:quickrun_config = { \ 'markdown': { \ 'outputter': 'browser', \ }, \}
LaTeX let g:quickrun_config = { \ 'tex': { \ 'command': 'pdflatex', \ 'exec': ['%c -synctex=1 -interaction=nonstopmode "%S:t:r.tex"', 'evince "%S:r.pdf"', 'rm "%S:t:r.pdf" "%S:t:r.aux" "%S:t:r.log" "%S:t:r.synctex.gz"'], \ }, \}
PlantUML let g:quickrun_config = { \ 'plantuml': { \ 'exec': ['java -jar ~/bin/plantuml.jar %S:p:h', 'display %S:p:r.png', 'rm %S:p:r.png'], \ 'outputter': 'null', \ }, \}
As you can see, the
outputter property
serves more like stdout, and
exec can act as a
command , it all depends on the task.
Bye all
To compile and run the current file, use the command
: QuickRun . Constantly typing it is not very convenient, therefore I advise you to define an alias in your
.vimrc file.
Examplenmap :w:QuickRun
, , !