> If I run the following at the command line, it works.
> :!python "%"
>
> When I try the same in a VimScript, it doesn't.
>
> Example:
>
> autocmd FileType python map <buffer> <S-e> :w<CR>:lcd %:h<CR>:!
> python "%"<CR>
>
> How do I properly use quotes in VimScript?
How doesn't it work? It works fine for me. Here's what I did.
I put your autocommand (on one line) in a file in my home directory,
bar.vim.
autocmd FileType python map <buffer> <S-e> :w<CR>:lcd %:h<CR>:!python "%"<CR>
I started vim in my home directory like this:
$ vim -N -u NONE --cmd 'filetype on' --cmd 'so bar.vim' /tmp/foo.py
Executing
:map E
shows that the mapping is defined:
E @:w<CR>:lcd %:h<CR>:!python "%"<CR>
I put this text into the buffer:
print("hello, world\n")
and typed
E
The text
hello, world
appeared in my terminal as expected.
Regards,
Gary
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment