例如, 如果文件扩展名为.js , 则如何将'<leader>r'
映射到:!node %
,然后将其映射到:!make %
otherwise?
General case, in your ~/.vimrc
:
nnoremap <leader>r :!make %<cr>
JavaScript files, in ~/after/ftplugin/javascript.vim
:
nnoremap <buffer> <leader>r :!node %
Or use the makeprg
option. See :h makeprg
.
Try this:
nnoremap <leader>r :!make %
autocmd FileType javascript nnoremap <leader>r :!node %
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.