2018-05-20 07:06:25 +00:00
|
|
|
#+TITLE: Hy layer
|
|
|
|
|
2019-05-07 08:53:56 +00:00
|
|
|
#+TAGS: general|layer|multi-paradigm|programming
|
2019-05-05 17:26:40 +00:00
|
|
|
|
2018-05-20 07:06:25 +00:00
|
|
|
[[file:img/hy.png]]
|
|
|
|
|
2019-05-07 20:05:06 +00:00
|
|
|
* Table of Contents :TOC_5_gh:noexport:
|
2018-05-20 07:06:25 +00:00
|
|
|
- [[#description][Description]]
|
|
|
|
- [[#features][Features:]]
|
|
|
|
- [[#install][Install]]
|
|
|
|
- [[#layer][Layer]]
|
2020-08-08 12:30:05 +00:00
|
|
|
- [[#auto-completion][Auto-completion]]
|
2018-12-05 03:03:03 +00:00
|
|
|
- [[#key-bindings][Key bindings]]
|
2018-05-20 07:06:25 +00:00
|
|
|
- [[#debug][Debug]]
|
|
|
|
- [[#repl][REPL]]
|
|
|
|
- [[#tests][Tests]]
|
2019-11-16 16:51:49 +00:00
|
|
|
- [[#python-environments][Python environments]]
|
2018-05-20 07:06:25 +00:00
|
|
|
|
|
|
|
* Description
|
|
|
|
This layer adds support for the Hy language based on Python.
|
|
|
|
|
|
|
|
** Features:
|
|
|
|
- syntax-highlighting
|
|
|
|
- Auto-completion
|
|
|
|
- Code Navigation
|
|
|
|
- Python test runners (see [[file:../python/README.org][python layer]])
|
|
|
|
- Virtual Environment using [[https://github.com/jorgenschaefer/pyvenv][pyvenv]] and [[https://github.com/yyuu/pyenv][pyenv]]
|
|
|
|
- Org Babel support
|
|
|
|
|
|
|
|
* Install
|
|
|
|
** Layer
|
|
|
|
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
|
|
|
add =hy= to the existing =dotspacemacs-configuration-layers= list in this file.
|
|
|
|
|
|
|
|
To install =hy= globally:
|
|
|
|
|
|
|
|
#+BEGIN_SRC sh
|
2020-08-08 12:30:05 +00:00
|
|
|
pip3 install hy
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Auto-completion
|
2020-08-09 09:45:26 +00:00
|
|
|
[[https://github.com/hylang/hy-mode][hy-mode]] relies on [[https://github.com/ekaschalk/jedhy][jedhy]] for auto-completion.
|
2020-08-08 12:30:05 +00:00
|
|
|
|
|
|
|
=jedhy= can be installed with:
|
|
|
|
|
2020-08-28 18:19:51 +00:00
|
|
|
#+BEGIN_SRC sh
|
2020-08-28 21:26:14 +00:00
|
|
|
pip3 install jedhy
|
2018-05-20 07:06:25 +00:00
|
|
|
#+END_SRC
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
* Key bindings
|
2018-05-20 07:06:25 +00:00
|
|
|
** Debug
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2018-05-20 07:06:25 +00:00
|
|
|
|-------------+---------------------|
|
|
|
|
| ~SPC m d d~ | insert pdb |
|
|
|
|
| ~SPC m d t~ | insert pdb threaded |
|
|
|
|
|
|
|
|
** REPL
|
2018-05-24 02:12:30 +00:00
|
|
|
Start a Hy inferior REPL process with ~SPC m s i~. If =hy= is
|
2018-05-20 07:06:25 +00:00
|
|
|
available in system executable search paths, =hy= will be used to
|
|
|
|
launch the shell. You may change your system executable search path
|
|
|
|
by activating a virtual environment.
|
|
|
|
|
|
|
|
Send code to hy REPL commands:
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2018-05-20 07:06:25 +00:00
|
|
|
|-------------+-----------------------------------------------------------------|
|
|
|
|
| ~SPC m s b~ | send buffer to the REPL |
|
|
|
|
| ~SPC m s B~ | send buffer to the REPL and switch to it |
|
|
|
|
| ~SPC m s c~ | send form containing current point to the REPL |
|
|
|
|
| ~SPC m s C~ | send form containing current point to the REPL and switch to it |
|
|
|
|
| ~SPC m s i~ | start and/or switch to REPL |
|
|
|
|
| ~SPC m s r~ | send current region to the REPL |
|
|
|
|
| ~SPC m s R~ | send current region to the REPL and switch to it |
|
|
|
|
| ~SPC m s s~ | start and/or swithc to REPL |
|
|
|
|
|
|
|
|
** Tests
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2018-05-20 07:06:25 +00:00
|
|
|
|-------------+------------------------------------------------------|
|
|
|
|
| ~SPC m t a~ | launch all tests of the project |
|
|
|
|
| ~SPC m t A~ | launch all tests of the project in debug mode |
|
|
|
|
| ~SPC m t m~ | launch all tests of the current module |
|
|
|
|
| ~SPC m t M~ | launch all tests of the current module in debug mode |
|
2019-11-16 16:51:49 +00:00
|
|
|
|
|
|
|
** Python environments
|
|
|
|
|
|
|
|
| Key binding | Description |
|
|
|
|
|---------------+-------------------------------------------------|
|
|
|
|
| ~SPC m v a~ | activate a virtual environment in any directory |
|
|
|
|
| ~SPC m v d~ | deactivate active virtual environment |
|
|
|
|
| ~SPC m v s~ | set a pyenv environment with [[https://github.com/pyenv/pyenv][pyenv]] |
|
|
|
|
| ~SPC m v u~ | unset a pyenv environment with [[https://github.com/pyenv/pyenv][pyenv]] |
|
|
|
|
| ~SPC m v w~ | work on virtual environment in =WORKON_HOME= |
|
|
|
|
| ~SPC m v p a~ | activate pipenv in current project |
|
|
|
|
| ~SPC m v p d~ | deactivate pipenv in current project |
|
|
|
|
| ~SPC m v p i~ | install module into pipenv environment |
|
|
|
|
| ~SPC m v p o~ | open pipenv module in buffer |
|
|
|
|
| ~SPC m v p s~ | launch pipenv shell in current project |
|
|
|
|
| ~SPC m v p u~ | uninstall module from pipenv environment |
|