Giter VIP home page Giter VIP logo

vim-compilers's Introduction

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 set the compiler and call it by (l)make in one go, for example:

LCompiler flake8 %:S

achieves the same as :comp flake8 | lmake %:S. 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 cm   Compiler
Alias cmm  Compiler\ %:S<c-b><c-right>
Alias lcm  LCompiler
Alias lcmm LCompiler\ %:S<c-b><c-right>

Alias m    Make
Alias mm   Make\ %:S
Alias lm   LMake
Alias lmm  LMake\ %:S

Calling a Linter

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

command! -buffer -bang Lint compiler flake8 | lmake %:S<bang>

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 python | make<bang>.

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

A search request on GitHub itself yields compiler files for

vim-compilers's People

Contributors

konfekt avatar pbnj avatar bergercookie avatar

Stargazers

Ethan Estrada avatar Gaeulbyul avatar Rafael Bodill avatar Shaun Chong avatar  avatar rocky avatar  avatar Adrien avatar  avatar Aleksandrs Stier avatar jiz4oh avatar  avatar Fidel H Viegas avatar Swastik Acharyya avatar Huy Le avatar Nissi Nassime avatar  avatar finrodfelagund_ avatar Joilnen avatar chris avatar  avatar Dhruv Thakur avatar  avatar  avatar Robertus Chris avatar Eliaz Bobadilla avatar  avatar Sean L avatar Stanislav Karkavin avatar Mitchell Garvin avatar Akiva Levy avatar  avatar Alex avatar  avatar C.D. MacEachern avatar Max Odnoletkov avatar Zhilei Han avatar David O'Trakoun avatar sloane avatar ik5 avatar Manu avatar Eric Wong avatar tamago324 avatar Gerry Agbobada avatar Jon Parise avatar Romain Lafourcade avatar

Watchers

Mitchell Garvin avatar James Cloos avatar  avatar

Forkers

pbnj bergercookie

vim-compilers's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.