vim में, आप बस अपने वर्तमान बफर के किसी भी श्रेणी के लिए एक बाहरी कमांड के लिए (चाहे वह पार्टी, अजगर, या आप अजगर स्क्रिप्ट के मालिक हैं) रीडायरेक्ट कर सकता है।
# redirect whole buffer to python
:%w !python
अपने वर्तमान बफर के रूप में नीचे दो पंक्तियाँ होती लगता है,
import numpy as np
print np.arange(12).reshape(3,4)
तो :%w !python
, यह चलेगा यह बचाया या नहीं हो। और अपने टर्मिनल पर नीचे की तरह प्रिंट कुछ,
[[ 0 1 2 3]
[ 4 5 6 7]
[ 8 9 10 11]]
बेशक
, आप कुछ लगातार, जैसे, कुछ keymaps बना सकता है।
nnoremap <F8> :.w !python<CR>
vnoremap <F8> :w !python<CR>
पहले एक रन वर्तमान लाइन, दूसरा एक दृश्य दृश्य चयन, पायथन दुभाषिया के माध्यम से।
#!! be careful, in vim ':w!python' and ':.w !python' are very different, the
first write (create or overwrite) a file named 'python' with contents of
current buffer, the second redirect the selected cmdline range (here dot .,
which mean current line) to external command (here 'python').
cmdline श्रृंखला के लिए,
:h cmdline-ranges
जो सामान्य आदेश के विषय में एक नहीं नीचे, देखते हैं, एक cmdline नहीं।
:h command-range
https://stackoverflow.com/a/19883963/3625404
से प्रेरित आप मेरी प्रतिक्रिया पर एक नज़र डालें सकते हैं? मुझे लगता है कि यह आपके प्रश्न का सही जवाब देता है। –