Editing (section) Easy floating point arithmetic 0 We recommend that you log in before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your Watchlist. Creating an account is quick and free. ==Comments== Or you could use <code>:perldo</code> instead of shelling out. ---- The bccalc {{script|id=219}} and EvalSelection {{script|id=889}} plugins serve a similar purpose. ---- The last one seems wrong. Both on Windows and on Linux I saw the expression replaced by "XXXXX...". ---- I found the problem with the last one: it does work with there is only one line in the buffer. This works (assuming `calcu <expr>' is something to calculate the expression: <pre> vnoremap <silent> <Leader>mr "aygvrXgv"by:r !calcu <C-R>a<CR>km`j0"cyWdd``:s/<C-R>b/<C-R>c/<CR>$ </pre> For other three, I am now using a simpler form: <pre> nnoremap <silent> <Leader>ma yypV:!calcu <C-R>"<CR>k$ vnoremap <silent> <Leader>ma yo<Esc>pV:!calcu <C-R>"<CR>k$ nnoremap <silent> <Leader>mr yyV:!calcu <C-R>"<CR>$ </pre> ---- I really worry about the replacement trick in the last mapping, so I worked out a safer version (using marking and jumping): <pre> vnoremap <silent> <Leader>mr ygvmaomb:r !calcu <C-R>"<CR>"ay$dd`bv`a"ap$ </pre> ---- In addition to bccalc and EvalSelection, there are VimCalc (requires Python) {{script|id=3329}} and Crunch (pure VimL) {{script|id=4686}}. Taking in account these plugins, maybe tips [[VimTip1235|Tip 1235 Scientific calculator]] and [[VimTip73|Tip 73 Using vim as calculator]] could be merge with this. ---- Loading editor Below are some commonly used wiki markup codes. Simply click on what you want to use and it will appear in the edit box above. Insert: – — … ° ≈ ≠ ≤ ≥ ± − × ÷ ← → · § Sign your username: ~~~~ Wiki markup: {{}} | [] [[]] [[Category:]] #REDIRECT [[]] <s></s> <sup></sup> <sub></sub> <code></code> <blockquote></blockquote> <ref></ref> {{Reflist}} <references/> <includeonly></includeonly> <noinclude></noinclude> {{DEFAULTSORT:}} <nowiki></nowiki> <!-- --> <span class="plainlinks"></span> Symbols: ~ | ¡ ¿ † ‡ ↔ ↑ ↓ • ¶ # ¹ ² ³ ½ ⅓ ⅔ ¼ ¾ ⅛ ⅜ ⅝ ⅞ ∞ ‘ “ ’ ” «» ¤ ₳ ฿ ₵ ¢ ₡ ₢ $ ₫ ₯ € ₠ ₣ ƒ ₴ ₭ ₤ ℳ ₥ ₦ № ₧ ₰ £ ៛ ₨ ₪ ৳ ₮ ₩ ¥ ♠ ♣ ♥ ♦ View this template This field is a spam trap. DO NOT fill it in! Edit summary Preview Mobile Desktop Show changes