Browse Source

Initial commit

main v1.0
ltdk 2 years ago
commit
753bfd9c32
  1. 1
      .gitignore
  2. 9
      CHANGELOG.md
  3. 29
      LICENSE.md
  4. 9
      Makefile
  5. 26
      README.md
  6. 141
      usr/share/kak/rc/tools/laymap.kak
  7. 135
      usr/share/vim/vimfiles/autoload/laymap.vim

1
.gitignore vendored

@ -0,0 +1 @@
*.tar.xz

9
CHANGELOG.md

@ -0,0 +1,9 @@
This project uses a **major**.**minor** versioning scheme, where:
* Bumping the major version resets the minor version to zero.
* The major version is bumped if the calling convention changes, or if the mapping changes.
* The minor version is bumped in all other cases.
# v1.0
This is the first release.

29
LICENSE.md

@ -0,0 +1,29 @@
# ANTI-CAPITALIST SOFTWARE LICENSE (v 1.4)
Copyright © 2020 ltdk.xyz
This is anti-capitalist software, released for free use by individuals and organizations that do
not operate by capitalist principles.
Permission is hereby granted, free of charge, to any person or organization (the "User") obtaining
a copy of this software and associated documentation files (the "Software"), to use, copy, modify,
merge, distribute, and/or sell copies of the Software, subject to the following conditions:
1. The above copyright notice and this permission notice shall be included in all copies or
modified versions of the Software.
2. The User is one of the following:
a. An individual person, laboring for themselves
b. A non-profit organization
c. An educational institution
d. An organization that seeks shared profit for all of its members, and allows non-members to
set the cost of their labor
3. If the User is an organization with owners, then all owners are workers and all workers are
owners with equal equity and/or equal vote.
4. If the User is an organization, then the User is not law enforcement or military, or working
for or under either.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

9
Makefile

@ -0,0 +1,9 @@
PROJECT = laymap
VERSION = $(shell git describe)
FILES = $(shell git ls-files usr/ README.md LICENSE.md CHANGELOG.md Makefile)
dist: $(PROJECT)-$(VERSION).tar.xz
$(PROJECT)-$(VERSION).tar.xz: $(FILES)
rm -f $(PROJECT)-$(VERSION).tar.xz
tar c -f - $(FILES) | xz -9 > $(PROJECT)-$(VERSION).tar.xz

26
README.md

@ -0,0 +1,26 @@
# laymap
Keyboard layout mappings for modal text editors.
## License
Available via the [Anti-Capitalist Software License][ACSL] for individuals, non-profit
organisations, and worker-owned businesses.
[ACSL]: ./LICENSE.md
## Installation
Merge the provided `/usr` with yours to install the plugin.
## Usage
### vim
In your `vimrc`, add `call laymap#Mapping()` to set a mapping. Supported `Mapping`s are `Qwerty`,
`Colemak`, and `Dvorak`.
### kakoune
In your `kakrc`, add `keymap-mapping` to set a mapping. Supported `mapping`s are `qwerty`,
`colemak`, and `dvorak`.

141
usr/share/kak/rc/tools/laymap.kak

@ -0,0 +1,141 @@
define-command -hidden -params 1 laymap-set %{
evaluate-commands %sh{
for map in $1; do
from=${map%|*}
to=${map#*|}
echo "map global goto %|$to| %|$from|"
echo "map global menu %|$to| %|$from|"
echo "map global normal %|$to| %|$from|"
echo "map global object %|$to| %|$from|"
echo "map global user %|$to| %|$from|"
echo "map global view %|$to| %|$from|"
done
}
}
define-command -docstring "laymap-qwerty: map to qwerty" laymap-qwerty %|
laymap-set %||
<minus>||||<minus> _||||_
=||||= <plus>||||<plus>
q||||q Q||||Q
w||||w W||||W
e||||e E||||E
r||||r R||||R
t||||t T||||T
y||||y Y||||Y
u||||u U||||U
i||||i I||||I
o||||o O||||O
p||||p P||||P
[||||[ {||||{
]||||] }||||{
a||||a A||||A
s||||s S||||S
d||||d D||||D
f||||f F||||F
g||||g G||||G
h||||h H||||H
j||||j J||||J
k||||k K||||K
l||||l L||||L
;||||; :||||:
'||||' "||||"
z||||z Z||||Z
x||||x X||||X
c||||c C||||C
v||||v V||||V
b||||b B||||B
k||||k K||||K
m||||m M||||M
,||||, <lt>||||<lt>
.||||. <gt>||||<gt>
/||||/ ?||||?
||
|
define-command -docstring "laymap-colemak: remap to colemak" laymap-colemak %|
laymap-set %||
<minus>||||<minus> _||||_
=||||= <plus>||||<plus>
q||||q Q||||Q
w||||w W||||W
e||||f E||||F
r||||p R||||P
t||||g T||||G
y||||j Y||||J
u||||l U||||L
i||||u I||||U
o||||y O||||Y
p||||; P||||:
[||||[ {||||{
]||||] }||||}
a||||a A||||A
s||||r S||||R
d||||s D||||S
f||||t F||||T
g||||d G||||D
j||||n J||||N
k||||e K||||E
l||||i L||||I
;||||o :||||O
'||||' "||||"
z||||z Z||||Z
x||||x X||||X
c||||c C||||C
v||||v V||||V
b||||b B||||B
n||||k N||||K
m||||m M||||M
,||||, <lt>||||<lt>
.||||. <gt>||||<gt>
/||||/ ?||||?
||
|
define-command -docstring "laymap-dvorak: remap to dvorak" laymap-dvorak %|
laymap-set %||
<minus>||||[ _||||{
=||||] <plus>||||}
q||||' Q||||"
w||||, W||||<lt>
e||||. E||||<gt>
r||||p R||||P
t||||y T||||Y
u||||f U||||F
i||||g I||||G
o||||c O||||C
p||||r P||||R
[||||/ {||||?
]||||= }||||<plus>
a||||a A||||A
s||||o S||||O
d||||e D||||E
f||||u F||||U
g||||i G||||I
h||||d H||||D
j||||h J||||H
k||||t K||||T
l||||n L||||N
;||||s :||||S
'||||<minus> "||||_
z||||; Z||||:
x||||q X||||Q
c||||j C||||J
v||||k V||||K
b||||x B||||X
n||||b N||||B
m||||m M||||M
,||||w <lt>||||W
.||||v <gt>||||V
/||||z ?||||Z
||
|

135
usr/share/vim/vimfiles/autoload/laymap.vim

@ -0,0 +1,135 @@
function! s:SetKeymaps(keymaps)
for map in a:keymaps
execute "noremap " . map[1] . " " . map[0]
endfor
endfunction
function! laymap#Qwerty()
let l:laymap=[
\ "--", "__",
\ "==", "++",
\ "qq", "QQ",
\ "ww", "WW",
\ "ee", "EE",
\ "rr", "RR",
\ "tt", "TT",
\ "yy", "YY",
\ "uu", "UU",
\ "ii", "II",
\ "oo", "OO",
\ "pp", "PP",
\ "[[", "{{",
\ "]]", "}{",
\ "aa", "AA",
\ "ss", "SS",
\ "dd", "DD",
\ "ff", "FF",
\ "gg", "GG",
\ "hh", "HH",
\ "jj", "JJ",
\ "kk", "KK",
\ "ll", "LL",
\ ";;", "::",
\ "''", '""',
\ "zz" "ZZ"
\ "xx", "XX",
\ "cc", "CC",
\ "vv", "VV",
\ "bb", "BB",
\ "kk", "KK",
\ "mm", "MM",
\ ",,", "<<",
\ "..", ">>",
\ "//", "??",
\ ]
call s:SetKeymaps(l:laymap)
endfunction
function! laymap#Colemak()
let l:laymap=[
\ "--", "__",
\ "==", "++",
\
\ "qq", "QQ",
\ "ww", "WW",
\ "ef", "EF",
\ "rp", "RP",
\ "tg", "TG",
\ "yj", "YJ",
\ "ul", "UL",
\ "iu", "IU",
\ "oy", "OY",
\ "p\\;", "P:",
\ "[[", "{{",
\ "]]", "}}",
\
\ "aa", "AA",
\ "sr", "SR",
\ "ds", "DS",
\ "ft", "FT",
\ "gd", "GD",
\ "jn", "JN",
\ "ke", "KE",
\ "li", "LI",
\ ";o", ":O",
\ "''", '""',
\
\ "zz", "ZZ",
\ "xx", "XX",
\ "cc", "CC",
\ "vv", "VV",
\ "bb", "BB",
\ "nk", "NK",
\ "mm", "MM",
\ "\\,\\,", "<<",
\ "..", ">>",
\ "//", "??",
\ ]
call s:SetKeymaps(l:laymap)
endfunction
function! laymap#Dvorak()
let l:laymap=[
\ "-[", "_{",
\ "=]", "+}",
\ "q'", "Q"",
\ "w,", "W,",
\ "e.", "E>",
\ "rp", "RP",
\ "ty", "TY",
\ "uf", "UF",
\ "ig", "IG",
\ "oc", "OC",
\ "pr", "PR",
\ "[/", "{?",
\ "]=", "}+",
\ "aa", "AA",
\ "so", "SO",
\ "de", "DE",
\ "fu", "FU",
\ "gi", "GI",
\ "hd", "HD",
\ "jh", "JH",
\ "kt", "KT",
\ "ln", "LN",
\ ";s", ":S",
\ "'-", ""_",
\ "z;", "Z:",
\ "xq", "XQ",
\ "cj", "CJ",
\ "vk", "VK",
\ "bx", "BX",
\ "nb", "NB",
\ "mm", "MM",
\ ",w", "<W",
\ ".v", ">V",
\ "/z", "?Z",
\ ]
call s:SetKeymaps(l:laymap)
endfunction
Loading…
Cancel
Save