How do you all enter the pipe operator |>?

How do you all enter the pipe operator |> on your keyboard? I keep having troubles with it :frowning:

2 Likes

What do you mean? Is it about your keyboard layout making it hard or something like that? It’s not clear what you are asking about … For me this question sounds like How do can breathe?.

I’m entering it without really thinking how to do it - simply by a lot of practice I don’t have to look at keyboard and as everything else I just type … I guess you mean something different (like problem with keyboard layout), right?

3 Likes

I guess he means is there an easier way to do it than shift + | then > with shift still held down :upside_down_face:

1 Like

I think you can somehow remap your layout but I am not sure.

1 Like

Well … depending on hardware, OS and other software there is always an option to remap some key and use it to insert many characters, but it sounds really overcomplicated for me. I’m even not sure if it’s worth to spend time on searching how to do that, testing it and potentially some day also dealing with consequences of the remapped key.

I think that any serious player on keyboard market (especially in gaming branch) have a tool that can do that.

1 Like

I have a dedicated key for it in my moonlander layout of course: Oryx: The ZSA Keyboard Configurator

Same with thin and fat arrows in the symbols layer

5 Likes

On the French keyboard the | is ⌥ +⇧+L, not ideal but we get used to it :man_shrugging:

1 Like

This. I have small pinkies. The | ain’t the issue on itself although I have to reach out quite far (for my linking), the subsequent movement to > is rather annoying.

I already had remapped a few keys using Karabiner on macOS and wonder what tricks / remappings others might have to ease |>.

ps. The keyboard thread has inspired me to use homerow mods and I really like it. With Ctrl and Meta so easy to reach it’s almost time to Caps-tap to opening a custom keymap :wink:

3 Likes

I made a vscode snippet for it, I just type pp<tab> and it writes a pipe op.

6 Likes

I feel you, I have a snippet for it when I type p it suggests me the pipe operator, it works ok.

@dorgan would you mind sharing your Moonlander layout, I have one too and I’m always curious to see others (here my layout).

1 Like

On my keyboard layout (for Glove80/Ergodox EZ) I have a _ on my main layout (which I highly recommend for Elixir programming). And when I press alt + _ in emacs/VSCode a |> is inserted (I almost always want that space character as well).

6 Likes

Yep this is mine (also linked in my first post)

2 Likes

I just make the reach on an American QWERTY keyboard. I’m one of those “Pipes shall always start a new line”-folks so I get some yypwCs in for subsequent lines (having a key that would just type it would be even quicker, for sure). I also have some snippets, like >a<TAB>foo becomes |> assign(:foo, foo).

EDIT: I can’t believe I misspelled “QWERTY”. I think I’m packing it in for the day.

2 Likes

You can also create a Siri shortcut and shout out “PIPE!” :stuck_out_tongue:

7 Likes

Personally I just type it normally, it’s not a problem for me. Now the tilde (for sigils) on the other hand - that one tilts me every time :slight_smile: There is just something about that key that begs me to hit 1 instead…

4 Likes

I just tried this in neovim - going to keep it!!

vim.api.nvim_set_keymap("i", "pp<tab>", "|>")
vim.api.nvim_set_keymap("i", "aa<tab>", "->")
6 Likes

If you find the delay every time you type a or p jarring you can use an abbreviation instead:

abbrev pp <bar>>
abbrev aa ->

(sorry, I don’t know the neo-y code for that)

Then you can just press pp<space> and aa<space> with no delay. No (English) words end in those (er, well, “app”). Of course you could do other stuff like p> and a> which is fine as another nice thing about abbreviations is that they only expand if they aren’t part of a word, so aa and pp should be fine.

4 Likes

I’ve had the following in my Neovim/vim config for ~15 years for Ruby:

vim.api.nvim_set_keymap("i", "<c-l>", "<Space>=><Space>")

When I got into Elixir, I added the following:

vim.api.nvim_set_keymap("i", "<c-h>", "<Space><-<Space>")
vim.api.nvim_set_keymap("i", "<c-j>", "<Space>-><Space>")
vim.api.nvim_set_keymap("i", "<c-k>", "<Space>|><Space>")
9 Likes

I’ve been experimenting with the text substitution of ?> for |> and it’s been surprisingly effective and ergonomic as a single motion inward roll ¯\_(ツ)_/¯

3 Likes

?. or /.? That’s a good one, especially if the latter.

EDIT: I responded too quickly

1 Like