Shortcut to wrap selected text between tags

In Emacs, there is a feature that I find very useful : after writing a very short script, my emacs is now customized so that when I have selected a piece of text and type only Ctrl+I, the selected text gets enclosed in phpBB italics tags, if I type Ctrl+B it gets enclosed in boldface tags, etc.

Can a similar form of customization be achieved in Atom ? (needless to say, I don’t mind much what the shortcut is for this or that feature, as long as it’s short)

The wrap-in-tag package only does HTML tags, but you can copy its code into your file and change the brackets used. That will let you use one keybinding for all tags.

I did just that I think, by changing the line starting with newText to

newText = [’[’, tag, ‘]’, text, ‘[/’, tag, ‘]’].join(’’)

If I put the snippet in ~/.atom/, it seems to have no effect : even when I open a new window I still get HTML tags not phpBB tags. If I try to modify ~/.atom/packages/atom-wrap-in-tag/lib/ directly the behavior is even worse, the shortcut is not recognized as a command any more.

What am I doing wrong ?

Show me exactly what you did in the form of screenshots?

I tried to uninstall and reinstall the package. Now the behavior is as follows :
if I wrap from the command menu, the selection does get wrapped but it’s always a p-tag, I cannot choose the tag. If I try to do it via the shortcut (Alt+Shift+w), it simply does not work as shown in the video below :

The menu item is working perfectly. It starts as <p></p>, but you’ll notice that the ps are highlighted. If you type anything, you’ll change the contents of the tags to whatever you type. I can’t tell what’s wrong with the keybinding until you show me the Keybinding Resolver after you’ve tried to use the shortcut.

I meant for you to screenshot the code you changed so that I could proofread it.

The Keybinding Resolevr reads my Alt+Shift+w as alt-shift-unidentified.

Let us first understand the keybinding issue that happens without any change to the code. When this is fixed, I’ll proceed to the next change-of-code step.

Are you able to use alt-shift with other letters? You won’t need to add any keybindings to see if the sequence registers in Atom, but it might be prudent to try both sequences that have registered bindings and ones that don’t. There’s also a nonzero chance that your computer is treating the left and right alt keys differently, so try from both sides of the keyboard.

As a matter of fact, there is a standard procedure (which I applied) when using Emacs on a Mac, namely asking for the computer to understand to treat the left-alt the Emacs way (as starting a new Emacs commands), and the right-alt the default way. I’m not sure if this causes any changes outside of Emacs, I’ve seen none so far.

From the random examples I tried, it seems I always get alt-shift-unidentified independently of whether the key sequence is registered, and independently of whether I use the right or left alt key.

By the way, is “Shift” supposed to mean the fn key or the Upwards big arrow key on my Mac. When I use the Upwards big arrow, I get the results described above. When I use the fn key, it is simply ignored (the keybinding resolver views alt+fn as just alt).

I’ve never heard anyone describe it as “Upwards big arrow”. It’s the button that shifts all your letters into uppercase and your numbers into symbols.

Does alt-w happen alright? What about shift-w?