Vim - map shell command - Stack Overflow
http://stackoverflow.com/questions/9364040/vim-map-shell-command
Note some things:Mapping keys in Vim - Tutorial (Part 1) - Vim Tips Wiki - Wikia
- Don’t use
map
(withoutn
andnore
) unless you have a specific reason. I believe you don’t need this mapping for visual and operator-pending modes (leadingn
restricts mapping to normal mode only) and you also should not want this mapping to be remappable.- Use
to discard count you can occasionally type unless you do know you need it (third version uses two hacks that turn mapping to no-op with a side-effect and does not need
).
- Never forget to escape shell arguments.
- Version with
silent !
(do not forget space aftersilent
, this is why @David Pope’s answer does not work) hasat the end. This is because using
!
will always provide access to your terminal and thus redraw is needed after command has run.- Versions with
system()
won’t work if you add an argument containing newline, it is a documented bug. If you don’t want to do so (expand('
won’t ever add newline) it is absolutely safe.') t
is a very useful motion. It is better to learn to use it then remap it to something. I suggest,t
as a lhs.
http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_%28Part_1%29
Mapping key sequences
http://osr507doc.sco.com/en/OSUserG/_mapping_key_sequences.html
Vim documentation: help
http://vimdoc.sourceforge.net/htmldoc/help.html
Vim documentation: usr_41
http://vimdoc.sourceforge.net/htmldoc/usr_41.html
Vim documentation: map
http://vimdoc.sourceforge.net/htmldoc/map.html
Learn Vimscript the Hard Way
http://learnvimscriptthehardway.stevelosh.com/
沒有留言:
張貼留言