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 - hhvm/vim-hack: Syntax highlighting and typechecker integration for Hack.

This repository was archived by the owner on May 1, 2022. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

63 Commits
63 Commits

Folders and files

NameName
Last commit message
Last commit date
after
after
 
 
doc
doc
 
 
ftdetect
ftdetect
 
 
.gitignore
.gitignore
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

About vim-hack

vim-hack provides file type detection and syntax highlighting for Hack files.

The Hack syntax file assumes that you are using the default PHP syntax file that ships with Vim 7.4, or a compatible file.

For more information on the Hack language, visit http://hacklang.org.

Installation

Vim 8 and NeoVim

We recommend installing both this plugin and ALE via your favorite plugin manager. ALE provides linting for various languages, and IDE-like features. If you do not have a plugin manager:

$ cd .vim # for Vim8
$ cd .config/neovim # for NeoVim
$ mkdir -p pack/github/start
$ cd pack/github/start
$ git clone https://github.com/hhvm/vim-hack.git
$ git clone https://github.com/w0rp/ale.git

By default, ALE will report errors; for additional features, see :help ale, or use the configuration below as a starting point:

" Automatic completion
let g:ale_completion_enabled = 1
" Include the linter name (e.g. 'hack' or 'hhast'), code, and message in errors
let g:ale_echo_msg_format = '[%linter%]% [code]% %s'
" Enable HHAST - this has security implications (see below)
let g:ale_linters = { 'hack': ['hack', 'hhast'] }
" Press `K` to view the type in the gutter
nnoremap <silent> K :ALEHover<CR>
" Type `gd` to go to definition
nnoremap <silent> gd :ALEGoToDefinition<CR>
" Meta-click (command-click) to go to definition
nnoremap <M-LeftMouse> <LeftMouse>:ALEGoToDefinition<CR>

" show type on hover in a floating bubble
if v:version >= 801
  set balloonevalterm
  let g:ale_set_balloons = 1
  let balloondelay = 250
endif

HHAST provides additional linting for Hack files - however, it is disabled by default, as it executes code in the project - if .hhconfig, hhast-lint.json, and vendor/bin/hhast-lint exist relative to any ancestor directory, vendor/bin/hhast-lint will be executed.

Vim 7

If you want IDE-like features (autocomplete, go to definition, etc), upgrade to Vim 8 or Neovim, and follow the instructions in the previous section.

The preferred method of installation for Vim 7 is using vim-plug; after installing vim-plug, put the following in your .vimrc:

call plug#begin('~/.vim/plugged')
Plug 'hhvm/vim-hack'
call plug#end()

Then, run :PlugInstall in vim. For advanced features, we strongly recommend upgrading to Vim8 or Neovim and using ALE; if this isn't possible, LanguageClient-neovim is an alternative:

Plug 'autozimu/LanguageClient-neovim', {
    \ 'branch': 'next',
    \ 'do': 'bash install.sh',
    \ }

This can then be enabled with:

let g:LanguageClient_serverCommands = {
  \ 'hack': [ 'hh_client', 'lsp' ],
  \ }

For a basic configuration, add:

" Press `K` to view the type in the gutter
nnoremap <silent> K :call LanguageClient_textDocument_hover()<CR>
" Type `gd` to go to definition
nnoremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
" Meta-click (command-click) to go to definition
nnoremap <M-LeftMouse> <LeftMouse>:call LanguageClient_textDocument_definition()<CR>

This binds K to 'show type in the gutter', and both gd and meta-click ('command-click') to 'go to definition'.

License

HHAST is MIT-licensed, as found in the LICENSE file.

About

Syntax highlighting and typechecker integration for Hack.

Topics

hacklangvim

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing
Activity
Custom properties

Stars

89 stars

Watchers

4 watching

Forks

23 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — 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.