I'd like to setup some key bindings in eclipse (3.7.2) involving the key ("windows" key), but it doesn't seem to be picking up that modifier key when I press it. Why? What can I do so it detects it?
You have "linux" tagged in your question, so I'll assume you're using Linux and X ...
So, to use Super with Eclipse, first you have to discover whether you have a Super, and if not, make one. The rest of this is probably way more than you need on the subject of xmodmap.
The first thing to do is see if you already have a Super modifier key. Run "xmodmap -pm" to see what your modifiers currently are. Here's a common output:
$ xmodmap -pm
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
In the output above, a bunch of keys are already mapped to Super, with (hex) keycodes 0x85, 0x86, 0xce, and 0xcf. To see if anything on your keyboard happens to be one of those keys (which isn't always the case), run "xev" in a terminal and move your mouse pointer into "xev"'s mostly-white input window, and try different keys. Typical output looks like this for keys (try control and shift to see examples) - pay particular attention to the third line with the keycode and keysym name, here 64 and Meta_L.
Be sure to try your "Windows" key too, to see what keycode and mapping it has currently.
KeyPress event, serial 42, synthetic NO, window 0xe600003,
root 0x6b6, subw 0x0, time 2232472454, (-1,167), root:(871,683),
state 0x0, keycode 64 (keysym 0xffe7, Meta_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
Find the "keycode" part and covert it to base 16. If you've hit one of the Supers, your converted code will match one of the (in the example above, four) hex keycodes, and show Super_L or Super_R instead of the Meta_L shown above.
If you don't have any keys mapped to Super, or it turns out that none of them exist on your keyboard, then use xev to find the keycode for the key you want to use for Super (CapsLock might be a good choice for some folks), then use xmodmap or some other tool in your desktop's UI to set it up. The latter is outside of the scope of this reply, but with xmodmap, you could just make a file named .Xmodmap in your home directory with this in it:
! note: replace the 0xff below with your *actual* Super_L key's keycode.
! note: whether to use mod3 or mod4 depends on your environment.
keycode 0xff = Super_L
clear mod4
add mod4 = Super_L
Apply the results with "xmodmap ~/.Xmodmap". Many X startups will automatically apply these for you. If you're using Ubuntu Unity, look up Startup Applications in the Dash and add one for that same command. I'm not sure if "~" works in the context, you might want to try $HOME or just use your home directory there. It ends up producing a file in ~/.config/autostart/xmodmap.desktop like this one (erlkonig = me; put your home in instead):
$ cat ./.config/autostart/xmodmap.desktop
[Desktop Entry]
Type=Application
Exec=/usr/bin/xmodmap /home/erlkonig/.Xmodmap
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=Xmodmap Keymap Settings
Name=Xmodmap Keymap Settings
Comment[en_US]=Set Keyboard Bindings
Comment=Set Keyboard Bindings
You can verify the results with "xmodmap -pm" or "xev". Here's the output for the former for my environment from a more complex setup (which probably won't match what you'd want yourself).
$ xmodmap -pm
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x7f)
control Control_L (0x25)
mod1 Meta_L (0x40), Meta_L (0xcd)
mod2 Alt_L (0x6c), Alt_L (0xcc)
mod3 Super_R (0x69), Super_L (0x85), Super_R (0x86), Super_L (0xce)
mod4 Hyper_L (0x42), Hyper_L (0xcf)
mod5 Num_Lock (0x4d)
Hyper replaces CapsLock (which I've moved elsewhere); I use it for window manager functions, like Hyper-f to "front" a window, Hyper-r to resize, etc.
For another random(ish) example of what you can with xmodmap, here's a keymap that map whatever keycode 78 is to Mode_switch, and then allow you to combine it with ', ", `, and ~ to enter prefixes that make your next vowel have the similar diacritic on them. You can also use the Mode_switch with a to get æ, d to get ð, ? to get ¿, and some others.
! note: 78 is probably not the keycode most would want here; pick your own :-)
keycode 78 = Mode_switch
! no mods shift mode-switch shift+mode-switch
keysym a = a A ae AE
keysym d = d D thorn THORN
keysym n = n N ntilde Ntilde
keysym o = o O oslash Oslash
keysym t = t T eth ETH
keysym s = s S ssharp
keysym 0 = 0 parenright degree
keysym 6 = 6 asciicircum dead_circumflex
keysym 8 = 8 asterisk multiply
keysym apostrophe = apostrophe quotedbl dead_acute dead_diaeresis
keysym grave = grave asciitilde dead_grave
keysym comma = comma less dead_cedilla guillemotleft
keysym period = period greater NoSymbol guillemotright
keysym slash = slash question NoSymbol questiondown
keysym 1 = 1 exclam NoSymbol exclamdown
keysym equal = equal plus notequal plusminus
for more information use "man xmodmap".
Eclipse does not hook the Windows key. The only thing you can do is use a tool to rebind the windows key to, for example, CTRL+ALT+SHIFT (if you don't use that). Tools like AutoHotkey may do the job.
Then, whenever you press the windows key, it will be as if you pressed CTRL+ALT+SHIFT, which you can then use to bind your desired hotkeys.
I suspect your core goal is to create key bindings in addition to your existing control and alt bindings. So, for example, have Windows-L do something different from Control-L, Alt-L or Shift-L.
Unfortunately, it seems that Eclipse on linux doesn't support modifiers beyond shift, control, and alt (which is mod1 in xmodmap). So there is no additional modifier for you map the Windows key to. The logical choice would be mod4, but it seems SWT doesn't support mod4 on non-Windows platforms.
There is a bug for adding non-windows mod4 support at https://bugs.eclipse.org/bugs/show_bug.cgi?id=55236. Unfortunately it's been marked "won't fix" for a while. I suggest going there and voting for it and sharing additional user cases/reasons for reopening it if you have them.
Related
Is there a way to jump to the signature of the function my cursor is currently in, then jump back to where I was?
For example, when I have a 1000 line function, where the prefix x + y: refers to line numbers, is there a way from me to jump from my cursor location at x + 555 to the signature at x + 0 then back to where I was at (x + 555):
x + 000: void theFn(int arg) {
x + ...: ...
x + 555: /// where my cursor starts
x + ...: ...
x + 999: }
And, yes, I couldn't agree with you more that there shouldn't be 1000 line functions.
Also, is there a way to automatically jump to the end of function without being at the opening bracket of the function?
Useful motions in such case are [[, ][ and <C-o>.
As we can read in help:
*[[*
[[ [count] sections backward or to the previous '{' in
the first column. |exclusive|
Note that |exclusive-linewise| often applies.
*][*
][ [count] sections forward or to the next '}' in the
first column. |exclusive|
Note that |exclusive-linewise| often applies.
*CTRL-O*
CTRL-O Go to [count] Older cursor position in jump list
(not a motion command).
{not available without the |+jumplist| feature}
In short:
[[ to got to the beginning
<C-o> to go back to previous place
][ to go to end
Those motions will have the desired effect only when braces are in the first column, but from your example seems like this requirement is not met.
In such case at the end of :h section we can read:
If your '{' or '}' are not in the first column, and you would like to use "[["
and "]]" anyway, try these mappings: >
:map [[ ?{<CR>w99[{
:map ][ /}<CR>b99]}
:map ]] j0[[%/{<CR>
:map [] k$][%?}<CR>
Unfortunately, Vim doesn't offer better solution as it doesn't parse syntax.
It may change though as Neovim experiments with Tree-sitter.
It also wouldn't be surprising if there was a plugin which provides better support for such motion.
Tagbar could fit this role:
Toggle Tagbar window
Switch to it
Cursor should be already over the current tag
Press enter
Toggle window
You are at beginning of the function
Use <C-o> to get back
I also once found and had in my config a mapping which could also be useful in such case:
nnoremap <Leader>gd ?\v%(%(if|while|for|switch)\_s*)#<!\([^)]*\)\_[^;(){}]*\zs\{
How can I bind key and its options?
Example:
dw - deletes one word. d3w - deletes three words. I want to use eo to delete one word, and e3o to delete three words. I can bind d to e, but the problem is I cannot bind option/movement key (e.g w to o in this example).
I tried:
nnoremap e d|xnoremap e d
nnoremap eo dw|xnoremap eo dw
or
nnoremap o w|xnoremap o w
nnoremap e d|xnoremap e d
What you're looking for is "operator pending mappings". You can remap the movement keys to specific actions.
In your case what you need to do is remap d to e
:nnoremap e d
And then remap the "w" movement to "o"
:onoremap o w
With this, both eo and e3o work.
Check this guide for a detailed description https://learnvimscriptthehardway.stevelosh.com/chapters/15.html
BTW: not sure if it's the best practice to remap VIM keybindings for basic actions such as deleting/inserting etc. as it can possibly mess up other bindings - unless some very specific usecase, maybe consider learning the default ones.
I regularly code in R, and I just realized how much of a pain it is for me to move my hand down to the arrow keys and then back to they letters on the keyboard. In Rstudio, I have to do this regularly because the studio completes certain synax automatically, (like parentheses and quotation marks) and then I have to press the arrow key to move out of the parentheses (or quotation marks), this then removed any possible advantage from having R complete the syntax for me. This is extra costly for me because I'm left handed. Is there a shortcut for the arrow keys that's closer to the letter keys?
Intro
To do this, you have two approaches in front:
use your own code
use 3rd party softwares
In these answer I introduce the most efficient and easy approach so for some OSs it's easy and efficient to write your own code while in others it's not really efficient and need a harsh work which have no achivement but wasting time
Windows users
In this method you will use:
alt+I instead of ↑
alt+K instead of ↓
alt+J instead of ←
alt+L instead of →
In order to use this feature, these are the steps in your way:
Download and install autohotkey
Right-click in your desktop area then go to new and make a new "notepad" file
Open empty notepad file and copy/paste codes below into that
Rename your notepad file eveything you want but with *.ahk format
Click your file to run your script
Now you can enjoy and never use arrow keys again...
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; AHK Command ; key = Effect (Description)
; ALT Keypress Implied for all below
!i::Send {UP} ; i UP (Cursor up line)
!k::Send {DOWN} ; k DOWN (Cursor down line)
!j::Send {LEFT} ; j LEFT (Cursor left one character)
!l::Send {RIGHT} ; l RIGHT (Cursor right one character)
!h::Send {HOME} ; h ALT + RIGHT (Cursor to beginning of line)
!;::Send {END} ; ; ALT + LEFT (Cursor to end of line)
!u::Send ^{HOME} ; h SHIFT + HOME (Cursor to beginning of document)
!o::Send ^{END} ; o SHIFT + END (Cursor to end of document)
; CTRL + ALT Keypress Implied for all below
!^j::Send ^{LEFT} ; j CTRL + LEFT (Cursor left per word)
!^l::Send ^{RIGHT} ; l CTRL + RIGHT (Cursor right per word)
; SHIFT + ALT Keypress Implied for all below
!+i::Send +{UP} ; i SHIFT + UP (Highlight per line)
!+k::Send +{DOWN} ; k SHIFT + DOWN (Highlight per line)
!+j::Send +{LEFT} ; j SHIFT + LEFT (Highlight per character)
!+l::Send +{RIGHT} ; l SHIFT + RIGHT (Highlight per character)
!+h::Send +{HOME} ; h SHIFT + ALT + LEFT (Highlight to beginning of line)
!+;::Send +{END} ; ; SHIFT + ALT + RIGHT (Hightlight to end of line)
!+u::Send ^+{HOME} ; u SHIFT + CTRL + HOME (Highlight to beggininng of document)
!+o::Send ^+{END} ; o SHIFT + CTRL + END (Hightlight to end of document)
; SHIFT + CTRL + ALT Keypress Implied for all below
!+^j::Send +^{LEFT} ; j SHIFT + CTRL + LEFT (Highlight per word)
!+^l::Send +^{RIGHT} ; l SHIFT + CTRL + RIGHT (Hightlight per word)
!+^i::Send +!{UP} ; i SHIFT + ALT + UP (Multiply cursor up)
!+^k::Send +!{DOWN} ; k SHIFT + ALT + DOWN (Multiply cursor down)
; CTRL + SHIFT Keypress Implied for all below
+^i::Send +^{UP}
+^k::Send +^{DOWN}
Important Notes
To use autohotkey script which you made, every time you turn on computer instead of clicking on your script every time, you can copy your script in startup folder.
How to find startup folder?
win+R
type: shell:startup
copy your script into that Folder
MacOS users
In this method you will use
option+I instead of ↑
option+K instead of ↓
option+J instead of ←
option+L instead of →
Use hammerspoon: Is a tremendous tool for many purposes (not just assign a keybinding, for example you can use it for windows sanping or ...) and I think that is one of the MUST-HAVE tools in any macos
Since the documentation of hammerspoon is very very straightforward, I just put the code here and you can install and config hammerspoon from it's Getting Started with Hammerspoon
hs.hotkey.bind({"alt"}, "I", function()
hs.eventtap.keyStroke({}, "up")
end)
hs.hotkey.bind({"alt"}, "K", function()
hs.eventtap.keyStroke({}, "down")
end)
hs.hotkey.bind({"alt"}, "J", function()
hs.eventtap.keyStroke({}, "left")
end)
hs.hotkey.bind({"alt"}, "L", function()
hs.eventtap.keyStroke({}, "right")
end)
Important Notes
If you think hammerspoon is slow or not working as genius as you want another option is Karabiner
Debian-based Linux users (not Ubuntu; see important notes):
In this method you will use:
CapsLock+I instead of ↑
CapsLock+K instead of ↓
CapsLock+J instead of ←
CapsLock+L instead of →
and
alt_gr instead of CapsLock
How? Well:
open up Terminal, write your keyboard layout on in a file(I named it modmap), then open that file and edit it as you will follow next steps:
xmodmap -pke > modmap
gedit modmap
change keyCode 108 (alt_Gr/ISO_Level3_Shift) value, so it should be like this after modifying:
keycode 108 = Caps_Lock Caps_Lock Caps_Lock Caps_Lock Caps_Lock Caps_Lock
change keyCode 66 (CapsLock) value, so it should be like this after modifying:
keycode 66 = Mode_switch Mode_switch Mode_switch Mode_switch Mode_switch Mode_switch
change keyCode 31 (i) value, so it should be like this after modifying:
keycode 31 = i I Up NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol
change keyCode 44 (j) value, so it should be like this after modifying:
keycode 44 = j J Left NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol
change keyCode 45 (k) value, so it should be like this after modifying:
keycode 45 = k K Down NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol
change keyCode 46 (l) value, so it should be like this after modifying:
keycode 46 = l L Right NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol
Important Notes
xmodmap is no longer used/supported on Ubuntu (because it wasn't handy for many users, I think they stop using xmodmap from 2013) but since this is a professional question for very fast coding and working with computer and also coding, I see many professionals using Debian or their own debian-based Linux (not Ubuntu) and they always prefer native solutions to plugins or...
Anyway if you are using Ubuntu you can use xkb or gnome tweak tools where you maybe can adjust your keyboard mapping in a GUI
You can't use this solution easily if you got multi langs/inputs on your keyboard, but you can use it like below:
CapsLock+shift+i instead of ↑
CapsLock+shift+k instead of ↓
CapsLock+shift+j instead of ←
CapsLock+shift+l instead of →
for example, if you also want to have persian_language_input you can do step 1,2,3 above then change other steps like below:
keycode 31 = i I Arabic_heh Up 5 6 7 8
keycode 44 = j J Arabic_teh Left 5 6 7 8
keycode 45 = k K Arabic_noon Down 5 6 7 8
keycode 46 = l L Arabic_meem Right 5 6 7 8
be careful that you shouldn't test above keyboard shortcuts in Terminal
Since we're using xmodmap tool (because it's native unlike xkb), You can only change the AltGr keysyms for keycodes that are already using AltGr. So we change it with CapsLock to overcome this problem since CapsLock is more comfort for fingers to find it is a very acceptable solution.
In most cases, alt_Gr is the right alt Key on your keyboard
further reading about xmodmap on ArchWiki
if anyone has knowledge about this answer in BSD OS (or BSD-BASED) I'll appreciate that if he/she add it to my answer
Two weeks back Microsoft launched "Power Toys" in the Microsoft Store.
You can use the keyboard manager to create a shortcut for arrow keys as mentioned in answer.
I use the vim shortcut for arrow keys as shown below:
[added shortcuts for arrow keys][1]
[1]: https://i.stack.imgur.com/F9syJ.png
I have the same pain, I've tried to use hjkl as arrow keys, and some layout like fun plus wsad. But now I have gotten the best solution since I got a Filco Minila-R. It divided space key into three keys, two function on two sides of sapce key. Like when I type right arrow, I hold the left fn key (at the left side of space) with my left hand thumb while touch F key, F key always used for locating for left hand.
e-d-f-s plus left function keys achived up-down-right-left, right function plus jm-k,-l. achived ins del-home end-pu pd.
If I use capslock + hjkl, I have to use two hands, Minila-R layout allows me using one sigle hand to touch this keys, besides, the two functions which devided from space key just at the most fine place for thumb to touch.
g is a prefix to several commands. e.g. goto to move the cursor, but also gqip to format a paragraph. Where is the reference for all commands that are prefixed with g?
Vim's documentation is http://vimdoc.sourceforge.net/. If you go for the HTML docs, you will find |reference_toc| More detailed information for all commands, which includes |index.txt| alphabetical index of all commands, which -- due to an unfortunate quirk with the doc file named index.txt and linked as index.html -- doesn't actually lead to where you would expect it to lead.
Long story short, http://vimdoc.sourceforge.net/htmldoc/vimindex.html#g is the documentation you are looking for ("Commands starting with 'g'").
Alternatively, type :help *g* in Vim.
(Sorry merlin2011 but your list is somewhat incomplete...)
Some reformatting applied:
2.4 Commands starting with 'g'
char note action in Normal mode
------------------------------------------------------------------
g CTRL-A only when compiled with MEM_PROFILE
defined: dump a memory profile
g CTRL-G show information about current cursor
position
g CTRL-H start Select block mode
g CTRL-] |:tjump| to the tag under the cursor
g# 1 like "#", but without using "\<" and "\>"
g$ 1 when 'wrap' off go to rightmost character of
the current line that is on the screen;
when 'wrap' on go to the rightmost character
of the current screen line
g& 2 repeat last ":s" on all lines
g'{mark} 1 like |'| but without changing the jumplist
g`{mark} 1 like |`| but without changing the jumplist
g* 1 like "*", but without using "\<" and "\>"
g0 1 when 'wrap' off go to leftmost character of
the current line that is on the screen;
when 'wrap' on go to the leftmost character
of the current screen line
g8 print hex value of bytes used in UTF-8
character under the cursor
g< display previous command output
g? 2 Rot13 encoding operator
g?? 2 Rot13 encode current line
g?g? 2 Rot13 encode current line
gD 1 go to definition of word under the cursor
in current file
gE 1 go backwards to the end of the previous
WORD
gH start Select line mode
gI 2 like "I", but always start in column 1
gJ 2 join lines without inserting space
["x]gP 2 put the text [from register x] before the
cursor N times, leave the cursor after it
gQ switch to "Ex" mode with Vim editing
gR 2 enter Virtual Replace mode
gU{motion} 2 make Nmove text uppercase
gV don't reselect the previous Visual area
when executing a mapping or menu in Select
mode
g] :tselect on the tag under the cursor
g^ 1 when 'wrap' off go to leftmost non-white
character of the current line that is on
the screen; when 'wrap' on go to the
leftmost non-white character of the current
screen line
ga print ascii value of character under the
cursor
gd 1 go to definition of word under the cursor
in current function
ge 1 go backwards to the end of the previous
word
gf start editing the file whose name is under
the cursor
gF start editing the file whose name is under
the cursor and jump to the line number
following the filename.
gg 1 cursor to line N, default first line
gh start Select mode
gi 2 like "i", but first move to the |'^| mark
gj 1 like "j", but when 'wrap' on go N screen
lines down
gk 1 like "k", but when 'wrap' on go N screen
lines up
gm 1 go to character at middle of the screenline
go 1 cursor to byte N in the buffer
["x]gp 2 put the text [from register x] after the
cursor N times, leave the cursor after it
gq{motion} 2 format Nmove text
gr{char} 2 virtual replace N chars with {char}
gs go to sleep for N seconds (default 1)
gu{motion} 2 make Nmove text lowercase
gv reselect the previous Visual area
gw{motion} 2 format Nmove text and keep cursor
gx execute application for file name under the
cursor (only with |netrw| plugin)
g#{motion} call 'operatorfunc'
g~{motion} 2 swap case for Nmove text
g<Down> 1 same as "gj"
g<End> 1 same as "g$"
g<Home> 1 same as "g0"
g<LeftMouse> same as <C-LeftMouse>
g<MiddleMouse> same as <C-MiddleMouse>
g<RightMouse> same as <C-RightMouse>
g<Up> 1 same as "gk"
note: 1 = cursor movement command; 2 = can be undone/redone
Open vim. Type :help g.
2.4 Commands starting with 'g' g
tag char note action in Normal mode
------------------------------------------------------------------------------
g_CTRL-A g CTRL-A only when compiled with MEM_PROFILE
defined: dump a memory profile
g_CTRL-G g CTRL-G show information about current cursor
position
g_CTRL-H g CTRL-H start Select block mode
g_CTRL-] g CTRL-] :tjump to the tag under the cursor
g# g# 1 like "#", but without using "\<" and "\>"
g$ g$ 1 when 'wrap' off go to rightmost character of
the current line that is on the screen;
when 'wrap' on go to the rightmost character
of the current screen line
g& g& 2 repeat last ":s" on all lines
g' g'{mark} 1 like ' but without changing the jumplist
g` g`{mark} 1 like ` but without changing the jumplist
gstar g* 1 like "*", but without using "\<" and "\>"
g+ g+ go to newer text state N times
g, g, 1 go to N newer position in change list
g- g- go to older text state N times
g0 g0 1 when 'wrap' off go to leftmost character of
the current line that is on the screen;
when 'wrap' on go to the leftmost character
of the current screen line
g8 g8 print hex value of bytes used in UTF-8
character under the cursor
g; g; 1 go to N older position in change list
g< g< display previous command output
The list above has been truncated for readability.
I am looking for a way to define an additional Shift key, for a given key scan code. So that I would end up with unchanged left and right shift, plus an extra shift key, which would be definable on any existing key (assuming I know its scan code).
In xkb/keycodes, I see shift keycodes defined for:
<LFSH>
<RTSH>
But if I was to add a third entry here, I don't know I'd tell xkb that it was also to be considered a Shift key.
(This is not relevant to the question, but in case you wondered, the use case is for some keyboards which have a split spacebar, where I would like to set one of the spacebar halves to be the extra Shift).
Interested on what xkb configuration I would need for this?
Perhaps you can do this using xmodmap, if you rename the keycode to keysym Shift_L, and add the Shift_L back
into the modifier map. Eg for keycode 110:
xmodmap -e 'keycode 110 = Shift_L Shift_L Shift_L Shift_L'
xmodmap -e 'add shift = Shift_L Shift_R'
Find the keycode by looking through xmodmap -pke or using xev or similar.
I have now found a way to achieve the above directly in xkb configuration, without the need to use xmodmap.
STEP ONE: In the xkb/symbols/pc file, note the following is already defined:
key <LFSH> { [ Shift_L ] };
key <RTSH> { [ Shift_R ] };
So, what is required as to add a new key definition for MDSH (ie "mid shift"):
key <MDSH> { [ Shift_L ] };
STEP TWO: Assign these keys to the keycodes. In xkb/keycodes/evdev, left and right shift are already defined:
<LFSH> = 50;
<RTSH> = 62;
So all that remains to add an extra definition for MDSH:
<MDSH> = XXX;
where XXX is the keycode you want to assign.