(Remove html character entities) |
(Adjust previous/next navigation) |
||
Line 2: | Line 2: | ||
{{TipImported |
{{TipImported |
||
|id=872 |
|id=872 |
||
− | |previous= |
+ | |previous=869 |
|next=873 |
|next=873 |
||
|created=February 10, 2005 |
|created=February 10, 2005 |
Revision as of 10:14, 12 April 2009
Tip 872 Printable Monobook Previous Next
created February 10, 2005 · complexity intermediate · author Bertram Scharpf · version 6.0
I have a little script making my modem dial phone numbers. As the numbers are contained in a file I edit with Vim, I call the script with:
func CPhone( ...) " Get phone number under cursor let s="[-+./()0-9 ]*" let nr=matchstr( getline("."), "\\s*\\zs".s."\\%".col(".")."c".s) let nr=substitute( nr, "\\s\\+$", "", "") if nr == "" && a:0 && a:1 throw "No phone number under cursor." endif return nr endf let @p=":exec \":!dial '\".CPhone(1).\"'\"\<CR>" augroup LocalUser autocmd BufRead phone* nnoremap <buffer> <CR> :exec ":!dial '".CPhone(1)."'"<CR> augroup END
Comments
This makes no sense? Does Vim dial the number?
My shell script 'dial' does that. I omitted it because writing "ATDT" sequences to '/dev/ttysS0' has nothing to do with Vim.
Roughly spoken, the script does an ":!echo -ne 'atdt,<number>;h0\r' >/dev/ttyS0", having stripped off all non-digit characters before.