aboutsummaryrefslogtreecommitdiff
path: root/docs/editors/index.html
blob: a8f680fc3b906d29bdbdd9a67da5be9f5f2a97fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<head>
  <link href="../favicon.ico" rel="shortcut icon" type="image/x-icon"/>
  <link href="../style.css" rel="stylesheet"/>
  <title>BQN: Editor support</title>
</head>
<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a></div>
<h1 id="editor-support"><a class="header" href="#editor-support">Editor support</a></h1>
<style>.Comment,.Function,.Number,.String { color: inherit; }</style>
<p>Editor plugins and other tools for allowing BQN input are in <a href="https://github.com/mlochbaum/BQN/tree/master/editors">this folder</a>. Input is always performed with a backslash <code><span class='Value'>\</span></code> prefix by default, using the layout shown <a href="https://mlochbaum.github.io/BQN/keymap.html">here</a>. To type an actual backslash, hit the backslash key twice.</p>
<p><a href="https://abrudz.github.io/lb/bqn">This bookmarklet</a> enables BQN input in any webpage in your <strong>browser</strong>.</p>
<p><a href="https://gist.github.com/dzaima/35ca0ce12b5e215a62460f00e693984f">This userscript</a> highlights BQN code on <strong>GitHub</strong>.</p>
<p>For <strong>Android</strong>, <a href="https://github.com/dzaima/hackerskeyboard/releases/latest">this fork</a> adds APL and BQN to Hacker's Keyboard.</p>
<p>For <strong>macOS</strong>, a keyboard layout can be found <a href="https://github.com/mlochbaum/BQN/blob/master/editors/BQN.keylayout">here</a>.</p>
<p>The file <a href="https://github.com/mlochbaum/BQN/blob/master/editors/inputrc">inputrc</a> can be copied or appended to <code><span class='Value'>~</span><span class='Function'>/</span><span class='Value'>.inputrc</span></code> to enable backslash input in <strong>bash</strong>, BQN with <strong>rlwrap</strong>, and other software that uses GNU Readline.</p>
<p>If you'd like to contribute files for another editor I'd gladly accept them!</p>
<h2 id="system-wide"><a class="header" href="#system-wide">System-wide</a></h2>
<h3 id="xkb-unix"><a class="header" href="#xkb-unix">XKB (Unix)</a></h3>
<p>The file <a href="https://github.com/mlochbaum/BQN/blob/master/editors/bqn">bqn</a> is for configuring XKB on Linux, or other systems using X11. To use, copy it to <code><span class='Function'>/</span><span class='Value'>usr</span><span class='Function'>/</span><span class='Value'>share</span><span class='Function'>/X11/</span><span class='Value'>xkb</span><span class='Function'>/</span><span class='Value'>symbols</span><span class='Function'>/</span></code>, then run</p>
<pre><span class='Value'>$</span> <span class='Value'>setxkbmap</span> <span class='Function'>-</span><span class='Value'>layout</span> <span class='Value'>us</span><span class='Separator'>,</span><span class='Value'>bqn</span> <span class='Function'>-</span><span class='Value'>option</span> <span class='Value'>grp:switch</span>
</pre>
<p>replacing <code><span class='Value'>us</span></code> with your ordinary keyboard layout. <code><span class='Value'>switch</span></code> indicates the right alt key and can be replaced with <code><span class='Value'>lswitch</span></code> for left alt or other codes. The setting will go away on shutdown so you will probably want to configure it to run every time you start up. The way to do this depends on your desktop environment. For further discussion, see <a href="https://en.wikipedia.org/wiki/X_keyboard_extension">Wikipedia</a> or the <a href="https://aplwiki.com/wiki/Typing_glyphs_on_Linux">APL Wiki</a>.</p>
<p>Another XKB option, if you have a compose key enabled, is to place <a href="https://github.com/mlochbaum/BQN/blob/master/editors/XCompose">XCompose</a> (possibly with adjustments) in <code><span class='Value'>~</span><span class='Function'>/</span><span class='Value'>.</span><span class='Function'>XCompose</span></code>.</p>
<h3 id="windows"><a class="header" href="#windows">Windows</a></h3>
<p>Folder <a href="https://github.com/mlochbaum/BQN/tree/master/editors/autohotkey-win">autohotkey-win</a> contains an <a href="https://en.wikipedia.org/wiki/AutoHotKey">AutoHotKey</a> script and the generated .exe file. It runs as an ordinary program that recognizes BQN key combinations system-wide, using the right alt key (to change this, replace <code><span class='Function'>RAlt</span></code> in the script and rebuild). Move it to the startup folder if you'd like to have it running all the time. You can right-click its icon in the system tray to disable it temporarily.</p>
<p>The <a href="https://github.com/mlochbaum/BQN/blob/master/editors/XCompose">XCompose</a> file, although created for XKB, is also usable with <a href="https://github.com/samhocevar/wincompose">WinCompose</a>.</p>
<h2 id="text-editors"><a class="header" href="#text-editors">Text editors</a></h2>
<h3 id="vim"><a class="header" href="#vim">Vim</a></h3>
<p>Copy or symlink all files into the corresponding directories in <code><span class='Value'>~</span><span class='Function'>/</span><span class='Value'>.vim</span></code>. Add the following two lines to <code><span class='Value'>~</span><span class='Function'>/</span><span class='Value'>.vim</span><span class='Function'>/</span><span class='Value'>filetype.vim</span></code>:</p>
<pre>  <span class='Value'>au</span><span class='Function'>!</span> <span class='Function'>BufRead</span><span class='Separator'>,</span><span class='Function'>BufNewFile</span> <span class='Value'>*.bqn</span> <span class='Value'>setf</span> <span class='Value'>bqn</span>
  <span class='Value'>au</span><span class='Function'>!</span> <span class='Function'>BufRead</span><span class='Separator'>,</span><span class='Function'>BufNewFile</span> <span class='Value'>*</span> <span class='Value'>if</span> <span class='Value'>getline</span><span class='Paren'>(</span><span class='Number'>1</span><span class='Paren'>)</span> <span class='Function'>=</span><span class='Value'>~</span> <span class='String'>'</span><span class='Value'>^</span><span class='Comment'>#!.*bqn$' | setf bqn | endif
</span></pre>
<p>Include <code><span class='Value'>syntax</span> <span class='Value'>on</span></code> in your .vimrc for syntax highlighting and <code><span class='Value'>filetype</span> <span class='Value'>plugin</span> <span class='Value'>on</span></code> for keyboard input. View docs from vim with <code><span class='Value'>:help</span> <span class='Value'>bqn</span></code>.</p>
<p>To use vim-plug to install BQN support for vim, add this to your plugin section of your <code><span class='Value'>.vimrc</span></code>:</p>
<pre>  <span class='Function'>Plug</span> <span class='String'>'</span><span class='Value'>mlochbaum</span><span class='Function'>/BQN</span><span class='String'>'</span><span class='Separator'>,</span> <span class='Brace'>{</span><span class='String'>'</span><span class='Value'>rtp</span><span class='String'>'</span><span class='Value'>:</span> <span class='String'>'</span><span class='Value'>editors</span><span class='Function'>/</span><span class='Value'>vim</span><span class='String'>'</span><span class='Brace'>}</span>
</pre>
<p>Then run <code><span class='Value'>:</span><span class='Function'>PlugInstall</span></code>.</p>
<h4 id="neovim-interactivity"><a class="header" href="#neovim-interactivity">Neovim interactivity</a></h4>
<p>See <a href="https://git.sr.ht/~detegr/nvim-bqn">this repository</a> for an additional plugin that provides bindings to run BQN code as you're editing it.</p>
<h3 id="emacs"><a class="header" href="#emacs">Emacs</a></h3>
<p>Emacs support now lives on <a href="https://github.com/museoa/bqn-mode">museoa/bqn-mode</a>. Clone and add the following two lines to your init file (usually <code><span class='Value'>~</span><span class='Function'>/</span><span class='Value'>.emacs.d</span><span class='Function'>/</span><span class='Value'>init.el</span></code>), replacing the path appropriately.</p>
<pre><span class='Paren'>(</span><span class='Value'>add</span><span class='Function'>-</span><span class='Value'>to</span><span class='Function'>-</span><span class='Value'>list</span> <span class='String'>'</span><span class='Value'>load</span><span class='Function'>-</span><span class='Value'>path</span> <span class='String'>&quot;/path/to/bqn-mode&quot;</span><span class='Paren'>)</span>
<span class='Paren'>(</span><span class='Value'>require</span> <span class='String'>'</span><span class='Value'>bqn</span><span class='Function'>-</span><span class='Value'>mode</span><span class='Paren'>)</span>
</pre>
<h3 id="vs-code"><a class="header" href="#vs-code">VS Code</a></h3>
<p>See <a href="https://github.com/razetime/bqn-vscode">this repository</a>.</p>
<h3 id="kakoune"><a class="header" href="#kakoune">Kakoune</a></h3>
<p>Copy or symlink <code><span class='Value'>kak</span><span class='Function'>/</span><span class='Value'>autoload</span><span class='Function'>/</span><span class='Value'>filetype</span><span class='Function'>/</span><span class='Value'>bqn.kak</span></code> into <code><span class='Value'>autoload</span><span class='Function'>/</span><span class='Value'>filetype</span></code> in your Kakoune config directory (probably <code><span class='Value'>.config</span><span class='Function'>/</span><span class='Value'>kak</span><span class='Function'>/</span></code>).</p>