dhruvasagar / dhruvasagar/vim-table-mode

Why isn't g:table_mode_realign_map always mapped?

Open
#249 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vim Script
Stars
2.2k
Forks
100
PR merge metrics
No merged PRs in 30d

Description

There's a bunch of variables to define mappings:
https://github.com/dhruvasagar/vim-table-mode/blob/9ac358083943f6339fc304a6e218b634fd1e30bd/plugin/table-mode.vim#L48-L56

Some (like `table_mode_tableize_map` and `table_mode_tableize_d_map`) are always mapped and others are toggled in `s:ToggleMapping()`. (Looks like 1d9d512ed1f4a59583dec6de9b04ec9a21d7a03b introduced these options, but never implemented them and ea78f6256513b4b853ea01b55b18baf0f9d99f8c implemented them.)

Most of them make sense to be only active in table mode, but **realign** stands out since the table is constantly realigned in table mode. It seems more useful to be able to trigger realignment without entering table mode.

However, if I try to map it myself:

```
let g:table_mode_map_prefix = 'ct'
nmap ctr (table-mode-realign)
```

then I get an error when I leave table mode:
```
 Error detected while processing function
 tablemode#Toggle[6]
 400_SetActive[3]
 400_ToggleMapping[31]
 400_UnMap[3]
 E31: No such mapping
 Table Mode Disabled
```

I can work around this by also making the built-in realign map invalid so it doesn't get remapped:
```
let g:table_mode_map_prefix = 'ct'
nmap ctr (table-mode-realign)
let g:table_mode_realign_map = ''
```

Feel free to close if you think realign should be only mapped in table mode. However, it'd be nice if the docs made it clearer which mappings are only in table mode.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.