LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Vim - execute the file I'm editing (https://www.linuxquestions.org/questions/linux-newbie-8/vim-execute-the-file-im-editing-747294/)

kofucii 08-13-2009 10:18 AM

Vim - execute the file I'm editing
 
Hello,
how can i execute the file, that I'm editing at the moment in vim.
I don't mean something like this:
:!scriptname

I need a command that will save the file, in some buffer or temporary file, then will make it executable and run it. At the end I wish to map it to F1 for example.

kbp 08-13-2009 10:47 AM

Hi kofucci,

Have a look at macros, basic process is:

q then key_to_bind
perform actions
q

maybe something along the lines of:

qx
:w /tmp/test.sh
:! chmod u+x /tmp/test.sh
:! /tmp/test.sh
:! rm -f /tmp/test.sh
q

access by using '@x'

( I gave it a test, seems to work ok )


cheers


All times are GMT -5. The time now is 04:31 AM.