- Notifications
You must be signed in to change notification settings - Fork5
(experimental!) Enables ALT key mappings in terminal vim
License
vim-utils/vim-alt-mappings
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This plugin isexperimental. After "playing" with it (if you want), youshould probably uninstall it due to problems it can cause to your workflow.
After creating this plugin and validating the functionality via automatedtests, 2 pretty big problematic areas were discovered:
- it breaks macros if they use
<esc> + char - mappings that use
<esc> + charwon't work
So far I don't know how to solve these issues and thus the label "experimental".
Please get in touch (via github issue) if you have an idea how to solve theabove problems.
Update: I opened anissue to TimPope in vim-rsi plugin, since he uses alt mappings there as well. It seems Timwas unaware of the problem as well.
This plugin enablesAlt key mappings interminal vim.
Now you can do something like this:
map <M-a> :echo "You just pressed Alt-a!"<CR>map <M-X> :echo "Works with uppercase letters."<CR>map <M-5> :echo "Numbers are supported too"<CR>map <M-$> :echo "as well as characters..."<CR>map <M-?> :echo "and more characters..."<CR>map <M-~> :echo "and more..."<CR>Alt behaves as just another modifier key (can't get enough of those, right?)
For example, when having soft-wrapped text in your buffer, to move betweenlines you can usegj andgk ("g" stands for graphical). When you use ita lot, you may realize that it quickly becomes tedious to have to prepend "g"every time. Drew Neil in his vimcast"Soft wrapping text"suggests mapping the "Command" key (D) to graphical keystrokes:
map<D-j>gjmap<D-k>gk
However, in Terminal vim this is not an option, because the "Command" key isused by the OS, and can't be used for mappings. Furthermore, PC users don'tevenhave a "Command" key. "Alt" mappings to the rescue!
map<M-j>gjmap<M-k>gk
Use your favorite plugin manager.
- Pathogen
- just
git clone https://github.com/vim-utils/vim-alt-mappings.git ~/.vim/bundle/vim-alt-mappings
- just
- Vundle
- add
Bundle 'vim-utils/vim-alt-mappings'to .vimrc - then run
:BundleInstall
- add
- NeoBundle
- add
NeoBundle 'vim-utils/vim-alt-mappings'to .vimrc - then run
:NeoBundleInstall
- add
- vim-plug
- add
Plug 'vim-utils/vim-alt-mappings'to .vimrc - then run
:PlugInstall
- add
Mappings for the following keys are (currently?) not possible:
Alt-O(that'sAltbig o)
if this one is set, movements arrow keys produce funny characters in insert andcommand line mode.Alt->,Alt-[- couldn't find a way to make these workAlt-space- when set up, messes up all other mappings
There are more than 90Alt key mappings available, so hopefully you won'tmiss the above 4 that are not (yet?) possible.
If you'reaware of the issues thatAltmappings can do, and still wanna usesome of them selectively, here's how youcan do that.
you donot need to have this plugin installed
choose a character you're sure won't cause you problems in macros ormappings, for example
x. It's unlikely you'll ever have<Esc>xin yourmacros or mappings.enable
<M-x>mapping by putting the following in.vimrcset <M-x>=\<Esc>xmap
<M-x>to something useful and use it!map <M-x> :echo "really useful"<cr>
This plugin uses the excellentvader.vimVimscript testing framework.To run the tests locally:
- install
vader.vimplugin - in this project's root directory run
$ test/run
@tpope for hisrsi.vim plugin, which was aninspiration for this one.
About
(experimental!) Enables ALT key mappings in terminal vim
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Contributors3
Uh oh!
There was an error while loading.Please reload this page.

