Skip to main content
added 27 characters in body
Source Link
Martin Tournoij
  • 63.3k
  • 26
  • 199
  • 274

You can use the more powerful "expression mappings":

:inoremap <expr> <silent> <Up>   pumvisible() ? "\<Up>" : "\<C-o>gk"
:inoremap <expr> <silent> <Down> pumvisible() ? "\<Down>" : "\<C-o>gj"

Note that we added the <expr> keyword here. Now Vim expects that the right-hand is some (valid) VimScript codeexpression. The codeThis expression is evaluated every time the key is pressed and the result is used as the action.

Here we use the pumvisible() function (short for "pop-up menu visible") to check if the popup menu is visible. If it is, just go up/down. If it isn't, use your special mappings.

Also see :help :map-expression.


Expression mappings were introduced with Vim 7, which was released in May 2006 (after the mailmaillist post you linked to), which is probably why no one mentioned itthis as a solution thenback then :-)

You can use the more powerful "expression mappings":

:inoremap <expr> <silent> <Up>   pumvisible() ? "\<Up>" : "\<C-o>gk"
:inoremap <expr> <silent> <Down> pumvisible() ? "\<Down>" : "\<C-o>gj"

Note that we added the <expr> keyword here. Now Vim expects that the right-hand is some (valid) VimScript code. The code is evaluated every time the key is pressed and the result is used as the action.

Here we use the pumvisible() function (short for "pop-up menu visible") to check if the popup menu is visible. If it is, just go up/down. If it isn't, use your special mappings.

Also see :help :map-expression.


Expression mappings were introduced with Vim 7, which was released in May 2006 (after the mail post), which is probably why no one mentioned it as a solution then :-)

You can use the more powerful "expression mappings":

:inoremap <expr> <silent> <Up>   pumvisible() ? "\<Up>" : "\<C-o>gk"
:inoremap <expr> <silent> <Down> pumvisible() ? "\<Down>" : "\<C-o>gj"

Note that we added the <expr> keyword here. Now Vim expects that the right-hand is some (valid) VimScript expression. This expression is evaluated every time the key is pressed and the result is used as the action.

Here we use the pumvisible() function (short for "pop-up menu visible") to check if the popup menu is visible. If it is, just go up/down. If it isn't, use your special mappings.

Also see :help :map-expression.


Expression mappings were introduced with Vim 7, which was released in May 2006 (after the maillist post you linked to), which is why no one mentioned this as a solution back then :-)

added 172 characters in body
Source Link
Martin Tournoij
  • 63.3k
  • 26
  • 199
  • 274

You can use the more powerful "expression mappings":

:inoremap <expr> <silent> <Up>   pumvisible() ? "\<Up>" : "\<C-o>gk"
:inoremap <expr> <silent> <Down> pumvisible() ? "\<Down>" : "\<C-o>gj"

Note that we added the <expr> keyword here. Now Vim expects that the right-hand is some (valid) VimScript code. The code is evaluated every time the key is pressed and the result is used as the action.

Here we use the pumvisible() function (short for "pop-up menu visible") to check if the popup menu is visible. If it is, just go up/down. If it isn't, use your special mappings.

Also see :help :map-expression.


Expression mappings were introduced with Vim 7, which was released in May 2006 (after the mail post), which is probably why no one mentioned it as a solution then :-)

You can use the more powerful "expression mappings":

:inoremap <expr> <silent> <Up>   pumvisible() ? "\<Up>" : "\<C-o>gk"
:inoremap <expr> <silent> <Down> pumvisible() ? "\<Down>" : "\<C-o>gj"

Note that we added the <expr> keyword here. Now Vim expects that the right-hand is some (valid) VimScript code. The code is evaluated every time the key is pressed and the result is used as the action.

Here we use the pumvisible() function (short for "pop-up menu visible") to check if the popup menu is visible. If it is, just go up/down. If it isn't, use your special mappings.

Also see :help :map-expression.

You can use the more powerful "expression mappings":

:inoremap <expr> <silent> <Up>   pumvisible() ? "\<Up>" : "\<C-o>gk"
:inoremap <expr> <silent> <Down> pumvisible() ? "\<Down>" : "\<C-o>gj"

Note that we added the <expr> keyword here. Now Vim expects that the right-hand is some (valid) VimScript code. The code is evaluated every time the key is pressed and the result is used as the action.

Here we use the pumvisible() function (short for "pop-up menu visible") to check if the popup menu is visible. If it is, just go up/down. If it isn't, use your special mappings.

Also see :help :map-expression.


Expression mappings were introduced with Vim 7, which was released in May 2006 (after the mail post), which is probably why no one mentioned it as a solution then :-)

Source Link
Martin Tournoij
  • 63.3k
  • 26
  • 199
  • 274

You can use the more powerful "expression mappings":

:inoremap <expr> <silent> <Up>   pumvisible() ? "\<Up>" : "\<C-o>gk"
:inoremap <expr> <silent> <Down> pumvisible() ? "\<Down>" : "\<C-o>gj"

Note that we added the <expr> keyword here. Now Vim expects that the right-hand is some (valid) VimScript code. The code is evaluated every time the key is pressed and the result is used as the action.

Here we use the pumvisible() function (short for "pop-up menu visible") to check if the popup menu is visible. If it is, just go up/down. If it isn't, use your special mappings.

Also see :help :map-expression.