andmarti1424 / sc-im

sc-im - Spreadsheet Calculator Improvised -- An ncurses spreadsheet program for terminal
Other
4.81k stars 204 forks source link

"go" does not work after remapping "o", cannot remap anything else to "go" either! #731

Open sagsai opened 2 years ago

sagsai commented 2 years ago

I am using Colemak keyboard layout so remapped n-e-i-o for cell navigation.

# move to the cell below, above, left, right
nnoremap "n" "j"
nnoremap "e" "k"
nnoremap "i" "h"
nnoremap "o" "l"
nnoremap "N" "H"
nnoremap "E" "L"

At this point I expected "go"("goa12") to work without any modification, but it didn't. Instead of going to the cell 'a12' it is going to the last visited cell. I think "go" is translated to "gl" automatically due to the mapping nnoremap "o" "l", which is an expected behavior.

I tried many other mappings/combinations none of which work:

# does not work
nnoremap "gs" "gt"
nnoremap "gt" "go"

# does not work
nunmap "k"
nunmap "l"
nnoremap "gk" "go"
nunmap "go"

# does not work
nnoremap "gq" "go"

So is this a bug or am I doing something wrong? If this is not a bug then how to map some other keys say "gt"(goto) to "go"?

Also I don't think unmapping work either, "k" & "l" still work even after "nunmap "k" & nunmap "l" if not mapped to something else. Please confirm.

Really hoping to replace Openoffice Calc with sc-im but won't be able to if cannot make Colemak mappings work. Thanks in advance for any help!

andmarti1424 commented 2 years ago

I see. You can just nmap "gt" "go" it would work, until you map "o" after it..

sagsai commented 2 years ago

Unfortunately mapping "o" to something else cannot be avoided on colemak. So the following mappings don't work for sc-im.

# move to the cell below, above, left, right
nnoremap "n" "j"
nnoremap "e" "k"
nnoremap "i" "h"
nnoremap "o" "l"
nnoremap "N" "H"
nnoremap "E" "L"

# edit row
nnoremap "l" "e"
nnoremap "L" "E"

# search
nnoremap "h" "n"
nnoremap "H" "N"

# prepend/append row/column
nnoremap "AR" "ir"
nnoremap "AC" "ic"
nnoremap "ar" "or"
nnoremap "ac" "oc"

# scroll to the left/right cell
nnoremap "zi" "zh"
nnoremap "zo" "zl"
# scroll left/right half a page horizontally
nnoremap "zI" "zH"
nnoremap "zO" "zL"

# format cells, increase/decrease height/width
nnoremap "fn" "fj"
nnoremap "fe" "fk"
nnoremap "fi" "fh"
nnoremap "fo" "fl"

# shift the current cell or range up
nnoremap "sn" "sj"
nnoremap "se" "sk"
nnoremap "si" "sh"
nnoremap "so" "sl"

nmap "gs" "gt"
nmap "gt" "go"

Have been able to change mappings using similar commands for neovim and ranger succussfully for colemak, this is the first time they didn't work. Thanks.

vanya-robertson commented 1 year ago
nnoremap "go" ":int goto "

Note that the remap ends with a space. This gives desired behaviour, except enter must be pressed -- to my knowledge one cannot wait for the command to execute using this method. Additionally, it must be defined before the nnoremap "o" "l" command.

Edit: This is functionally identical to the statement nnoremap "go" "/" So you could just press /A23 instead of goA23