Skip to content

Instantly share code, notes, and snippets.

@slmjkdbtl
Last active October 4, 2021 15:34
Show Gist options
  • Save slmjkdbtl/c61141901a3592911ad13133ad2f33dd to your computer and use it in GitHub Desktop.
Save slmjkdbtl/c61141901a3592911ad13133ad2f33dd to your computer and use it in GitHub Desktop.
use esc+ as meta key in vim
" useful if you want to use alt + * key combs and your terminal sends out esc for alt keys
for k in split("qwertyuiopasdfghjklzxcvbnm1234567890`-=\\;',./", '\zs')
exec 'map <esc>' . k . ' <m-' . k . '>'
exec 'map! <esc>' . k . ' <m-' . k . '>'
endfor
for k in split('cr bs tab left right up down')
exec 'map <esc><' . k . '> <m-' . k . '>'
exec 'map! <esc><' . k . '> <m-' . k . '>'
endfor
" it'll work now, e.g. alt + backspace to delete word
" map! <m-bs> <c-w>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment