Skip to content

Commit

Permalink
Fix NeoVintageous#946 noremap and unmap should include Select mode
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenesvk committed Jan 6, 2024
1 parent 4066e32 commit c37a69d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* [#915](https://github.com/NeoVintageous/NeoVintageous/issues/915): Show marks in gutter (controlled via `vintageous_show_marks_in_gutter` setting)
* [#921](https://github.com/NeoVintageous/NeoVintageous/issues/921): `'equalalways'` option

### Changed

* [#946](https://github.com/NeoVintageous/NeoVintageous/issues/946): :noremap and unmap now include Select mode

### Fixed

* [#929](https://github.com/NeoVintageous/NeoVintageous/issues/929): There is no syntax highlighting for `<LocalLeader>`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Overview of which map command works in which mode. More details below.

| COMMAND | COMMAND | MODES
| :-------- | :------ | :----
| :noremap | :unmap | Normal, Visual, Select, Operator-pending <br>:warning: Currently does not include Select mode; this may be fixed in a future release.
| :noremap | :unmap | Normal, Visual, Select, Operator-pending
| :nnoremap | :nunmap | Normal
| :inoremap | :iunmap | Insert <br>:warning: Insert mode mappings are very limited. Very few keys are mappable out-of-the-box, but you can configure any key to be mappable. This may be improved in a future release.
| :vnoremap | :vunmap | Visual and Select <br>:warning: Currently does not include Select mode; this may be fixed in a future release.
Expand Down
3 changes: 2 additions & 1 deletion nv/ex_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ def ex_noremap(lhs: str = None, rhs: str = None, **kwargs) -> None:

mappings_add(NORMAL, lhs, rhs)
mappings_add(OPERATOR_PENDING, lhs, rhs)
mappings_add(SELECT, lhs, rhs)
mappings_add(VISUAL, lhs, rhs)
mappings_add(VISUAL_BLOCK, lhs, rhs)
mappings_add(VISUAL_LINE, lhs, rhs)
Expand Down Expand Up @@ -896,7 +897,7 @@ def ex_tabprevious(window, **kwargs) -> None:


def ex_unmap(lhs: str, **kwargs) -> None:
for mode in (NORMAL, OPERATOR_PENDING, VISUAL, VISUAL_LINE, VISUAL_BLOCK):
for mode in (NORMAL, OPERATOR_PENDING, SELECT, VISUAL, VISUAL_LINE, VISUAL_BLOCK):
try:
mappings_remove(mode, lhs)
except KeyError:
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test__ex_noremap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ def test_noremap(self):

self.assertMapping(unittest.NORMAL, 'x', 'y')
self.assertMapping(unittest.OPERATOR_PENDING, 'x', 'y')
self.assertMapping(unittest.SELECT, 'x', 'y')
self.assertMapping(unittest.VISUAL, 'x', 'y')
self.assertMapping(unittest.VISUAL_BLOCK, 'x', 'y')
self.assertMapping(unittest.VISUAL_LINE, 'x', 'y')
self.assertNotMapping('x', unittest.INSERT)
self.assertNotMapping('x', unittest.SELECT)

self.assertNoStatusMessage()
5 changes: 3 additions & 2 deletions tests/functional/test__ex_unmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ class Test_ex_unmap(unittest.FunctionalTestCase):
@unittest.mock_status_message()
def test_no_such_mapping(self):
self.feed(':unmap x')
self.assertStatusMessage('E31: No such mapping', 5)
self.assertStatusMessage('E31: No such mapping', 6)

@unittest.mock_mappings(
(unittest.NORMAL, 'x', 'y'),
(unittest.OPERATOR_PENDING, 'x', 'y'),
(unittest.SELECT, 'x', 'y'),
(unittest.VISUAL, 'x', 'y'),
(unittest.VISUAL_BLOCK, 'x', 'y'),
(unittest.VISUAL_LINE, 'x', 'y'))
Expand All @@ -43,4 +44,4 @@ def test_vunmap(self):
def test_no_status_message_when_at_least_one_mode_mapping_is_found(self):
self.feed(':unmap x')
self.assertNotMapping('x')
self.assertStatusMessage('E31: No such mapping', 4)
self.assertStatusMessage('E31: No such mapping', 5)

0 comments on commit c37a69d

Please sign in to comment.