Hi,
Chris Lott schrieb am 10.10.2018 um 21:05:
>
> I have a mapping in my .vimrc :
>
> nnoremap md :write:silent !open -a 'Marked.app' '%:p'
>
> When I invoke the map, my cursor in Vim moves to the beginning of the
> line. This doesn't happen if I run the commands manually. Why does the
> cursor move and how can I stop it from doing so?
the problem is with the combination of and in your mapping.
The will execute the :write command. After that Vim is in normal
mode, where is a command to put the cursor in a specified column,
i.e. 10| would put the cursor in column 10. Because stands on its
own in your mapping the cursor is put in the first column.
You only need either or between two commands on the right side
of your mapping. You can write it either as
nnoremap md :writesilent !open -a 'Marked.app' '%:p'
or as
nnoremap md :write:silent !open -a 'Marked.app' '%:p'
Regards,
Jürgen
--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.