earthly.vim icon indicating copy to clipboard operation
earthly.vim copied to clipboard

Earthfile syntax highlighting for vim

Earthfile syntax highlighing

Syntax highlighting for Earthly Earthfiles for Vim.

For an introduction of Earthly see the Earthly GitHub repository or the Earthly documentation.

Requirements

  • Install vim or neovim

  • Enable syntax highlighting:

    Update your ~/.vimrc file to include:

    syntax on
    

Installation Notes

Use your favorite plugin manager:

Vim-Plug

Using the vim-plug plugin manager, add:

Plug 'earthly/earthly.vim', { 'branch': 'main' }

Then run

:PlugInstall

Pathogen

git clone [email protected]:earthly/earthly.vim.git ~/.vim/bundle/earthly

Manual

To install manually, copy syntax/Earthfile.vim to ~/.vim/syntax/Earthfile.vim.

Now write the following into the file at ~/.vim/ftdetect/Earthfile.vim

au BufRead,BufNewFile Earthfile set filetype=Earthfile
au BufRead,BufNewFile build.earth set filetype=Earthfile

Neovim

Neovim users will have to change the ~/.vim/ prefix in the above steps to ~/.config/nvim.

Screenshot

Java example Earthfile in Vim