https://github.com/luffah/vim-accessibility
This project group all the things needed to make Vim more accessible for people.
https://github.com/luffah/vim-accessibility
accessibility aliases keybindings remanent screenreader vim-plugin
Last synced: 8 months ago
JSON representation
This project group all the things needed to make Vim more accessible for people.
- Host: GitHub
- URL: https://github.com/luffah/vim-accessibility
- Owner: luffah
- License: gpl-3.0
- Created: 2018-03-26T08:58:17.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2025-04-19T22:49:47.000Z (9 months ago)
- Last Synced: 2025-04-19T23:27:31.027Z (9 months ago)
- Topics: accessibility, aliases, keybindings, remanent, screenreader, vim-plugin
- Language: Vim Script
- Size: 68.4 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Set of scripts attempting to implement accessibility features
This project group things intended to make Vim more accessible for people.
* Remanent keys : for keeping your pinkies safe
```vim
" Map `` to be the remanent key for Shift, and `` to be the remanent key for Ctrl.
" ['n'] is for normal mode
let g:sticky_map = {
\'shift': { '':['n'] },
\'ctrl': { '':['n'] },
\})
```
* Documented keymapping : to force yourself to document your keybind and allow to create tutorials
In short, it can be written like that :
```vim
" Here 8 simples mapping in 2 lines
" Keys ''Description '' Vim action % modes
"Enter command line" : % I n v
"Compl. filename " pumvisible()?"":"%1%" % i -n-%i%
" Want more ? you forgot your shortcuts ? do you want to see the list.
" You can ':call KeyMap#PrintCurrentLayer()',
" But why not grouping shortcuts by categories ?
" -> a tutorial mode for
"C-w" % n
T ":Move to a new tab" T %
" -> an emacs like layer
"~Emacs C-x" % n
":Search file" :e! %:p:h/* % n
```
See the details about keymapping
Every lines above are a short format the following lines:
```vim
" enter in command line mode from insert, normal, and visual mode
" cal ..Map('Description', keys, action, modes_and_things_related_to_the_mode)
cal KeyMap#Map('Enter command line' , ['',''] , ':' , ['I','n','v'])
" I is for insert mode, to use a one-shot normal mode key. (equivalent to ':')
" complete filename in insert and normal mode
" 'i' is for insert mode
" '-n-%i%' is for normal mode; but force the use of in insert mode
" another way to say it : '%1%' is replaced by 'i'
cal KeyMap#Map('Complete filename' , '' , 'pumvisible()? "":"%1%"' , ['i' , '-n-%i%'])
" Following example is usefull for re-discovering keys
" When you hit , a window with 'T -> Move to a new tab' is shown
" If you hit 'T' then ':wincmd T' is applied
" Too, if you hit 'w' then ':wincmd w' is applied (no need to document everything)
cal KeyMap#Map('C-w' , '' , "" , ['n'])
cal KeyMap#Map(':Move to a new tab' , 'T' , "T" , [])
" Here a way to have a thousand of keybinds
" It define a new keybind temporary layer,
" '~' just say to not show the window which shows activated keybinds
cal KeyMap#Map('~Emacs C-x' , '' , '' , ['n'])
cal KeyMap#Map(':Search file' , '' , ':e! %:p:h/*' , ['n'])
```
* Text to Speech dispatcher : keybinds and commands to make Vim speak
(require speech-dispatcher on linux - if you use Orca it shall be already installed)
```vim
"let g:speak_lang = "fr" " automatically set by detecting the spell lang
"let g:speak_voice_type = "female1" " default
```
`:SpeakLine` speak (send text at) the current line (to speech-dispatcher).
`:SpeakWORD` speak the following word in the text; intended to be followed by W in order to read text word by word.
Anyway, in a GVim just hit `` (Ctrl + s) to toggle a screen reader mode.
# Installation
Get the repository.
```sh
# 'ui' is abitrary chosen for 'user interface'
mkdir -p ~/.vim/pack/ui/start
git clone https://github.com/luffah/vim-accessibility.git ~/.vim/pack/ui/start/accessibility
```
```vim
packloadall
" Examples
let mapleader=","
KeyMap $VIMPLUGINS/vim-accessibility/doc/samples/common.vimkm
KeyMap $VIMPLUGINS/vim-accessibility/doc/samples/bepo.vimkm
```
My Vim doesn't support +packages
If you have an old version of Vim (< 8), it is useless to create `~/.vim/pack/`. Just use the path where you install your plugins.
```vim
" let $VIMPLUGINS =
"
" [Optional]
" This allows to access to documentation and some syntax sugar.
" Add to runtime path
set rtp+=$VIMPLUGINS/vim-accessibility
" Activate plugins
filetype indent plugin on
" [Required]
" Given plugins commands are only usable after initialization
" Sourcing the files, ensure KeyMap is known.
so $VIMPLUGINS/vim-accessibility/loader.vim
" Examples
let mapleader=","
KeyMap $VIMPLUGINS/vim-accessibility/doc/samples/common.vimkm
KeyMap $VIMPLUGINS/vim-accessibility/doc/samples/bepo.vimkm
```
# License
[Vim](https://www.vim.org/) is distributed under [GPL-compatible Charityware License](https://www.gnu.org/licenses/vim-license.txt).
The content of this project itself is licensed under the [Creative Commons Attribution-ShareAlike 4.0](https://creativecommons.org/licenses/by-sa/4.0/) license,
and source code contained in this repository is licensed under the [GPLv3 license](./LICENSE).

