Mercurial > vim
diff src/testdir/test_terminal.vim @ 12457:dfb8254aa735 v8.0.1108
patch 8.0.1108: cannot specify mappings for the terminal window
commit https://github.com/vim/vim/commit/69fbc9e1dab176f345719436cd89d854df0a2abd
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 14 20:37:57 2017 +0200
patch 8.0.1108: cannot specify mappings for the terminal window
Problem: Cannot specify mappings for the terminal window.
Solution: Add the :tmap command and associated code. (Jacob Askeland,
closes #2073)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 14 Sep 2017 20:45:05 +0200 |
parents | 4ae1485b5834 |
children | 27c5d8954231 |
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -620,3 +620,40 @@ func Test_terminal_redir_file() call delete('Xfile') endif endfunc + +func TerminalTmap(remap) + let buf = Run_shell_in_terminal({}) + call assert_equal('t', mode()) + + if a:remap + tmap 123 456 + else + tnoremap 123 456 + endif + tmap 456 abcde + call assert_equal('456', maparg('123', 't')) + call assert_equal('abcde', maparg('456', 't')) + call feedkeys("123", 'tx') + call term_wait(buf) + let lnum = term_getcursor(buf)[0] + if a:remap + call assert_match('abcde', term_getline(buf, lnum)) + else + call assert_match('456', term_getline(buf, lnum)) + endif + + call term_sendkeys(buf, "\r") + call Stop_shell_in_terminal(buf) + call term_wait(buf) + + tunmap 123 + tunmap 456 + call assert_equal('', maparg('123', 't')) + close + unlet g:job +endfunc + +func Test_terminal_tmap() + call TerminalTmap(1) + call TerminalTmap(0) +endfunc