Monday, January 28, 2013

Augmenting Octave with Vim

Integrating the powerful mathematical package, Octave, with the flexible editor, Vim.

Today, I'm sharing some tips to use the vim editor inside the Octave interactive command line.

The octaverc file


The first thing towards customizing Octave is creating an .octaverc file, if you don't have one already. The .octaverc file holds some Octave commands that are executed every time you launch Octave.

We'll work with the .octaverc file that lives in your home directory, which is user specific.
# Create/modify .octaverc in your home folder
vim ~/.octaverc
A good starting .octaverc file looks as follows:

Using vim as editor in Octave


Next, let's set vim as the default editor in Octave. (source of information)
# Add extra configuration
vim ~/.octaverc
Open the .octaverc file and append the following:
Now you can call vim from within Octave, and use it in command line mode, i.e. without opening an (unnecessary) additional window.

As a bonus you get a function template.

Now, let's tweak vim for extra features!

Adding syntax highlighting


We'll add syntax coloring/highlighting to vim. Similar to the .octaverc file, vim also has a configuration file named .vimrc. Before touching the .vimrc file, you'll need to grab a vim syntax file from here (grab the latest version).

Next you'll need to drop that octave.vim file in the following directory: ~/.vim/syntax.
# If you don't have the folders already
mkdir -p ~/.vim/syntax
mv /path/to/downloaded/octave.vim ~/.vim/syntax/octave.vim
Next, you'll need to append the following lines in your .vimrc file.
Let's try editing a file inside Octave again.

Added Octave syntax highlighting for vim.

Execute Octave scripts from within vim


Here is where the magic comes in. With this hack, you'll be able to test the octave script you are editing in vim, inside vim and without leaving vim. In other words, you'll be able to use the F5 key to run your script, just like you do in the Matlab editor.

Without further ado, you'll need to add this to your .vimrc
Let's test the magic.



Executing an Octave script from within vim using the F5 key in normal mode.

I need to inform you that this hack adds two extra lines of code to your script:

"pkg load all" at the beginning of your code. Which grants access to all functions inside the extra Octave packages.

"pause" at the end of your code. Without this you won't be able to see the plots drawn in your script.

When the execution of the script finishes, these two lines are removed.

That's all folks, happy coding!

36 comments:

  1. Thanks! This works great.

    I found that vim in Apple's Terminal doesn't seem to work with the F5 thing, though: No biggie, MacVim does it right and nails it.


    ReplyDelete
    Replies
    1. Hello Everyone

      I'm providing fresh & legit Fullz & Tools with Tutorials

      For Contact
      //> 752-822-040 -> I C Q
      //> peeterhacks -> Skype/Wickr
      //> @killhacks -> Tel.Gram

      All types of Tools & Fullz Available
      CC FULLZ WITH CVV
      SSN DOB DL FULLZ
      HIGH CS FULLZ
      DUMPS WITH PIN CODES

      -----752-822-040 -> I C Q-----
      -----peeterhacks -> Skype/Wickr-----
      -----@leadsupplier -> Tel.Gram-----

      TOOLS FOR Hac-king
      Spa-mming Stuff With Commplete Guide
      Carding Methods with Cash out Process
      FB/WA Hac-king Tips & Tricks
      BTC Cracker/Flasher
      Kali-Linux Master Class
      Fr**d Bi*le 2021/2022
      D-e-e-p W-eb Complete Course with video Tutorials
      Combos
      Shells/C-panels/Mailers/Brutes
      SMS Spoofer/Boomber
      Smtp's/Rdp's
      ETC

      *Fast Reply
      *Cheap Prices
      *No Refund, only replacement
      *Special discount for bulk order

      Delete
  2. Replies
    1. Hello Everyone

      Selling SSN DOB Fullz in bulk
      DL & work history will be include (if needed)
      High Credit Scores USA Fullz/Pros

      USA/UK/Canada CC Fullz also available
      Dumps Tutorials & Dumps with pin codes available (101 & 202)
      Business Fullz with EIN
      Office365 Logs in bulk

      Here I'm

      TG/ICQ = @killhacks
      WA = +92 317 2721122
      Emails = exploit dot tools4u at gmail dot com
      Wickr = peeterhacks

      Hacking, Spamming, Carding Stuff also available
      Tools with tutorials & Ebooks
      Mailers/Brutes/Viruses
      Kali Linux Full course
      D**P/D**k web Courses with Legit Links
      Combos/logs/I.P's/Proxies

      Legit & Genuine Tools

      Emails = exploit dot tools4u at gmail dot com
      Wickr = peeterhacks
      TG/ICQ = @killhacks
      WA = +92 317 2721122

      Delete
  3. Should that be a " character instead of a # for the comment in .vimrc? I.e.:

    " F5 executes the octave script you are editing

    ReplyDelete
  4. I'm having some trouble with the path variable in Octave.

    I put the following in my octaverc file:
    edit editor 'vim > /dev/tty 2>&1 < /dev/tty %s'

    and I edited my system path to include the parent director of vim74.exe

    however, when I restart Octave and type:
    >> edit foo.m

    it reports the following error:
    The system cannot find the path specified

    Anyone have any suggestions?

    ReplyDelete
  5. I'm on windows, and there is no /dev/tty, so that was the problem. The following seems to work:

    edit editor "gvim %s"

    Is there an equivalent for /dev/tty on windows that I should use?

    ReplyDelete
  6. I've enhanced the executing function. With my version the cursor jumps back to the position, where it was before pressing f5:

    " F5 executes the octave script you are editing
    autocmd FileType octave map maggOpkg load allGopause:w:!octave -qf %ddggdd:w`a

    Happy Coding!

    ReplyDelete
  7. Wow, amazing blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is fantastic, let alone the content!

    3D Animation services in Atlanta
    Cheap Rate Chatbot Development Service
    Cheap Rate Mobile app development in Coimbatore

    ReplyDelete
  8. AE Clicks is one of the top website development company in dubai. With a team of highly skilled web developers and web designers, we have successfully completed over 300+ projects across various industries.

    ReplyDelete
  9. Selling USA FRESH SPAMMED SSN Leads/Fullz, along with Driving License/ID Number with EXCELLENT connectivity.

    **PRICE**
    >>1$ FOR EACH FULLZ WITHOUT DL NUMBER
    >>2$ FOR EACH LEAD/FULLZ/PROFILE
    >>5$ FOR EACH PREMIUM LEAD/FULLZ/PROFILE

    **DETAILS IN EACH LEAD/FULLZ**

    ->FULL NAME
    ->SSN
    ->DATE OF BIRTH
    ->DRIVING LICENSE NUMBER WITH EXPIRY DATE
    ->ADDRESS WITH ZIP
    ->PHONE NUMBER, EMAIL, I.P ADDRESS
    ->EMPLOYEE DETAILS
    ->REALTIONSHIP DETAILS
    ->MORTGAGE INFO
    ->BANK ACCOUNT DETAILS

    >All Leads are Tested & Verified.
    >Invalid info found, will be replaced.
    >Serious buyers will be welcome & I will give discounts on bulk orders.
    >Fresh spammed data of USA Credit Bureau
    >Good credit Scores, 700 minimum scores
    >Bulk order will be preferable
    >Minimum order 20 leads/fullz
    >Hope for the long term business
    >You can asked for samples, specific states & zips (if needed)
    >Payment mode BTC, ETH, LTC, Paypal & PERFECT MONEY

    Email > leads.sellers1212@gmail.com
    Telegram > @leadsupplier
    ICQ > 752822040

    ''OTHER GADGETS PROVIDING''

    >SSN Fullz
    >Dead Fullz
    >Carding Tutorials
    >Hacking Tutorials
    >SMTP Linux Root
    >DUMPS with pins track 1 and 2
    >Sock Tools
    >Server I.P's
    >USA emails with passwords (bulk order preferable)

    **Contact 24/7**

    Email > leads.sellers1212@gmail.com
    Telegram > @leadsupplier
    ICQ > 752822040

    ReplyDelete
  10. repeat post! I am actually getting ready to across this information, is very helpful my friend. Also great blog here with all of the valuable information you have. Keep up the good work you are doing here. 야동

    Also feel free to visit may web page check this link 일본야동

    ReplyDelete
  11. This is just the information I am finding everywhere. Thanks for your blog, I just subscribe your blog. This is a nice blog. 야동

    Also feel free to visit may web page check this link 일본야동

    ReplyDelete
  12. Very good blog post about plastering a one bed flat. I am very happy to see this post and interested to find another good post in coming days. Thanks for it 한국야동

    Also feel free to visit may web page check this link 야설

    ReplyDelete
  13. Incredible post I should say and a debt of gratitude is in order for the data. Schooling is certainly a tacky subject. Be that as it may, is still among the main subjects within recent memory. I appreciate your post and anticipate more. You have made some valid statements there. I looked on the web to study the issue and discovered a great many people will oblige your perspectives on this site...
    how to make a paper airplane eagle | how to make a boomerang airplane | the eagle paper airplane | best paper airplane design for distance and accuracy | best paper airplanes for distance and speed | what is the best paper airplane design for distance | paper airplane that flies far and straight | nakamura lock paper airplane instructions | paper airplane templates for distance

    ReplyDelete
  14. Bon situ web : Zonahobisaya
    Bon situ web : Zonahobisaya
    Bon situ web : Resep
    Bon situ web : Zonahobisaya
    Bon situ web : Zonahobisaya
    Bon situ web : Biografi
    Bon situ web : Logo
    Bon situ web : Zonahobisaya

    ReplyDelete
  15. Hello Everyone

    I'm providing fresh & legit Fullz & Tools with Tutorials

    For Contact
    //> 752-822-040 -> I C Q
    //> peeterhacks -> Skype/Wickr
    //> @killhacks -> Tel.Gram

    All types of Tools & Fullz Available
    CC FULLZ WITH CVV
    SSN DOB DL FULLZ
    HIGH CS FULLZ
    DUMPS WITH PIN CODES

    -----752-822-040 -> I C Q-----
    -----peeterhacks -> Skype/Wickr-----
    -----@leadsupplier -> Tel.Gram-----

    TOOLS FOR Hac-king
    Spa-mming Stuff With Commplete Guide
    Carding Methods with Cash out Process
    FB/WA Hac-king Tips & Tricks
    BTC Cracker/Flasher
    Kali-Linux Master Class
    Fr**d Bi*le 2021/2022
    D-e-e-p W-eb Complete Course with video Tutorials
    Combos
    Shells/C-panels/Mailers/Brutes
    SMS Spoofer/Boomber
    Smtp's/Rdp's
    ETC

    *Fast Reply
    *Cheap Prices
    *No Refund, only replacement
    *Special discount for bulk order

    ReplyDelete
  16. Nice Blog. Thanks for sharing with us. Keep Sharing!!

    Do you want to buy Windows Embedded Panel PCs Online?

    Buy Windows Embedded Panel PCs Online

    ReplyDelete