GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Konfekt/vim-compilers: a collection of compilers for ready use by Vim's built-in compiler feature (see :help :compiler)

BranchesTags
Open more actions menu

Latest commit

 

History

70 Commits
70 Commits

Folders and files

NameName
Last commit message
Last commit date
compiler
compiler
 
 
plugin
plugin
 
 
README.md
README.md
 
 

Repository files navigation

The folder compiler/ contains compiler files that set up compilers (or linters, that is, syntax checkers) for easy use in Vim. Copy them into your Vim configuration folder (~/.vim on Linux and MacOS, %USERPROFILE%/vimfiles on Microsoft Windows). You may also use a plug-in manager such as vim-plug (in this case, add Plug 'konfekt/vim-compilers' to your vimrc to use them).

Usage and Setup

Switch to a compiler by :compiler ... and then start it by :make or :lmake. For example, first call :compiler flake8 to switch to flake8, and then lint the current (Python) file by :lmake %:S. In one go: :comp flake8 | lmake %:S.

Convenience Commands

This plug-in provides a command (L)Compiler to temporarily switch to the compiler and call it by (l)Make in one go, for example:

LCompiler flake8 %:S

achieves the same as :comp flake8 | lmake %:S followed by reverting to the previous compiler options. Everything following its first argument is passed to (L)Make.

For faster access to this commands, install vim-alias and add aliases such as

Alias c   Compiler
Alias lc  LCompiler\ %:S<c-b><c-right>

Alias m    Make
Alias lm  LMake\ %:S

Calling a Linter

For convenience, define in ~/.vim/after/ftplugin/python.vim a command

command! -buffer -bang Lint Compiler<bang> flake8 %:S

It can then be called to lint the main file by :Lint.

The location-list window that lists all compiler messages can then be opened by :lwindow; their locations can be jumped to by :ln respectively :lp (or use vim-unimpaired's mappings ]l and [l.)

To automatically open the location-list window after linting has finished, add autocmd QuickFixCmdPost lmake lwindow to your vimrc.

To automatically run :Lint after saving the modifications to a source code file, say Python, add to ~/.vim/after/ftplugin/python.vim:

    autocmd BufWrite <buffer=abuf> Lint!

Calling a Compiler

For a compiler command, such as python, define in ~/.vim/after/ftplugin/python.vim a command

command! -buffer -bang Compile Compiler<bang> python

that can then be called to compile the main file. For example, if it is the one of the currently open buffer, then :Compile %:S suffices.

The (quickfix) window that lists all compiler messages can then be opened by :cwindow; their locations can be jumped to by :cn respectively :cp (or use vim-unimpaired's mappings ]q and [q.).

To automatically open the quickfix window after compilation has finished, add autocmd QuickFixCmdPost make cwindow to your vimrc.

Run as Jobs

To run a linter or compiler in the background, use an :(L)Make command (instead of :make or :lmake), such as

  • that of tasks.vim, or

  • that of vim-dispatch, or

  • that defined by

    command! -bang -nargs=* -complete=file Make AsyncRun<bang> -auto=make -program=make -strip <args>

    with AsyncRun.vim installed. To avoid empty lines in the quickfix list, add let g:asyncrun_trim = 1 to your vimrc. Other options, such as g:asyncrun_save might be of interest.

Signpost Locations

The plug-in vim-markify marks all found locations by text signs at the side of the window.

Additional Compilers

Vim already comes with many compiler files, see :e $VIMRUNTIME/compiler.

Googling for GitHub Vim compilers yielded compiler files for

  • Python, Pytest, Flake8, pylint and mypy
  • Go
  • C#
  • Bash
  • LanguageTool ...

A search request on GitHub itself yields compiler files for

  • minitest
  • ESlint, Jenkins, node.vim, npm and TypeScript
  • Gradle, JSlint, Maven, pychecker and pyflakes
  • LiveScript
  • Scala, Maven and JShint
  • Clang and xCodebuild
  • Go
  • Fish
  • Haskell Stack
  • GnuPlot
  • AutoHotKey ...

About

a collection of compilers for ready use by Vim's built-in compiler feature (see :help :compiler)

Resources

Readme
Activity

Stars

57 stars

Watchers

3 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.